changeset 13660:23784e697ad8

8225423: GTK L&F: JSplitPane: There is no divider shown Reviewed-by: prr, serb
author psadhukhan
date Fri, 12 Jul 2019 09:27:00 +0530
parents c41a8edbaefa
children 00df83826341
files src/solaris/native/sun/awt/gtk3_interface.c src/solaris/native/sun/awt/gtk3_interface.h
diffstat 2 files changed, 25 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/native/sun/awt/gtk3_interface.c	Sat Aug 03 13:53:19 2019 +0530
+++ b/src/solaris/native/sun/awt/gtk3_interface.c	Fri Jul 12 09:27:00 2019 +0530
@@ -477,8 +477,7 @@
         fp_gtk_fixed_new = dl_symbol("gtk_fixed_new");
         fp_gtk_handle_box_new = dl_symbol("gtk_handle_box_new");
         fp_gtk_image_new = dl_symbol("gtk_image_new");
-        fp_gtk_hpaned_new = dl_symbol("gtk_hpaned_new");
-        fp_gtk_vpaned_new = dl_symbol("gtk_vpaned_new");
+        fp_gtk_paned_new = dl_symbol("gtk_paned_new");
         fp_gtk_scale_new = dl_symbol("gtk_scale_new");
         fp_gtk_hscrollbar_new = dl_symbol("gtk_hscrollbar_new");
         fp_gtk_vscrollbar_new = dl_symbol("gtk_vscrollbar_new");
@@ -1081,7 +1080,7 @@
         case SPLIT_PANE:
             if (init_result = (NULL == gtk3_widgets[_GTK_HPANED_TYPE]))
             {
-                gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_hpaned_new)();
+                gtk3_widgets[_GTK_HPANED_TYPE] = (*fp_gtk_paned_new)(GTK_ORIENTATION_HORIZONTAL);
             }
             result = gtk3_widgets[_GTK_HPANED_TYPE];
             break;
@@ -1314,7 +1313,7 @@
         case VSPLIT_PANE_DIVIDER:
             if (init_result = (NULL == gtk3_widgets[_GTK_VPANED_TYPE]))
             {
-                gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_vpaned_new)();
+                gtk3_widgets[_GTK_VPANED_TYPE] = (*fp_gtk_paned_new)(GTK_ORIENTATION_VERTICAL);
             }
             result = gtk3_widgets[_GTK_VPANED_TYPE];
             break;
@@ -1434,6 +1433,10 @@
             } else if (strcmp(detail, "option") == 0) {
                 path = createWidgetPath (NULL);
                 append_element(path, "radio");
+            } else if (strcmp(detail, "paned") == 0) {
+                path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
+                append_element(path, "paned");
+                append_element(path, "separator");
             } else {
                 path = createWidgetPath (fp_gtk_style_context_get_path (widget_context));
                 append_element(path, detail);
@@ -1832,22 +1835,30 @@
 {
     gtk3_widget = gtk3_get_widget(widget_type);
 
-    GtkStyleContext* context = fp_gtk_widget_get_style_context (gtk3_widget);
-
-    fp_gtk_style_context_save (context);
+    GtkStyleContext* context = get_style(widget_type, detail);
 
     GtkStateFlags flags = get_gtk_flags(state_type);
     fp_gtk_style_context_set_state(context, GTK_STATE_FLAG_PRELIGHT);
 
-    if (detail != 0) {
+    if (detail != 0 && !(strcmp(detail, "paned") == 0)) {
         transform_detail_string(detail, context);
         fp_gtk_style_context_add_class (context, "handlebox_bin");
     }
 
-    fp_gtk_render_handle(context, cr, x, y, width, height);
-    fp_gtk_render_background(context, cr, x, y, width, height);
-
-    fp_gtk_style_context_restore (context);
+    if (!(strcmp(detail, "paned") == 0)) {
+        fp_gtk_render_handle(context, cr, x, y, width, height);
+        fp_gtk_render_background(context, cr, x, y, width, height);
+    } else {
+        if (orientation == GTK_ORIENTATION_VERTICAL) {
+            fp_gtk_render_handle(context, cr, x+width/2, y, 2, height);
+            fp_gtk_render_background(context, cr, x+width/2, y, 2, height);
+        } else {
+            fp_gtk_render_handle(context, cr, x, y+height/2, width, 2);
+            fp_gtk_render_background(context, cr, x, y+height/2, width, 2);
+        }
+    }
+
+    disposeOrRestoreContext(context);
 }
 
 static void gtk3_paint_hline(WidgetType widget_type, GtkStateType state_type,
--- a/src/solaris/native/sun/awt/gtk3_interface.h	Sat Aug 03 13:53:19 2019 +0530
+++ b/src/solaris/native/sun/awt/gtk3_interface.h	Fri Jul 12 09:27:00 2019 +0530
@@ -163,6 +163,7 @@
 typedef void GtkProgressBar;
 typedef void GtkProgress;
 typedef void GtkWidgetPath;
+typedef void GtkPaned;
 
 /* Some real structures */
 typedef struct
@@ -502,8 +503,7 @@
 static GtkWidget* (*fp_gtk_entry_new)();
 static GtkWidget* (*fp_gtk_fixed_new)();
 static GtkWidget* (*fp_gtk_handle_box_new)();
-static GtkWidget* (*fp_gtk_hpaned_new)();
-static GtkWidget* (*fp_gtk_vpaned_new)();
+static GtkWidget* (*fp_gtk_paned_new)(GtkOrientation orientation);
 static GtkWidget* (*fp_gtk_scale_new)(GtkOrientation  orientation,
                                        GtkAdjustment* adjustment);
 static GtkWidget* (*fp_gtk_hscrollbar_new)(GtkAdjustment* adjustment);