summaryrefslogtreecommitdiff
path: root/plugins/mouse/msd-locate-pointer.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mouse/msd-locate-pointer.c')
-rw-r--r--plugins/mouse/msd-locate-pointer.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c
index 8f44646..f13f7a0 100644
--- a/plugins/mouse/msd-locate-pointer.c
+++ b/plugins/mouse/msd-locate-pointer.c
@@ -242,15 +242,15 @@ create_window (MsdLocatePointerData *data,
GdkColormap *colormap;
GdkVisual *visual;
GdkWindowAttr attributes;
+ gint attributes_mask;
colormap = gdk_screen_get_rgba_colormap (screen);
visual = gdk_screen_get_rgba_visual (screen);
- if (!colormap)
- {
- colormap = gdk_screen_get_rgb_colormap (screen);
- visual = gdk_screen_get_rgb_visual (screen);
- }
+ attributes_mask = GDK_WA_X | GDK_WA_Y;
+
+ if (colormap)
+ attributes_mask = attributes_mask | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_OUTPUT;
@@ -262,7 +262,7 @@ create_window (MsdLocatePointerData *data,
data->window = gdk_window_new (gdk_screen_get_root_window (screen),
&attributes,
- GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
+ attributes_mask);
gdk_window_set_user_data (data->window, data->widget);
}
@@ -301,8 +301,7 @@ move_locate_pointer_window (MsdLocatePointerData *data,
{
gint cursor_x, cursor_y;
GdkBitmap *mask;
- GdkColor col;
- GdkGC *gc;
+ cairo_t *cr;
gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL);
@@ -311,18 +310,18 @@ move_locate_pointer_window (MsdLocatePointerData *data,
cursor_y - WINDOW_SIZE / 2,
WINDOW_SIZE, WINDOW_SIZE);
- col.pixel = 0;
mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
- gc = gdk_gc_new (mask);
- gdk_gc_set_foreground (gc, &col);
- gdk_draw_rectangle (mask, gc, TRUE, 0, 0, WINDOW_SIZE, WINDOW_SIZE);
+ cr = gdk_cairo_create (mask);
+ cairo_set_source_rgb (cr, 0., 0., 0.);
+ cairo_rectangle (cr, 0., 0., WINDOW_SIZE, WINDOW_SIZE);
+ cairo_fill (cr);
+ cairo_destroy (cr);
/* allow events to happen through the window */
gdk_window_input_shape_combine_mask (data->window, mask, 0, 0);
g_object_unref (mask);
- g_object_unref (gc);
}
void
@@ -381,7 +380,7 @@ filter (GdkXEvent *xevent,
group,
&keyval,
NULL, NULL, NULL);
- if (keyval == GDK_Control_L || keyval == GDK_Control_R)
+ if (keyval == GDK_KEY_Control_L || keyval == GDK_KEY_Control_R)
{
if (xev->type == KeyPress)
{
@@ -418,7 +417,7 @@ set_locate_pointer (void)
int n_screens;
int n_keys;
gboolean has_entries;
- static const guint keyvals[] = { GDK_Control_L, GDK_Control_R };
+ static const guint keyvals[] = { GDK_KEY_Control_L, GDK_KEY_Control_R };
unsigned j;
display = gdk_display_get_default ();