18061
|
1 |
/*
|
|
2 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
*
|
|
4 |
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
5 |
* copy of this software and associated documentation files (the "Software"),
|
|
6 |
* to deal in the Software without restriction, including without limitation
|
|
7 |
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
8 |
* and/or sell copies of the Software, and to permit persons to whom the
|
|
9 |
* Software is furnished to do so, subject to the following conditions:
|
|
10 |
*
|
|
11 |
* The above copyright notice and this permission notice (including the next
|
|
12 |
* paragraph) shall be included in all copies or substantial portions of the
|
|
13 |
* Software.
|
|
14 |
*
|
|
15 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18 |
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
21 |
* DEALINGS IN THE SOFTWARE.
|
|
22 |
*/
|
|
23 |
|
|
24 |
/*
|
|
25 |
* It fixes bug 6757448 and 6924996
|
|
26 |
* 6757448 xscreensaver doesn't notice XRandR resize events
|
|
27 |
* 6924996 High volume of error message display in SPARC:
|
|
28 |
"Xlib: extension "RANDR" missing on display from screensaver"
|
|
29 |
*/
|
|
30 |
|
|
31 |
diff --git xscreensaver-5.11/driver/lock.c xscreensaver-5.11/driver/lock.c
|
|
32 |
--- xscreensaver-5.11/driver/lock.c
|
|
33 |
+++ xscreensaver-5.11/driver/lock.c
|
|
34 |
@@ -50,6 +50,9 @@
|
|
35 |
static void xfree_lock_grab_smasher (saver_info *si, Bool lock_p);
|
|
36 |
#endif /* HAVE_XF86MISCSETGRABKEYSSTATE */
|
|
37 |
|
|
38 |
+#ifdef HAVE_RANDR
|
|
39 |
+#include <X11/extensions/Xrandr.h>
|
|
40 |
+#endif /* HAVE_RANDR */
|
|
41 |
|
|
42 |
#ifdef _VROOT_H_
|
|
43 |
ERROR! You must not include vroot.h in this file.
|
18121
|
44 |
@@ -2536,6 +2539,57 @@ passwd_event_loop (saver_info *si)
|
18061
|
45 |
{
|
|
46 |
XtAppNextEvent (si->app, &event);
|
18077
|
47 |
|
18061
|
48 |
+#ifdef HAVE_RANDR
|
|
49 |
+ /*
|
|
50 |
+ * 6757448 xscreensaver doesn't notice XRandR resize events.
|
|
51 |
+ */
|
18077
|
52 |
+ if (si->using_randr_extension &&
|
|
53 |
+ (event.type == (si->randr_event_number + RRScreenChangeNotify)))
|
|
54 |
+ {
|
|
55 |
+ /* The Resize and Rotate extension sends an event when the
|
|
56 |
+ size, rotation, or refresh rate of the screen has changed. */
|
18061
|
57 |
+
|
18077
|
58 |
+ XRRScreenChangeNotifyEvent *xrr_event =
|
|
59 |
+ (XRRScreenChangeNotifyEvent *) & event;
|
|
60 |
+
|
|
61 |
+ /* XRRRootToScreen is in Xrandr.h 1.4, 2001/06/07 */
|
|
62 |
+ int screen = XRRRootToScreen(si->dpy, xrr_event->window);
|
18061
|
63 |
+
|
18077
|
64 |
+ if (p->verbose_p)
|
|
65 |
+ {
|
|
66 |
+ if ((si->screens[screen].width == xrr_event->width) &&
|
|
67 |
+ (si->screens[screen].height == xrr_event->height))
|
|
68 |
+ fprintf(stderr,
|
|
69 |
+ "%s: %d: no-op screen size change event (%dx%d)\n",
|
|
70 |
+ blurb(), screen,
|
|
71 |
+ xrr_event->width, xrr_event->height);
|
|
72 |
+ else
|
|
73 |
+ fprintf(stderr,
|
|
74 |
+ "%s: %d: screen size changed from %dx%d to %dx%d\n",
|
|
75 |
+ blurb(), screen,
|
|
76 |
+ si->screens[screen].width,
|
|
77 |
+ si->screens[screen].height,
|
|
78 |
+ xrr_event->width, xrr_event->height);
|
|
79 |
+ }
|
18061
|
80 |
+
|
|
81 |
+#ifdef RRScreenChangeNotifyMask
|
18077
|
82 |
+ /* Inform Xlib that it's ok to update its data structures. */
|
|
83 |
+ XRRUpdateConfiguration(&event); /* Xrandr.h 1.9, 2002/09/29 */
|
18061
|
84 |
+#endif /* RRScreenChangeNotifyMask */
|
18077
|
85 |
+
|
|
86 |
+ /* Resize the existing xscreensaver windows and cached ssi data. */
|
|
87 |
+ if (update_screen_layout (si))
|
|
88 |
+ {
|
|
89 |
+ if (p->verbose_p)
|
|
90 |
+ {
|
|
91 |
+ fprintf (stderr, "%s: new layout:\n", blurb());
|
|
92 |
+ describe_monitor_layout (si);
|
|
93 |
+ }
|
|
94 |
+ resize_screensaver_window (si);
|
|
95 |
+ }
|
18061
|
96 |
+ }
|
|
97 |
+#endif /* HAVE_RANDR */
|
|
98 |
+
|
18077
|
99 |
#ifndef HAVE_XSCREENSAVER_LOCK
|
|
100 |
if (event.xany.window == si->passwd_dialog && event.xany.type == Expose)
|
|
101 |
draw_passwd_window (si);
|
18061
|
102 |
diff --git xscreensaver-5.11/driver/timers.c xscreensaver-5.11/driver/timers.c
|
|
103 |
--- xscreensaver-5.11/driver/timers.c
|
|
104 |
+++ xscreensaver-5.11/driver/timers.c
|
18121
|
105 |
@@ -1130,7 +1130,8 @@ sleep_until_idle (saver_info *si, Bool until_idle_p)
|
18061
|
106 |
else
|
|
107 |
|
|
108 |
#ifdef HAVE_RANDR
|
|
109 |
- if (event.x_event.type == (si->randr_event_number + RRScreenChangeNotify))
|
18077
|
110 |
+ if (si->using_randr_extension &&
|
|
111 |
+ (event.x_event.type == (si->randr_event_number + RRScreenChangeNotify)))
|
18061
|
112 |
{
|
|
113 |
/* The Resize and Rotate extension sends an event when the
|
|
114 |
size, rotation, or refresh rate of any screen has changed.
|
|
115 |
diff --git xscreensaver-5.11/driver/types.h xscreensaver-5.11/driver/types.h
|
|
116 |
--- xscreensaver-5.11/driver/types.h
|
|
117 |
+++ xscreensaver-5.11/driver/types.h
|
18121
|
118 |
@@ -193,6 +193,7 @@ struct saver_info {
|
18061
|
119 |
# ifdef HAVE_RANDR
|
|
120 |
int randr_event_number;
|
|
121 |
int randr_error_number;
|
|
122 |
+ Bool using_randr_extension;
|
|
123 |
# endif
|
|
124 |
|
18121
|
125 |
Bool using_xinput_extension; /* Note that `p->use_*' is the *request*, */
|
18061
|
126 |
diff --git xscreensaver-5.11/driver/xscreensaver.c xscreensaver-5.11/driver/xscreensaver.c
|
|
127 |
--- xscreensaver-5.11/driver/xscreensaver.c
|
|
128 |
+++ xscreensaver-5.11/driver/xscreensaver.c
|
18121
|
129 |
@@ -959,6 +959,8 @@ initialize_server_extensions (saver_info *si)
|
18061
|
130 |
int nscreens = ScreenCount (si->dpy); /* number of *real* screens */
|
|
131 |
int i;
|
|
132 |
|
|
133 |
+ si->using_randr_extension = TRUE;
|
|
134 |
+
|
|
135 |
if (p->verbose_p)
|
|
136 |
fprintf (stderr, "%s: selecting RANDR events\n", blurb());
|
|
137 |
for (i = 0; i < nscreens; i++)
|
|
138 |
|