@@ -246,6 +246,51 @@ static void panel_toplevel_calculate_animation_end_geometry(PanelToplevel *tople
246
246
static void panel_toplevel_update_monitor (PanelToplevel * toplevel );
247
247
static void panel_toplevel_set_monitor_internal (PanelToplevel * toplevel , int monitor , gboolean force_resize );
248
248
249
+ static void
250
+ update_style_classes (PanelToplevel * toplevel )
251
+ {
252
+ GtkStyleContext * context ;
253
+
254
+ context = gtk_widget_get_style_context (GTK_WIDGET (toplevel ));
255
+
256
+ /*ensure the panel BG can always be themed*/
257
+ /*Without this gtk3.19/20 cannot set the BG color and resetting the bg to system is not immediately applied*/
258
+ gtk_style_context_add_class (context ,"gnome-panel-menu-bar" );
259
+ gtk_style_context_add_class (context ,"mate-panel-menu-bar" );
260
+
261
+ gtk_style_context_remove_class (context , GTK_STYLE_CLASS_HORIZONTAL );
262
+ gtk_style_context_remove_class (context , GTK_STYLE_CLASS_VERTICAL );
263
+ gtk_style_context_remove_class (context , GTK_STYLE_CLASS_RIGHT );
264
+ gtk_style_context_remove_class (context , GTK_STYLE_CLASS_LEFT );
265
+ gtk_style_context_remove_class (context , GTK_STYLE_CLASS_TOP );
266
+ gtk_style_context_remove_class (context , GTK_STYLE_CLASS_BOTTOM );
267
+
268
+ switch (toplevel -> priv -> orientation ) {
269
+ case PANEL_ORIENTATION_TOP :
270
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_HORIZONTAL );
271
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_TOP );
272
+ break ;
273
+
274
+ case PANEL_ORIENTATION_LEFT :
275
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_VERTICAL );
276
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_LEFT );
277
+ break ;
278
+
279
+ case PANEL_ORIENTATION_BOTTOM :
280
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_HORIZONTAL );
281
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_BOTTOM );
282
+ break ;
283
+
284
+ case PANEL_ORIENTATION_RIGHT :
285
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_VERTICAL );
286
+ gtk_style_context_add_class (context , GTK_STYLE_CLASS_RIGHT );
287
+ break ;
288
+
289
+ default :
290
+ g_assert_not_reached ();
291
+ break ;
292
+ }
293
+ }
249
294
250
295
GSList * panel_toplevel_list_toplevels (void )
251
296
{
@@ -4806,12 +4851,7 @@ panel_toplevel_init (PanelToplevel *toplevel)
4806
4851
(PanelBackgroundChangedNotify ) background_changed ,
4807
4852
toplevel );
4808
4853
4809
- /*ensure the panel BG can always be themed*/
4810
- /*Without this gtk3.19/20 cannot set the BG color and resetting the bg to system is not immediately applied*/
4811
- GtkStyleContext * context ;
4812
- context = gtk_widget_get_style_context (GTK_WIDGET (toplevel ));
4813
- gtk_style_context_add_class (context ,"gnome-panel-menu-bar" );
4814
- gtk_style_context_add_class (context ,"mate-panel-menu-bar" );
4854
+ update_style_classes (toplevel );
4815
4855
}
4816
4856
4817
4857
PanelWidget *
@@ -5020,15 +5060,8 @@ panel_toplevel_set_orientation (PanelToplevel *toplevel,
5020
5060
}
5021
5061
5022
5062
toplevel -> priv -> orientation = orientation ;
5063
+ update_style_classes (toplevel );
5023
5064
5024
- GtkStyleContext * context = gtk_widget_get_style_context (GTK_WIDGET (toplevel ));
5025
- if (orientation & PANEL_HORIZONTAL_MASK ) {
5026
- gtk_style_context_add_class (context , GTK_STYLE_CLASS_HORIZONTAL );
5027
- gtk_style_context_remove_class (context , GTK_STYLE_CLASS_VERTICAL );
5028
- } else {
5029
- gtk_style_context_add_class (context , GTK_STYLE_CLASS_VERTICAL );
5030
- gtk_style_context_remove_class (context , GTK_STYLE_CLASS_HORIZONTAL );
5031
- }
5032
5065
gtk_widget_reset_style (GTK_WIDGET (toplevel ));
5033
5066
5034
5067
panel_toplevel_update_hide_buttons (toplevel );
0 commit comments