}
}
+int
+x_display_pixel_height (struct x_display_info *dpyinfo)
+{
+ if (dpyinfo->screen_height)
+ return dpyinfo->screen_height;
+
+ return HeightOfScreen (dpyinfo->screen);
+}
+
+int
+x_display_pixel_width (struct x_display_info *dpyinfo)
+{
+ if (dpyinfo->screen_width)
+ return dpyinfo->screen_width;
+
+ return WidthOfScreen (dpyinfo->screen);
+}
+
/* Handles the XEvent EVENT on display DPYINFO.
*FINISH is X_EVENT_GOTO_OUT if caller should stop reading events.
So if this ConfigureNotify is immediately followed by another
for the same window, use the info from the latest update, and
consider the events all handled. */
+
/* Opaque resize may be trickier; ConfigureNotify events are
mixed with Expose events for multiple windows. */
configureEvent = *event;
configureEvent = next_event;
}
+ /* If we get a ConfigureNotify for the root window, this means
+ the dimensions of the screen it's on changed. */
+
+ if (configureEvent.xconfigure.window == dpyinfo->root_window)
+ {
+ dpyinfo->screen_width = configureEvent.xconfigure.width;
+ dpyinfo->screen_height = configureEvent.xconfigure.height;
+ }
+
if (x_dnd_in_progress && x_dnd_use_toplevels
&& dpyinfo == FRAME_DISPLAY_INFO (x_dnd_frame))
{
}
#endif
+ /* Select for structure events on the root window, since this allows
+ us to record changes to the size of the screen. */
+
+ XSelectInput (dpy, DefaultRootWindow (dpy), StructureNotifyMask);
+
/* We have definitely succeeded. Record the new connection. */
dpyinfo = xzalloc (sizeof *dpyinfo);
int n_protected_windows;
int protected_windows_max;
#endif
+
+ /* The current dimensions of the screen. This is updated when a
+ ConfigureNotify is received for the root window, and is zero if
+ that didn't happen. */
+ int screen_width;
+ int screen_height;
};
#ifdef HAVE_X_I18N
int, Time);
extern void x_set_dnd_targets (Atom *, int);
-INLINE int
-x_display_pixel_height (struct x_display_info *dpyinfo)
-{
- return HeightOfScreen (dpyinfo->screen);
-}
-
-INLINE int
-x_display_pixel_width (struct x_display_info *dpyinfo)
-{
- return WidthOfScreen (dpyinfo->screen);
-}
+extern int x_display_pixel_height (struct x_display_info *);
+extern int x_display_pixel_width (struct x_display_info *);
INLINE unsigned long
x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)