Bug 389910 - Substitute GdkColor with GdkRGBA
Summary: Substitute GdkColor with GdkRGBA
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.3 M4   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 340067
  Show dependency tree
 
Reported: 2012-09-19 11:52 EDT by Anatoly Spektor CLA
Modified: 2012-11-16 10:44 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anatoly Spektor CLA 2012-09-19 11:52:44 EDT
GTK+ 3 uses GdkRGBA instead of GdkColor.

GdkColor is widely used through SWT, some classes have number of getter/setter functions that return GdkColor.

What is the expected procedure to substitute GdkColor with GdkRGBA? Should GdkRGBA has its own getter/setter methods ? If yes what is the naming policy of this methods, should this getter/setters be flagged that they are for Gtk+ 3 only ?

As an example of use of GdkColor here are methods from Control.java:

GdkColor getForegroundColor () {
	return getFgColor ();
}

GdkColor getFgColor () {
	int /*long*/ fontHandle = fontHandle ();
	OS.gtk_widget_realize (fontHandle);
	GdkColor color = new GdkColor ();
	OS.gtk_style_get_fg (OS.gtk_widget_get_style (fontHandle), OS.GTK_STATE_NORMAL, color);
	return color;
}

....etc

Implementation of GdkRGBA is needed because it is used by GtkStyleContext that replaces GtkStyle in Gtk3.Without GdkRGBA we cannot substitute this GtkStyle methods:

gtk_style_get_bg_gc
gtk_style_get_black_gc
gtk_style_get_dark_gc
gtk_style_get_fg_gc
gtk_style_get_light_gc
gtk_style_get_mid_gc
gtk_style_get_text_aa_gc
gtk_style_get_text_gc
gtk_style_get_white_gc
gtk_style_render_icon
Comment 1 Silenio Quarti CLA 2012-11-02 10:33:31 EDT
For now, we need to keep our color handle as a GdkColor so that we can run on GTK2, but we have to convert a GdkColor to GdkRGBA and use the new GtkStyleContext API to change colors and fonts on widgets.

This is fixed in the branch below. I will push to master when M3 is done.

http://git.eclipse.org/c/platform/eclipse.platform.swt.git/log/?h=silenio/Bug389910
Comment 2 Silenio Quarti CLA 2012-11-02 16:27:48 EDT
Pushed to master.