mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
backend: Add an XIWarpPointer wrapper
This makes Alt+F7 / Alt+F8 work respectively under X11 nested mode. For the native backend implementation, we'll need a special Clutter function, so don't implement that for now.
This commit is contained in:
parent
0a9187a6e9
commit
b704659899
@ -62,6 +62,10 @@ struct _MetaBackendClass
|
|||||||
gboolean (* ungrab_device) (MetaBackend *backend,
|
gboolean (* ungrab_device) (MetaBackend *backend,
|
||||||
int device_id,
|
int device_id,
|
||||||
uint32_t timestamp);
|
uint32_t timestamp);
|
||||||
|
|
||||||
|
void (* warp_pointer) (MetaBackend *backend,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* META_BACKEND_PRIVATE_H */
|
#endif /* META_BACKEND_PRIVATE_H */
|
||||||
|
@ -100,6 +100,14 @@ meta_backend_real_ungrab_device (MetaBackend *backend,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_backend_real_warp_pointer (MetaBackend *backend,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
|
{
|
||||||
|
/* Do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_class_init (MetaBackendClass *klass)
|
meta_backend_class_init (MetaBackendClass *klass)
|
||||||
{
|
{
|
||||||
@ -111,6 +119,7 @@ meta_backend_class_init (MetaBackendClass *klass)
|
|||||||
klass->create_cursor_renderer = meta_backend_real_create_cursor_renderer;
|
klass->create_cursor_renderer = meta_backend_real_create_cursor_renderer;
|
||||||
klass->grab_device = meta_backend_real_grab_device;
|
klass->grab_device = meta_backend_real_grab_device;
|
||||||
klass->ungrab_device = meta_backend_real_ungrab_device;
|
klass->ungrab_device = meta_backend_real_ungrab_device;
|
||||||
|
klass->warp_pointer = meta_backend_real_warp_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -189,6 +198,14 @@ meta_backend_ungrab_device (MetaBackend *backend,
|
|||||||
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp);
|
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_backend_warp_pointer (MetaBackend *backend,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
|
{
|
||||||
|
META_BACKEND_GET_CLASS (backend)->warp_pointer (backend, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
static GType
|
static GType
|
||||||
get_backend_type (void)
|
get_backend_type (void)
|
||||||
{
|
{
|
||||||
|
@ -50,6 +50,10 @@ gboolean meta_backend_ungrab_device (MetaBackend *backend,
|
|||||||
int device_id,
|
int device_id,
|
||||||
uint32_t timestamp);
|
uint32_t timestamp);
|
||||||
|
|
||||||
|
void meta_backend_warp_pointer (MetaBackend *backend,
|
||||||
|
int x,
|
||||||
|
int y);
|
||||||
|
|
||||||
void meta_clutter_init (void);
|
void meta_clutter_init (void);
|
||||||
|
|
||||||
#endif /* META_BACKEND_H */
|
#endif /* META_BACKEND_H */
|
||||||
|
@ -346,6 +346,22 @@ meta_backend_x11_ungrab_device (MetaBackend *backend,
|
|||||||
return (ret == Success);
|
return (ret == Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_backend_x11_warp_pointer (MetaBackend *backend,
|
||||||
|
int x,
|
||||||
|
int y)
|
||||||
|
{
|
||||||
|
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
|
||||||
|
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
||||||
|
|
||||||
|
XIWarpPointer (priv->xdisplay,
|
||||||
|
META_VIRTUAL_CORE_POINTER_ID,
|
||||||
|
None,
|
||||||
|
meta_backend_x11_get_xwindow (x11),
|
||||||
|
0, 0, 0, 0,
|
||||||
|
x, y);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_backend_x11_class_init (MetaBackendX11Class *klass)
|
meta_backend_x11_class_init (MetaBackendX11Class *klass)
|
||||||
{
|
{
|
||||||
@ -358,6 +374,7 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
|
|||||||
|
|
||||||
backend_class->grab_device = meta_backend_x11_grab_device;
|
backend_class->grab_device = meta_backend_x11_grab_device;
|
||||||
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
|
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
|
||||||
|
backend_class->warp_pointer = meta_backend_x11_warp_pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -58,6 +58,8 @@
|
|||||||
#include "wayland/window-wayland.h"
|
#include "wayland/window-wayland.h"
|
||||||
#include "wayland/meta-wayland-private.h"
|
#include "wayland/meta-wayland-private.h"
|
||||||
|
|
||||||
|
#include "backends/meta-backend.h"
|
||||||
|
|
||||||
/* Windows that unmaximize to a size bigger than that fraction of the workarea
|
/* Windows that unmaximize to a size bigger than that fraction of the workarea
|
||||||
* will be scaled down to that size (while maintaining aspect ratio).
|
* will be scaled down to that size (while maintaining aspect ratio).
|
||||||
* Windows that cover an area greater then this size are automaximized on map.
|
* Windows that cover an area greater then this size are automaximized on map.
|
||||||
@ -6562,12 +6564,10 @@ warp_grab_pointer (MetaWindow *window,
|
|||||||
meta_window_get_client_root_coords (window,
|
meta_window_get_client_root_coords (window,
|
||||||
&display->grab_anchor_window_pos);
|
&display->grab_anchor_window_pos);
|
||||||
|
|
||||||
XIWarpPointer (display->xdisplay,
|
{
|
||||||
META_VIRTUAL_CORE_POINTER_ID,
|
MetaBackend *backend = meta_get_backend ();
|
||||||
None,
|
meta_backend_warp_pointer (backend, *x, *y);
|
||||||
window->screen->xroot,
|
}
|
||||||
0, 0, 0, 0,
|
|
||||||
*x, *y);
|
|
||||||
|
|
||||||
if (meta_error_trap_pop_with_return (display) != Success)
|
if (meta_error_trap_pop_with_return (display) != Success)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user