@@ -1583,17 +1583,29 @@ void updateStyle () {
15831583 if (provider == 0 ) {
15841584 provider = GTK .gtk_css_provider_new ();
15851585 if ((style & SWT .DROP_DOWN ) != 0 ) {
1586- long box = GTK3 .gtk_bin_get_child (handle );
1587- long list = GTK3 .gtk_container_get_children (box );
1588- for (int i = 0 ; i < 2 ; i ++) {
1589- long child = OS .g_list_nth_data (list , i );
1590- long context = GTK .gtk_widget_get_style_context (child );
1591- GTK .gtk_style_context_add_provider (context , provider , GTK .GTK_STYLE_PROVIDER_PRIORITY_APPLICATION );
1586+ if (GTK .GTK4 ) {
1587+ long context = GTK .gtk_widget_get_style_context (boxHandle );
1588+ GTK .gtk_style_context_add_provider (context , provider , GTK .GTK_STYLE_PROVIDER_PRIORITY_APPLICATION );
1589+ context = GTK .gtk_widget_get_style_context (arrowHandle );
1590+ GTK .gtk_style_context_add_provider (context , provider , GTK .GTK_STYLE_PROVIDER_PRIORITY_APPLICATION );
1591+ } else {
1592+ long box = GTK3 .gtk_bin_get_child (handle );
1593+ long list = GTK3 .gtk_container_get_children (box );
1594+ for (int i = 0 ; i < 2 ; i ++) {
1595+ long child = OS .g_list_nth_data (list , i );
1596+ long context = GTK .gtk_widget_get_style_context (child );
1597+ GTK .gtk_style_context_add_provider (context , provider , GTK .GTK_STYLE_PROVIDER_PRIORITY_APPLICATION );
1598+ }
1599+ OS .g_list_free (list );
15921600 }
1593- OS .g_list_free (list );
15941601 } else {
1595- long child = GTK3 .gtk_bin_get_child (handle );
1596- long context = GTK .gtk_widget_get_style_context (child );
1602+ long context ;
1603+ if (GTK .GTK4 ) {
1604+ context = GTK .gtk_widget_get_style_context (handle );
1605+ } else {
1606+ long child = GTK3 .gtk_bin_get_child (handle );
1607+ context = GTK .gtk_widget_get_style_context (child );
1608+ }
15971609 GTK .gtk_style_context_add_provider (context , provider , GTK .GTK_STYLE_PROVIDER_PRIORITY_APPLICATION );
15981610 }
15991611 OS .g_object_unref (provider );
0 commit comments