@@ -13,6 +13,7 @@ static GtkWidget *openbox_theme_name;
13
13
static GtkWidget * gtk_theme_name ;
14
14
static GtkWidget * icon_theme_name ;
15
15
static GtkWidget * cursor_theme_name ;
16
+ static GtkWidget * cursor_size ;
16
17
static GtkWidget * natural_scroll ;
17
18
18
19
static struct themes openbox_themes = { 0 };
@@ -69,6 +70,14 @@ environment_set(const char *key, const char *value)
69
70
rename (bufname , filename );
70
71
}
71
72
73
+ static void
74
+ environment_set_num (const char * key , int value ) {
75
+ char buffer [255 ];
76
+ snprintf (buffer , 255 , "%d" , value );
77
+
78
+ environment_set (key , buffer );
79
+ }
80
+
72
81
static void
73
82
set_value (GSettings * settings , const char * key , const char * value )
74
83
{
@@ -79,8 +88,15 @@ set_value(GSettings *settings, const char *key, const char *value)
79
88
g_settings_set_value (settings , key , g_variant_new ("s" , value ));
80
89
}
81
90
91
+ static void
92
+ set_value_num (GSettings * settings , const char * key , int value )
93
+ {
94
+ g_settings_set_value (settings , key , g_variant_new ("i" , value ));
95
+ }
96
+
82
97
#define COMBO_TEXT (w ) gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(w))
83
98
#define SPIN_BUTTON_VAL (w ) gtk_spin_button_get_value(GTK_SPIN_BUTTON(w))
99
+ #define SPIN_BUTTON_VAL_INT (w ) (int)SPIN_BUTTON_VAL(w)
84
100
85
101
static void
86
102
update (GtkWidget * widget , gpointer data )
@@ -93,12 +109,13 @@ update(GtkWidget *widget, gpointer data)
93
109
94
110
/* gsettings */
95
111
set_value (settings , "cursor-theme" , COMBO_TEXT (cursor_theme_name ));
112
+ set_value_num (settings , "cursor-size" , SPIN_BUTTON_VAL_INT (cursor_size ));
96
113
set_value (settings , "gtk-theme" , COMBO_TEXT (gtk_theme_name ));
97
114
set_value (settings , "icon-theme" , COMBO_TEXT (icon_theme_name ));
98
115
99
116
/* ~/.config/labwc/environment */
100
117
environment_set ("XCURSOR_THEME" , COMBO_TEXT (cursor_theme_name ));
101
-
118
+ environment_set_num ( "XCURSOR_SIZE" , SPIN_BUTTON_VAL_INT ( cursor_size ));
102
119
103
120
if (!g_strcmp0 (COMBO_TEXT (openbox_theme_name ), "GTK" )) {
104
121
spawn_sync ("labwc-gtktheme.py" );
@@ -210,6 +227,15 @@ activate(GtkApplication *app, gpointer user_data)
210
227
gtk_combo_box_set_active (GTK_COMBO_BOX (cursor_theme_name ), active );
211
228
gtk_grid_attach (GTK_GRID (grid ),cursor_theme_name , 1 , row ++ , 1 , 1 );
212
229
230
+ /* cursor size spinbutton */
231
+ widget = gtk_label_new ("cursor size" );
232
+ gtk_widget_set_halign (widget , GTK_ALIGN_START );
233
+ gtk_grid_attach (GTK_GRID (grid ), widget , 0 , row , 1 , 1 );
234
+ GtkAdjustment * cursor_adjustment = gtk_adjustment_new (0 , 0 , 512 , 1 , 2 , 0 );
235
+ cursor_size = gtk_spin_button_new (GTK_ADJUSTMENT (cursor_adjustment ), 1 , 0 );
236
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (cursor_size ), g_settings_get_int (settings , "cursor-size" ));
237
+ gtk_grid_attach (GTK_GRID (grid ), cursor_size , 1 , row ++ , 1 , 1 );
238
+
213
239
/* natural scroll combobox */
214
240
widget = gtk_label_new ("natural scroll" );
215
241
gtk_widget_set_halign (widget , GTK_ALIGN_START );
0 commit comments