Mageia Bugzilla – Attachment 5363 Details for
Bug 13954
Checkboxes/RadioButtons not displaying selected state
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Fixes the issue, as well as progressbar rendering
checkbuttons.patch (text/plain), 7.56 KB, created by
Hugo Pereira Da Costa
on 2014-08-25 10:23:34 CEST
(
hide
)
Description:
Fixes the issue, as well as progressbar rendering
Filename:
MIME Type:
Creator:
Hugo Pereira Da Costa
Created:
2014-08-25 10:23:34 CEST
Size:
7.56 KB
patch
obsolete
>diff --git a/src/oxygenstyleoptions.h b/src/oxygenstyleoptions.h >index 52334df..5d7d7e3 100644 >--- a/src/oxygenstyleoptions.h >+++ b/src/oxygenstyleoptions.h >@@ -78,6 +78,10 @@ namespace Oxygen > if( flags & GTK_STATE_FLAG_SELECTED ) (*this) |= (Selected|Active); > if( flags & GTK_STATE_FLAG_ACTIVE ) (*this) |= Sunken; > >+ #if GTK_CHECK_VERSION( 3, 13, 7 ) >+ if( flags & GTK_STATE_FLAG_CHECKED ) (*this) |= Sunken; >+ #endif >+ > // TODO: check whether one should use this, or gtk_widget_has_focus > if( flags & GTK_STATE_FLAG_FOCUSED ) (*this) |= Focus; > >@@ -91,6 +95,11 @@ namespace Oxygen > if( flags & GTK_STATE_FLAG_PRELIGHT ) (*this) |= Hover; > if( flags & GTK_STATE_FLAG_SELECTED ) (*this) |= (Selected|Active); > if( flags & GTK_STATE_FLAG_ACTIVE ) (*this) |= Sunken; >+ >+ #if GTK_CHECK_VERSION( 3, 13, 7 ) >+ if( flags & GTK_STATE_FLAG_CHECKED ) (*this) |= Sunken; >+ #endif >+ > if( flags & GTK_STATE_FLAG_FOCUSED ) (*this) |= Focus; > else if( GTK_IS_WIDGET( widget ) && gtk_widget_has_focus(widget) ) (*this)|=Focus; > } >diff --git a/src/oxygenthemingengine.cpp b/src/oxygenthemingengine.cpp >index 0e6382e..1a22b1b 100644 >--- a/src/oxygenthemingengine.cpp >+++ b/src/oxygenthemingengine.cpp >@@ -335,7 +335,7 @@ namespace Oxygen > > } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_NOTEBOOK ) ) { > >- // no need to render anything for notebook gradient >+ // no need to render anything for notebook background > > } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_CELL ) ) { > >@@ -514,15 +514,15 @@ namespace Oxygen > > // render background > if( !Gtk::gtk_widget_is_applet( widget ) ) >- { >+ { > #if OXYGEN_DEBUG > int r; > const GtkStateFlags state( gtk_theming_engine_get_state( engine ) ); > gtk_theming_engine_get( engine, state, GTK_STYLE_PROPERTY_BORDER_RADIUS, &r, NULL ); > std::cerr << "Oxygen::ThemingEngine::render_background - radius: " << r << std::endl; >- #endif >- >- Style::instance().renderTitleBarBackground( context, widget, x, y, w, h ); >+ #endif >+ >+ Style::instance().renderTitleBarBackground( context, widget, x, y, w, h ); > } > > render_animated_button( context, widget ); >@@ -546,6 +546,7 @@ namespace Oxygen > } else if( > gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_BUTTON ) || > gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_INFO ) || >+ gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_PROGRESSBAR ) || > gtk_widget_path_is_type( path, GTK_TYPE_INFO_BAR ) || > gtk_widget_path_is_type( path, GTK_TYPE_BUTTON ) ) > { >@@ -701,6 +702,32 @@ namespace Oxygen > } > > >+ #if GTK_CHECK_VERSION( 3, 13, 7 ) >+ } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_PROGRESSBAR ) ) { >+ >+ // lookup widget and state >+ GtkWidget* widget( Style::instance().widgetLookup().find( context, gtk_theming_engine_get_path( engine ) ) ); >+ GtkStateFlags state( gtk_theming_engine_get_state( engine ) ); >+ >+ StyleOptions options( widget, state); >+ if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_VERTICAL ) ) options |= Vertical; >+ >+ if( GTK_IS_PROGRESS_BAR(widget) ) >+ { >+ >+ y+=1; h-=2; >+ x+=1; w-=2; >+ >+ } else if( GTK_IS_ENTRY( widget ) ) { >+ >+ y+=1; h-=2; >+ x+=3; w-=6; >+ >+ } >+ >+ Style::instance().renderProgressBarHandle( context, x, y, w, h, options ); >+ return; >+ #endif > } > > // adjust shadow type for some known widgets >@@ -1867,9 +1894,13 @@ namespace Oxygen > > // shadow type defines checkmark presence and type > GtkShadowType shadow( GTK_SHADOW_OUT ); >- if( state>K_STATE_FLAG_INCONSISTENT ) shadow = GTK_SHADOW_ETCHED_IN; >- else if( state>K_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; >+ if( state & GTK_STATE_FLAG_INCONSISTENT ) shadow = GTK_SHADOW_ETCHED_IN; >+ else if( state & GTK_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; >+ #if GTK_CHECK_VERSION( 3, 13, 7 ) >+ else if( state & GTK_STATE_FLAG_CHECKED ) shadow = GTK_SHADOW_IN; >+ #endif > >+ // render > Style::instance().renderCheckBox( widget, context, x, y, w, h, shadow, options, data ); > > } else { >@@ -1955,7 +1986,12 @@ namespace Oxygen > // shadow type defines checkmark presence and type > GtkShadowType shadow( GTK_SHADOW_OUT ); > if( state>K_STATE_FLAG_INCONSISTENT ) shadow = GTK_SHADOW_ETCHED_IN; >- else if( state>K_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; >+ else if( state & GTK_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; >+ #if GTK_CHECK_VERSION( 3, 13, 7 ) >+ else if( state & GTK_STATE_FLAG_CHECKED ) shadow = GTK_SHADOW_IN; >+ #endif >+ >+ // render > Style::instance().renderRadioButton( widget, context, x, y, w, h, shadow, options, data ); > > } else { >@@ -2480,6 +2516,7 @@ namespace Oxygen > << std::endl; > #endif > >+ #if !GTK_CHECK_VERSION( 3, 13, 7 ) > if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_PROGRESSBAR ) ) > { > >@@ -2504,15 +2541,16 @@ namespace Oxygen > } > > Style::instance().renderProgressBarHandle( context, x, y, w, h, options ); >- >- } else { >- >- #if OXYGEN_DEBUG >- std::cerr << "Oxygen::render_activity - Calling parentClass()->render_activity()\n"; >- #endif >- ThemingEngine::parentClass()->render_activity( engine, context, x, y, w, h ); >+ return; > > } >+ #endif >+ >+ // fallback to parent theme in all other cases >+ #if OXYGEN_DEBUG >+ std::cerr << "Oxygen::render_activity - Calling parentClass()->render_activity()\n"; >+ #endif >+ ThemingEngine::parentClass()->render_activity( engine, context, x, y, w, h ); > > return; > >diff --git a/src/oxygenwindowmanager.cpp b/src/oxygenwindowmanager.cpp >index da5c9e5..d6cf52a 100644 >--- a/src/oxygenwindowmanager.cpp >+++ b/src/oxygenwindowmanager.cpp >@@ -166,6 +166,8 @@ namespace Oxygen > if( GTK_IS_NOTEBOOK( parent ) && Gtk::gtk_notebook_is_tab_label( GTK_NOTEBOOK( parent ), widget ) ) > { return false; } > >+ >+ #if GTK_CHECK_VERSION( 3, 13, 7 ) > /* > check event mask (for now we only need to do that for GtkWindow) > The idea is that if the window has been set to receive button_press and button_release events >@@ -173,9 +175,13 @@ namespace Oxygen > in which case we should not use them for grabbing > */ > if( >+ ( GTK_IS_VIEWPORT( widget ) ) && >+ ( gtk_widget_get_events ( widget ) & ( GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK ) ) ) >+ #else >+ if( > ( GTK_IS_WINDOW( widget ) || GTK_IS_VIEWPORT( widget ) ) && >- ( gtk_widget_get_events ( widget ) & >- ( GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK ) ) ) >+ ( gtk_widget_get_events ( widget ) & ( GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK ) ) ) >+ #endif > { > #if OXYGEN_DEBUG > std::cerr
diff --git a/src/oxygenstyleoptions.h b/src/oxygenstyleoptions.h index 52334df..5d7d7e3 100644 --- a/src/oxygenstyleoptions.h +++ b/src/oxygenstyleoptions.h @@ -78,6 +78,10 @@ namespace Oxygen if( flags & GTK_STATE_FLAG_SELECTED ) (*this) |= (Selected|Active); if( flags & GTK_STATE_FLAG_ACTIVE ) (*this) |= Sunken; + #if GTK_CHECK_VERSION( 3, 13, 7 ) + if( flags & GTK_STATE_FLAG_CHECKED ) (*this) |= Sunken; + #endif + // TODO: check whether one should use this, or gtk_widget_has_focus if( flags & GTK_STATE_FLAG_FOCUSED ) (*this) |= Focus; @@ -91,6 +95,11 @@ namespace Oxygen if( flags & GTK_STATE_FLAG_PRELIGHT ) (*this) |= Hover; if( flags & GTK_STATE_FLAG_SELECTED ) (*this) |= (Selected|Active); if( flags & GTK_STATE_FLAG_ACTIVE ) (*this) |= Sunken; + + #if GTK_CHECK_VERSION( 3, 13, 7 ) + if( flags & GTK_STATE_FLAG_CHECKED ) (*this) |= Sunken; + #endif + if( flags & GTK_STATE_FLAG_FOCUSED ) (*this) |= Focus; else if( GTK_IS_WIDGET( widget ) && gtk_widget_has_focus(widget) ) (*this)|=Focus; } diff --git a/src/oxygenthemingengine.cpp b/src/oxygenthemingengine.cpp index 0e6382e..1a22b1b 100644 --- a/src/oxygenthemingengine.cpp +++ b/src/oxygenthemingengine.cpp @@ -335,7 +335,7 @@ namespace Oxygen } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_NOTEBOOK ) ) { - // no need to render anything for notebook gradient + // no need to render anything for notebook background } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_CELL ) ) { @@ -514,15 +514,15 @@ namespace Oxygen // render background if( !Gtk::gtk_widget_is_applet( widget ) ) - { + { #if OXYGEN_DEBUG int r; const GtkStateFlags state( gtk_theming_engine_get_state( engine ) ); gtk_theming_engine_get( engine, state, GTK_STYLE_PROPERTY_BORDER_RADIUS, &r, NULL ); std::cerr << "Oxygen::ThemingEngine::render_background - radius: " << r << std::endl; - #endif - - Style::instance().renderTitleBarBackground( context, widget, x, y, w, h ); + #endif + + Style::instance().renderTitleBarBackground( context, widget, x, y, w, h ); } render_animated_button( context, widget ); @@ -546,6 +546,7 @@ namespace Oxygen } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_BUTTON ) || gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_INFO ) || + gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_PROGRESSBAR ) || gtk_widget_path_is_type( path, GTK_TYPE_INFO_BAR ) || gtk_widget_path_is_type( path, GTK_TYPE_BUTTON ) ) { @@ -701,6 +702,32 @@ namespace Oxygen } + #if GTK_CHECK_VERSION( 3, 13, 7 ) + } else if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_PROGRESSBAR ) ) { + + // lookup widget and state + GtkWidget* widget( Style::instance().widgetLookup().find( context, gtk_theming_engine_get_path( engine ) ) ); + GtkStateFlags state( gtk_theming_engine_get_state( engine ) ); + + StyleOptions options( widget, state); + if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_VERTICAL ) ) options |= Vertical; + + if( GTK_IS_PROGRESS_BAR(widget) ) + { + + y+=1; h-=2; + x+=1; w-=2; + + } else if( GTK_IS_ENTRY( widget ) ) { + + y+=1; h-=2; + x+=3; w-=6; + + } + + Style::instance().renderProgressBarHandle( context, x, y, w, h, options ); + return; + #endif } // adjust shadow type for some known widgets @@ -1867,9 +1894,13 @@ namespace Oxygen // shadow type defines checkmark presence and type GtkShadowType shadow( GTK_SHADOW_OUT ); - if( state>K_STATE_FLAG_INCONSISTENT ) shadow = GTK_SHADOW_ETCHED_IN; - else if( state>K_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; + if( state & GTK_STATE_FLAG_INCONSISTENT ) shadow = GTK_SHADOW_ETCHED_IN; + else if( state & GTK_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; + #if GTK_CHECK_VERSION( 3, 13, 7 ) + else if( state & GTK_STATE_FLAG_CHECKED ) shadow = GTK_SHADOW_IN; + #endif + // render Style::instance().renderCheckBox( widget, context, x, y, w, h, shadow, options, data ); } else { @@ -1955,7 +1986,12 @@ namespace Oxygen // shadow type defines checkmark presence and type GtkShadowType shadow( GTK_SHADOW_OUT ); if( state>K_STATE_FLAG_INCONSISTENT ) shadow = GTK_SHADOW_ETCHED_IN; - else if( state>K_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; + else if( state & GTK_STATE_FLAG_ACTIVE ) shadow = GTK_SHADOW_IN; + #if GTK_CHECK_VERSION( 3, 13, 7 ) + else if( state & GTK_STATE_FLAG_CHECKED ) shadow = GTK_SHADOW_IN; + #endif + + // render Style::instance().renderRadioButton( widget, context, x, y, w, h, shadow, options, data ); } else { @@ -2480,6 +2516,7 @@ namespace Oxygen << std::endl; #endif + #if !GTK_CHECK_VERSION( 3, 13, 7 ) if( gtk_theming_engine_has_class( engine, GTK_STYLE_CLASS_PROGRESSBAR ) ) { @@ -2504,15 +2541,16 @@ namespace Oxygen } Style::instance().renderProgressBarHandle( context, x, y, w, h, options ); - - } else { - - #if OXYGEN_DEBUG - std::cerr << "Oxygen::render_activity - Calling parentClass()->render_activity()\n"; - #endif - ThemingEngine::parentClass()->render_activity( engine, context, x, y, w, h ); + return; } + #endif + + // fallback to parent theme in all other cases + #if OXYGEN_DEBUG + std::cerr << "Oxygen::render_activity - Calling parentClass()->render_activity()\n"; + #endif + ThemingEngine::parentClass()->render_activity( engine, context, x, y, w, h ); return; diff --git a/src/oxygenwindowmanager.cpp b/src/oxygenwindowmanager.cpp index da5c9e5..d6cf52a 100644 --- a/src/oxygenwindowmanager.cpp +++ b/src/oxygenwindowmanager.cpp @@ -166,6 +166,8 @@ namespace Oxygen if( GTK_IS_NOTEBOOK( parent ) && Gtk::gtk_notebook_is_tab_label( GTK_NOTEBOOK( parent ), widget ) ) { return false; } + + #if GTK_CHECK_VERSION( 3, 13, 7 ) /* check event mask (for now we only need to do that for GtkWindow) The idea is that if the window has been set to receive button_press and button_release events @@ -173,9 +175,13 @@ namespace Oxygen in which case we should not use them for grabbing */ if( + ( GTK_IS_VIEWPORT( widget ) ) && + ( gtk_widget_get_events ( widget ) & ( GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK ) ) ) + #else + if( ( GTK_IS_WINDOW( widget ) || GTK_IS_VIEWPORT( widget ) ) && - ( gtk_widget_get_events ( widget ) & - ( GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK ) ) ) + ( gtk_widget_get_events ( widget ) & ( GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK ) ) ) + #endif { #if OXYGEN_DEBUG std::cerr
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 13954
:
5351
| 5363