mirror of
https://github.com/brl/mutter.git
synced 2025-02-12 03:14:10 +00:00
core: Make frame handle per-pointer cursors.
This commit is contained in:
parent
04cbdb4e23
commit
7138cc7ea4
@ -759,11 +759,22 @@ meta_core_grab_buttons (Display *xdisplay,
|
|||||||
void
|
void
|
||||||
meta_core_set_screen_cursor (Display *xdisplay,
|
meta_core_set_screen_cursor (Display *xdisplay,
|
||||||
Window frame_on_screen,
|
Window frame_on_screen,
|
||||||
|
gint device_id,
|
||||||
MetaCursor cursor)
|
MetaCursor cursor)
|
||||||
{
|
{
|
||||||
MetaWindow *window = get_window (xdisplay, frame_on_screen);
|
MetaWindow *window = get_window (xdisplay, frame_on_screen);
|
||||||
|
MetaDevice *pointer;
|
||||||
|
|
||||||
meta_frame_set_screen_cursor (window->frame, cursor);
|
pointer = meta_device_map_lookup (window->display->device_map,
|
||||||
|
device_id);
|
||||||
|
|
||||||
|
if (pointer == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!META_IS_DEVICE_POINTER (pointer))
|
||||||
|
pointer = meta_device_get_paired_device (pointer);
|
||||||
|
|
||||||
|
meta_frame_set_screen_cursor (window->frame, pointer, cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -202,6 +202,7 @@ void meta_core_grab_buttons (Display *xdisplay,
|
|||||||
|
|
||||||
void meta_core_set_screen_cursor (Display *xdisplay,
|
void meta_core_set_screen_cursor (Display *xdisplay,
|
||||||
Window frame_on_screen,
|
Window frame_on_screen,
|
||||||
|
int device_id,
|
||||||
MetaCursor cursor);
|
MetaCursor cursor);
|
||||||
|
|
||||||
void meta_core_select_events (Display *xdisplay,
|
void meta_core_select_events (Display *xdisplay,
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "bell.h"
|
#include "bell.h"
|
||||||
#include <meta/errors.h>
|
#include <meta/errors.h>
|
||||||
#include "keybindings-private.h"
|
#include "keybindings-private.h"
|
||||||
|
#include "device-pointer.h"
|
||||||
|
|
||||||
#include <X11/extensions/Xrender.h>
|
#include <X11/extensions/Xrender.h>
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ meta_window_ensure_frame (MetaWindow *window)
|
|||||||
frame->child_y = 0;
|
frame->child_y = 0;
|
||||||
frame->bottom_height = 0;
|
frame->bottom_height = 0;
|
||||||
frame->right_width = 0;
|
frame->right_width = 0;
|
||||||
frame->current_cursor = 0;
|
frame->cursors = g_hash_table_new (NULL, NULL);
|
||||||
|
|
||||||
frame->mapped = FALSE;
|
frame->mapped = FALSE;
|
||||||
frame->is_flashing = FALSE;
|
frame->is_flashing = FALSE;
|
||||||
@ -229,6 +230,7 @@ meta_window_destroy_frame (MetaWindow *window)
|
|||||||
/* Move keybindings to window instead of frame */
|
/* Move keybindings to window instead of frame */
|
||||||
meta_window_grab_keys (window);
|
meta_window_grab_keys (window);
|
||||||
|
|
||||||
|
g_hash_table_destroy (frame->cursors);
|
||||||
g_free (frame);
|
g_free (frame);
|
||||||
|
|
||||||
/* Put our state back where it should be */
|
/* Put our state back where it should be */
|
||||||
@ -408,21 +410,21 @@ meta_frame_queue_draw (MetaFrame *frame)
|
|||||||
|
|
||||||
void
|
void
|
||||||
meta_frame_set_screen_cursor (MetaFrame *frame,
|
meta_frame_set_screen_cursor (MetaFrame *frame,
|
||||||
|
MetaDevice *pointer,
|
||||||
MetaCursor cursor)
|
MetaCursor cursor)
|
||||||
{
|
{
|
||||||
Cursor xcursor;
|
MetaCursor old_cursor;
|
||||||
if (cursor == frame->current_cursor)
|
|
||||||
|
old_cursor = GPOINTER_TO_UINT (g_hash_table_lookup (frame->cursors, pointer));
|
||||||
|
|
||||||
|
if (cursor == old_cursor)
|
||||||
return;
|
return;
|
||||||
frame->current_cursor = cursor;
|
|
||||||
if (cursor == META_CURSOR_DEFAULT)
|
g_hash_table_insert (frame->cursors, pointer,
|
||||||
XUndefineCursor (frame->window->display->xdisplay, frame->xwindow);
|
GUINT_TO_POINTER (cursor));
|
||||||
else
|
meta_device_pointer_set_window_cursor (META_DEVICE_POINTER (pointer),
|
||||||
{
|
frame->xwindow, cursor);
|
||||||
xcursor = meta_display_create_x_cursor (frame->window->display, cursor);
|
|
||||||
XDefineCursor (frame->window->display->xdisplay, frame->xwindow, xcursor);
|
|
||||||
XFlush (frame->window->display->xdisplay);
|
XFlush (frame->window->display->xdisplay);
|
||||||
XFreeCursor (frame->window->display->xdisplay, xcursor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Window
|
Window
|
||||||
|
@ -34,7 +34,7 @@ struct _MetaFrame
|
|||||||
/* reparent window */
|
/* reparent window */
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
|
|
||||||
MetaCursor current_cursor;
|
GHashTable *cursors;
|
||||||
|
|
||||||
/* This rect is trusted info from where we put the
|
/* This rect is trusted info from where we put the
|
||||||
* frame, not the result of ConfigureNotify
|
* frame, not the result of ConfigureNotify
|
||||||
@ -77,6 +77,7 @@ gboolean meta_frame_sync_to_window (MetaFrame *frame,
|
|||||||
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
|
cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
|
||||||
|
|
||||||
void meta_frame_set_screen_cursor (MetaFrame *frame,
|
void meta_frame_set_screen_cursor (MetaFrame *frame,
|
||||||
|
MetaDevice *pointer,
|
||||||
MetaCursor cursor);
|
MetaCursor cursor);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -637,10 +637,12 @@ meta_frames_unmanage_window (MetaFrames *frames,
|
|||||||
|
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
/* restore the cursor */
|
/* restore the cursor */
|
||||||
meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
META_CURSOR_DEFAULT);
|
META_CURSOR_DEFAULT);
|
||||||
|
#endif
|
||||||
|
|
||||||
gdk_window_set_user_data (frame->window, NULL);
|
gdk_window_set_user_data (frame->window, NULL);
|
||||||
|
|
||||||
@ -1594,8 +1596,10 @@ meta_frames_update_prelit_control (MetaFrames *frames,
|
|||||||
MetaFrameControl control)
|
MetaFrameControl control)
|
||||||
{
|
{
|
||||||
MetaFrameControl old_control;
|
MetaFrameControl old_control;
|
||||||
|
GdkDevice *device;
|
||||||
MetaCursor cursor;
|
MetaCursor cursor;
|
||||||
|
|
||||||
|
device = gtk_get_current_event_device ();
|
||||||
|
|
||||||
meta_verbose ("Updating prelit control from %u to %u\n",
|
meta_verbose ("Updating prelit control from %u to %u\n",
|
||||||
frame->prelit_control, control);
|
frame->prelit_control, control);
|
||||||
@ -1661,6 +1665,7 @@ meta_frames_update_prelit_control (MetaFrames *frames,
|
|||||||
/* set/unset the prelight cursor */
|
/* set/unset the prelight cursor */
|
||||||
meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
meta_core_set_screen_cursor (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
|
||||||
frame->xwindow,
|
frame->xwindow,
|
||||||
|
gdk_x11_device_get_id (device),
|
||||||
cursor);
|
cursor);
|
||||||
|
|
||||||
switch (control)
|
switch (control)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user