diff options
author | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-11-12 15:56:38 -0500 |
---|---|---|
committer | Silenio Quarti <silenio_quarti@ca.ibm.com> | 2012-11-12 15:56:38 -0500 |
commit | 8619e947eac7fa56991129fea0c5b3d12c3121b0 (patch) | |
tree | 12c28f28ed33f38f307755061c8e45fa73ce0530 | |
parent | 2f862f00166fcf6199c86ef2db5918eea6feae6a (diff) | |
download | eclipse.platform.swt-8619e947eac7fa56991129fea0c5b3d12c3121b0.tar.gz eclipse.platform.swt-8619e947eac7fa56991129fea0c5b3d12c3121b0.tar.xz eclipse.platform.swt-8619e947eac7fa56991129fea0c5b3d12c3121b0.zip |
Bug 393727 - [GTK3] Search box in eclipse is clipped on the right
6 files changed, 107 insertions, 9 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 0fe252e604..72813c197e 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 @@ -9584,6 +9584,30 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1editable_1set_1position) } #endif +#ifndef NO__1gtk_1entry_1get_1icon_1area +JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1entry_1get_1icon_1area) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2) +{ + GdkRectangle _arg2, *lparg2=NULL; + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1entry_1get_1icon_1area_FUNC); + if (arg2) if ((lparg2 = getGdkRectangleFields(env, arg2, &_arg2)) == NULL) goto fail; +/* + rc = (jint)gtk_entry_get_icon_area((GtkEntry *)arg0, arg1, lparg2); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_entry_get_icon_area) + if (fp) { + rc = (jint)((jint (CALLING_CONVENTION*)(GtkEntry *, jint, GdkRectangle *))fp)((GtkEntry *)arg0, arg1, lparg2); + } + } +fail: + if (arg2 && lparg2) setGdkRectangleFields(env, arg2, lparg2); + OS_NATIVE_EXIT(env, that, _1gtk_1entry_1get_1icon_1area_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1entry_1get_1inner_1border JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1entry_1get_1inner_1border) (JNIEnv *env, jclass that, jintLong arg0) @@ -14674,6 +14698,28 @@ fail: } #endif +#ifndef NO__1gtk_1style_1context_1get_1border +JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1get_1border) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2) +{ + GtkBorder _arg2, *lparg2=NULL; + OS_NATIVE_ENTER(env, that, _1gtk_1style_1context_1get_1border_FUNC); + if (arg2) if ((lparg2 = getGtkBorderFields(env, arg2, &_arg2)) == NULL) goto fail; +/* + gtk_style_context_get_border(arg0, arg1, lparg2); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_style_context_get_border) + if (fp) { + ((void (CALLING_CONVENTION*)(jintLong, jint, GtkBorder *))fp)(arg0, arg1, lparg2); + } + } +fail: + if (arg2 && lparg2) setGtkBorderFields(env, arg2, lparg2); + OS_NATIVE_EXIT(env, that, _1gtk_1style_1context_1get_1border_FUNC); +} +#endif + #ifndef NO__1gtk_1style_1context_1get_1border_1color JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1get_1border_1color) (JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2) 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 0a9abfafec..d62f902705 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 @@ -518,11 +518,13 @@ #define gtk_style_context_add_class_LIB LIB_GTK #define gtk_style_context_get_border_color_LIB LIB_GTK #define gtk_style_context_get_padding_LIB LIB_GTK +#define gtk_style_context_get_border_LIB LIB_GTK #define gtk_hsv_to_rgb_LIB LIB_GTK #define gtk_rgb_to_hsv_LIB LIB_GTK #define gdk_window_set_background_pattern_LIB LIB_GTK #define gtk_widget_input_shape_combine_region_LIB LIB_GTK #define gtk_entry_set_placeholder_text_LIB LIB_GTK +#define gtk_entry_get_icon_area_LIB LIB_GTK #define gdk_event_get_scroll_deltas_LIB LIB_GTK /* Field accessors */ 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 9d627e2a1f..d87dca885b 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 @@ -714,6 +714,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1editable_1select_1region", "_1gtk_1editable_1set_1editable", "_1gtk_1editable_1set_1position", + "_1gtk_1entry_1get_1icon_1area", "_1gtk_1entry_1get_1inner_1border", "_1gtk_1entry_1get_1invisible_1char", "_1gtk_1entry_1get_1layout", @@ -1049,6 +1050,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1status_1icon_1set_1visible", "_1gtk_1style_1context_1add_1class", "_1gtk_1style_1context_1get_1background_1color", + "_1gtk_1style_1context_1get_1border", "_1gtk_1style_1context_1get_1border_1color", "_1gtk_1style_1context_1get_1color", "_1gtk_1style_1context_1get_1font", 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 a9a6750add..fa0ca99a2c 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 @@ -724,6 +724,7 @@ typedef enum { _1gtk_1editable_1select_1region_FUNC, _1gtk_1editable_1set_1editable_FUNC, _1gtk_1editable_1set_1position_FUNC, + _1gtk_1entry_1get_1icon_1area_FUNC, _1gtk_1entry_1get_1inner_1border_FUNC, _1gtk_1entry_1get_1invisible_1char_FUNC, _1gtk_1entry_1get_1layout_FUNC, @@ -1059,6 +1060,7 @@ typedef enum { _1gtk_1status_1icon_1set_1visible_FUNC, _1gtk_1style_1context_1add_1class_FUNC, _1gtk_1style_1context_1get_1background_1color_FUNC, + _1gtk_1style_1context_1get_1border_FUNC, _1gtk_1style_1context_1get_1border_1color_FUNC, _1gtk_1style_1context_1get_1color_FUNC, _1gtk_1style_1context_1get_1font_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 0c2601f7e2..186b0859db 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 @@ -7080,6 +7080,19 @@ public static final int gtk_entry_text_index_to_layout_index (long /*int*/ entry lock.unlock(); } } +/** + * @method flags=dynamic + * @param entry cast=(GtkEntry *) + */ +public static final native int _gtk_entry_get_icon_area(long /*int*/ entry, int icon_pos, GdkRectangle icon_area); +public static final int gtk_entry_get_icon_area(long /*int*/ entry, int icon_pos, GdkRectangle icon_area) { + lock.lock(); + try { + return _gtk_entry_get_icon_area(entry, icon_pos, icon_area); + } finally { + lock.unlock(); + } +} /** @param entry cast=(GtkEntry *) */ public static final native int _gtk_entry_get_max_length(long /*int*/ entry); public static final int gtk_entry_get_max_length(long /*int*/ entry) { @@ -10725,6 +10738,16 @@ public static final void gtk_style_context_get_padding(long /*int*/ context, int } } /** @method flags=dynamic */ +public static final native void _gtk_style_context_get_border(long /*int*/ context, int state, GtkBorder padding); +public static final void gtk_style_context_get_border(long /*int*/ context, int state, GtkBorder padding) { + lock.lock(); + try { + _gtk_style_context_get_border(context, state, padding); + } finally { + lock.unlock(); + } +} +/** @method flags=dynamic */ public static final native void _gtk_style_context_save(long /*int*/ self); public static final void gtk_style_context_save(long /*int*/ self) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java index 52740f2510..04d8521c61 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java @@ -569,16 +569,39 @@ public Rectangle computeTrim (int x, int y, int width, int height) { Rectangle trim = super.computeTrim (x, y, width, height); int xborder = 0, yborder = 0; if ((style & SWT.SINGLE) != 0) { - if ((style & SWT.BORDER) != 0) { - Point thickness = getThickness (handle); - xborder += thickness.x; - yborder += thickness.y; + if (OS.GTK3) { + GtkBorder tmp = new GtkBorder(); + long /*int*/ context = OS.gtk_widget_get_style_context (handle); + OS.gtk_style_context_get_padding (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + trim.x -= tmp.left; + trim.y -= tmp.top; + trim.width += tmp.left + tmp.right; + trim.height += tmp.top + tmp.bottom; + if ((style & SWT.BORDER) != 0) { + OS.gtk_style_context_get_border (context, OS.GTK_STATE_FLAG_NORMAL, tmp); + trim.x -= tmp.left; + trim.y -= tmp.top; + trim.width += tmp.left + tmp.right; + trim.height += tmp.top + tmp.bottom; + } + GdkRectangle icon_area = new GdkRectangle(); + OS.gtk_entry_get_icon_area(handle, OS.GTK_ENTRY_ICON_PRIMARY, icon_area); + trim.x -= icon_area.width; + trim.width += icon_area.width; + OS.gtk_entry_get_icon_area(handle, OS.GTK_ENTRY_ICON_SECONDARY, icon_area); + trim.width += icon_area.width; + } else { + if ((style & SWT.BORDER) != 0) { + Point thickness = getThickness (handle); + xborder += thickness.x; + yborder += thickness.y; + } + GtkBorder innerBorder = Display.getEntryInnerBorder (handle); + trim.x -= innerBorder.left; + trim.y -= innerBorder.top; + trim.width += innerBorder.left + innerBorder.right; + trim.height += innerBorder.top + innerBorder.bottom; } - GtkBorder innerBorder = Display.getEntryInnerBorder (handle); - trim.x -= innerBorder.left; - trim.y -= innerBorder.top; - trim.width += innerBorder.left + innerBorder.right; - trim.height += innerBorder.top + innerBorder.bottom; } else { int borderWidth = OS.gtk_container_get_border_width (handle); xborder += borderWidth; |