mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
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:
parent
648639fffe
commit
08df9bf559
@ -117,12 +117,6 @@ typedef struct
|
|||||||
guint ping_timeout_id;
|
guint ping_timeout_id;
|
||||||
} MetaPingData;
|
} MetaPingData;
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
MetaDisplay *display;
|
|
||||||
Window xwindow;
|
|
||||||
} MetaAutoRaiseData;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
MetaDisplay *display;
|
MetaDisplay *display;
|
||||||
@ -1620,23 +1614,10 @@ reset_ignored_crossing_serials (MetaDisplay *display)
|
|||||||
static gboolean
|
static gboolean
|
||||||
window_raise_with_delay_callback (void *data)
|
window_raise_with_delay_callback (void *data)
|
||||||
{
|
{
|
||||||
MetaWindow *window;
|
MetaWindow *window = data;
|
||||||
MetaAutoRaiseData *auto_raise;
|
|
||||||
|
|
||||||
auto_raise = data;
|
window->display->autoraise_timeout_id = 0;
|
||||||
|
window->display->autoraise_window = NULL;
|
||||||
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;
|
|
||||||
|
|
||||||
/* If we aren't already on top, check whether the pointer is inside
|
/* If we aren't already on top, check whether the pointer is inside
|
||||||
* the window and raise the window if so.
|
* the window and raise the window if so.
|
||||||
@ -1778,17 +1759,11 @@ void
|
|||||||
meta_display_queue_autoraise_callback (MetaDisplay *display,
|
meta_display_queue_autoraise_callback (MetaDisplay *display,
|
||||||
MetaWindow *window)
|
MetaWindow *window)
|
||||||
{
|
{
|
||||||
MetaAutoRaiseData *auto_raise_data;
|
|
||||||
|
|
||||||
meta_topic (META_DEBUG_FOCUS,
|
meta_topic (META_DEBUG_FOCUS,
|
||||||
"Queuing an autoraise timeout for %s with delay %d\n",
|
"Queuing an autoraise timeout for %s with delay %d\n",
|
||||||
window->desc,
|
window->desc,
|
||||||
meta_prefs_get_auto_raise_delay ());
|
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)
|
if (display->autoraise_timeout_id != 0)
|
||||||
g_source_remove (display->autoraise_timeout_id);
|
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,
|
g_timeout_add_full (G_PRIORITY_DEFAULT,
|
||||||
meta_prefs_get_auto_raise_delay (),
|
meta_prefs_get_auto_raise_delay (),
|
||||||
window_raise_with_delay_callback,
|
window_raise_with_delay_callback,
|
||||||
auto_raise_data,
|
window, NULL);
|
||||||
g_free);
|
|
||||||
display->autoraise_window = window;
|
display->autoraise_window = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2000,6 +2000,8 @@ meta_window_unmanage (MetaWindow *window,
|
|||||||
meta_window_ungrab_keys (window);
|
meta_window_ungrab_keys (window);
|
||||||
meta_display_ungrab_window_buttons (window->display, window->xwindow);
|
meta_display_ungrab_window_buttons (window->display, window->xwindow);
|
||||||
meta_display_ungrab_focus_window_button (window->display, window);
|
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)
|
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user