add support for Xcursors.
Fri Aug 1 13:06:04 2003 Jonathan Blandford <jrb@redhat.com> * gnome-mouse-properties.c (create_dialog): add support for Xcursors.
This commit is contained in:
parent
2e32bbe920
commit
22e9266f78
4 changed files with 197 additions and 31 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Aug 1 13:06:04 2003 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gnome-mouse-properties.c (create_dialog): add support for
|
||||
Xcursors.
|
||||
|
||||
Thu Jul 24 16:14:33 2003 Jonathan Blandford <jrb@redhat.com>
|
||||
|
||||
* gnome-mouse-properties.c (setup_dialog): remove the float_to_int
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <config.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <gnome.h>
|
||||
|
@ -98,10 +96,17 @@ enum
|
|||
* define the macro */
|
||||
|
||||
#define DOUBLE_CLICK_KEY "/desktop/gnome/peripherals/mouse/double_click"
|
||||
#define CURSOR_FONT_KEY "/desktop/gnome/peripherals/mouse/cursor_font"
|
||||
#define CURSOR_FONT_KEY "/desktop/gnome/peripherals/mouse/cursor_font"
|
||||
#define CURSOR_SIZE_KEY "/desktop/gnome/peripherals/mouse/cursor_size"
|
||||
|
||||
GConfClient *client;
|
||||
|
||||
#ifdef HAVE_XCURSOR
|
||||
static gboolean server_supports_xcursor = TRUE;
|
||||
#else
|
||||
static gboolean server_supports_xcursor = FALSE;
|
||||
#endif
|
||||
|
||||
/* State in testing the double-click speed. Global for a great deal of
|
||||
* convenience
|
||||
*/
|
||||
|
@ -237,6 +242,60 @@ drag_threshold_from_gconf (GConfPropertyEditor *peditor,
|
|||
return new_value;
|
||||
}
|
||||
|
||||
static GConfValue *
|
||||
cursor_size_to_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *new_value;
|
||||
gint widget_val;
|
||||
|
||||
widget_val = gconf_value_get_int (value);
|
||||
|
||||
new_value = gconf_value_new (GCONF_VALUE_INT);
|
||||
switch (widget_val) {
|
||||
case 12:
|
||||
gconf_value_set_int (new_value, 0);
|
||||
break;
|
||||
case 24:
|
||||
gconf_value_set_int (new_value, 1);
|
||||
break;
|
||||
case 36:
|
||||
gconf_value_set_int (new_value, 2);
|
||||
break;
|
||||
default:
|
||||
gconf_value_set_int (new_value, -1);
|
||||
break;
|
||||
}
|
||||
|
||||
return new_value;
|
||||
}
|
||||
|
||||
static GConfValue *
|
||||
cursor_size_from_widget (GConfPropertyEditor *peditor, const GConfValue *value)
|
||||
{
|
||||
GConfValue *new_value;
|
||||
gint radio_val;
|
||||
|
||||
radio_val = gconf_value_get_int (value);
|
||||
|
||||
new_value = gconf_value_new (GCONF_VALUE_INT);
|
||||
switch (radio_val) {
|
||||
case 0:
|
||||
gconf_value_set_int (new_value, 12);
|
||||
break;
|
||||
case 1:
|
||||
gconf_value_set_int (new_value, 24);
|
||||
break;
|
||||
case 2:
|
||||
gconf_value_set_int (new_value, 36);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
return new_value;
|
||||
}
|
||||
|
||||
/* Retrieve legacy settings */
|
||||
|
||||
static void
|
||||
|
@ -514,6 +573,9 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
tree_view = WID ("cursor_tree");
|
||||
cursor_font = read_cursor_font ();
|
||||
|
||||
|
||||
|
||||
|
||||
model = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
|
||||
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), model);
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
|
@ -619,7 +681,16 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
|
||||
gconf_peditor_new_boolean
|
||||
(changeset, "/desktop/gnome/peripherals/mouse/locate_pointer", WID ("locate_pointer_toggle"), NULL);
|
||||
/* Motion page */
|
||||
|
||||
gconf_peditor_new_select_radio (changeset,
|
||||
CURSOR_SIZE_KEY,
|
||||
gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("cursor_size_small_radio"))),
|
||||
"conv-to-widget-cb", cursor_size_to_widget,
|
||||
"conv-from-widget-cb", cursor_size_from_widget,
|
||||
NULL);
|
||||
|
||||
|
||||
/* Motion page */
|
||||
/* speed */
|
||||
gconf_peditor_new_numeric_range
|
||||
(changeset, DOUBLE_CLICK_KEY, WID ("delay_scale"),
|
||||
|
@ -659,16 +730,35 @@ setup_dialog (GladeXML *dialog, GConfChangeSet *changeset)
|
|||
static GladeXML *
|
||||
create_dialog (void)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GladeXML *dialog;
|
||||
GtkSizeGroup *size_group;
|
||||
gchar *text;
|
||||
|
||||
/* register the custom type */
|
||||
(void) mouse_capplet_check_button_get_type ();
|
||||
|
||||
dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/gnome-mouse-properties.glade", "mouse_properties_dialog", NULL);
|
||||
widget = glade_xml_get_widget (dialog, "prefs_widget");
|
||||
|
||||
if (server_supports_xcursor) {
|
||||
gtk_widget_hide (WID ("cursor_font_vbox"));
|
||||
gtk_widget_show (WID ("cursor_size_vbox"));
|
||||
text = g_strdup_printf ("<b>%s</b>", _("Cursor Size"));
|
||||
gtk_label_set_markup (GTK_LABEL (WID ("cursor_category_label")), text);
|
||||
g_free (text);
|
||||
gtk_box_set_child_packing (GTK_BOX (WID ("cursors_vbox")),
|
||||
WID ("cursor_appearance_vbox"),
|
||||
FALSE, TRUE, 0, GTK_PACK_START);
|
||||
} else {
|
||||
gtk_widget_hide (WID ("cursor_size_vbox"));
|
||||
gtk_widget_show (WID ("cursor_font_vbox"));
|
||||
text = g_strdup_printf ("<b>%s</b>", _("Cursor Theme"));
|
||||
gtk_label_set_markup (GTK_LABEL (WID ("cursor_category_label")), text);
|
||||
g_free (text);
|
||||
gtk_box_set_child_packing (GTK_BOX (WID ("cursors_vbox")),
|
||||
WID ("cursor_appearance_vbox"),
|
||||
TRUE, TRUE, 0, GTK_PACK_START);
|
||||
}
|
||||
|
||||
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
gtk_size_group_add_widget (size_group, WID ("acceleration_label"));
|
||||
gtk_size_group_add_widget (size_group, WID ("sensitivity_label"));
|
||||
|
@ -744,7 +834,7 @@ main (int argc, char **argv)
|
|||
G_CALLBACK (dialog_response_cb), changeset);
|
||||
|
||||
capplet_set_icon (dialog_win, "mouse-capplet.png");
|
||||
gtk_widget_show_all (dialog_win);
|
||||
gtk_widget_show (dialog_win);
|
||||
|
||||
gtk_main ();
|
||||
}
|
||||
|
|
|
@ -461,15 +461,15 @@
|
|||
<property name="spacing">18</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox10">
|
||||
<widget class="GtkVBox" id="cursor_appearance_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="theme_category_label">
|
||||
<widget class="GtkLabel" id="cursor_category_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Cursor Theme</b></property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
|
@ -521,19 +521,66 @@
|
|||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label17">
|
||||
<widget class="GtkVBox" id="cursor_size_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Cursor _themes:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">cursor_tree</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="cursor_size_small_radio">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Small</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="cursor_size_medium_radio">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Medium</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">cursor_size_small_radio</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="cursor_size_large_radio">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Large</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">cursor_size_small_radio</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -543,14 +590,27 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="cursor_tree">
|
||||
<property name="width_request">350</property>
|
||||
<widget class="GtkVBox" id="cursor_font_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">True</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="cursor_tree">
|
||||
<property name="width_request">350</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
|
@ -602,7 +662,7 @@
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox11">
|
||||
<widget class="GtkVBox" id="cursor_locate_pointer_vbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
|
11
configure.in
11
configure.in
|
@ -110,6 +110,17 @@ GNOME_SETTINGS_DAEMON_LIBS="$GNOME_SETTINGS_DAEMON_LIBS $x_libs"
|
|||
|
||||
AC_PATH_PROG(GCONFTOOL, gconftool-2)
|
||||
|
||||
dnl
|
||||
dnl Check for XCursor support. If it exists, then we compile the
|
||||
dnl mouse capplet with support for it turned on
|
||||
dnl
|
||||
have_xcursor=no
|
||||
AC_CHECK_HEADER(X11/Xcursor/Xcursor.h, have_xcursor=yes
|
||||
AC_DEFINE(HAVE_XCURSOR, 1, Have the Xcursor extension),
|
||||
:, [#include <X11/Xlib.h>])
|
||||
AM_CONDITIONAL(HAVE_XCURSOR, [test $have_xcursor=yes])
|
||||
|
||||
|
||||
dnl
|
||||
dnl Check for gtk+ with multihead support
|
||||
dnl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue