* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkdisplay.h"
#include "gdkeventsource.h"
#include "gdkeventtranslator.h"
+#include "gdkframeclockprivate.h"
#include "gdkinternals.h"
#include "gdkscreen.h"
#include "gdkinternals.h"
GdkEvent *event,
XEvent *xevent);
-#ifdef HAVE_X11R6
static void gdk_internal_connection_watch (Display *display,
XPointer arg,
gint fd,
gboolean opening,
XPointer *watch_data);
-#endif /* HAVE_X11R6 */
typedef struct _GdkEventTypeX11 GdkEventTypeX11;
"_NET_WM_WINDOW_TYPE_NORMAL",
"_NET_WM_USER_TIME",
"_NET_VIRTUAL_ROOTS",
- "GDK_SELECTION"
+ "GDK_SELECTION",
+ "_NET_WM_STATE_FOCUSED"
};
static char *gdk_sm_client_id;
}
else
{
- if (toplevel->have_sticky || toplevel->on_all_desktops)
+ if (toplevel->have_sticky && toplevel->on_all_desktops)
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_STICKY);
0,
GDK_WINDOW_STATE_MAXIMIZED);
}
+
+ if (old_state & GDK_WINDOW_STATE_FOCUSED)
+ {
+ if (!toplevel->have_focused)
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_FOCUSED,
+ 0);
+ }
+ else
+ {
+ if (toplevel->have_focused)
+ gdk_synthesize_window_state (window,
+ 0,
+ GDK_WINDOW_STATE_FOCUSED);
+ }
+
+ if (old_state & GDK_WINDOW_STATE_ICONIFIED)
+ {
+ if (!toplevel->have_hidden)
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_ICONIFIED,
+ 0);
+ }
+ else
+ {
+ if (toplevel->have_hidden)
+ gdk_synthesize_window_state (window,
+ 0,
+ GDK_WINDOW_STATE_ICONIFIED);
+ }
}
static void
if (type != None)
{
desktop = (gulong *)data;
- toplevel->on_all_desktops = (*desktop == 0xFFFFFFFF);
+ toplevel->on_all_desktops = ((*desktop & 0xFFFFFFFF) == 0xFFFFFFFF);
XFree (desktop);
}
else
{
GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (window);
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
+ GdkScreen *screen = GDK_WINDOW_SCREEN (window);
Atom type;
gint format;
toplevel->have_maxvert = FALSE;
toplevel->have_maxhorz = FALSE;
toplevel->have_fullscreen = FALSE;
+ toplevel->have_focused = FALSE;
+ toplevel->have_hidden = FALSE;
type = None;
gdk_x11_display_error_trap_push (display);
Atom maxvert_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_VERT");
Atom maxhorz_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_MAXIMIZED_HORZ");
Atom fullscreen_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FULLSCREEN");
+ Atom focused_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_FOCUSED");
+ Atom hidden_atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE_HIDDEN");
atoms = (Atom *)data;
toplevel->have_maxhorz = TRUE;
else if (atoms[i] == fullscreen_atom)
toplevel->have_fullscreen = TRUE;
+ else if (atoms[i] == focused_atom)
+ toplevel->have_focused = TRUE;
+ else if (atoms[i] == hidden_atom)
+ toplevel->have_hidden = TRUE;
++i;
}
XFree (atoms);
}
+ if (!gdk_x11_screen_supports_net_wm_hint (screen,
+ gdk_atom_intern_static_string ("_NET_WM_STATE_FOCUSED")))
+ toplevel->have_focused = TRUE;
+
/* When have_sticky is turned on, we have to check the DESKTOP property
* as well.
*/
do_net_wm_state_changes (window);
}
-static GdkWindow *
-get_event_window (GdkEventTranslator *translator,
- XEvent *xevent)
+static Window
+get_event_xwindow (XEvent *xevent)
{
- GdkDisplay *display;
Window xwindow;
- display = (GdkDisplay *) translator;
-
switch (xevent->type)
{
case DestroyNotify:
case ConfigureNotify:
xwindow = xevent->xconfigure.window;
break;
+ case ReparentNotify:
+ xwindow = xevent->xreparent.window;
+ break;
+ case GravityNotify:
+ xwindow = xevent->xgravity.window;
+ break;
+ case CirculateNotify:
+ xwindow = xevent->xcirculate.window;
+ break;
default:
xwindow = xevent->xany.window;
}
- return gdk_x11_window_lookup_for_display (display, xwindow);
+ return xwindow;
}
static gboolean
GdkEvent *event,
XEvent *xevent)
{
+ Window xwindow;
GdkWindow *window;
+ gboolean is_substructure;
GdkWindowImplX11 *window_impl = NULL;
GdkScreen *screen = NULL;
GdkX11Screen *x11_screen = NULL;
GdkToplevelX11 *toplevel = NULL;
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
gboolean return_val;
- Window xwindow = None;
- /* Find the GdkWindow that this event relates to.
- * Basically this means substructure events
- * are reported same as structure events
+ /* Find the GdkWindow that this event relates to. If that's
+ * not the same as the window that the event was sent to,
+ * we are getting an event from SubstructureNotifyMask.
+ * We ignore such events for internal operation, but we
+ * need to report them to the application because of
+ * GDK_SUBSTRUCTURE_MASK (which should be removed at next
+ * opportunity.) The most likely reason for getting these
+ * events is when we are used in the Metacity or Mutter
+ * window managers.
*/
- window = get_event_window (translator, xevent);
+ xwindow = get_event_xwindow (xevent);
+ is_substructure = xwindow != xevent->xany.window;
+ window = gdk_x11_window_lookup_for_display (display, xwindow);
if (window)
{
/* We may receive events such as NoExpose/GraphicsExpose
x11_screen = GDK_X11_SCREEN (screen);
toplevel = _gdk_x11_window_get_toplevel (window);
window_impl = GDK_WINDOW_IMPL_X11 (window->impl);
- xwindow = GDK_WINDOW_XID (window);
g_object_ref (window);
}
}
}
- if (xevent->type == DestroyNotify)
+ if (xevent->type == DestroyNotify && !is_substructure)
{
int i, n;
screen = gdk_display_get_screen (display, i);
x11_screen = GDK_X11_SCREEN (screen);
- if (x11_screen->wmspec_check_window == xwindow)
+ if (x11_screen->wmspec_check_window == xevent->xdestroywindow.window)
{
x11_screen->wmspec_check_window = None;
x11_screen->last_wmspec_check_time = 0;
g_message ("destroy notify:\twindow: %ld",
xevent->xdestroywindow.window));
- /* Ignore DestroyNotify from SubstructureNotifyMask */
- if (xevent->xdestroywindow.window == xevent->xdestroywindow.event)
+ if (!is_substructure)
{
event->any.type = GDK_DESTROY;
event->any.window = window;
event->any.type = GDK_UNMAP;
event->any.window = window;
- /* If we are shown (not withdrawn) and get an unmap, it means we
- * were iconified in the X sense. If we are withdrawn, and get
- * an unmap, it means we hid the window ourselves, so we
- * will have already flipped the iconified bit off.
- */
- if (window)
- {
- if (GDK_WINDOW_IS_MAPPED (window))
- gdk_synthesize_window_state (window,
- 0,
- GDK_WINDOW_STATE_ICONIFIED);
+ if (window && !is_substructure)
+ {
+ /* If the WM supports the _NET_WM_STATE_HIDDEN hint, we do not want to
+ * interpret UnmapNotify events as implying iconic state.
+ * http://bugzilla.gnome.org/show_bug.cgi?id=590726.
+ */
+ if (screen &&
+ !gdk_x11_screen_supports_net_wm_hint (screen,
+ gdk_atom_intern_static_string ("_NET_WM_STATE_HIDDEN")))
+ {
+ /* If we are shown (not withdrawn) and get an unmap, it means we were
+ * iconified in the X sense. If we are withdrawn, and get an unmap, it
+ * means we hid the window ourselves, so we will have already flipped
+ * the iconified bit off.
+ */
+ if (GDK_WINDOW_IS_MAPPED (window))
+ gdk_synthesize_window_state (window,
+ 0,
+ GDK_WINDOW_STATE_ICONIFIED);
+ }
+
+ if (window_impl->toplevel &&
+ window_impl->toplevel->frame_pending)
+ {
+ window_impl->toplevel->frame_pending = FALSE;
+ _gdk_frame_clock_thaw (gdk_window_get_frame_clock (event->any.window));
+ }
+
+ if (toplevel)
+ gdk_window_freeze_toplevel_updates_libgtk_only (window);
_gdk_x11_window_grab_check_unmap (window, xevent->xany.serial);
}
event->any.type = GDK_MAP;
event->any.window = window;
- /* Unset iconified if it was set */
- if (window && (window->state & GDK_WINDOW_STATE_ICONIFIED))
- gdk_synthesize_window_state (window,
- GDK_WINDOW_STATE_ICONIFIED,
- 0);
+ if (window && !is_substructure)
+ {
+ /* Unset iconified if it was set */
+ if (window->state & GDK_WINDOW_STATE_ICONIFIED)
+ gdk_synthesize_window_state (window,
+ GDK_WINDOW_STATE_ICONIFIED,
+ 0);
+
+ if (toplevel)
+ gdk_window_thaw_toplevel_updates_libgtk_only (window);
+ }
break;
}
#ifdef HAVE_XSYNC
- if (toplevel && display_x11->use_sync && !XSyncValueIsZero (toplevel->pending_counter_value))
+ if (!is_substructure && toplevel && display_x11->use_sync && toplevel->pending_counter_value != 0)
{
- toplevel->current_counter_value = toplevel->pending_counter_value;
- XSyncIntToValue (&toplevel->pending_counter_value, 0);
+ toplevel->configure_counter_value = toplevel->pending_counter_value;
+ toplevel->configure_counter_value_is_extended = toplevel->pending_counter_value_is_extended;
+ toplevel->pending_counter_value = 0;
}
#endif
event->configure.x = xevent->xconfigure.x;
event->configure.y = xevent->xconfigure.y;
}
- window->x = event->configure.x;
- window->y = event->configure.y;
- window->width = xevent->xconfigure.width;
- window->height = xevent->xconfigure.height;
+ if (!is_substructure)
+ {
+ window->x = event->configure.x;
+ window->y = event->configure.y;
+ window->width = xevent->xconfigure.width;
+ window->height = xevent->xconfigure.height;
- _gdk_window_update_size (window);
- _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
+ _gdk_window_update_size (window);
+ _gdk_x11_window_update_size (GDK_WINDOW_IMPL_X11 (window->impl));
- if (window->resize_count >= 1)
- {
- window->resize_count -= 1;
+ if (window->resize_count >= 1)
+ {
+ window->resize_count -= 1;
- if (window->resize_count == 0)
- _gdk_x11_moveresize_configure_done (display, window);
- }
+ if (window->resize_count == 0)
+ _gdk_x11_moveresize_configure_done (display, window);
+ }
+ }
}
break;
event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.selection);
event->selection.target = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.target);
event->selection.property = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.property);
- event->selection.requestor = xevent->xselectionrequest.requestor;
+ if (xevent->xselectionrequest.requestor != None)
+ event->selection.requestor = gdk_x11_window_foreign_new_for_display (display,
+ xevent->xselectionrequest.requestor);
+ else
+ event->selection.requestor = NULL;
event->selection.time = xevent->xselectionrequest.time;
break;
break;
case ClientMessage:
- {
- GList *tmp_list;
- GdkFilterReturn result = GDK_FILTER_CONTINUE;
- GdkAtom message_type = gdk_x11_xatom_to_atom_for_display (display, xevent->xclient.message_type);
-
- GDK_NOTE (EVENTS,
- g_message ("client message:\twindow: %ld",
- xevent->xclient.window));
-
- tmp_list = display_x11->client_filters;
- while (tmp_list)
- {
- GdkClientFilter *filter = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (filter->type == message_type)
- {
- result = (*filter->function) (xevent, event, filter->data);
- if (result != GDK_FILTER_CONTINUE)
- break;
- }
- }
-
- switch (result)
- {
- case GDK_FILTER_REMOVE:
- return_val = FALSE;
- break;
- case GDK_FILTER_TRANSLATE:
- return_val = TRUE;
- break;
- case GDK_FILTER_CONTINUE:
- /* Send unknown ClientMessage's on to Gtk for it to use */
- if (window == NULL)
- {
- return_val = FALSE;
- }
- else
- {
- event->client.type = GDK_CLIENT_EVENT;
- event->client.window = window;
- event->client.message_type = message_type;
- event->client.data_format = xevent->xclient.format;
- memcpy(&event->client.data, &xevent->xclient.data,
- sizeof(event->client.data));
- }
- break;
- }
- }
+ GDK_NOTE (EVENTS,
+ g_message ("client message:\twindow: %ld",
+ xevent->xclient.window));
+ /* Not currently handled */
+ return_val = FALSE;
break;
case MappingNotify:
event->owner_change.type = GDK_OWNER_CHANGE;
event->owner_change.window = window;
- event->owner_change.owner = selection_notify->owner;
+ if (selection_notify->owner != None)
+ event->owner_change.owner = gdk_x11_window_foreign_new_for_display (display,
+ selection_notify->owner);
+ else
+ event->owner_change.owner = NULL;
event->owner_change.reason = selection_notify->subtype;
event->owner_change.selection =
gdk_x11_xatom_to_atom_for_display (display,
return return_val;
}
-static GdkFilterReturn
-gdk_wm_protocols_filter (GdkXEvent *xev,
- GdkEvent *event,
- gpointer data)
+static GdkFrameTimings *
+find_frame_timings (GdkFrameClock *clock,
+ guint64 serial)
+{
+ gint64 start_frame, end_frame, i;
+
+ start_frame = gdk_frame_clock_get_history_start (clock);
+ end_frame = gdk_frame_clock_get_frame_counter (clock);
+ for (i = end_frame; i >= start_frame; i--)
+ {
+ GdkFrameTimings *timings = gdk_frame_clock_get_timings (clock, i);
+
+ if (timings->cookie == serial)
+ return timings;
+ }
+
+ return NULL;
+}
+
+GdkFilterReturn
+_gdk_wm_protocols_filter (GdkXEvent *xev,
+ GdkEvent *event,
+ gpointer data)
{
XEvent *xevent = (XEvent *)xev;
GdkWindow *win = event->any.window;
GdkDisplay *display;
Atom atom;
- if (!win)
- return GDK_FILTER_REMOVE;
+ if (!GDK_IS_X11_WINDOW (win) || GDK_WINDOW_DESTROYED (win))
+ return GDK_FILTER_CONTINUE;
+
+ if (xevent->type != ClientMessage)
+ return GDK_FILTER_CONTINUE;
display = GDK_WINDOW_DISPLAY (win);
- atom = (Atom)xevent->xclient.data.l[0];
+
+ /* This isn't actually WM_PROTOCOLS because that wouldn't leave enough space
+ * in the message for everything that gets stuffed in */
+ if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_FRAME_DRAWN"))
+ {
+ GdkWindowImplX11 *window_impl;
+ window_impl = GDK_WINDOW_IMPL_X11 (win->impl);
+ if (window_impl->toplevel)
+ {
+ guint32 d0 = xevent->xclient.data.l[0];
+ guint32 d1 = xevent->xclient.data.l[1];
+ guint32 d2 = xevent->xclient.data.l[2];
+ guint32 d3 = xevent->xclient.data.l[3];
+
+ guint64 serial = ((guint64)d1 << 32) | d0;
+ gint64 frame_drawn_time = ((guint64)d3 << 32) | d2;
+ gint64 refresh_interval, presentation_time;
+
+ GdkFrameClock *clock = gdk_window_get_frame_clock (win);
+ GdkFrameTimings *timings = find_frame_timings (clock, serial);
+
+ if (timings)
+ timings->drawn_time = frame_drawn_time;
+
+ if (window_impl->toplevel->frame_pending)
+ {
+ window_impl->toplevel->frame_pending = FALSE;
+ _gdk_frame_clock_thaw (clock);
+ }
+
+ gdk_frame_clock_get_refresh_info (clock,
+ frame_drawn_time,
+ &refresh_interval,
+ &presentation_time);
+ if (presentation_time != 0)
+ window_impl->toplevel->throttled_presentation_time = presentation_time + refresh_interval;
+ }
+
+ return GDK_FILTER_REMOVE;
+ }
+
+ if (xevent->xclient.message_type == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_FRAME_TIMINGS"))
+ {
+ GdkWindowImplX11 *window_impl;
+ window_impl = GDK_WINDOW_IMPL_X11 (win->impl);
+ if (window_impl->toplevel)
+ {
+ guint32 d0 = xevent->xclient.data.l[0];
+ guint32 d1 = xevent->xclient.data.l[1];
+ guint32 d2 = xevent->xclient.data.l[2];
+ guint32 d3 = xevent->xclient.data.l[3];
+
+ guint64 serial = ((guint64)d1 << 32) | d0;
+
+ GdkFrameClock *clock = gdk_window_get_frame_clock (win);
+ GdkFrameTimings *timings = find_frame_timings (clock, serial);
+
+ if (timings)
+ {
+ gint32 presentation_time_offset = (gint32)d2;
+ gint32 refresh_interval = d3;
+
+ if (timings->drawn_time && presentation_time_offset)
+ timings->presentation_time = timings->drawn_time + presentation_time_offset;
+
+ if (refresh_interval)
+ timings->refresh_interval = refresh_interval;
+
+ timings->complete = TRUE;
+#ifdef G_ENABLE_DEBUG
+ if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
+ _gdk_frame_clock_debug_print_timings (clock, timings);
+#endif /* G_ENABLE_DEBUG */
+ }
+ }
+ }
+
+ if (xevent->xclient.message_type != gdk_x11_get_xatom_by_name_for_display (display, "WM_PROTOCOLS"))
+ return GDK_FILTER_CONTINUE;
+
+ atom = (Atom) xevent->xclient.data.l[0];
if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW"))
{
}
else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "WM_TAKE_FOCUS"))
{
- GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (event->any.window);
+ GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (win);
/* There is no way of knowing reliably whether we are viewable;
- * _gdk_x11_set_input_focus_safe() traps errors asynchronously.
+ * so trap errors asynchronously around the XSetInputFocus call
*/
if (toplevel && win->accept_focus)
- _gdk_x11_set_input_focus_safe (display, toplevel->focus_window,
- RevertToParent,
- xevent->xclient.data.l[1]);
+ {
+ gdk_x11_display_error_trap_push (display);
+ XSetInputFocus (GDK_DISPLAY_XDISPLAY (display),
+ toplevel->focus_window,
+ RevertToParent,
+ xevent->xclient.data.l[1]);
+ gdk_x11_display_error_trap_pop_ignored (display);
+ }
return GDK_FILTER_REMOVE;
}
else if (atom == gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_SYNC_REQUEST") &&
GDK_X11_DISPLAY (display)->use_sync)
{
- GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (event->any.window);
+ GdkToplevelX11 *toplevel = _gdk_x11_window_get_toplevel (win);
if (toplevel)
{
#ifdef HAVE_XSYNC
- XSyncIntsToValue (&toplevel->pending_counter_value,
- xevent->xclient.data.l[2],
- xevent->xclient.data.l[3]);
+ toplevel->pending_counter_value = xevent->xclient.data.l[2] + ((gint64)xevent->xclient.data.l[3] << 32);
+ toplevel->pending_counter_value_is_extended = xevent->xclient.data.l[4] != 0;
#endif
}
return GDK_FILTER_REMOVE;
device_manager = gdk_display_get_device_manager (display);
gdk_x11_event_source_add_translator ((GdkEventSource *) display_x11->event_source,
GDK_EVENT_TRANSLATOR (device_manager));
-
- gdk_display_add_client_message_filter (display,
- gdk_atom_intern_static_string ("WM_PROTOCOLS"),
- gdk_wm_protocols_filter,
- NULL);
}
static void
xdisplay = XOpenDisplay (display_name);
if (!xdisplay)
return NULL;
-
+
display = g_object_new (GDK_TYPE_X11_DISPLAY, NULL);
display_x11 = GDK_X11_DISPLAY (display);
display_x11->xdisplay = xdisplay;
-#ifdef HAVE_X11R6
/* Set up handlers for Xlib internal connections */
XAddConnectionWatch (xdisplay, gdk_internal_connection_watch, NULL);
-#endif /* HAVE_X11R6 */
-
+
_gdk_x11_precache_atoms (display, precache_atoms, G_N_ELEMENTS (precache_atoms));
/* RandR must be initialized before we initialize the screens */
* structures in places
*/
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
- _gdk_x11_screen_init_events (display_x11->screens[i]);
+ _gdk_x11_xsettings_init (GDK_X11_SCREEN (display_x11->screens[i]));
/*set the default screen */
display_x11->default_screen = display_x11->screens[DefaultScreen (display_x11->xdisplay)];
XSynchronize (display_x11->xdisplay, True);
class_hint = XAllocClassHint();
- class_hint->res_name = g_get_prgname ();
-
+ class_hint->res_name = (char *) g_get_prgname ();
class_hint->res_class = (char *)gdk_get_program_class ();
/* XmbSetWMProperties sets the RESOURCE_NAME environment variable
* from argv[0], so we just synthesize an argument array here.
*/
argc = 1;
- argv[0] = g_get_prgname ();
+ argv[0] = (char *) g_get_prgname ();
XmbSetWMProperties (display_x11->xdisplay,
display_x11->leader_window,
XkbSelectEventDetails (display_x11->xdisplay,
XkbUseCoreKbd, XkbStateNotify,
XkbAllStateComponentsMask,
- XkbGroupLockMask|XkbModifierLockMask);
+ XkbModifierStateMask|XkbGroupStateMask);
XkbSetDetectableAutoRepeat (display_x11->xdisplay,
True,
#endif
gdk_x11_display_init_input (display);
- _gdk_x11_display_init_dnd (display);
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
_gdk_x11_screen_setup (display_x11->screens[i]);
g_signal_emit_by_name (display, "opened");
- g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display);
return display;
}
-#ifdef HAVE_X11R6
/*
* XLib internal connection handling
*/
{
GdkInternalConnection *connection = (GdkInternalConnection *)data;
- GDK_THREADS_ENTER ();
+ gdk_threads_enter ();
XProcessInternalConnection ((Display*)connection->display, connection->fd);
- GDK_THREADS_LEAVE ();
+ gdk_threads_leave ();
return TRUE;
}
else
gdk_remove_connection_handler ((GdkInternalConnection *)*watch_data);
}
-#endif /* HAVE_X11R6 */
-static G_CONST_RETURN gchar *
+static const gchar *
gdk_x11_display_get_name (GdkDisplay *display)
{
return (gchar *) DisplayString (GDK_X11_DISPLAY (display)->xdisplay);
gpointer data,
gulong serial)
{
+ GdkPointerWindowInfo *pointer_info;
GdkDevice *device = data;
- _gdk_display_device_grab_update (display, device, NULL, serial);
+ pointer_info = _gdk_display_get_pointer_info (display, device);
+ _gdk_display_device_grab_update (display, device,
+ pointer_info->last_slave, serial);
}
#define XSERVER_TIME_IS_LATER(time1, time2) \
/**
* gdk_x11_display_grab:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
*
* Call XGrabServer() on @display.
* To ungrab the display again, use gdk_x11_display_ungrab().
/**
* gdk_x11_display_ungrab:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
*
* Ungrab @display after it has been grabbed with
* gdk_x11_display_grab().
_gdk_x11_cursor_display_finalize (GDK_DISPLAY (display_x11));
+ /* Empty the event queue */
+ _gdk_x11_display_free_translate_queue (GDK_DISPLAY (display_x11));
+
/* Atom Hashtable */
g_hash_table_destroy (display_x11->atom_from_virtual);
g_hash_table_destroy (display_x11->atom_to_virtual);
/* Leader Window */
XDestroyWindow (display_x11->xdisplay, display_x11->leader_window);
- /* list of filters for client messages */
- g_list_foreach (display_x11->client_filters, (GFunc) g_free, NULL);
- g_list_free (display_x11->client_filters);
-
/* List of event window extraction functions */
g_slist_foreach (display_x11->event_types, (GFunc)g_free, NULL);
g_slist_free (display_x11->event_types);
/* input GdkDevice list */
- g_list_foreach (display_x11->input_devices, (GFunc) g_object_unref, NULL);
- g_list_free (display_x11->input_devices);
+ g_list_free_full (display_x11->input_devices, g_object_unref);
/* input GdkWindow list */
- g_list_foreach (display_x11->input_windows, (GFunc) g_free, NULL);
- g_list_free (display_x11->input_windows);
+ g_list_free_full (display_x11->input_windows, g_free);
/* Free all GdkScreens */
for (i = 0; i < ScreenCount (display_x11->xdisplay); i++)
* Given the root window ID of one of the screen's of a #GdkDisplay,
* finds the screen.
*
- * Return value: the #GdkScreen corresponding to @xrootwin, or %NULL.
+ * Return value: (transfer none): the #GdkScreen corresponding to
+ * @xrootwin, or %NULL.
**/
GdkScreen *
_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
/**
* gdk_x11_display_get_xdisplay:
- * @display: a #GdkDisplay
- * @returns: an X display.
+ * @display: (type GdkX11Display): a #GdkDisplay
*
* Returns the X display of a #GdkDisplay.
*
+ * Returns: (transfer none): an X display
+ *
* Since: 2.2
*/
Display *
/**
* gdk_x11_display_broadcast_startup_message:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
* @message_type: startup notification message type ("new", "change",
* or "remove")
* @...: a list of key/value pairs (as strings), terminated by a
/**
* gdk_x11_display_get_user_time:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
*
* Returns the timestamp of the last user interaction on
* @display. The timestamp is taken from events caused
/**
* gdk_x11_display_get_startup_notification_id:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
*
* Gets the startup notification ID for a display.
*
*
* Since: 2.12
*/
-G_CONST_RETURN gchar *
+const gchar *
gdk_x11_display_get_startup_notification_id (GdkDisplay *display)
{
return GDK_X11_DISPLAY (display)->startup_notification_id;
/**
* gdk_x11_display_set_startup_notification_id:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
* @startup_id: the startup notification ID (must be valid utf8)
*
* Sets the startup notification ID for a display.
return GDK_X11_DISPLAY (display)->input_devices;
}
-static gboolean
-gdk_x11_display_send_client_message (GdkDisplay *display,
- GdkEvent *event,
- GdkNativeWindow winid)
-{
- XEvent sev;
-
- g_return_val_if_fail(event != NULL, FALSE);
-
- /* Set up our event to send, with the exception of its target window */
- sev.xclient.type = ClientMessage;
- sev.xclient.display = GDK_DISPLAY_XDISPLAY (display);
- sev.xclient.format = event->client.data_format;
- sev.xclient.window = winid;
- memcpy(&sev.xclient.data, &event->client.data, sizeof (sev.xclient.data));
- sev.xclient.message_type = gdk_x11_atom_to_xatom_for_display (display, event->client.message_type);
-
- return _gdk_x11_display_send_xevent (display, winid, False, NoEventMask, &sev);
-}
-
-static void
-gdk_x11_display_add_client_message_filter (GdkDisplay *display,
- GdkAtom message_type,
- GdkFilterFunc func,
- gpointer data)
-{
- GdkClientFilter *filter;
- g_return_if_fail (GDK_IS_DISPLAY (display));
- filter = g_new (GdkClientFilter, 1);
-
- filter->type = message_type;
- filter->function = func;
- filter->data = data;
-
- GDK_X11_DISPLAY(display)->client_filters =
- g_list_append (GDK_X11_DISPLAY (display)->client_filters,
- filter);
-}
-
/**
* gdk_x11_register_standard_event_type:
* @display: a #GdkDisplay
" (Details: serial %ld error_code %d request_code %d minor_code %d)\n"
" (Note to programmers: normally, X errors are reported asynchronously;\n"
" that is, you will receive the error a while after causing it.\n"
- " To debug your program, run it with the --sync command line\n"
- " option to change this behavior. You can then get a meaningful\n"
+ " To debug your program, run it with the GDK_SYNCHRONIZE environment\n"
+ " variable to change this behavior. You can then get a meaningful\n"
" backtrace from your debugger if you break on the gdk_x_error() function.)",
g_get_prgname (),
buf,
#else /* !G_ENABLE_DEBUG */
g_warning ("%s\n", msg);
- exit (1);
+ _exit (1);
#endif /* G_ENABLE_DEBUG */
}
}
/**
* gdk_x11_display_error_trap_push:
- * @display: a #GdkDisplay
+ * @display: (type GdkX11Display): a #GdkDisplay
*
* Begins a range of X requests on @display for which X error events
* will be ignored. Unignored errors (when no trap is pushed) will abort
/**
* gdk_x11_display_error_trap_pop:
- * @display: the display
+ * @display: (type GdkX11Display): the display
*
* Pops the error trap pushed by gdk_x11_display_error_trap_push().
* Will XSync() if necessary and will always block until
/**
* gdk_x11_display_error_trap_pop_ignored:
- * @display: the display
+ * @display: (type GdkX11Display): the display
*
* Pops the error trap pushed by gdk_x11_display_error_trap_push().
* Does not block to see if an error occurred; merely records the
gdk_x11_display_error_trap_pop_internal (display, FALSE);
}
-extern GdkAppLaunchContext *_gdk_x11_display_get_app_launch_context (GdkDisplay *display);
-extern GdkNativeWindow _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
- GdkNativeWindow xid,
- GdkDragProtocol *protocol,
- guint *version);
-
-
/**
* gdk_x11_set_sm_client_id:
* @sm_client_id: the client id assigned by the session manager when the
display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes;
display_class->supports_composite = gdk_x11_display_supports_composite;
display_class->list_devices = gdk_x11_display_list_devices;
- display_class->send_client_message = gdk_x11_display_send_client_message;
- display_class->add_client_message_filter = gdk_x11_display_add_client_message_filter;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
- display_class->get_drag_protocol = _gdk_x11_display_get_drag_protocol;
display_class->get_cursor_for_type = _gdk_x11_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_x11_display_get_cursor_for_name;
display_class->get_cursor_for_pixbuf = _gdk_x11_display_get_cursor_for_pixbuf;