mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Add two new settings, gtk-cursor-theme-name and gtk-cursor-theme-size to
2005-06-15 Matthias Clasen <mclasen@redhat.com> * gtk/gtksettings.c: Add two new settings, gtk-cursor-theme-name and gtk-cursor-theme-size to control the cursor theme. * gdk/x11/gdkevents-x11.c: Add two new X settings, Gtk/CursorThemeName and Gtk/CursorThemeSize, and map these to the gtk settings. * tests/testgtk.c (create_cursors): Add a cursor theme testcase.
This commit is contained in:
parent
3c96358fd1
commit
df517cb1d5
11
ChangeLog
11
ChangeLog
@ -1,5 +1,16 @@
|
||||
2005-06-15 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtksettings.c: Add two new settings,
|
||||
gtk-cursor-theme-name and gtk-cursor-theme-size to
|
||||
control the cursor theme.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c: Add two new X settings,
|
||||
Gtk/CursorThemeName and Gtk/CursorThemeSize, and map
|
||||
these to the gtk settings.
|
||||
|
||||
* tests/testgtk.c (create_cursors): Add a cursor theme
|
||||
testcase.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.[hc]: Keep a reference to the
|
||||
GdkCursor and add a private getter for it, so that we can
|
||||
update the cursor when the cursor theme changes.
|
||||
|
@ -1,5 +1,16 @@
|
||||
2005-06-15 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtksettings.c: Add two new settings,
|
||||
gtk-cursor-theme-name and gtk-cursor-theme-size to
|
||||
control the cursor theme.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c: Add two new X settings,
|
||||
Gtk/CursorThemeName and Gtk/CursorThemeSize, and map
|
||||
these to the gtk settings.
|
||||
|
||||
* tests/testgtk.c (create_cursors): Add a cursor theme
|
||||
testcase.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.[hc]: Keep a reference to the
|
||||
GdkCursor and add a private getter for it, so that we can
|
||||
update the cursor when the cursor theme changes.
|
||||
|
@ -1,5 +1,16 @@
|
||||
2005-06-15 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtksettings.c: Add two new settings,
|
||||
gtk-cursor-theme-name and gtk-cursor-theme-size to
|
||||
control the cursor theme.
|
||||
|
||||
* gdk/x11/gdkevents-x11.c: Add two new X settings,
|
||||
Gtk/CursorThemeName and Gtk/CursorThemeSize, and map
|
||||
these to the gtk settings.
|
||||
|
||||
* tests/testgtk.c (create_cursors): Add a cursor theme
|
||||
testcase.
|
||||
|
||||
* gdk/x11/gdkwindow-x11.[hc]: Keep a reference to the
|
||||
GdkCursor and add a private getter for it, so that we can
|
||||
update the cursor when the cursor theme changes.
|
||||
|
@ -2766,6 +2766,8 @@ static const struct
|
||||
{ "Gtk/ButtonImages", "gtk-button-images" },
|
||||
{ "Gtk/MenuImages", "gtk-menu-images" },
|
||||
{ "Gtk/MenuBarAccel", "gtk-menu-bar-accel" },
|
||||
{ "Gtk/CursorThemeName", "gtk-cursor-theme-name" },
|
||||
{ "Gtk/CursorThemeSize", "gtk-cursor-theme-size" },
|
||||
{ "Xft/Antialias", "gtk-xft-antialias" },
|
||||
{ "Xft/Hinting", "gtk-xft-hinting" },
|
||||
{ "Xft/HintStyle", "gtk-xft-hintstyle" },
|
||||
|
@ -25,6 +25,14 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include "x11/gdkx.h"
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <pango/pangoxft.h>
|
||||
#endif
|
||||
|
||||
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
|
||||
|
||||
typedef enum
|
||||
@ -46,11 +54,6 @@ struct _GtkSettingsPropertyValue
|
||||
GtkSettingsSource source;
|
||||
};
|
||||
|
||||
#if 0
|
||||
#include <pango/pangoxft.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
#endif
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_DOUBLE_CLICK_TIME,
|
||||
@ -72,6 +75,8 @@ enum {
|
||||
PROP_XFT_HINTSTYLE,
|
||||
PROP_XFT_RGBA,
|
||||
PROP_XFT_DPI,
|
||||
PROP_CURSOR_THEME_NAME,
|
||||
PROP_CURSOR_THEME_SIZE,
|
||||
#endif
|
||||
PROP_ALTERNATIVE_BUTTON_ORDER
|
||||
};
|
||||
@ -97,6 +102,10 @@ static guint settings_install_property_parser (GtkSettingsClass *class,
|
||||
static void settings_update_double_click (GtkSettings *settings);
|
||||
static void settings_update_modules (GtkSettings *settings);
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
static void settings_update_cursor_theme (GtkSettings *settings);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* --- variables --- */
|
||||
@ -136,6 +145,7 @@ gtk_settings_get_type (void)
|
||||
|
||||
#if 0
|
||||
static void
|
||||
|
||||
gtk_default_substitute (FcPattern *pattern,
|
||||
gpointer data)
|
||||
{
|
||||
@ -427,6 +437,26 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
NULL);
|
||||
|
||||
g_assert (result == PROP_XFT_DPI);
|
||||
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_string ("gtk-cursor-theme-name",
|
||||
P_("Cursor theme name"),
|
||||
P_("Name of the cursor theme to use"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE),
|
||||
NULL);
|
||||
g_assert (result == PROP_CURSOR_THEME_NAME);
|
||||
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_int ("gtk-cursor-theme-size",
|
||||
P_("Cursor theme size"),
|
||||
P_("Size to use for cursors"),
|
||||
0, 128, 24,
|
||||
GTK_PARAM_READWRITE),
|
||||
NULL);
|
||||
|
||||
g_assert (result == PROP_CURSOR_THEME_SIZE);
|
||||
|
||||
#endif /* GDK_WINDOWING_X11 */
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_boolean ("gtk-alternative-button-order",
|
||||
@ -630,6 +660,12 @@ gtk_settings_notify (GObject *object,
|
||||
*/
|
||||
gtk_rc_reset_styles (GTK_SETTINGS (object));
|
||||
break;
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
case PROP_CURSOR_THEME_NAME:
|
||||
case PROP_CURSOR_THEME_SIZE:
|
||||
settings_update_cursor_theme (settings);
|
||||
break;
|
||||
#endif /* GDK_WINDOWING_X11 */
|
||||
}
|
||||
}
|
||||
@ -1406,5 +1442,22 @@ settings_update_modules (GtkSettings *settings)
|
||||
g_free (modules);
|
||||
}
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
static void
|
||||
settings_update_cursor_theme (GtkSettings *settings)
|
||||
{
|
||||
GdkDisplay *display = gdk_screen_get_display (settings->screen);
|
||||
gchar *theme = NULL;
|
||||
gint size = 0;
|
||||
|
||||
g_object_get (settings,
|
||||
"gtk-cursor-theme-name", &theme,
|
||||
"gtk-cursor-theme-size", &size,
|
||||
NULL);
|
||||
|
||||
gdk_x11_display_set_cursor_theme (display, theme, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
#define __GTK_SETTINGS_C__
|
||||
#include "gtkaliasdef.c"
|
||||
|
@ -5890,6 +5890,30 @@ cursor_event (GtkWidget *widget,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include "x11/gdkx.h"
|
||||
|
||||
static void
|
||||
change_cursor_theme (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
const gchar *theme;
|
||||
gint size;
|
||||
GList *children;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (data));
|
||||
|
||||
theme = gtk_entry_get_text (GTK_ENTRY (children->next->data));
|
||||
size = (gint) gtk_spin_button_get_value (GTK_SPIN_BUTTON (children->next->next->data));
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
gdk_x11_display_set_cursor_theme (gtk_widget_get_display (widget),
|
||||
theme, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
create_cursors (GtkWidget *widget)
|
||||
{
|
||||
@ -5904,6 +5928,8 @@ create_cursors (GtkWidget *widget)
|
||||
GtkWidget *label;
|
||||
GtkWidget *any;
|
||||
GtkAdjustment *adj;
|
||||
GtkWidget *entry;
|
||||
GtkWidget *size;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@ -5930,10 +5956,33 @@ create_cursors (GtkWidget *widget)
|
||||
"GtkWidget::visible", TRUE,
|
||||
NULL);
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Cursor Theme : ");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), "default");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, TRUE, 0);
|
||||
|
||||
size = gtk_spin_button_new_with_range (1.0, 64.0, 1.0);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (size), 24.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), size, TRUE, TRUE, 0);
|
||||
|
||||
g_signal_connect (entry, "changed",
|
||||
G_CALLBACK (change_cursor_theme), hbox);
|
||||
g_signal_connect (size, "changed",
|
||||
G_CALLBACK (change_cursor_theme), hbox);
|
||||
#endif
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
|
||||
|
||||
label = gtk_label_new ("Cursor Value : ");
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user