diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2013-03-27 13:16:00 -0400 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2013-03-27 13:16:17 -0400 |
commit | d8e12db9b88dc96dbe41cc1c8e60f7059a2e208b (patch) | |
tree | 8eb0693e658b2a194512469b060467b6944130d8 | |
parent | 3c3c7c9089849de4c9934fd5a64c3bef20239c69 (diff) | |
download | eclipse.platform.swt-d8e12db9b88dc96dbe41cc1c8e60f7059a2e208b.tar.gz eclipse.platform.swt-d8e12db9b88dc96dbe41cc1c8e60f7059a2e208b.tar.xz eclipse.platform.swt-d8e12db9b88dc96dbe41cc1c8e60f7059a2e208b.zip |
Bug 398748 - [GTK3] Text in Javadoc hover unreadable on Ubuntu 12.04
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java index 576ac5d557..f41ab74207 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java @@ -2279,6 +2279,29 @@ GdkColor toGdkColor (GdkRGBA rgba, double m) { return gdkColor; } +void getBackgroundColor (long /*int*/ context, int state, GdkRGBA rgba) { + /* + * Draw the context background to an offset screen surface and get the color + * in the middle of the surface. + */ + OS.gtk_style_context_save (context); + OS.gtk_style_context_set_state (context, state); + long /*int*/ surface = Cairo.cairo_image_surface_create (Cairo.CAIRO_FORMAT_RGB24, 1, 1); + long /*int*/ cairo = Cairo.cairo_create (surface); + OS.gtk_render_background (context, cairo, -50, -50, 100, 100); + Cairo.cairo_fill (cairo); + Cairo.cairo_surface_flush (surface); + byte[] buffer = new byte[3]; + OS.memmove (buffer, Cairo.cairo_image_surface_get_data(surface), buffer.length); + rgba.red = buffer[2] / 255f; + rgba.green = buffer[1] / 255f; + rgba.blue = buffer[0] / 255f; + rgba.alpha = 1; + Cairo.cairo_surface_destroy (surface); + Cairo.cairo_destroy (cairo); + OS.gtk_style_context_restore (context); +} + void initializeSystemColors () { long /*int*/ tooltipShellHandle = OS.gtk_window_new (OS.GTK_WINDOW_POPUP); if (tooltipShellHandle == 0) error (SWT.ERROR_NO_HANDLES); @@ -2309,7 +2332,7 @@ void initializeSystemColors () { GdkRGBA rgba = new GdkRGBA(); OS.gtk_style_context_get_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); COLOR_INFO_FOREGROUND = toGdkColor (rgba); - OS.gtk_style_context_get_background_color (context, OS.GTK_STATE_FLAG_NORMAL, rgba); + getBackgroundColor (context, OS.GTK_STATE_FLAG_NORMAL, rgba); COLOR_INFO_BACKGROUND = toGdkColor (rgba); OS.gtk_widget_destroy (tooltipShellHandle); |