Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArun Thondapu2016-01-06 09:44:39 -0500
committerArun Thondapu2016-01-06 09:44:39 -0500
commit12badf3289f1dc4ea2839d8c8c42af50fb2f0249 (patch)
treef591d911bf48527d438a8383c37398cfa78f6a51
parenta6809d2829e8dba637cdcebd3962e699b1a152b4 (diff)
downloadeclipse.platform.swt-12badf3289f1dc4ea2839d8c8c42af50fb2f0249.tar.gz
eclipse.platform.swt-12badf3289f1dc4ea2839d8c8c42af50fb2f0249.tar.xz
eclipse.platform.swt-12badf3289f1dc4ea2839d8c8c42af50fb2f0249.zip
Revert "Bug 479998: [GTK3] Form/wizard Composites have incorrect background colors "
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java29
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java10
8 files changed, 6 insertions, 113 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
index 21649e98d3..14c8a5d58f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c
@@ -7341,30 +7341,6 @@ fail:
}
#endif
-#ifndef NO__1gdk_1rgba_1to_1string
-JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1rgba_1to_1string)
- (JNIEnv *env, jclass that, jobject arg0)
-{
- GdkRGBA _arg0, *lparg0=NULL;
- jintLong rc = 0;
- OS_NATIVE_ENTER(env, that, _1gdk_1rgba_1to_1string_FUNC);
- if (arg0) if ((lparg0 = getGdkRGBAFields(env, arg0, &_arg0)) == NULL) goto fail;
-/*
- rc = (jintLong)gdk_rgba_to_string((GdkRGBA *)lparg0);
-*/
- {
- OS_LOAD_FUNCTION(fp, gdk_rgba_to_string)
- if (fp) {
- rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GdkRGBA *))fp)((GdkRGBA *)lparg0);
- }
- }
-fail:
- if (arg0 && lparg0) setGdkRGBAFields(env, arg0, lparg0);
- OS_NATIVE_EXIT(env, that, _1gdk_1rgba_1to_1string_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO__1gdk_1screen_1get_1default
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gdk_1screen_1get_1default)
(JNIEnv *env, jclass that)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
index a3d0c061ee..88015a8a01 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h
@@ -299,7 +299,6 @@
#define gdk_pointer_ungrab_LIB LIB_GDK
#define gdk_region_polygon_LIB LIB_GDK
#define gdk_region_get_rectangles_LIB LIB_GDK
-#define gdk_rgba_to_string_LIB LIB_GDK
#define gdk_screen_get_default_LIB LIB_GDK
#define gdk_screen_get_monitor_at_point_LIB LIB_GDK
#define gdk_screen_get_monitor_at_window_LIB LIB_GDK
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
index 2c786a8608..157145a6c0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c
@@ -554,7 +554,6 @@ char * OS_nativeFunctionNames[] = {
"_1gdk_1region_1subtract",
"_1gdk_1region_1union",
"_1gdk_1region_1union_1with_1rect",
- "_1gdk_1rgba_1to_1string",
"_1gdk_1screen_1get_1default",
"_1gdk_1screen_1get_1monitor_1at_1point",
"_1gdk_1screen_1get_1monitor_1at_1window",
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
index 63d5db4bfb..05432e91b2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h
@@ -564,7 +564,6 @@ typedef enum {
_1gdk_1region_1subtract_FUNC,
_1gdk_1region_1union_FUNC,
_1gdk_1region_1union_1with_1rect_FUNC,
- _1gdk_1rgba_1to_1string_FUNC,
_1gdk_1screen_1get_1default_FUNC,
_1gdk_1screen_1get_1monitor_1at_1point_FUNC,
_1gdk_1screen_1get_1monitor_1at_1window_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
index 80271a431e..63b2274b9c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java
@@ -5447,19 +5447,6 @@ public static final void gdk_region_union_with_rect(long /*int*/ region, GdkRect
lock.unlock();
}
}
-/**
- * @method flags=dynamic
- * @param rgba cast=(GdkRGBA *)
- */
-public static final native long /*int*/ _gdk_rgba_to_string(GdkRGBA rgba);
-public static final long /*int*/ gdk_rgba_to_string(GdkRGBA rgba) {
- lock.lock();
- try {
- return _gdk_rgba_to_string(rgba);
- } finally {
- lock.unlock();
- }
-}
/** @method flags=dynamic */
public static final native long /*int*/ _gdk_screen_get_default();
public static final long /*int*/ gdk_screen_get_default() {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index b42995f4c8..23d8dd009a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -64,7 +64,6 @@ public class Composite extends Scrollable {
Layout layout;
Control[] tabList;
int layoutCount, backgroundMode;
- GdkRGBA background;
static final String NO_INPUT_METHOD = "org.eclipse.swt.internal.gtk.noInputMethod"; //$NON-NLS-1$
@@ -353,16 +352,6 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
}
@Override
-long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- Rectangle area = getClientArea();
- long /*int*/ context = OS.gtk_widget_get_style_context(widget);
- OS.gtk_render_background(context, cairo, area.x, area.y, area.width, area.height);
- }
- return super.gtk_draw(widget, cairo);
-}
-
-@Override
void deregister () {
super.deregister ();
if (socketHandle != 0) display.removeWidget (socketHandle);
@@ -661,23 +650,6 @@ public Rectangle getClientArea () {
return super.getClientArea();
}
-@Override
-GdkColor getContextBackground () {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- if (background != null) {
- GdkColor color = new GdkColor ();
- color.red = (short)(background.red * 0xFFFF);
- color.green = (short)(background.green * 0xFFFF);
- color.blue = (short)(background.blue * 0xFFFF);
- return color;
- } else {
- return display.COLOR_WIDGET_BACKGROUND;
- }
- } else {
- return super.getContextBackground();
- }
-}
-
/**
* Returns layout which is associated with the receiver, or
* null if one has not been set.
@@ -1460,18 +1432,6 @@ public void setBackgroundMode (int mode) {
}
@Override
-void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- background = rgba;
- String color = gtk_rgba_to_css_string(background);
- String css = "SwtFixed {background-color: " + color + "}";
- gtk_css_provider_load_from_css(context, css);
- } else {
- super.setBackgroundColor(context, handle, rgba);
- }
-}
-
-@Override
int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
int result = super.setBounds (x, y, width, height, move, resize);
if ((result & RESIZED) != 0 && layout != null) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index c9719bc4b1..8f5fe71daa 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -4060,30 +4060,13 @@ void gtk_css_provider_load_from_css (long /*int*/ context, String css) {
String gtk_rgba_to_css_string (GdkRGBA rgba) {
/*
- * In GdkRGBA, values are a double between 0-1.
- * In CSS, values are integers between 0-255 for r, g, and b.
- * Alpha is still a double between 0-1.
- * The final CSS format is: rgba(int, int, int, double)
- * Due to this, there is a slight loss of precision.
- * Setting/getting with CSS *might* yield slight differences.
+ * In GdkRGBA, values are a double between 0-1.<br>
+ * In CSS, values are typically integers between 0-255.<br>
+ * I.e, note, there is a slight loss of precision.
+ * Thus setting/getting color *might* return slight differences.
*/
- GdkRGBA toConvert;
- if (rgba != null) {
- toConvert = rgba;
- } else {
- // If we have a null RGBA, set it to the default COLOR_WIDGET_BACKGROUND.
- GdkColor defaultGdkColor = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND).handle;
- toConvert = new GdkRGBA ();
- toConvert.alpha = 1.0;
- toConvert.red = (defaultGdkColor.red & 0xFFFF) / (float)0xFFFF;
- toConvert.green = (defaultGdkColor.green & 0xFFFF) / (float)0xFFFF;
- toConvert.blue = (defaultGdkColor.blue & 0xFFFF) / (float)0xFFFF;
- }
- long /*int*/ str = OS.gdk_rgba_to_string (toConvert);
- int length = OS.strlen (str);
- byte [] buffer = new byte [length];
- OS.memmove (buffer, str, length);
- return new String (Converter.mbcsToWcs (null, buffer));
+ String color = "rgba(" + (int)(rgba.red * 255) + "," + (int)(rgba.green * 255) + "," + (int)(rgba.blue * 255) + "," + (int)(rgba.alpha * 255) + ")";
+ return color;
}
void setBackgroundColor (long /*int*/ handle, GdkColor color) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
index 7ce46cf7c3..42a2b5e604 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolBar.java
@@ -598,16 +598,6 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize
}
@Override
-void setBackgroundColor (long /*int*/ context, long /*int*/ handle, GdkRGBA rgba) {
- if (OS.GTK_VERSION >= OS.VERSION(3, 16, 0)) {
- String css = "GtkToolbar {background-color: " + gtk_rgba_to_css_string(rgba) + "}";
- gtk_css_provider_load_from_css(context, css);
- } else {
- super.setBackgroundColor(context, handle, rgba);
- }
-}
-
-@Override
void setFontDescription (long /*int*/ font) {
super.setFontDescription (font);
ToolItem [] items = getItems ();

Back to the top