Move alarm and xids management to MetaX11Display

https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
Armin Krezović 2017-08-26 18:56:44 +02:00 committed by Jonas Ådahl
parent 937a9853cd
commit 722c975aca
18 changed files with 216 additions and 192 deletions

View File

@ -97,7 +97,7 @@ _meta_barrier_impl_x11_destroy (MetaBarrierImpl *impl)
return;
XFixesDestroyPointerBarrier (dpy, priv->xbarrier);
g_hash_table_remove (display->xids, &priv->xbarrier);
g_hash_table_remove (display->x11_display->xids, &priv->xbarrier);
priv->xbarrier = 0;
}
@ -134,7 +134,7 @@ meta_barrier_impl_x11_new (MetaBarrier *barrier)
allowed_motion_dirs,
0, NULL);
g_hash_table_insert (display->xids, &priv->xbarrier, barrier);
g_hash_table_insert (display->x11_display->xids, &priv->xbarrier, barrier);
return META_BARRIER_IMPL (self);
}
@ -174,8 +174,8 @@ meta_barrier_fire_xevent (MetaBarrier *barrier,
}
gboolean
meta_display_process_barrier_xevent (MetaDisplay *display,
XIEvent *event)
meta_x11_display_process_barrier_xevent (MetaX11Display *x11_display,
XIEvent *event)
{
MetaBarrier *barrier;
XIBarrierEvent *xev;
@ -193,7 +193,7 @@ meta_display_process_barrier_xevent (MetaDisplay *display,
}
xev = (XIBarrierEvent *) event;
barrier = g_hash_table_lookup (display->xids, &xev->barrier);
barrier = g_hash_table_lookup (x11_display->xids, &xev->barrier);
if (barrier != NULL)
{
meta_barrier_fire_xevent (barrier, xev);

View File

@ -758,7 +758,7 @@ meta_compositor_process_event (MetaCompositor *compositor,
if (window == NULL)
{
Window xwin = ((XDamageNotifyEvent *) event)->drawable;
window = meta_display_lookup_x_window (compositor->display, xwin);
window = meta_x11_display_lookup_x_window (x11_display, xwin);
}
if (window)

View File

@ -29,6 +29,7 @@
#include <meta/errors.h>
#include "util-private.h"
#include "x11/meta-x11-display-private.h"
#include "x11/window-x11.h"
#include "x11/window-x11-private.h"
@ -51,7 +52,7 @@ get_window (Display *xdisplay,
MetaWindow *window;
display = meta_display_for_x_display (xdisplay);
window = meta_display_lookup_x_window (display, frame_xwindow);
window = meta_x11_display_lookup_x_window (display->x11_display, frame_xwindow);
if (window == NULL || window->frame == NULL)
{

View File

@ -102,10 +102,6 @@ typedef enum {
META_EVENT_ROUTE_FRAME_BUTTON,
} MetaEventRoute;
typedef gboolean (*MetaAlarmFilter) (MetaDisplay *display,
XSyncAlarmNotifyEvent *event,
gpointer data);
typedef void (* MetaDisplayWindowFunc) (MetaWindow *window,
gpointer user_data);
@ -165,7 +161,6 @@ struct _MetaDisplay
/*< private-ish >*/
MetaScreen *screen;
GHashTable *xids;
GHashTable *stamps;
GHashTable *wayland_windows;
@ -257,9 +252,6 @@ struct _MetaDisplay
MetaGestureTracker *gesture_tracker;
ClutterEventSequence *pointer_emulating_sequence;
MetaAlarmFilter alarm_filter;
gpointer alarm_filter_data;
ClutterActor *current_pad_osd;
MetaStartupNotification *startup_notification;
@ -299,17 +291,6 @@ void meta_display_unmanage_windows (MetaDisplay *display,
int meta_display_stack_cmp (const void *a,
const void *b);
/* A given MetaWindow may have various X windows that "belong"
* to it, such as the frame window.
*/
MetaWindow* meta_display_lookup_x_window (MetaDisplay *display,
Window xwindow);
void meta_display_register_x_window (MetaDisplay *display,
Window *xwindowp,
MetaWindow *window);
void meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow);
/* Each MetaWindow is uniquely identified by a 64-bit "stamp"; unlike a
* a MetaWindow *, a stamp will never be recycled
*/
@ -338,14 +319,6 @@ void meta_display_register_wayland_window (MetaDisplay *display,
void meta_display_unregister_wayland_window (MetaDisplay *display,
MetaWindow *window);
MetaWindow* meta_display_lookup_sync_alarm (MetaDisplay *display,
XSyncAlarm alarm);
void meta_display_register_sync_alarm (MetaDisplay *display,
XSyncAlarm *alarmp,
MetaWindow *window);
void meta_display_unregister_sync_alarm (MetaDisplay *display,
XSyncAlarm alarm);
void meta_display_notify_window_created (MetaDisplay *display,
MetaWindow *window);
@ -412,11 +385,6 @@ void meta_display_accelerator_activate (MetaDisplay *display,
ClutterKeyEvent *event);
gboolean meta_display_modifiers_accelerator_activate (MetaDisplay *display);
#ifdef HAVE_XI23
gboolean meta_display_process_barrier_xevent (MetaDisplay *display,
XIEvent *event);
#endif /* HAVE_XI23 */
void meta_display_set_input_focus_xwindow (MetaDisplay *display,
MetaScreen *screen,
Window window,
@ -456,10 +424,6 @@ void meta_display_cancel_touch (MetaDisplay *display);
gboolean meta_display_windows_are_interactable (MetaDisplay *display);
void meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data);
void meta_display_show_tablet_mapping_notification (MetaDisplay *display,
ClutterInputDevice *pad,
const gchar *pretty_name);

View File

@ -732,9 +732,6 @@ meta_display_open (void)
meta_display_init_events_x11 (display);
display->xids = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal);
/* Create the leader window here. Set its properties and
* use the timestamp from one of the PropertyNotify events
* that will follow.
@ -847,7 +844,9 @@ meta_display_open (void)
if (old_active_xwindow != None)
{
MetaWindow *old_active_window = meta_display_lookup_x_window (display, old_active_xwindow);
MetaWindow *old_active_window;
old_active_window = meta_x11_display_lookup_x_window (display->x11_display,
old_active_xwindow);
if (old_active_window)
meta_window_focus (old_active_window, timestamp);
else
@ -898,17 +897,20 @@ meta_display_list_windows (MetaDisplay *display,
winlist = NULL;
g_hash_table_iter_init (&iter, display->xids);
while (g_hash_table_iter_next (&iter, &key, &value))
if (display->x11_display)
{
MetaWindow *window = value;
g_hash_table_iter_init (&iter, display->x11_display->xids);
while (g_hash_table_iter_next (&iter, &key, &value))
{
MetaWindow *window = value;
if (!META_IS_WINDOW (window) || window->unmanaging)
continue;
if (!META_IS_WINDOW (window) || window->unmanaging)
continue;
if (!window->override_redirect ||
(flags & META_LIST_INCLUDE_OVERRIDE_REDIRECT) != 0)
winlist = g_slist_prepend (winlist, window);
if (!window->override_redirect ||
(flags & META_LIST_INCLUDE_OVERRIDE_REDIRECT) != 0)
winlist = g_slist_prepend (winlist, window);
}
}
g_hash_table_iter_init (&iter, display->wayland_windows);
@ -1015,11 +1017,6 @@ meta_display_close (MetaDisplay *display,
/* Stop caring about events */
meta_display_free_events_x11 (display);
/* Must be after all calls to meta_window_unmanage() since they
* unregister windows
*/
g_hash_table_destroy (display->xids);
if (display->leader_window != None)
XDestroyWindow (display->x11_display->xdisplay, display->leader_window);
@ -1459,32 +1456,6 @@ request_xserver_input_focus_change (MetaDisplay *display,
meta_display_remove_autoraise_callback (display);
}
MetaWindow*
meta_display_lookup_x_window (MetaDisplay *display,
Window xwindow)
{
return g_hash_table_lookup (display->xids, &xwindow);
}
void
meta_display_register_x_window (MetaDisplay *display,
Window *xwindowp,
MetaWindow *window)
{
g_return_if_fail (g_hash_table_lookup (display->xids, xwindowp) == NULL);
g_hash_table_insert (display->xids, xwindowp, window);
}
void
meta_display_unregister_x_window (MetaDisplay *display,
Window xwindow)
{
g_return_if_fail (g_hash_table_lookup (display->xids, &xwindow) != NULL);
g_hash_table_remove (display->xids, &xwindow);
}
void
meta_display_register_wayland_window (MetaDisplay *display,
MetaWindow *window)
@ -1530,7 +1501,8 @@ meta_display_lookup_stack_id (MetaDisplay *display,
guint64 stack_id)
{
if (META_STACK_ID_IS_X11 (stack_id))
return meta_display_lookup_x_window (display, (Window)stack_id);
return meta_x11_display_lookup_x_window (display->x11_display,
(Window)stack_id);
else
return meta_display_lookup_stamp (display, stack_id);
}
@ -1561,37 +1533,6 @@ meta_display_describe_stack_id (MetaDisplay *display,
return result;
}
/* We store sync alarms in the window ID hash table, because they are
* just more types of XIDs in the same global space, but we have
* typesafe functions to register/unregister for readability.
*/
MetaWindow*
meta_display_lookup_sync_alarm (MetaDisplay *display,
XSyncAlarm alarm)
{
return g_hash_table_lookup (display->xids, &alarm);
}
void
meta_display_register_sync_alarm (MetaDisplay *display,
XSyncAlarm *alarmp,
MetaWindow *window)
{
g_return_if_fail (g_hash_table_lookup (display->xids, alarmp) == NULL);
g_hash_table_insert (display->xids, alarmp, window);
}
void
meta_display_unregister_sync_alarm (MetaDisplay *display,
XSyncAlarm alarm)
{
g_return_if_fail (g_hash_table_lookup (display->xids, &alarm) != NULL);
g_hash_table_remove (display->xids, &alarm);
}
void
meta_display_notify_window_created (MetaDisplay *display,
MetaWindow *window)
@ -3044,17 +2985,6 @@ meta_display_is_pointer_emulating_sequence (MetaDisplay *display,
return display->pointer_emulating_sequence == sequence;
}
void
meta_display_set_alarm_filter (MetaDisplay *display,
MetaAlarmFilter filter,
gpointer data)
{
g_return_if_fail (filter == NULL || display->alarm_filter == NULL);
display->alarm_filter = filter;
display->alarm_filter_data = data;
}
void
meta_display_request_pad_osd (MetaDisplay *display,
ClutterInputDevice *pad,

View File

@ -85,7 +85,7 @@ meta_window_ensure_frame (MetaWindow *window)
XChangeWindowAttributes (x11_display->xdisplay,
frame->xwindow, CWEventMask, &attrs);
meta_display_register_x_window (window->display, &frame->xwindow, window);
meta_x11_display_register_x_window (x11_display, &frame->xwindow, window);
meta_error_trap_push (x11_display);
if (window->mapped)
@ -201,8 +201,7 @@ meta_window_destroy_frame (MetaWindow *window)
meta_ui_frame_unmanage (frame->ui_frame);
meta_display_unregister_x_window (window->display,
frame->xwindow);
meta_x11_display_unregister_x_window (x11_display, frame->xwindow);
window->frame = NULL;
if (window->frame_bounds)

View File

@ -851,8 +851,9 @@ meta_stack_tracker_sync_stack (MetaStackTracker *tracker)
if (META_STACK_ID_IS_X11 (window))
{
MetaX11Display *x11_display = tracker->screen->display->x11_display;
MetaWindow *meta_window =
meta_display_lookup_x_window (tracker->screen->display, (Window)window);
meta_x11_display_lookup_x_window (x11_display, (Window)window);
/* When mapping back from xwindow to MetaWindow we have to be a bit careful;
* children of the root could include unmapped windows created by toolkits

View File

@ -7488,8 +7488,8 @@ meta_window_get_transient_for (MetaWindow *window)
if (window->transient_for)
return window->transient_for;
else if (window->xtransient_for)
return meta_display_lookup_x_window (window->display,
window->xtransient_for);
return meta_x11_display_lookup_x_window (window->display->x11_display,
window->xtransient_for);
else
return NULL;
}
@ -8050,24 +8050,24 @@ window_has_pointer_wayland (MetaWindow *window)
static gboolean
window_has_pointer_x11 (MetaWindow *window)
{
MetaDisplay *display = window->display;
MetaX11Display *x11_display = window->display->x11_display;
Window root, child;
double root_x, root_y, x, y;
XIButtonState buttons;
XIModifierState mods;
XIGroupState group;
meta_error_trap_push (display->x11_display);
XIQueryPointer (display->x11_display->xdisplay,
meta_error_trap_push (x11_display);
XIQueryPointer (x11_display->xdisplay,
META_VIRTUAL_CORE_POINTER_ID,
display->x11_display->xroot,
x11_display->xroot,
&root, &child,
&root_x, &root_y, &x, &y,
&buttons, &mods, &group);
meta_error_trap_pop (display->x11_display);
meta_error_trap_pop (x11_display);
free (buttons.mask);
return meta_display_lookup_x_window (display, child) == window;
return meta_x11_display_lookup_x_window (x11_display, child) == window;
}
gboolean

View File

@ -41,7 +41,7 @@ typedef struct {
} TestCase;
static gboolean
test_case_alarm_filter (MetaDisplay *display,
test_case_alarm_filter (MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event,
gpointer data)
{
@ -49,12 +49,12 @@ test_case_alarm_filter (MetaDisplay *display,
GHashTableIter iter;
gpointer key, value;
if (async_waiter_alarm_filter (test->waiter, display, event))
if (async_waiter_alarm_filter (test->waiter, x11_display, event))
return TRUE;
g_hash_table_iter_init (&iter, test->clients);
while (g_hash_table_iter_next (&iter, &key, &value))
if (test_client_alarm_filter (value, display, event))
if (test_client_alarm_filter (value, x11_display, event))
return TRUE;
return FALSE;
@ -103,8 +103,8 @@ test_case_new (void)
test_case_log_func,
test);
meta_display_set_alarm_filter (meta_get_display (),
test_case_alarm_filter, test);
meta_x11_display_set_alarm_filter (meta_get_display ()->x11_display,
test_case_alarm_filter, test);
test->clients = g_hash_table_new (g_str_hash, g_str_equal);
test->waiter = async_waiter_new ();
@ -501,7 +501,8 @@ test_case_destroy (TestCase *test,
async_waiter_destroy (test->waiter);
meta_display_set_alarm_filter (meta_get_display (), NULL, NULL);
meta_x11_display_set_alarm_filter (meta_get_display ()->x11_display,
NULL, NULL);
g_hash_table_destroy (test->clients);
g_free (test);

View File

@ -162,7 +162,7 @@ async_waiter_set_and_wait (AsyncWaiter *waiter)
gboolean
async_waiter_alarm_filter (AsyncWaiter *waiter,
MetaDisplay *display,
MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event)
{
if (event->alarm != waiter->alarm)
@ -335,11 +335,11 @@ test_client_find_window (TestClient *client,
gboolean
test_client_alarm_filter (TestClient *client,
MetaDisplay *display,
MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event)
{
if (client->waiter)
return async_waiter_alarm_filter (client->waiter, display, event);
return async_waiter_alarm_filter (client->waiter, x11_display, event);
else
return FALSE;
}

View File

@ -44,7 +44,7 @@ void test_init (int argc,
char **argv);
gboolean async_waiter_alarm_filter (AsyncWaiter *waiter,
MetaDisplay *display,
MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event);
void async_waiter_set_and_wait (AsyncWaiter *waiter);
@ -56,7 +56,7 @@ void async_waiter_destroy (AsyncWaiter *waiter);
char * test_client_get_id (TestClient *client);
gboolean test_client_alarm_filter (TestClient *client,
MetaDisplay *display,
MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event);
gboolean test_client_wait (TestClient *client,

View File

@ -610,8 +610,8 @@ wayland_selection_data_new (XSelectionRequestEvent *request_event,
data->cancellable = g_cancellable_new ();
data->stream = g_unix_input_stream_new (p[0], TRUE);
data->window = meta_display_lookup_x_window (display,
data->request_event.requestor);
data->window = meta_x11_display_lookup_x_window (x11_display,
data->request_event.requestor);
/* Do *not* change the event mask on the root window, bugger! */
if (!data->window && data->request_event.requestor != x11_display->xroot)

View File

@ -856,7 +856,9 @@ handle_input_xevent (MetaDisplay *display,
}
modified = xievent_get_modified_window (display, input_event);
window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;
window = modified != None ?
meta_x11_display_lookup_x_window (display->x11_display, modified) :
NULL;
/* If this is an event for a GTK+ widget, let GTK+ handle it. */
if (meta_ui_window_is_widget (display->screen->ui, modified))
@ -1173,7 +1175,8 @@ notify_bell (MetaDisplay *display,
XkbBellNotifyEvent *xkb_bell_event = (XkbBellNotifyEvent*) xkb_ev;
MetaWindow *window;
window = meta_display_lookup_x_window (display, xkb_bell_event->window);
window = meta_x11_display_lookup_x_window (display->x11_display,
xkb_bell_event->window);
if (!window && display->focus_window && display->focus_window->frame)
window = display->focus_window;
@ -1202,7 +1205,7 @@ handle_other_xevent (MetaDisplay *display,
gboolean bypass_gtk = FALSE;
modified = event_get_modified_window (display, event);
window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;
window = modified != None ? meta_x11_display_lookup_x_window (x11_display, modified) : NULL;
frame_was_receiver = (window && window->frame && modified == window->frame->xwindow);
/* We only want to respond to _NET_WM_USER_TIME property notify
@ -1219,8 +1222,8 @@ handle_other_xevent (MetaDisplay *display,
if (META_X11_DISPLAY_HAS_XSYNC (x11_display) &&
event->type == (x11_display->xsync_event_base + XSyncAlarmNotify))
{
MetaWindow *alarm_window = meta_display_lookup_sync_alarm (display,
((XSyncAlarmNotifyEvent*)event)->alarm);
MetaWindow *alarm_window = meta_x11_display_lookup_sync_alarm (x11_display,
((XSyncAlarmNotifyEvent*)event)->alarm);
if (alarm_window != NULL)
{
@ -1232,10 +1235,10 @@ handle_other_xevent (MetaDisplay *display,
}
else
{
if (display->alarm_filter &&
display->alarm_filter (display,
(XSyncAlarmNotifyEvent*)event,
display->alarm_filter_data))
if (x11_display->alarm_filter &&
x11_display->alarm_filter (x11_display,
(XSyncAlarmNotifyEvent*)event,
x11_display->alarm_filter_data))
bypass_gtk = TRUE;
}
@ -1748,7 +1751,8 @@ meta_display_handle_xevent (MetaDisplay *display,
meta_topic (META_DEBUG_FOCUS, "Earlier attempt to focus %s failed\n",
display->focus_window->desc);
meta_display_update_focus_window (display,
meta_display_lookup_x_window (display, display->server_focus_window),
meta_x11_display_lookup_x_window (display->x11_display,
display->server_focus_window),
display->server_focus_window,
display->server_focus_serial,
FALSE);
@ -1780,7 +1784,7 @@ meta_display_handle_xevent (MetaDisplay *display,
}
#ifdef HAVE_XI23
if (meta_display_process_barrier_xevent (display, input_event))
if (meta_x11_display_process_barrier_xevent (display->x11_display, input_event))
{
bypass_gtk = bypass_compositor = TRUE;
goto out;
@ -1814,7 +1818,9 @@ meta_display_handle_xevent (MetaDisplay *display,
out:
if (!bypass_compositor)
{
MetaWindow *window = modified != None ? meta_display_lookup_x_window (display, modified) : NULL;
MetaWindow *window = modified != None ?
meta_x11_display_lookup_x_window (display->x11_display, modified) :
NULL;
if (meta_compositor_process_event (display->compositor, event, window))
bypass_gtk = TRUE;

View File

@ -33,6 +33,10 @@
#include "meta/types.h"
#include "meta/meta-x11-display.h"
typedef gboolean (*MetaAlarmFilter) (MetaX11Display *x11_display,
XSyncAlarmNotifyEvent *event,
gpointer data);
struct _MetaX11Display
{
GObject parent;
@ -54,6 +58,11 @@ struct _MetaX11Display
#include "x11/atomnames.h"
#undef item
GHashTable *xids;
MetaAlarmFilter alarm_filter;
gpointer alarm_filter_data;
int composite_event_base;
int composite_error_base;
int composite_major_version;
@ -96,4 +105,29 @@ Cursor meta_x11_display_create_x_cursor (MetaX11Display *x11_display,
void meta_x11_display_reload_cursor (MetaX11Display *x11_display);
MetaWindow *meta_x11_display_lookup_x_window (MetaX11Display *x11_display,
Window xwindow);
void meta_x11_display_register_x_window (MetaX11Display *x11_display,
Window *xwindowp,
MetaWindow *window);
void meta_x11_display_unregister_x_window (MetaX11Display *x11_display,
Window xwindow);
MetaWindow *meta_x11_display_lookup_sync_alarm (MetaX11Display *x11_display,
XSyncAlarm alarm);
void meta_x11_display_register_sync_alarm (MetaX11Display *x11_display,
XSyncAlarm *alarmp,
MetaWindow *window);
void meta_x11_display_unregister_sync_alarm (MetaX11Display *x11_display,
XSyncAlarm alarm);
#ifdef HAVE_XI23
gboolean meta_x11_display_process_barrier_xevent (MetaX11Display *x11_display,
XIEvent *event);
#endif /* HAVE_XI23 */
void meta_x11_display_set_alarm_filter (MetaX11Display *x11_display,
MetaAlarmFilter filter,
gpointer data);
#endif /* META_X11_DISPLAY_PRIVATE_H */

View File

@ -68,6 +68,15 @@ meta_x11_display_dispose (GObject *object)
{
MetaX11Display *x11_display = META_X11_DISPLAY (object);
if (x11_display->xids)
{
/* Must be after all calls to meta_window_unmanage() since they
* unregister windows
*/
g_hash_table_destroy (x11_display->xids);
x11_display->xids = NULL;
}
if (x11_display->xroot != None)
{
meta_error_trap_push (x11_display);
@ -397,6 +406,9 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
update_cursor_theme (x11_display);
x11_display->xids = g_hash_table_new (meta_unsigned_long_hash,
meta_unsigned_long_equal);
return x11_display;
}
@ -556,3 +568,72 @@ update_cursor_theme (MetaX11Display *x11_display)
set_cursor_theme (xdisplay);
}
}
MetaWindow *
meta_x11_display_lookup_x_window (MetaX11Display *x11_display,
Window xwindow)
{
return g_hash_table_lookup (x11_display->xids, &xwindow);
}
void
meta_x11_display_register_x_window (MetaX11Display *x11_display,
Window *xwindowp,
MetaWindow *window)
{
g_return_if_fail (g_hash_table_lookup (x11_display->xids, xwindowp) == NULL);
g_hash_table_insert (x11_display->xids, xwindowp, window);
}
void
meta_x11_display_unregister_x_window (MetaX11Display *x11_display,
Window xwindow)
{
g_return_if_fail (g_hash_table_lookup (x11_display->xids, &xwindow) != NULL);
g_hash_table_remove (x11_display->xids, &xwindow);
}
/* We store sync alarms in the window ID hash table, because they are
* just more types of XIDs in the same global space, but we have
* typesafe functions to register/unregister for readability.
*/
MetaWindow *
meta_x11_display_lookup_sync_alarm (MetaX11Display *x11_display,
XSyncAlarm alarm)
{
return g_hash_table_lookup (x11_display->xids, &alarm);
}
void
meta_x11_display_register_sync_alarm (MetaX11Display *x11_display,
XSyncAlarm *alarmp,
MetaWindow *window)
{
g_return_if_fail (g_hash_table_lookup (x11_display->xids, alarmp) == NULL);
g_hash_table_insert (x11_display->xids, alarmp, window);
}
void
meta_x11_display_unregister_sync_alarm (MetaX11Display *x11_display,
XSyncAlarm alarm)
{
g_return_if_fail (g_hash_table_lookup (x11_display->xids, &alarm) != NULL);
g_hash_table_remove (x11_display->xids, &alarm);
}
void
meta_x11_display_set_alarm_filter (MetaX11Display *x11_display,
MetaAlarmFilter filter,
gpointer data)
{
g_return_if_fail (filter == NULL || x11_display->alarm_filter == NULL);
x11_display->alarm_filter = filter;
x11_display->alarm_filter_data = data;
}

View File

@ -468,8 +468,8 @@ reload_net_wm_user_time_window (MetaWindow *window,
if (window->user_time_window != None)
{
/* See the comment to the meta_display_register_x_window call below. */
meta_display_unregister_x_window (window->display,
window->user_time_window);
meta_x11_display_unregister_x_window (window->display->x11_display,
window->user_time_window);
/* Don't get events on not-managed windows */
XSelectInput (window->display->x11_display->xdisplay,
window->user_time_window,
@ -479,10 +479,12 @@ reload_net_wm_user_time_window (MetaWindow *window,
/* Ensure the new user time window is not used on another MetaWindow,
* and unset its user time window if that is the case.
*/
prev_owner = meta_display_lookup_x_window (window->display, value->v.xwindow);
prev_owner = meta_x11_display_lookup_x_window (window->display->x11_display,
value->v.xwindow);
if (prev_owner && prev_owner->user_time_window == value->v.xwindow)
{
meta_display_unregister_x_window (window->display, value->v.xwindow);
meta_x11_display_unregister_x_window (window->display->x11_display,
value->v.xwindow);
prev_owner->user_time_window = None;
}
@ -502,9 +504,9 @@ reload_net_wm_user_time_window (MetaWindow *window,
* than atom__NET_WM_USER_TIME ones, but I just don't care
* and it's not specified in the spec anyway.
*/
meta_display_register_x_window (window->display,
&window->user_time_window,
window);
meta_x11_display_register_x_window (window->display->x11_display,
&window->user_time_window,
window);
/* Just listen for property notify events */
XSelectInput (window->display->x11_display->xdisplay,
window->user_time_window,
@ -1630,7 +1632,8 @@ reload_transient_for (MetaWindow *window,
{
transient_for = value->v.xwindow;
parent = meta_display_lookup_x_window (window->display, transient_for);
parent = meta_x11_display_lookup_x_window (window->display->x11_display,
transient_for);
if (!parent)
{
meta_warning ("Invalid WM_TRANSIENT_FOR window 0x%lx specified for %s.\n",
@ -1649,8 +1652,8 @@ reload_transient_for (MetaWindow *window,
break;
}
parent = meta_display_lookup_x_window (parent->display,
parent->xtransient_for);
parent = meta_x11_display_lookup_x_window (parent->display->x11_display,
parent->xtransient_for);
}
}
else
@ -1671,8 +1674,8 @@ reload_transient_for (MetaWindow *window,
meta_window_set_transient_for (window, NULL);
else
{
parent = meta_display_lookup_x_window (window->display,
window->xtransient_for);
parent = meta_x11_display_lookup_x_window (window->display->x11_display,
window->xtransient_for);
meta_window_set_transient_for (window, parent);
}
}

View File

@ -510,7 +510,9 @@ meta_window_x11_manage (MetaWindow *window)
meta_icon_cache_init (&priv->icon_cache);
meta_display_register_x_window (display, &window->xwindow, window);
meta_x11_display_register_x_window (display->x11_display,
&window->xwindow,
window);
/* assign the window to its group, or create a new group if needed */
window->group = NULL;
@ -617,7 +619,7 @@ meta_window_x11_unmanage (MetaWindow *window)
window->xwindow);
}
meta_display_unregister_x_window (window->display, window->xwindow);
meta_x11_display_unregister_x_window (x11_display, window->xwindow);
/* Put back anything we messed up */
if (priv->border_width != 0)
@ -645,8 +647,8 @@ meta_window_x11_unmanage (MetaWindow *window)
if (window->user_time_window != None)
{
meta_display_unregister_x_window (window->display,
window->user_time_window);
meta_x11_display_unregister_x_window (x11_display,
window->user_time_window);
window->user_time_window = None;
}
@ -2247,8 +2249,8 @@ meta_window_x11_configure_request (MetaWindow *window,
MetaDisplay *display;
display = meta_window_get_display (window);
sibling = meta_display_lookup_x_window (display,
event->xconfigurerequest.above);
sibling = meta_x11_display_lookup_x_window (display->x11_display,
event->xconfigurerequest.above);
if (sibling == NULL)
return TRUE;
@ -2340,14 +2342,14 @@ handle_net_restack_window (MetaDisplay *display,
if (event->xclient.data.l[0] != 2)
return;
window = meta_display_lookup_x_window (display,
event->xclient.window);
window = meta_x11_display_lookup_x_window (display->x11_display,
event->xclient.window);
if (window)
{
if (event->xclient.data.l[1])
sibling = meta_display_lookup_x_window (display,
event->xclient.data.l[1]);
sibling = meta_x11_display_lookup_x_window (display->x11_display,
event->xclient.data.l[1]);
restack_window (window, sibling, event->xclient.data.l[2]);
}
@ -3484,7 +3486,7 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
&values);
if (meta_error_trap_pop_with_return (x11_display) == Success)
meta_display_register_sync_alarm (window->display, &window->sync_request_alarm, window);
meta_x11_display_register_sync_alarm (x11_display, &window->sync_request_alarm, window);
else
{
window->sync_request_alarm = None;
@ -3495,11 +3497,13 @@ meta_window_x11_create_sync_request_alarm (MetaWindow *window)
void
meta_window_x11_destroy_sync_request_alarm (MetaWindow *window)
{
MetaX11Display *x11_display = window->display->x11_display;
if (window->sync_request_alarm != None)
{
/* Has to be unregistered _before_ clearing the structure field */
meta_display_unregister_sync_alarm (window->display, window->sync_request_alarm);
XSyncDestroyAlarm (window->display->x11_display->xdisplay,
meta_x11_display_unregister_sync_alarm (x11_display, window->sync_request_alarm);
XSyncDestroyAlarm (x11_display->xdisplay,
window->sync_request_alarm);
window->sync_request_alarm = None;
}

View File

@ -132,7 +132,7 @@ validate_or_free_results (GetPropertyResults *results,
prop_name = XGetAtomName (x11_display->xdisplay, results->xatom);
meta_error_trap_pop (x11_display);
w = meta_display_lookup_x_window (results->display, results->xwindow);
w = meta_x11_display_lookup_x_window (x11_display, results->xwindow);
if (w != NULL)
{