summaryrefslogtreecommitdiff
path: root/plugins/mouse/msd-locate-pointer.c
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-12-15 02:13:53 +0200
committerJasmine Hassan <[email protected]>2012-12-15 02:13:53 +0200
commit7d37bfdb82681fc8dc27ec80e1df388fe31c0e04 (patch)
tree8add944a518b092e9b5330edb353e8fb2d80c9e0 /plugins/mouse/msd-locate-pointer.c
parent0d6c7518d2cd66ba15ca7b8628d7b1e40e9ba875 (diff)
downloadmate-settings-daemon-7d37bfdb82681fc8dc27ec80e1df388fe31c0e04.tar.bz2
mate-settings-daemon-7d37bfdb82681fc8dc27ec80e1df388fe31c0e04.tar.xz
[mouse] Replace Gdk drawing with Cairo (GTK3)
http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=1c1677dcfd55eb7e1f6a20435af466331ec2a911
Diffstat (limited to 'plugins/mouse/msd-locate-pointer.c')
-rw-r--r--plugins/mouse/msd-locate-pointer.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c
index 8f44646..e304862 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