Commit b5060666 authored by Soeren Sandmann's avatar Soeren Sandmann Committed by Søren Sandmann Pedersen

New function. Make sure the sync counter is recreated when a window is

Mon Aug  2 21:52:45 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

	* gdk/x11/gdkwindow-x11.c (ensure_sync_counter): New
	function. Make sure the sync counter is recreated when a window is
	reparented to become a toplevel. (#148358)
parent 6159834e
Mon Aug 2 21:52:45 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/x11/gdkwindow-x11.c (ensure_sync_counter): New
function. Make sure the sync counter is recreated when a window is
reparented to become a toplevel. (#148358)
2004-08-02 Matthias Clasen <mclasen@redhat.com>
* tests/testcombo.c: Some trees in combo boxes.
......
Mon Aug 2 21:52:45 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/x11/gdkwindow-x11.c (ensure_sync_counter): New
function. Make sure the sync counter is recreated when a window is
reparented to become a toplevel. (#148358)
2004-08-02 Matthias Clasen <mclasen@redhat.com>
* tests/testcombo.c: Some trees in combo boxes.
......
Mon Aug 2 21:52:45 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/x11/gdkwindow-x11.c (ensure_sync_counter): New
function. Make sure the sync counter is recreated when a window is
reparented to become a toplevel. (#148358)
2004-08-02 Matthias Clasen <mclasen@redhat.com>
* tests/testcombo.c: Some trees in combo boxes.
......
Mon Aug 2 21:52:45 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/x11/gdkwindow-x11.c (ensure_sync_counter): New
function. Make sure the sync counter is recreated when a window is
reparented to become a toplevel. (#148358)
2004-08-02 Matthias Clasen <mclasen@redhat.com>
* tests/testcombo.c: Some trees in combo boxes.
......
......@@ -2150,6 +2150,13 @@ _gdk_events_queue (GdkDisplay *display)
}
}
static gboolean
has_events_already (GdkDisplay *display)
{
gboolean r = XEventsQueued (GDK_DISPLAY_XDISPLAY (display), QueuedAlready);
return r;
}
static gboolean
gdk_event_prepare (GSource *source,
gint *timeout)
......@@ -2161,7 +2168,7 @@ gdk_event_prepare (GSource *source,
*timeout = -1;
retval = (_gdk_event_queue_find_first (display) != NULL ||
gdk_check_xpending (display));
has_events_already (display));
GDK_THREADS_LEAVE ();
......@@ -2198,13 +2205,13 @@ gdk_event_dispatch (GSource *source,
GDK_THREADS_ENTER ();
_gdk_events_queue (display);
event = _gdk_event_unqueue (display);
if (event)
{
if (_gdk_event_func)
(*_gdk_event_func) (event, _gdk_event_data);
gdk_event_free (event);
}
......
......@@ -524,6 +524,43 @@ create_focus_window (Display *xdisplay,
return focus_window;
}
static void
ensure_sync_counter (GdkWindow *window)
{
#ifdef HAVE_XSYNC
if (!GDK_WINDOW_DESTROYED (window))
{
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplX11 *impl = GDK_WINDOW_IMPL_X11 (private->impl);
if (toplevel && impl->use_synchronized_configure &&
toplevel->update_counter == None &&
GDK_DISPLAY_X11 (display)->use_sync)
{
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
XSyncValue value;
Atom atom;
XSyncIntToValue (&value, 0);
toplevel->update_counter = XSyncCreateCounter (xdisplay, value);
atom = gdk_x11_get_xatom_by_name_for_display (display,
"_NET_WM_SYNC_REQUEST_COUNTER");
XChangeProperty (xdisplay, GDK_WINDOW_XID (window),
atom, XA_CARDINAL,
32, PropModeReplace,
(guchar *)&toplevel->update_counter, 1);
XSyncIntToValue (&toplevel->current_counter_value, 0);
}
}
#endif
}
static void
setup_toplevel_window (GdkWindow *window,
GdkWindow *parent)
......@@ -583,6 +620,8 @@ setup_toplevel_window (GdkWindow *window,
gdk_x11_window_set_user_time (window, 0);
else if (GDK_DISPLAY_X11 (screen_x11->display)->user_time != 0)
gdk_x11_window_set_user_time (window, GDK_DISPLAY_X11 (screen_x11->display)->user_time);
ensure_sync_counter (window);
}
/**
......@@ -5653,40 +5692,18 @@ gdk_window_begin_move_drag (GdkWindow *window,
void
gdk_window_enable_synchronized_configure (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplX11 *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
#ifdef HAVE_XSYNC
if (!GDK_WINDOW_DESTROYED (window))
{
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
impl = GDK_WINDOW_IMPL_X11 (private->impl);
if (toplevel && toplevel->update_counter == None &&
GDK_DISPLAY_X11 (display)->use_sync)
if (!impl->use_synchronized_configure)
{
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
XSyncValue value;
Atom atom;
if (toplevel->update_counter != None)
return;
XSyncIntToValue (&value, 0);
toplevel->update_counter = XSyncCreateCounter (xdisplay, value);
atom = gdk_x11_get_xatom_by_name_for_display (display,
"_NET_WM_SYNC_REQUEST_COUNTER");
XChangeProperty (xdisplay, GDK_WINDOW_XID (window),
atom, XA_CARDINAL,
32, PropModeReplace,
(guchar *)&toplevel->update_counter, 1);
XSyncIntToValue (&toplevel->current_counter_value, 0);
}
impl->use_synchronized_configure = TRUE;
ensure_sync_counter (window);
}
#endif /* HAVE_XSYNC */
}
/**
......
......@@ -77,6 +77,7 @@ struct _GdkWindowImplX11
GdkToplevelX11 *toplevel; /* Toplevel-specific information */
gint8 toplevel_window_type;
guint override_redirect : 1;
guint use_synchronized_configure : 1;
};
struct _GdkWindowImplX11Class
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment