mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 00:50:42 -05:00
window: set the corresponding client pointer on focused windows.
The client window determines the device pair that is used for core protocol calls such as XQueryPointer(), so different clients using the core protocol can be focused by different devices simultaneously.
This commit is contained in:
parent
d32c726967
commit
e6f0af9abc
@ -660,6 +660,10 @@ void meta_window_propagate_focus_appearance (MetaWindow *window,
|
||||
MetaDevice *keyboard,
|
||||
gboolean focused);
|
||||
|
||||
void meta_window_set_client_pointer (MetaWindow *window,
|
||||
MetaDevice *pointer);
|
||||
MetaDevice * meta_window_get_client_pointer (MetaWindow *window);
|
||||
|
||||
MetaDevice * meta_window_guess_grab_pointer (MetaWindow *window);
|
||||
|
||||
#endif
|
||||
|
@ -6754,6 +6754,8 @@ meta_window_notify_focus (MetaWindow *window,
|
||||
!meta_prefs_get_raise_on_click())
|
||||
meta_display_ungrab_focus_window_button (window->display, window);
|
||||
|
||||
meta_window_set_client_pointer (window,
|
||||
meta_device_get_paired_device (keyboard));
|
||||
g_signal_emit (window, window_signals[FOCUS], 0);
|
||||
|
||||
if (meta_device_get_id (keyboard) == META_CORE_KEYBOARD_ID)
|
||||
@ -10523,6 +10525,32 @@ meta_window_get_frame_bounds (MetaWindow *window)
|
||||
return window->frame_bounds;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_set_client_pointer (MetaWindow *window,
|
||||
MetaDevice *pointer)
|
||||
{
|
||||
#ifdef HAVE_XINPUT2
|
||||
XISetClientPointer (window->display->xdisplay,
|
||||
window->xwindow,
|
||||
meta_device_get_id (pointer));
|
||||
#endif
|
||||
}
|
||||
|
||||
MetaDevice *
|
||||
meta_window_get_client_pointer (MetaWindow *window)
|
||||
{
|
||||
int device_id = META_CORE_POINTER_ID;
|
||||
|
||||
#ifdef HAVE_XINPUT2
|
||||
if (window->display->have_xinput2)
|
||||
XIGetClientPointer (window->display->xdisplay,
|
||||
window->xwindow, &device_id);
|
||||
#endif
|
||||
|
||||
return meta_device_map_lookup (window->display->device_map,
|
||||
device_id);
|
||||
}
|
||||
|
||||
/* Guesses the better device to grab on if a grab is to be started,
|
||||
* only should be be used in circumstances where we don't know a
|
||||
* device at all.
|
||||
|
Loading…
Reference in New Issue
Block a user