[gtk+] gtk-demo: Don't rely on gdk_cursor_get_image
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gtk-demo: Don't rely on gdk_cursor_get_image
- Date: Tue, 12 May 2015 11:15:55 +0000 (UTC)
commit cfc07fdfcf4811e0edbaf941970ac2653d57afd8
Author: Matthias Clasen <mclasen redhat com>
Date: Mon May 11 23:06:50 2015 -0400
gtk-demo: Don't rely on gdk_cursor_get_image
This function is only implemented on X11. Instead,
just use a fixed set of cursor images from resources.
demos/gtk-demo/Makefile.am | 38 ++++++++++++++++++++++++++++++-
demos/gtk-demo/alias_cursor.png | Bin 0 -> 1383 bytes
demos/gtk-demo/all_scroll_cursor.png | Bin 0 -> 1776 bytes
demos/gtk-demo/cell_cursor.png | Bin 0 -> 1155 bytes
demos/gtk-demo/col_resize_cursor.png | Bin 0 -> 1479 bytes
demos/gtk-demo/copy_cursor.png | Bin 0 -> 1325 bytes
demos/gtk-demo/crosshair_cursor.png | Bin 0 -> 985 bytes
demos/gtk-demo/cursors.c | 11 +++++++-
demos/gtk-demo/default_cursor.png | Bin 0 -> 1252 bytes
demos/gtk-demo/demo.gresource.xml | 37 ++++++++++++++++++++++++++++++
demos/gtk-demo/e_resize_cursor.png | Bin 0 -> 1289 bytes
demos/gtk-demo/ew_resize_cursor.png | Bin 0 -> 1479 bytes
demos/gtk-demo/grab_cursor.png | Bin 0 -> 1392 bytes
demos/gtk-demo/grabbing_cursor.png | Bin 0 -> 1216 bytes
demos/gtk-demo/hand_cursor.png | Bin 0 -> 1416 bytes
demos/gtk-demo/help_cursor.png | Bin 0 -> 1549 bytes
demos/gtk-demo/move_cursor.png | Bin 0 -> 1601 bytes
demos/gtk-demo/n_resize_cursor.png | Bin 0 -> 1287 bytes
demos/gtk-demo/ne_resize_cursor.png | Bin 0 -> 1423 bytes
demos/gtk-demo/nesw_resize_cursor.png | Bin 0 -> 1248 bytes
demos/gtk-demo/no_drop_cursor.png | Bin 0 -> 1176 bytes
demos/gtk-demo/none_cursor.png | Bin 0 -> 182 bytes
demos/gtk-demo/not_allowed_cursor.png | Bin 0 -> 2280 bytes
demos/gtk-demo/ns_resize_cursor.png | Bin 0 -> 1411 bytes
demos/gtk-demo/nw_resize_cursor.png | Bin 0 -> 1545 bytes
demos/gtk-demo/nwse_resize_cursor.png | Bin 0 -> 1223 bytes
demos/gtk-demo/pointer_cursor.png | Bin 0 -> 1416 bytes
demos/gtk-demo/progress_cursor.png | Bin 0 -> 1879 bytes
demos/gtk-demo/row_resize_cursor.png | Bin 0 -> 1411 bytes
demos/gtk-demo/s_resize_cursor.png | Bin 0 -> 1208 bytes
demos/gtk-demo/se_resize_cursor.png | Bin 0 -> 1338 bytes
demos/gtk-demo/sw_resize_cursor.png | Bin 0 -> 1369 bytes
demos/gtk-demo/text_cursor.png | Bin 0 -> 844 bytes
demos/gtk-demo/vertical_text_cursor.png | Bin 0 -> 823 bytes
demos/gtk-demo/w_resize_cursor.png | Bin 0 -> 1355 bytes
demos/gtk-demo/wait_cursor.png | Bin 0 -> 2013 bytes
demos/gtk-demo/zoom_in_cursor.png | Bin 0 -> 2289 bytes
demos/gtk-demo/zoom_out_cursor.png | Bin 0 -> 2170 bytes
38 files changed, 83 insertions(+), 3 deletions(-)
---
diff --git a/demos/gtk-demo/Makefile.am b/demos/gtk-demo/Makefile.am
index d31e6be..f8b7c9f 100644
--- a/demos/gtk-demo/Makefile.am
+++ b/demos/gtk-demo/Makefile.am
@@ -155,7 +155,43 @@ RESOURCES = \
css_pixbufs.css \
css_shadows.css \
cssview.css \
- reset.css
+ reset.css \
+ alias_cursor.png \
+ all_scroll_cursor.png \
+ cell_cursor.png \
+ col_resize_cursor.png \
+ copy_cursor.png \
+ crosshair_cursor.png \
+ default_cursor.png \
+ e_resize_cursor.png \
+ ew_resize_cursor.png \
+ grabbing_cursor.png \
+ grab_cursor.png \
+ hand_cursor.png \
+ help_cursor.png \
+ move_cursor.png \
+ ne_resize_cursor.png \
+ nesw_resize_cursor.png \
+ none_cursor.png \
+ no_drop_cursor.png \
+ not_allowed_cursor.png \
+ n_resize_cursor.png \
+ ns_resize_cursor.png \
+ nw_resize_cursor.png \
+ nwse_resize_cursor.png \
+ pointer_cursor.png \
+ progress_cursor.png \
+ row_resize_cursor.png \
+ se_resize_cursor.png \
+ s_resize_cursor.png \
+ sw_resize_cursor.png \
+ text_cursor.png \
+ vertical_text_cursor.png \
+ wait_cursor.png \
+ w_resize_cursor.png \
+ zoom_in_cursor.png \
+ zoom_out_cursor.png
+
iconthemedir = $(datadir)/icons/hicolor
diff --git a/demos/gtk-demo/alias_cursor.png b/demos/gtk-demo/alias_cursor.png
new file mode 100644
index 0000000..70a7956
Binary files /dev/null and b/demos/gtk-demo/alias_cursor.png differ
diff --git a/demos/gtk-demo/all_scroll_cursor.png b/demos/gtk-demo/all_scroll_cursor.png
new file mode 100644
index 0000000..b42ae85
Binary files /dev/null and b/demos/gtk-demo/all_scroll_cursor.png differ
diff --git a/demos/gtk-demo/cell_cursor.png b/demos/gtk-demo/cell_cursor.png
new file mode 100644
index 0000000..0bb0935
Binary files /dev/null and b/demos/gtk-demo/cell_cursor.png differ
diff --git a/demos/gtk-demo/col_resize_cursor.png b/demos/gtk-demo/col_resize_cursor.png
new file mode 100644
index 0000000..8dbd462
Binary files /dev/null and b/demos/gtk-demo/col_resize_cursor.png differ
diff --git a/demos/gtk-demo/copy_cursor.png b/demos/gtk-demo/copy_cursor.png
new file mode 100644
index 0000000..c2350b8
Binary files /dev/null and b/demos/gtk-demo/copy_cursor.png differ
diff --git a/demos/gtk-demo/crosshair_cursor.png b/demos/gtk-demo/crosshair_cursor.png
new file mode 100644
index 0000000..7247e06
Binary files /dev/null and b/demos/gtk-demo/crosshair_cursor.png differ
diff --git a/demos/gtk-demo/cursors.c b/demos/gtk-demo/cursors.c
index 1188995..1ccb580 100644
--- a/demos/gtk-demo/cursors.c
+++ b/demos/gtk-demo/cursors.c
@@ -51,8 +51,15 @@ add_button (GtkWidget *section,
if (cursor == NULL)
image = gtk_image_new_from_icon_name ("image-missing", GTK_ICON_SIZE_MENU);
else
- image = gtk_image_new_from_pixbuf (gdk_cursor_get_image (cursor));
- gtk_widget_set_size_request (image, 24, 24);
+ {
+ gchar *path;
+
+ path = g_strdup_printf ("/cursors/%s_cursor.png", css_name);
+ g_strdelimit (path, "-", '_');
+ image = gtk_image_new_from_resource (path);
+ g_free (path);
+ }
+ gtk_widget_set_size_request (image, 32, 32);
button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), image);
gtk_style_context_add_class (gtk_widget_get_style_context (button), "image-button");
diff --git a/demos/gtk-demo/default_cursor.png b/demos/gtk-demo/default_cursor.png
new file mode 100644
index 0000000..aa39aa4
Binary files /dev/null and b/demos/gtk-demo/default_cursor.png differ
diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml
index 91db2a5..91f50b6 100644
--- a/demos/gtk-demo/demo.gresource.xml
+++ b/demos/gtk-demo/demo.gresource.xml
@@ -47,6 +47,43 @@
<file>cssview.css</file>
<file>reset.css</file>
</gresource>
+ <gresource prefix="/cursors">
+ <file>alias_cursor.png</file>
+ <file>all_scroll_cursor.png</file>
+ <file>cell_cursor.png</file>
+ <file>col_resize_cursor.png</file>
+ <file>copy_cursor.png</file>
+ <file>crosshair_cursor.png</file>
+ <file>default_cursor.png</file>
+ <file>e_resize_cursor.png</file>
+ <file>ew_resize_cursor.png</file>
+ <file>grabbing_cursor.png</file>
+ <file>grab_cursor.png</file>
+ <file>hand_cursor.png</file>
+ <file>help_cursor.png</file>
+ <file>move_cursor.png</file>
+ <file>ne_resize_cursor.png</file>
+ <file>nesw_resize_cursor.png</file>
+ <file>no_drop_cursor.png</file>
+ <file>none_cursor.png</file>
+ <file>not_allowed_cursor.png</file>
+ <file>n_resize_cursor.png</file>
+ <file>ns_resize_cursor.png</file>
+ <file>nw_resize_cursor.png</file>
+ <file>nwse_resize_cursor.png</file>
+ <file>pointer_cursor.png</file>
+ <file>progress_cursor.png</file>
+ <file>row_resize_cursor.png</file>
+ <file>se_resize_cursor.png</file>
+ <file>s_resize_cursor.png</file>
+ <file>sw_resize_cursor.png</file>
+ <file>text_cursor.png</file>
+ <file>vertical_text_cursor.png</file>
+ <file>wait_cursor.png</file>
+ <file>w_resize_cursor.png</file>
+ <file>zoom_in_cursor.png</file>
+ <file>zoom_out_cursor.png</file>
+ </gresource>
<gresource prefix="/iconview">
<file preprocess="to-pixdata">gnome-fs-directory.png</file>
<file preprocess="to-pixdata">gnome-fs-regular.png</file>
diff --git a/demos/gtk-demo/e_resize_cursor.png b/demos/gtk-demo/e_resize_cursor.png
new file mode 100644
index 0000000..f06bf46
Binary files /dev/null and b/demos/gtk-demo/e_resize_cursor.png differ
diff --git a/demos/gtk-demo/ew_resize_cursor.png b/demos/gtk-demo/ew_resize_cursor.png
new file mode 100644
index 0000000..8dbd462
Binary files /dev/null and b/demos/gtk-demo/ew_resize_cursor.png differ
diff --git a/demos/gtk-demo/grab_cursor.png b/demos/gtk-demo/grab_cursor.png
new file mode 100644
index 0000000..a920eef
Binary files /dev/null and b/demos/gtk-demo/grab_cursor.png differ
diff --git a/demos/gtk-demo/grabbing_cursor.png b/demos/gtk-demo/grabbing_cursor.png
new file mode 100644
index 0000000..33418ac
Binary files /dev/null and b/demos/gtk-demo/grabbing_cursor.png differ
diff --git a/demos/gtk-demo/hand_cursor.png b/demos/gtk-demo/hand_cursor.png
new file mode 100644
index 0000000..b510203
Binary files /dev/null and b/demos/gtk-demo/hand_cursor.png differ
diff --git a/demos/gtk-demo/help_cursor.png b/demos/gtk-demo/help_cursor.png
new file mode 100644
index 0000000..5440fd9
Binary files /dev/null and b/demos/gtk-demo/help_cursor.png differ
diff --git a/demos/gtk-demo/move_cursor.png b/demos/gtk-demo/move_cursor.png
new file mode 100644
index 0000000..6028099
Binary files /dev/null and b/demos/gtk-demo/move_cursor.png differ
diff --git a/demos/gtk-demo/n_resize_cursor.png b/demos/gtk-demo/n_resize_cursor.png
new file mode 100644
index 0000000..fbd8420
Binary files /dev/null and b/demos/gtk-demo/n_resize_cursor.png differ
diff --git a/demos/gtk-demo/ne_resize_cursor.png b/demos/gtk-demo/ne_resize_cursor.png
new file mode 100644
index 0000000..0ca3f6e
Binary files /dev/null and b/demos/gtk-demo/ne_resize_cursor.png differ
diff --git a/demos/gtk-demo/nesw_resize_cursor.png b/demos/gtk-demo/nesw_resize_cursor.png
new file mode 100644
index 0000000..aa3bf68
Binary files /dev/null and b/demos/gtk-demo/nesw_resize_cursor.png differ
diff --git a/demos/gtk-demo/no_drop_cursor.png b/demos/gtk-demo/no_drop_cursor.png
new file mode 100644
index 0000000..4f9968f
Binary files /dev/null and b/demos/gtk-demo/no_drop_cursor.png differ
diff --git a/demos/gtk-demo/none_cursor.png b/demos/gtk-demo/none_cursor.png
new file mode 100644
index 0000000..ad0dae1
Binary files /dev/null and b/demos/gtk-demo/none_cursor.png differ
diff --git a/demos/gtk-demo/not_allowed_cursor.png b/demos/gtk-demo/not_allowed_cursor.png
new file mode 100644
index 0000000..1305af8
Binary files /dev/null and b/demos/gtk-demo/not_allowed_cursor.png differ
diff --git a/demos/gtk-demo/ns_resize_cursor.png b/demos/gtk-demo/ns_resize_cursor.png
new file mode 100644
index 0000000..acb1283
Binary files /dev/null and b/demos/gtk-demo/ns_resize_cursor.png differ
diff --git a/demos/gtk-demo/nw_resize_cursor.png b/demos/gtk-demo/nw_resize_cursor.png
new file mode 100644
index 0000000..6691557
Binary files /dev/null and b/demos/gtk-demo/nw_resize_cursor.png differ
diff --git a/demos/gtk-demo/nwse_resize_cursor.png b/demos/gtk-demo/nwse_resize_cursor.png
new file mode 100644
index 0000000..183001d
Binary files /dev/null and b/demos/gtk-demo/nwse_resize_cursor.png differ
diff --git a/demos/gtk-demo/pointer_cursor.png b/demos/gtk-demo/pointer_cursor.png
new file mode 100644
index 0000000..b510203
Binary files /dev/null and b/demos/gtk-demo/pointer_cursor.png differ
diff --git a/demos/gtk-demo/progress_cursor.png b/demos/gtk-demo/progress_cursor.png
new file mode 100644
index 0000000..7afe983
Binary files /dev/null and b/demos/gtk-demo/progress_cursor.png differ
diff --git a/demos/gtk-demo/row_resize_cursor.png b/demos/gtk-demo/row_resize_cursor.png
new file mode 100644
index 0000000..acb1283
Binary files /dev/null and b/demos/gtk-demo/row_resize_cursor.png differ
diff --git a/demos/gtk-demo/s_resize_cursor.png b/demos/gtk-demo/s_resize_cursor.png
new file mode 100644
index 0000000..5e6bf50
Binary files /dev/null and b/demos/gtk-demo/s_resize_cursor.png differ
diff --git a/demos/gtk-demo/se_resize_cursor.png b/demos/gtk-demo/se_resize_cursor.png
new file mode 100644
index 0000000..f6e4002
Binary files /dev/null and b/demos/gtk-demo/se_resize_cursor.png differ
diff --git a/demos/gtk-demo/sw_resize_cursor.png b/demos/gtk-demo/sw_resize_cursor.png
new file mode 100644
index 0000000..1963383
Binary files /dev/null and b/demos/gtk-demo/sw_resize_cursor.png differ
diff --git a/demos/gtk-demo/text_cursor.png b/demos/gtk-demo/text_cursor.png
new file mode 100644
index 0000000..53cec46
Binary files /dev/null and b/demos/gtk-demo/text_cursor.png differ
diff --git a/demos/gtk-demo/vertical_text_cursor.png b/demos/gtk-demo/vertical_text_cursor.png
new file mode 100644
index 0000000..17241bc
Binary files /dev/null and b/demos/gtk-demo/vertical_text_cursor.png differ
diff --git a/demos/gtk-demo/w_resize_cursor.png b/demos/gtk-demo/w_resize_cursor.png
new file mode 100644
index 0000000..65383b1
Binary files /dev/null and b/demos/gtk-demo/w_resize_cursor.png differ
diff --git a/demos/gtk-demo/wait_cursor.png b/demos/gtk-demo/wait_cursor.png
new file mode 100644
index 0000000..21ccd2f
Binary files /dev/null and b/demos/gtk-demo/wait_cursor.png differ
diff --git a/demos/gtk-demo/zoom_in_cursor.png b/demos/gtk-demo/zoom_in_cursor.png
new file mode 100644
index 0000000..ae3114d
Binary files /dev/null and b/demos/gtk-demo/zoom_in_cursor.png differ
diff --git a/demos/gtk-demo/zoom_out_cursor.png b/demos/gtk-demo/zoom_out_cursor.png
new file mode 100644
index 0000000..846a3dd
Binary files /dev/null and b/demos/gtk-demo/zoom_out_cursor.png differ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]