display: Use MetaWindow for auto-raise callbacks

This allows us to autoraise Wayland windows... well, except for the
XQueryPointer, but we'll replace that soon.
This commit is contained in:
Jasper St. Pierre 2013-10-16 00:19:33 -04:00
parent 648639fffe
commit 08df9bf559
2 changed files with 6 additions and 30 deletions

View File

@ -117,12 +117,6 @@ typedef struct
guint ping_timeout_id;
} MetaPingData;
typedef struct
{
MetaDisplay *display;
Window xwindow;
} MetaAutoRaiseData;
typedef struct
{
MetaDisplay *display;
@ -1620,23 +1614,10 @@ reset_ignored_crossing_serials (MetaDisplay *display)
static gboolean
window_raise_with_delay_callback (void *data)
{
MetaWindow *window;
MetaAutoRaiseData *auto_raise;
MetaWindow *window = data;
auto_raise = data;
meta_topic (META_DEBUG_FOCUS,
"In autoraise callback for window 0x%lx\n",
auto_raise->xwindow);
auto_raise->display->autoraise_timeout_id = 0;
auto_raise->display->autoraise_window = NULL;
window = meta_display_lookup_x_window (auto_raise->display,
auto_raise->xwindow);
if (window == NULL)
return FALSE;
window->display->autoraise_timeout_id = 0;
window->display->autoraise_window = NULL;
/* If we aren't already on top, check whether the pointer is inside
* the window and raise the window if so.
@ -1778,17 +1759,11 @@ void
meta_display_queue_autoraise_callback (MetaDisplay *display,
MetaWindow *window)
{
MetaAutoRaiseData *auto_raise_data;
meta_topic (META_DEBUG_FOCUS,
"Queuing an autoraise timeout for %s with delay %d\n",
window->desc,
meta_prefs_get_auto_raise_delay ());
auto_raise_data = g_new (MetaAutoRaiseData, 1);
auto_raise_data->display = window->display;
auto_raise_data->xwindow = window->xwindow;
if (display->autoraise_timeout_id != 0)
g_source_remove (display->autoraise_timeout_id);
@ -1796,8 +1771,7 @@ meta_display_queue_autoraise_callback (MetaDisplay *display,
g_timeout_add_full (G_PRIORITY_DEFAULT,
meta_prefs_get_auto_raise_delay (),
window_raise_with_delay_callback,
auto_raise_data,
g_free);
window, NULL);
display->autoraise_window = window;
}

View File

@ -2000,6 +2000,8 @@ meta_window_unmanage (MetaWindow *window,
meta_window_ungrab_keys (window);
meta_display_ungrab_window_buttons (window->display, window->xwindow);
meta_display_ungrab_focus_window_button (window->display, window);
if (window->display->autoraise_window == window)
meta_display_remove_autoraise_callback (window->display);
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
{