Changeset 58:a5c274fa5af9
- Timestamp:
- 01/12/08 01:02:08
(9 months ago)
- Author:
- Frank Benoit <benoit@tionex.de>
- branch:
- default
- Message:
extended helloworld crashing
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r55 |
r58 |
|
| 3 | 3 | |
|---|
| 4 | 4 | [helloworld.d] |
|---|
| | 5 | |
|---|
| 5 | 6 | buildflags+=-L-lgtk-x11-2.0 |
|---|
| 6 | 7 | buildflags+=-L-lgdk-x11-2.0 |
|---|
| … | … | |
| 29 | 30 | buildflags+=-L-lcairo |
|---|
| 30 | 31 | buildflags+=-I/home/frank/jive |
|---|
| 31 | | buildflags+=-g -gc |
|---|
| | 32 | #buildflags+=-g -gc |
|---|
| 32 | 33 | |
|---|
| 33 | 34 | |
|---|
| | 35 | |
|---|
| | 36 | [structs.d] |
|---|
| r55 |
r58 |
|
| 3432 | 3432 | public static char[] getMessage(char[] key) { |
|---|
| 3433 | 3433 | // PORTING_FIXME: Implement |
|---|
| 3434 | | return null; |
|---|
| | 3434 | return "msg not found"; |
|---|
| 3435 | 3435 | //return Compatibility.getMessage(key); |
|---|
| 3436 | 3436 | } |
|---|
| r55 |
r58 |
|
| 142 | 142 | } |
|---|
| 143 | 143 | |
|---|
| 144 | | public Point computeSize (int wHint, int hHint, bool changed) { |
|---|
| | 144 | override public Point computeSize (int wHint, int hHint, bool changed) { |
|---|
| 145 | 145 | checkWidget (); |
|---|
| 146 | 146 | if (wHint !is SWT.DEFAULT && wHint < 0) wHint = 0; |
|---|
| … | … | |
| 164 | 164 | if (wHint !is SWT.DEFAULT || hHint !is SWT.DEFAULT) { |
|---|
| 165 | 165 | if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_CAN_DEFAULT) !is 0) { |
|---|
| 166 | | GtkBorder* border = new GtkBorder (); |
|---|
| | 166 | GtkBorder border; |
|---|
| 167 | 167 | GtkBorder* buffer; |
|---|
| 168 | 168 | OS.gtk_widget_style_get1 (handle, OS.default_border.ptr, cast(int*)&buffer ); |
|---|
| 169 | 169 | if (buffer !is null) { |
|---|
| 170 | | border = buffer; |
|---|
| | 170 | border = *buffer; |
|---|
| 171 | 171 | } else { |
|---|
| 172 | 172 | /* Use the GTK+ default value of 1 for each. */ |
|---|
| … | … | |
| 180 | 180 | } |
|---|
| 181 | 181 | |
|---|
| 182 | | void createHandle (int index) { |
|---|
| | 182 | override void createHandle (int index) { |
|---|
| 183 | 183 | state |= HANDLE; |
|---|
| 184 | 184 | if ((style & SWT.PUSH) is 0) state |= THEME_BACKGROUND; |
|---|
| … | … | |
| 248 | 248 | OS.gtk_container_add (cast(GtkContainer*)fixedHandle, handle); |
|---|
| 249 | 249 | |
|---|
| 250 | | if ((style & SWT.ARROW) !is 0) return; |
|---|
| | 250 | if ((style & SWT.ARROW) !is 0) return; |
|---|
| 251 | 251 | _setAlignment (style & (SWT.LEFT | SWT.CENTER | SWT.RIGHT)); |
|---|
| 252 | 252 | } |
|---|
| 253 | 253 | |
|---|
| 254 | | void createWidget (int index) { |
|---|
| | 254 | override void createWidget (int index) { |
|---|
| 255 | 255 | super.createWidget (index); |
|---|
| 256 | 256 | text = ""; |
|---|
| 257 | 257 | } |
|---|
| 258 | 258 | |
|---|
| 259 | | void deregister () { |
|---|
| | 259 | override void deregister () { |
|---|
| 260 | 260 | super.deregister (); |
|---|
| 261 | 261 | if (boxHandle !is null) display.removeWidget (boxHandle); |
|---|
| … | … | |
| 317 | 317 | } |
|---|
| 318 | 318 | |
|---|
| 319 | | char[] getNameText () { |
|---|
| | 319 | override char[] getNameText () { |
|---|
| 320 | 320 | return getText (); |
|---|
| 321 | 321 | } |
|---|
| … | … | |
| 411 | 411 | } |
|---|
| 412 | 412 | |
|---|
| 413 | | void hookEvents () { |
|---|
| | 413 | override void hookEvents () { |
|---|
| 414 | 414 | super.hookEvents(); |
|---|
| 415 | 415 | OS.g_signal_connect_closure (handle, OS.clicked.ptr, display.closures [CLICKED], false); |
|---|
| … | … | |
| 419 | 419 | } |
|---|
| 420 | 420 | |
|---|
| 421 | | bool isDescribedByLabel () { |
|---|
| | 421 | override bool isDescribedByLabel () { |
|---|
| 422 | 422 | return false; |
|---|
| 423 | 423 | } |
|---|
| 424 | 424 | |
|---|
| 425 | 425 | alias Control.mnemonicHit mnemonicHit; |
|---|
| 426 | | bool mnemonicHit (char key) { |
|---|
| | 426 | override bool mnemonicHit (char key) { |
|---|
| 427 | 427 | if (labelHandle is null) return false; |
|---|
| 428 | 428 | bool result = super.mnemonicHit (labelHandle, key); |
|---|
| … | … | |
| 432 | 432 | |
|---|
| 433 | 433 | alias Control.mnemonicMatch mnemonicMatch; |
|---|
| 434 | | bool mnemonicMatch (char key) { |
|---|
| | 434 | override bool mnemonicMatch (char key) { |
|---|
| 435 | 435 | if (labelHandle is null) return false; |
|---|
| 436 | 436 | return mnemonicMatch (labelHandle, key); |
|---|
| 437 | 437 | } |
|---|
| 438 | 438 | |
|---|
| 439 | | void register () { |
|---|
| | 439 | override void register () { |
|---|
| 440 | 440 | super.register (); |
|---|
| 441 | 441 | if (boxHandle !is null) display.addWidget (boxHandle, this); |
|---|
| … | … | |
| 445 | 445 | } |
|---|
| 446 | 446 | |
|---|
| 447 | | void releaseHandle () { |
|---|
| | 447 | override void releaseHandle () { |
|---|
| 448 | 448 | super.releaseHandle (); |
|---|
| 449 | 449 | boxHandle = imageHandle = labelHandle = arrowHandle = null; |
|---|
| 450 | 450 | } |
|---|
| 451 | 451 | |
|---|
| 452 | | void releaseWidget () { |
|---|
| | 452 | override void releaseWidget () { |
|---|
| 453 | 453 | super.releaseWidget (); |
|---|
| 454 | 454 | if (groupHandle !is null) OS.g_object_unref (groupHandle); |
|---|
| … | … | |
| 485 | 485 | } |
|---|
| 486 | 486 | |
|---|
| 487 | | void resizeHandle (int width, int height) { |
|---|
| | 487 | override void resizeHandle (int width, int height) { |
|---|
| 488 | 488 | super.resizeHandle (width, height); |
|---|
| 489 | 489 | /* |
|---|
| … | … | |
| 613 | 613 | } |
|---|
| 614 | 614 | |
|---|
| 615 | | void setFontDescription (PangoFontDescription* font) { |
|---|
| | 615 | override void setFontDescription (PangoFontDescription* font) { |
|---|
| 616 | 616 | super.setFontDescription (font); |
|---|
| 617 | 617 | if (labelHandle !is null) OS.gtk_widget_modify_font (labelHandle, font); |
|---|
| … | … | |
| 619 | 619 | } |
|---|
| 620 | 620 | |
|---|
| 621 | | bool setRadioSelection (bool value) { |
|---|
| | 621 | override bool setRadioSelection (bool value) { |
|---|
| 622 | 622 | if ((style & SWT.RADIO) is 0) return false; |
|---|
| 623 | 623 | if (getSelection () !is value) { |
|---|
| … | … | |
| 677 | 677 | } |
|---|
| 678 | 678 | |
|---|
| 679 | | void setOrientation () { |
|---|
| | 679 | override void setOrientation () { |
|---|
| 680 | 680 | super.setOrientation (); |
|---|
| 681 | 681 | if ((style & SWT.RIGHT_TO_LEFT) !is 0) { |
|---|
| … | … | |
| 760 | 760 | } |
|---|
| 761 | 761 | |
|---|
| 762 | | void showWidget () { |
|---|
| | 762 | override void showWidget () { |
|---|
| 763 | 763 | super.showWidget (); |
|---|
| 764 | 764 | if (boxHandle !is null) OS.gtk_widget_show (boxHandle); |
|---|
| r37 |
r58 |
|
| 128 | 128 | } |
|---|
| 129 | 129 | |
|---|
| 130 | | Point getIMCaretPos () { |
|---|
| | 130 | override Point getIMCaretPos () { |
|---|
| 131 | 131 | if (caret is null) return super.getIMCaretPos (); |
|---|
| 132 | 132 | return new Point (caret.x, caret.y); |
|---|
| … | … | |
| 154 | 154 | } |
|---|
| 155 | 155 | |
|---|
| 156 | | void redrawWidget (int x, int y, int width, int height, bool redrawAll, bool all, bool trim) { |
|---|
| | 156 | override void redrawWidget (int x, int y, int width, int height, bool redrawAll, bool all, bool trim) { |
|---|
| 157 | 157 | bool isFocus = caret !is null && caret.isFocusCaret (); |
|---|
| 158 | 158 | if (isFocus) caret.killFocus (); |
|---|
| … | … | |
| 161 | 161 | } |
|---|
| 162 | 162 | |
|---|
| 163 | | void releaseChildren (bool destroy) { |
|---|
| | 163 | override void releaseChildren (bool destroy) { |
|---|
| 164 | 164 | if (caret !is null) { |
|---|
| 165 | 165 | caret.release (false); |
|---|
| … | … | |
| 277 | 277 | } |
|---|
| 278 | 278 | |
|---|
| 279 | | int setBounds (int x, int y, int width, int height, bool move, bool resize) { |
|---|
| | 279 | override int setBounds (int x, int y, int width, int height, bool move, bool resize) { |
|---|
| 280 | 280 | bool isFocus = caret !is null && caret.isFocusCaret (); |
|---|
| 281 | 281 | if (isFocus) caret.killFocus (); |
|---|
| … | … | |
| 319 | 319 | } |
|---|
| 320 | 320 | |
|---|
| 321 | | public void setFont (Font font) { |
|---|
| | 321 | override public void setFont (Font font) { |
|---|
| 322 | 322 | checkWidget(); |
|---|
| 323 | 323 | if (caret !is null) caret.setFont (font); |
|---|
| r55 |
r58 |
|
| 29 | 29 | import dwt.internal.gtk.OS; |
|---|
| 30 | 30 | import dwt.graphics.Rectangle; |
|---|
| | 31 | |
|---|
| | 32 | import tango.io.Stdout; |
|---|
| 31 | 33 | |
|---|
| 32 | 34 | /** |
|---|
| … | … | |
| 199 | 201 | } |
|---|
| 200 | 202 | |
|---|
| 201 | | void checkBuffered () { |
|---|
| | 203 | override void checkBuffered () { |
|---|
| 202 | 204 | if ((style & SWT.DOUBLE_BUFFERED) is 0 && (style & SWT.NO_BACKGROUND) !is 0) { |
|---|
| 203 | 205 | return; |
|---|
| … | … | |
| 206 | 208 | } |
|---|
| 207 | 209 | |
|---|
| 208 | | protected void checkSubclass () { |
|---|
| | 210 | override protected void checkSubclass () { |
|---|
| 209 | 211 | /* Do nothing - Subclassing is allowed */ |
|---|
| 210 | 212 | } |
|---|
| 211 | 213 | |
|---|
| 212 | | GtkStyle* childStyle () { |
|---|
| | 214 | override GtkStyle* childStyle () { |
|---|
| 213 | 215 | if (scrolledHandle !is null) return null; |
|---|
| 214 | 216 | return super.childStyle (); |
|---|
| 215 | 217 | } |
|---|
| 216 | 218 | |
|---|
| 217 | | public Point computeSize (int wHint, int hHint, bool changed) { |
|---|
| | 219 | override public Point computeSize (int wHint, int hHint, bool changed) { |
|---|
| 218 | 220 | checkWidget (); |
|---|
| 219 | 221 | if (wHint !is SWT.DEFAULT && wHint < 0) wHint = 0; |
|---|
| … | … | |
| 239 | 241 | } |
|---|
| 240 | 242 | |
|---|
| 241 | | Control [] computeTabList () { |
|---|
| | 243 | override Control [] computeTabList () { |
|---|
| 242 | 244 | Control result [] = super.computeTabList (); |
|---|
| 243 | 245 | if (result.length is 0) return result; |
|---|
| … | … | |
| 256 | 258 | } |
|---|
| 257 | 259 | |
|---|
| 258 | | void createHandle (int index) { |
|---|
| | 260 | override void createHandle (int index) { |
|---|
| 259 | 261 | state |= HANDLE | CANVAS; |
|---|
| 260 | 262 | bool scrolled = (style & (SWT.H_SCROLL | SWT.V_SCROLL)) !is 0; |
|---|
| … | … | |
| 331 | 333 | } |
|---|
| 332 | 334 | |
|---|
| 333 | | void deregister () { |
|---|
| | 335 | override void deregister () { |
|---|
| 334 | 336 | super.deregister (); |
|---|
| 335 | 337 | if (socketHandle !is null) display.removeWidget (cast(GtkWidget*)socketHandle); |
|---|
| … | … | |
| 394 | 396 | } |
|---|
| 395 | 397 | |
|---|
| 396 | | void enableWidget (bool enabled) { |
|---|
| | 398 | override void enableWidget (bool enabled) { |
|---|
| 397 | 399 | if ((state & CANVAS) !is 0) return; |
|---|
| 398 | 400 | super.enableWidget (enabled); |
|---|
| … | … | |
| 403 | 405 | } |
|---|
| 404 | 406 | |
|---|
| 405 | | Menu [] findMenus (Control control) { |
|---|
| | 407 | override Menu [] findMenus (Control control) { |
|---|
| 406 | 408 | if (control is this) return new Menu [0]; |
|---|
| 407 | 409 | Menu result [] = super.findMenus (control); |
|---|
| … | … | |
| 420 | 422 | } |
|---|
| 421 | 423 | |
|---|
| 422 | | void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, Decorations oldDecorations, Menu [] menus) { |
|---|
| | 424 | override void fixChildren (Shell newShell, Shell oldShell, Decorations newDecorations, Decorations oldDecorations, Menu [] menus) { |
|---|
| 423 | 425 | super.fixChildren (newShell, oldShell, newDecorations, oldDecorations, menus); |
|---|
| 424 | 426 | Control [] children = _getChildren (); |
|---|
| … | … | |
| 429 | 431 | |
|---|
| 430 | 432 | alias Scrollable.fixStyle fixStyle; |
|---|
| 431 | | void fixStyle () { |
|---|
| | 433 | override void fixStyle () { |
|---|
| 432 | 434 | super.fixStyle (); |
|---|
| 433 | 435 | if (scrolledHandle is null) fixStyle (handle); |
|---|
| … | … | |
| 460 | 462 | |
|---|
| 461 | 463 | void fixZOrder () { |
|---|
| | 464 | Stdout.formatln( "{}: parent.fixZOrder gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 465 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| 462 | 466 | if ((state & CANVAS) !is 0) return; |
|---|
| 463 | 467 | auto parentHandle = parentingHandle (); |
|---|
| … | … | |
| 480 | 484 | OS.g_list_free (windowList); |
|---|
| 481 | 485 | } |
|---|
| 482 | | } |
|---|
| 483 | | |
|---|
| 484 | | GtkWidget* focusHandle () { |
|---|
| | 486 | Stdout.formatln( "{}: parent.fixZOrder gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 487 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| | 488 | } |
|---|
| | 489 | |
|---|
| | 490 | override GtkWidget* focusHandle () { |
|---|
| 485 | 491 | if (socketHandle !is null) return socketHandle; |
|---|
| 486 | 492 | return super.focusHandle (); |
|---|
| 487 | 493 | } |
|---|
| 488 | 494 | |
|---|
| 489 | | bool forceFocus (GtkWidget* focusHandle) { |
|---|
| | 495 | override bool forceFocus (GtkWidget* focusHandle) { |
|---|
| 490 | 496 | if (socketHandle !is null) OS.GTK_WIDGET_SET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); |
|---|
| 491 | 497 | bool result = super.forceFocus (focusHandle); |
|---|
| … | … | |
| 555 | 561 | } |
|---|
| 556 | 562 | |
|---|
| 557 | | public Rectangle getClientArea () { |
|---|
| | 563 | override public Rectangle getClientArea () { |
|---|
| 558 | 564 | checkWidget(); |
|---|
| 559 | 565 | if ((state & CANVAS) !is 0) { |
|---|
| … | … | |
| 758 | 764 | } |
|---|
| 759 | 765 | |
|---|
| 760 | | void hookEvents () { |
|---|
| | 766 | override void hookEvents () { |
|---|
| 761 | 767 | super.hookEvents (); |
|---|
| 762 | 768 | if ((state & CANVAS) !is 0) { |
|---|
| … | … | |
| 772 | 778 | } |
|---|
| 773 | 779 | |
|---|
| 774 | | GtkIMContext* imHandle () { |
|---|
| | 780 | override GtkIMContext* imHandle () { |
|---|
| 775 | 781 | return imHandle_; |
|---|
| 776 | 782 | } |
|---|
| … | … | |
| 799 | 805 | } |
|---|
| 800 | 806 | |
|---|
| 801 | | bool isTabGroup() { |
|---|
| | 807 | override bool isTabGroup() { |
|---|
| 802 | 808 | if ((state & CANVAS) !is 0) return true; |
|---|
| 803 | 809 | return super.isTabGroup(); |
|---|
| … | … | |
| 977 | 983 | } |
|---|
| 978 | 984 | |
|---|
| 979 | | void markLayout (bool changed, bool all) { |
|---|
| | 985 | override void markLayout (bool changed, bool all) { |
|---|
| 980 | 986 | if (layout_ !is null) { |
|---|
| 981 | 987 | state |= LAYOUT_NEEDED; |
|---|
| … | … | |
| 990 | 996 | } |
|---|
| 991 | 997 | |
|---|
| | 998 | alias Scrollable.moveAbove moveAbove; |
|---|
| 992 | 999 | void moveAbove (GtkWidget* child, GtkWidget* sibling) { |
|---|
| 993 | 1000 | if (child is sibling) return; |
|---|
| 994 | 1001 | auto parentHandle = parentingHandle (); |
|---|
| 995 | 1002 | auto fixed = cast(GtkFixed*)parentHandle; |
|---|
| 996 | | auto children = fixed.children; |
|---|
| | 1003 | GList* children = fixed.children; |
|---|
| 997 | 1004 | if (children is null) return; |
|---|
| 998 | | GList* data; |
|---|
| | 1005 | void* data; |
|---|
| 999 | 1006 | GtkWidget* widget; |
|---|
| 1000 | | GList* childData, childLink, siblingLink; |
|---|
| | 1007 | void* childData; |
|---|
| | 1008 | GList* childLink, siblingLink; |
|---|
| 1001 | 1009 | GList* temp = children; |
|---|
| 1002 | 1010 | while (temp !is null) { |
|---|
| 1003 | | data = temp; |
|---|
| 1004 | | widget = cast(GtkWidget*) data; |
|---|
| | 1011 | data = temp.data; |
|---|
| | 1012 | widget = *cast(GtkWidget**) data; |
|---|
| 1005 | 1013 | if (child is widget) { |
|---|
| 1006 | 1014 | childLink = temp; |
|---|
| … | … | |
| 1027 | 1035 | } |
|---|
| 1028 | 1036 | |
|---|
| | 1037 | alias Scrollable.moveBelow moveBelow; |
|---|
| 1029 | 1038 | void moveBelow (GtkWidget* child, GtkWidget* sibling) { |
|---|
| 1030 | 1039 | if (child is sibling) return; |
|---|
| … | … | |
| 1035 | 1044 | } |
|---|
| 1036 | 1045 | auto fixed = cast(GtkFixed*)parentHandle; |
|---|
| 1037 | | auto children = fixed.children; |
|---|
| | 1046 | GList* children = fixed.children; |
|---|
| 1038 | 1047 | if (children is null) return; |
|---|
| 1039 | | GList* data; |
|---|
| | 1048 | void* data; |
|---|
| 1040 | 1049 | GtkWidget* widget; |
|---|
| 1041 | | GList* childData, childLink, siblingLink, temp = children; |
|---|
| | 1050 | void* childData; |
|---|
| | 1051 | GList* childLink, siblingLink, temp = children; |
|---|
| | 1052 | Stdout.formatln( "{}: before loop child={} sibling={}", __LINE__, child, sibling ); |
|---|
| | 1053 | Stdout.formatln( "{}: parent.moveBelow gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 1054 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| 1042 | 1055 | while (temp !is null) { |
|---|
| 1043 | | data = temp; |
|---|
| | 1056 | Stdout.formatln( "{}: loop start {}->{}", __LINE__, temp, cast(void*)temp.data ); |
|---|
| | 1057 | data = (*temp).data; |
|---|
| 1044 | 1058 | widget = cast(GtkWidget*) data; |
|---|
| 1045 | 1059 | if (child is widget) { |
|---|
| | 1060 | Stdout.formatln( "{}: child is widget", __LINE__ ); |
|---|
| 1046 | 1061 | childLink = temp; |
|---|
| 1047 | 1062 | childData = data; |
|---|
| 1048 | 1063 | } else if (sibling is widget) { |
|---|
| | 1064 | Stdout.formatln( "{}: sibling is widget", __LINE__ ); |
|---|
| 1049 | 1065 | siblingLink = temp; |
|---|
| 1050 | 1066 | } |
|---|
| 1051 | 1067 | if (childData !is null && (sibling is null || siblingLink !is null)) break; |
|---|
| 1052 | | temp = temp.next; |
|---|
| 1053 | | } |
|---|
| | 1068 | temp = OS.g_list_next(temp); |
|---|
| | 1069 | Stdout.formatln( "{}: loop end", __LINE__ ); |
|---|
| | 1070 | } |
|---|
| | 1071 | Stdout.formatln( "{}: after loop childLink={}", __LINE__, childLink ); |
|---|
| 1054 | 1072 | children = OS.g_list_remove_link (children, childLink); |
|---|
| 1055 | | if (siblingLink is null || siblingLink.next is null) { |
|---|
| | 1073 | if (siblingLink is null || OS.g_list_next(siblingLink) is null) { |
|---|
| 1056 | 1074 | OS.g_list_free_1 (childLink); |
|---|
| | 1075 | Stdout.formatln( "{}: parent.moveBelow gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 1076 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| | 1077 | Stdout.formatln( " {} {}", children, childData ); |
|---|
| 1057 | 1078 | children = OS.g_list_append (children, childData); |
|---|
| | 1079 | Stdout.formatln( "{}: parent.moveBelow gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 1080 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| 1058 | 1081 | } else { |
|---|
| 1059 | | temp = siblingLink.next; |
|---|
| 1060 | | childLink.next = temp; |
|---|
| 1061 | | temp.prev = childLink; |
|---|
| 1062 | | childLink.prev = siblingLink; |
|---|
| 1063 | | siblingLink.next = childLink; |
|---|
| | 1082 | Stdout.formatln( "{}: parent.moveBelow gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 1083 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| | 1084 | temp = OS.g_list_next( siblingLink ); |
|---|
| | 1085 | OS.g_list_set_next (childLink, temp); |
|---|
| | 1086 | OS.g_list_set_previous (temp, childLink); |
|---|
| | 1087 | OS.g_list_set_previous (childLink, siblingLink); |
|---|
| | 1088 | OS.g_list_set_next (siblingLink, childLink); |
|---|
| 1064 | 1089 | } |
|---|
| 1065 | 1090 | fixed.children = children; |
|---|
| 1066 | 1091 | parentHandle = cast(GtkWidget*)fixed; |
|---|
| | 1092 | Stdout.formatln( "{}: parent.moveBelow gtk_container_get_children {:x}", __LINE__, parentingHandle() ); |
|---|
| | 1093 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentingHandle()) ); |
|---|
| 1067 | 1094 | } |
|---|
| 1068 | 1095 | |
|---|
| … | … | |
| 1083 | 1110 | } |
|---|
| 1084 | 1111 | |
|---|
| 1085 | | void redrawChildren () { |
|---|
| | 1112 | override void redrawChildren () { |
|---|
| 1086 | 1113 | super.redrawChildren (); |
|---|
| 1087 | 1114 | Control [] children = _getChildren (); |
|---|
| … | … | |
| 1095 | 1122 | } |
|---|
| 1096 | 1123 | |
|---|
| 1097 | | void register () { |
|---|
| | 1124 | override void register () { |
|---|
| 1098 | 1125 | super.register (); |
|---|
| 1099 | 1126 | if (socketHandle !is null) display.addWidget (socketHandle, this); |
|---|
| 1100 | 1127 | } |
|---|
| 1101 | 1128 | |
|---|
| 1102 | | void releaseChildren (bool destroy) { |
|---|
| | 1129 | override void releaseChildren (bool destroy) { |
|---|
| 1103 | 1130 | Control [] children = _getChildren (); |
|---|
| 1104 | 1131 | for (int i=0; i<children.length; i++) { |
|---|
| … | … | |
| 1111 | 1138 | } |
|---|
| 1112 | 1139 | |
|---|
| 1113 | | void releaseHandle () { |
|---|
| | 1140 | override void releaseHandle () { |
|---|
| 1114 | 1141 | super.releaseHandle (); |
|---|
| 1115 | 1142 | socketHandle = null; |
|---|
| … | … | |
| 1117 | 1144 | } |
|---|
| 1118 | 1145 | |
|---|
| 1119 | | void releaseWidget () { |
|---|
| | 1146 | override void releaseWidget () { |
|---|
| 1120 | 1147 | super.releaseWidget (); |
|---|
| 1121 | 1148 | if (imHandle_ !is null) OS.g_object_unref (imHandle_); |
|---|
| … | … | |
| 1129 | 1156 | } |
|---|
| 1130 | 1157 | |
|---|
| 1131 | | void resizeHandle (int width, int height) { |
|---|
| | 1158 | override void resizeHandle (int width, int height) { |
|---|
| 1132 | 1159 | super.resizeHandle (width, height); |
|---|
| 1133 | 1160 | if (socketHandle !is null) OS.gtk_widget_set_size_request (socketHandle, width, height); |
|---|
| … | … | |
| 1160 | 1187 | } |
|---|
| 1161 | 1188 | |
|---|
| 1162 | | int setBounds (int x, int y, int width, int height, bool move, bool resize) { |
|---|
| | 1189 | alias Scrollable.setBounds setBounds; |
|---|
| | 1190 | override int setBounds (int x, int y, int width, int height, bool move, bool resize) { |
|---|
| 1163 | 1191 | int result = super.setBounds (x, y, width, height, move, resize); |
|---|
| 1164 | 1192 | if ((result & RESIZED) !is 0 && layout_ !is null) { |
|---|
| … | … | |
| 1169 | 1197 | } |
|---|
| 1170 | 1198 | |
|---|
| 1171 | | public bool setFocus () { |
|---|
| | 1199 | override public bool setFocus () { |
|---|
| 1172 | 1200 | checkWidget(); |
|---|
| 1173 | 1201 | Control [] children = _getChildren (); |
|---|
| … | … | |
| 1229 | 1257 | } |
|---|
| 1230 | 1258 | |
|---|
| 1231 | | bool setScrollBarVisible (ScrollBar bar, bool visible) { |
|---|
| | 1259 | override bool setScrollBarVisible (ScrollBar bar, bool visible) { |
|---|
| 1232 | 1260 | bool changed = super.setScrollBarVisible (bar, visible); |
|---|
| 1233 | 1261 | if (changed && layout_ !is null) { |
|---|
| … | … | |
| 1238 | 1266 | } |
|---|
| 1239 | 1267 | |
|---|
| 1240 | | bool setTabGroupFocus (bool next) { |
|---|
| | 1268 | override bool setTabGroupFocus (bool next) { |
|---|
| 1241 | 1269 | if (isTabItem ()) return setTabItemFocus (next); |
|---|
| 1242 | 1270 | bool takeFocus = (style & SWT.NO_FOCUS) is 0; |
|---|
| … | … | |
| 1252 | 1280 | } |
|---|
| 1253 | 1281 | |
|---|
| 1254 | | bool setTabItemFocus (bool next) { |
|---|
| | 1282 | override bool setTabItemFocus (bool next) { |
|---|
| 1255 | 1283 | if (!super.setTabItemFocus (next)) return false; |
|---|
| 1256 | 1284 | if (socketHandle !is null) { |
|---|
| … | … | |
| 1294 | 1322 | } |
|---|
| 1295 | 1323 | |
|---|
| 1296 | | void showWidget () { |
|---|
| | 1324 | override void showWidget () { |
|---|
| 1297 | 1325 | super.showWidget (); |
|---|
| 1298 | 1326 | if (socketHandle !is null) { |
|---|
| … | … | |
| 1303 | 1331 | } |
|---|
| 1304 | 1332 | |
|---|
| 1305 | | bool translateMnemonic (Event event, Control control) { |
|---|
| | 1333 | override bool translateMnemonic (Event event, Control control) { |
|---|
| 1306 | 1334 | if (super.translateMnemonic (event, control)) return true; |
|---|
| 1307 | 1335 | if (control !is null) { |
|---|
| … | … | |
| 1315 | 1343 | } |
|---|
| 1316 | 1344 | |
|---|
| 1317 | | int traversalCode(int key, GdkEventKey* event) { |
|---|
| | 1345 | override int traversalCode(int key, GdkEventKey* event) { |
|---|
| 1318 | 1346 | if ((state & CANVAS) !is 0) { |
|---|
| 1319 | 1347 | if ((style & SWT.NO_FOCUS) !is 0) return 0; |
|---|
| … | … | |
| 1323 | 1351 | } |
|---|
| 1324 | 1352 | |
|---|
| 1325 | | bool translateTraversal (GdkEventKey* keyEvent) { |
|---|
| | 1353 | override bool translateTraversal (GdkEventKey* keyEvent) { |
|---|
| 1326 | 1354 | if (socketHandle !is null) return false; |
|---|
| 1327 | 1355 | return super.translateTraversal (keyEvent); |
|---|
| r55 |
r58 |
|
| 53 | 53 | |
|---|
| 54 | 54 | import Math = tango.math.Math; |
|---|
| 55 | | import tango.stdc.string; |
|---|
| 56 | 55 | import tango.stdc.stringz; |
|---|
| 57 | 56 | import tango.core.Thread; |
|---|
| … | … | |
| 132 | 131 | } |
|---|
| 133 | 132 | |
|---|
| 134 | | void deregister () { |
|---|
| | 133 | override void deregister () { |
|---|
| 135 | 134 | super.deregister (); |
|---|
| 136 | 135 | if (fixedHandle !is null) display.removeWidget (fixedHandle); |
|---|
| … | … | |
| 180 | 179 | } |
|---|
| 181 | 180 | |
|---|
| 182 | | void fixStyle () { |
|---|
| | 181 | public void fixStyle () { |
|---|
| 183 | 182 | if (fixedHandle !is null) fixStyle (fixedHandle); |
|---|
| 184 | 183 | } |
|---|
| … | … | |
| 199 | 198 | auto childStyle = parent.childStyle (); |
|---|
| 200 | 199 | if (childStyle !is null) { |
|---|
| 201 | | GdkColor* color = new GdkColor(); |
|---|
| 202 | | OS.gtk_style_get_bg (childStyle, 0, color); |
|---|
| 203 | | OS.gtk_widget_modify_bg (handle, 0, color); |
|---|
| | 200 | GdkColor color; |
|---|
| | 201 | OS.gtk_style_get_bg (childStyle, 0, &color); |
|---|
| | 202 | OS.gtk_widget_modify_bg (handle, 0, &color); |
|---|
| 204 | 203 | } |
|---|
| 205 | 204 | } |
|---|
| … | … | |
| 217 | 216 | } |
|---|
| 218 | 217 | |
|---|
| 219 | | void hookEvents () { |
|---|
| | 218 | override void hookEvents () { |
|---|
| 220 | 219 | /* Connect the keyboard signals */ |
|---|
| 221 | 220 | auto focusHandle = focusHandle (); |
|---|
| … | … | |
| 291 | 290 | } |
|---|
| 292 | 291 | |
|---|
| 293 | | int /*long*/ hoverProc (int /*long*/ widget) { |
|---|
| | 292 | override int /*long*/ hoverProc (GtkWidget* widget) { |
|---|
| 294 | 293 | int x, y; |
|---|
| 295 | 294 | int mask; |
|---|
| … | … | |
| 300 | 299 | } |
|---|
| 301 | 300 | |
|---|
| 302 | | GtkWidget* topHandle() { |
|---|
| | 301 | override GtkWidget* topHandle() { |
|---|
| 303 | 302 | if (fixedHandle !is null) return fixedHandle; |
|---|
| 304 | 303 | return super.topHandle (); |
|---|
| … | … | |
| 315 | 314 | } |
|---|
| 316 | 315 | |
|---|
| 317 | | GdkWindow* paintWindow () { |
|---|
| | 316 | override GdkWindow* paintWindow () { |
|---|
| 318 | 317 | auto paintHandle = paintHandle (); |
|---|
| 319 | 318 | OS.gtk_widget_realize (paintHandle); |
|---|
| … | … | |
| 418 | 417 | } |
|---|
| 419 | 418 | |
|---|
| 420 | | void createWidget (int index) { |
|---|
| | 419 | override void createWidget (int index) { |
|---|
| 421 | 420 | state |= DRAG_DETECT; |
|---|
| 422 | 421 | checkOrientation (parent); |
|---|
| … | … | |
| 476 | 475 | int width = wHint, height = hHint; |
|---|
| 477 | 476 | if (wHint is SWT.DEFAULT && hHint is SWT.DEFAULT) { |
|---|
| 478 | | GtkRequisition* requisition = new GtkRequisition (); |
|---|
| 479 | | gtk_widget_size_request (h, requisition); |
|---|
| | 477 | GtkRequisition requisition; |
|---|
| | 478 | gtk_widget_size_request (h, &requisition); |
|---|
| 480 | 479 | width = OS.GTK_WIDGET_REQUISITION_WIDTH (h); |
|---|
| 481 | 480 | height = OS.GTK_WIDGET_REQUISITION_HEIGHT (h); |
|---|
| … | … | |
| 484 | 483 | OS.gtk_widget_get_size_request (h, &reqWidth, &reqHeight); |
|---|
| 485 | 484 | OS.gtk_widget_set_size_request (h, wHint, hHint); |
|---|
| 486 | | GtkRequisition* requisition = new GtkRequisition (); |
|---|
| 487 | | gtk_widget_size_request (h, requisition); |
|---|
| | 485 | GtkRequisition requisition; |
|---|
| | 486 | gtk_widget_size_request (h, &requisition); |
|---|
| 488 | 487 | OS.gtk_widget_set_size_request (h, reqWidth, reqHeight); |
|---|
| 489 | 488 | width = wHint is SWT.DEFAULT ? requisition.width : wHint; |
|---|
| … | … | |
| 500 | 499 | */ |
|---|
| 501 | 500 | auto topHandle = topHandle (); |
|---|
| 502 | | GtkRequisition* requisition = new GtkRequisition (); |
|---|
| 503 | | gtk_widget_size_request (topHandle, requisition); |
|---|
| 504 | | GtkAllocation* allocation = new GtkAllocation (); |
|---|
| | 501 | GtkRequisition requisition; |
|---|
| | 502 | gtk_widget_size_request (topHandle, &requisition); |
|---|
| | 503 | GtkAllocation allocation; |
|---|
| 505 | 504 | allocation.x = OS.GTK_WIDGET_X (topHandle); |
|---|
| 506 | 505 | allocation.y = OS.GTK_WIDGET_Y (topHandle); |
|---|
| 507 | 506 | allocation.width = OS.GTK_WIDGET_WIDTH (topHandle); |
|---|
| 508 | 507 | allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle); |
|---|
| 509 | | OS.gtk_widget_size_allocate (topHandle, allocation); |
|---|
| | 508 | OS.gtk_widget_size_allocate (topHandle, &allocation); |
|---|
| 510 | 509 | } |
|---|
| 511 | 510 | |
|---|
| … | … | |
| 675 | 674 | * a call to gtk_widget_size_request(). |
|---|
| 676 | 675 | */ |
|---|
| 677 | | GtkRequisition* requisition = new GtkRequisition (); |
|---|
| 678 | | gtk_widget_size_request (topHandle, requisition); |
|---|
| 679 | | GtkAllocation* allocation = new GtkAllocation (); |
|---|
| | 676 | GtkRequisition requisition; |
|---|
| | 677 | gtk_widget_size_request (topHandle, &requisition); |
|---|
| | 678 | GtkAllocation allocation; |
|---|
| 680 | 679 | if (move) { |
|---|
| 681 | 680 | allocation.x = x; |
|---|
| … | … | |
| 692 | 691 | allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle); |
|---|
| 693 | 692 | } |
|---|
| 694 | | OS.gtk_widget_size_allocate (topHandle, allocation); |
|---|
| | 693 | OS.gtk_widget_size_allocate (topHandle, &allocation); |
|---|
| 695 | 694 | } |
|---|
| 696 | 695 | /* |
|---|
| … | … | |
| 842 | 841 | |
|---|
| 843 | 842 | Stdout.formatln( "setRelations {:x}", cast(uint)parentHandle ); |
|---|
| | 843 | Stdout.formatln( "showWidget gtk_container_get_children {:x}", parentHandle ); |
|---|
| | 844 | Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentHandle) ); |
|---|
| 844 | 845 | auto list = OS.gtk_container_get_children (cast(GtkContainer*)parentHandle); |
|---|
| 845 | 846 | if (list is null) return; |
|---|
| … | … | |
| 1840 | 1841 | } |
|---|
| 1841 | 1842 | |
|---|
| 1842 | | bool dragDetect (int x, int y, bool filter, bool [] consume) { |
|---|
| | 1843 | bool dragDetect (int x, int y, bool filter, bool* consume) { |
|---|
| 1843 | 1844 | bool quit = false, dragging = false; |
|---|
| 1844 | 1845 | while (!quit) { |
|---|
| … | … | |
| 1849 | 1850 | break; |
|---|
| 1850 | 1851 | } else { |
|---|
| 1851 | | try {Thread.sleep(50);} catch (Exception ex) {} |
|---|
| | 1852 | try {Thread.sleep(0.050);} catch (Exception ex) {} |
|---|
| 1852 | 1853 | } |
|---|
| 1853 | 1854 | } |
|---|
| 1854 | 1855 | switch (cast(int)OS.GDK_EVENT_TYPE (eventPtr)) { |
|---|
| 1855 | 1856 | case OS.GDK_MOTION_NOTIFY: { |
|---|
| 1856 | | GdkEventMotion* gdkMotionEvent = new GdkEventMotion (); |
|---|
| 1857 | | memmove (gdkMotionEvent, eventPtr, GdkEventMotion.sizeof); |
|---|
| | 1857 | GdkEventMotion* gdkMotionEvent = cast(GdkEventMotion*)eventPtr; |
|---|
| 1858 | 1858 | if ((gdkMotionEvent.state & OS.GDK_BUTTON1_MASK) !is 0) { |
|---|
| 1859 | 1859 | if (OS.gtk_drag_check_threshold (handle, x, y, cast(int) gdkMotionEvent.x, cast(int) gdkMotionEvent.y)) { |
|---|
| … | … | |
| 1870 | 1870 | case OS.GDK_KEY_PRESS: |
|---|
| 1871 | 1871 | case OS.GDK_KEY_RELEASE: { |
|---|
| 1872 | | GdkEventKey* gdkEvent = new GdkEventKey (); |
|---|
| 1873 | | memmove (gdkEvent, eventPtr, GdkEventKey.sizeof); |
|---|
| | 1872 | GdkEventKey* gdkEvent = cast(GdkEventKey*)eventPtr; |
|---|
| 1874 | 1873 | if (gdkEvent.keyval is OS.GDK_Escape) quit = true; |
|---|
| 1875 | 1874 | break; |
|---|
| … | … | |
| 1914 | 1913 | } |
|---|
| 1915 | 1914 | |
|---|
| 1916 | | int /*long*/ fixedMapProc (GtkWidget* widget) { |
|---|
| | 1915 | override int /*long*/ fixedMapProc (GtkWidget* widget) { |
|---|
| 1917 | 1916 | OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED); |
|---|
| 1918 | 1917 | auto widgetList = OS.gtk_container_get_children (cast(GtkContainer*)widget); |
|---|
| … | … | |
| 2212 | 2211 | if (screen !is null) { |
|---|
| 2213 | 2212 | int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, paintWindow ()); |
|---|
| 2214 | | GdkRectangle* dest = new GdkRectangle (); |
|---|
| 2215 | | OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); |
|---|
| | 2213 | GdkRectangle dest; |
|---|
| | 2214 | OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, &dest); |
|---|
| 2216 | 2215 | monitor = new dwt.widgets.Monitor.Monitor (); |
|---|
| 2217 | 2216 | monitor.handle = monitorNumber; |
|---|
| … | … | |
| 2334 | 2333 | } |
|---|
| 2335 | 2334 | |
|---|
| 2336 | | override int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* event) { |
|---|
| 2337 | | GdkEventButton* gdkEvent = new GdkEventButton (); |
|---|
| 2338 | | memmove (gdkEvent, event, GdkEventButton.sizeof); |
|---|
| | 2335 | override int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* gdkEvent) { |
|---|
| 2339 | 2336 | if (gdkEvent.type is OS.GDK_3BUTTON_PRESS) return 0; |
|---|
| 2340 | 2337 | /* |
|---|
| … | … | |
| 2361 | 2358 | if ((state & DRAG_DETECT) !is 0 && hooks (SWT.DragDetect)) { |
|---|
| 2362 | 2359 | if (gdkEvent.button is 1) { |
|---|
| 2363 | | bool [] consume = new bool [1]; |
|---|
| 2364 | | if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, consume)) { |
|---|
| | 2360 | bool consume = false; |
|---|
| | 2361 | if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, &consume)) { |
|---|
| 2365 | 2362 | dragging = true; |
|---|
| 2366 | | if (consume [0]) result = 1; |
|---|
| | 2363 | if (consume ) result = 1; |
|---|
| 2367 | 2364 | } |
|---|
| 2368 | 2365 | if (isDisposed ()) return 1; |
|---|
| … | … | |
| 2398 | 2395 | } |
|---|
| 2399 | 2396 | |
|---|
| 2400 | | override int /*long*/ gtk_button_release_event (GtkWidget* widget, GdkEventButton* event) { |
|---|
| 2401 | | GdkEventButton* gdkEvent = new GdkEventButton (); |
|---|
| 2402 | | memmove (gdkEvent, event, GdkEventButton.sizeof); |
|---|
| | 2397 | override int /*long*/ gtk_button_release_event (GtkWidget* widget, GdkEventButton* gdkEvent) { |
|---|
| 2403 | 2398 | /* |
|---|
| 2404 | 2399 | * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK |
|---|
| … | … | |
| 2425 | 2420 | } |
|---|
| 2426 | 2421 | |
|---|
| 2427 | | override int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* event) { |
|---|
| | 2422 | override int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* gdkEvent) { |
|---|
| 2428 | 2423 | if (display.currentControl is this) return 0; |
|---|
| 2429 | | GdkEventCrossing* gdkEvent = new GdkEventCrossing (); |
|---|
| 2430 | | memmove (gdkEvent, event, GdkEventCrossing.sizeof); |
|---|
| 2431 | 2424 | if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0; |
|---|
| 2432 | 2425 | if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0; |
|---|
| … | … | |
| 2443 | 2436 | |
|---|
| 2444 | 2437 | override int /*long*/ gtk_event_after (GtkWidget* widget, GdkEvent* gdkEvent) { |
|---|
| 2445 | | GdkEvent* event = new GdkEvent (); |
|---|
| 2446 | | memmove (event, gdkEvent, GdkEvent.sizeof); |
|---|
| 2447 | | switch (cast(int)event.type) { |
|---|
| | 2438 | switch (cast(int)gdkEvent.type) { |
|---|
| 2448 | 2439 | case OS.GDK_BUTTON_PRESS: { |
|---|
| 2449 | 2440 | if (widget !is eventHandle ()) break; |
|---|
| … | … | |
| 2454 | 2445 | */ |
|---|
| 2455 | 2446 | if ((state & MENU) is 0) { |
|---|
| 2456 | | GdkEventButton* gdkEventButton = new GdkEventButton (); |
|---|
| 2457 | | memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof); |
|---|
| | 2447 | GdkEventButton* gdkEventButton = cast(GdkEventButton*)gdkEvent; |
|---|
| 2458 | 2448 | if (gdkEventButton.button is 3) { |
|---|
| 2459 | 2449 | showMenu (cast(int) gdkEventButton.x_root, cast(int) gdkEventButton.y_root); |
|---|
| … | … | |
| 2464 | 2454 | case OS.GDK_FOCUS_CHANGE: { |
|---|
| 2465 | 2455 | if (widget !is focusHandle ()) break; |
|---|
| 2466 | | GdkEventFocus* gdkEventFocus = new GdkEventFocus (); |
|---|
| 2467 | | memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof); |
|---|
| | 2456 | GdkEventFocus* gdkEventFocus = cast(GdkEventFocus*)gdkEvent; |
|---|
| 2468 | 2457 | |
|---|
| 2469 | 2458 | /* |
|---|
| … | … | |
| 2499 | 2488 | } |
|---|
| 2500 | 2489 | |
|---|
| 2501 | | override int /*long*/ gtk_expose_event (GtkWidget* widget, GdkEventExpose* eventPtr) { |
|---|
| | 2490 | override int /*long*/ gtk_expose_event (GtkWidget* widget, GdkEventExpose* gdkEvent) { |
|---|
| 2502 | 2491 | if ((state & OBSCURED) !is 0) return 0; |
|---|
| 2503 | 2492 | if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0; |
|---|
| 2504 | | GdkEventExpose* gdkEvent = new GdkEventExpose (); |
|---|
| 2505 | | memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof); |
|---|
| 2506 | 2493 | Event event = new Event (); |
|---|
| 2507 | 2494 | event.count = gdkEvent.count; |
|---|
| … | … | |
| 2556 | 2543 | } |
|---|
| 2557 | 2544 | |
|---|
| 2558 | | override int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* event) { |
|---|
| | 2545 | override int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* gdkEvent) { |
|---|
| 2559 | 2546 | if (!hasFocus ()) return 0; |
|---|
| 2560 | | GdkEventKey* gdkEvent = new GdkEventKey (); |
|---|
| 2561 | | memmove (gdkEvent, event, GdkEventKey.sizeof); |
|---|
| 2562 | 2547 | |
|---|
| 2563 | 2548 | if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1; |
|---|
| … | … | |
| 2565 | 2550 | if (isDisposed ()) return 0; |
|---|
| 2566 | 2551 | |
|---|
| 2567 | | if (filterKey (gdkEvent.keyval, event)) return 1; |
|---|
| | 2552 | if (filterKey (gdkEvent.keyval, gdkEvent)) return 1; |
|---|
| 2568 | 2553 | // widget could be disposed at this point |
|---|
| 2569 | 2554 | if (isDisposed ()) return 0; |
|---|
| … | … | |
| 2572 | 2557 | // widget could be disposed at this point |
|---|
| 2573 | 2558 | if (isDisposed ()) return 0; |
|---|
| 2574 | | return super.gtk_key_press_event (widget, event); |
|---|
| | 2559 | return super.gtk_key_press_event (widget, gdkEvent); |
|---|
| 2575 | 2560 | } |
|---|
| 2576 | 2561 | |
|---|
| … | … | |
| 2584 | 2569 | } |
|---|
| 2585 | 2570 | |
|---|
| 2586 | | override int /*long*/ gtk_leave_notify_event (GtkWidget* widget, GdkEventCrossing* event) { |
|---|
| | 2571 | override int /*long*/ gtk_leave_notify_event (GtkWidget* widget, GdkEventCrossing* gdkEvent) { |
|---|
| 2587 | 2572 | if (display.currentControl !is this) return 0; |
|---|
| 2588 | 2573 | display.removeMouseHoverTimeout (handle); |
|---|
| 2589 | 2574 | int result = 0; |
|---|
| 2590 | 2575 | if (sendLeaveNotify () || display.getCursorControl () is null) { |
|---|
| 2591 | | GdkEventCrossing* gdkEvent = new GdkEventCrossing (); |
|---|
| 2592 | | memmove (gdkEvent, event, GdkEventCrossing.sizeof); |
|---|
| 2593 | 2576 | if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0; |
|---|
| 2594 | 2577 | if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0; |
|---|
| … | … | |
| 2603 | 2586 | auto eventPtr = OS.gtk_get_current_event (); |
|---|
| 2604 | 2587 | if (eventPtr !is null) { |
|---|
| 2605 | | GdkEventKey* keyEvent = new GdkEventKey (); |
|---|
| 2606 | | memmove (keyEvent, eventPtr, GdkEventKey.sizeof); |
|---|
| | 2588 | GdkEventKey* keyEvent = cast(GdkEventKey*)eventPtr; |
|---|
| 2607 | 2589 | if (keyEvent.type is OS.GDK_KEY_PRESS) { |
|---|
| 2608 | 2590 | Control focusControl = display.getFocusControl (); |
|---|
| … | … | |
| 2620 | 2602 | } |
|---|
| 2621 | 2603 | |
|---|
| 2622 | | override int /*long*/ gtk_motion_notify_event (GtkWidget* widget, GdkEventMotion* event) { |
|---|
| 2623 | | GdkEventMotion* gdkEvent = new GdkEventMotion (); |
|---|
| 2624 | | memmove (gdkEvent, event, GdkEventMotion.sizeof); |
|---|
| | 2604 | override int /*long*/ gtk_motion_notify_event (GtkWidget* widget, GdkEventMotion* gdkEvent) { |
|---|
| 2625 | 2605 | if (this is display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) { |
|---|
| 2626 | 2606 | display.addMouseHoverTimeout (handle); |
|---|
| … | … | |
| 2666 | 2646 | } |
|---|
| 2667 | 2647 | |
|---|
| 2668 | | override int /*long*/ gtk_scroll_event (GtkWidget* widget, GdkEventScroll* eventPtr) { |
|---|
| 2669 | | GdkEventScroll* gdkEvent = new GdkEventScroll (); |
|---|
| 2670 | | memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof); |
|---|
| | 2648 | override int /*long*/ gtk_scroll_event (GtkWidget* widget, GdkEventScroll* gdkEvent) { |
|---|
| 2671 | 2649 | switch (cast(int)gdkEvent.direction) { |
|---|
| 2672 | 2650 | case OS.GDK_SCROLL_UP: |
|---|
| … | … | |
| 2701 | 2679 | } |
|---|
| 2702 | 2680 | |
|---|
| 2703 | | override int /*long*/ gtk_visibility_notify_event (GtkWidget* widget, GdkEventVisibility* event) { |
|---|
| 2704 | | GdkEventVisibility* gdkEvent = new GdkEventVisibility (); |
|---|
| 2705 | | memmove (gdkEvent, event, GdkEventVisibility.sizeof); |
|---|
| | 2681 | override int /*long*/ gtk_visibility_notify_event (GtkWidget* widget, GdkEventVisibility* gdkEvent) { |
|---|
| 2706 | 2682 | auto paintWindow = paintWindow(); |
|---|
| 2707 | 2683 | auto window = gdkEvent.window; |
|---|
| … | … | |
| 2713 | 2689 | int width, height; |
|---|
| 2714 | 2690 | OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &width, &height); |
|---|
| 2715 | | GdkRectangle* rect = new GdkRectangle (); |
|---|
| | 2691 | GdkRectangle rect; |
|---|
| 2716 | 2692 | rect.width = width; |
|---|
| 2717 | 2693 | rect.height = height; |
|---|
| 2718 | | OS.gdk_window_invalidate_rect (window, rect, false); |
|---|
| | 2694 | OS.gdk_window_invalidate_rect (window, &rect, false); |
|---|
| 2719 | 2695 | } |
|---|
| 2720 | 2696 | state &= ~OBSCURED; |
|---|
| … | … | |
| 2919 | 2895 | } |
|---|
| 2920 | 2896 | |
|---|
| 2921 | | void register () { |
|---|
| | 2897 | override void register () { |
|---|
| 2922 | 2898 | super.register (); |
|---|
| 2923 | 2899 | if (fixedHandle !is null) display.addWidget (fixedHandle, this); |
|---|
| … | … | |
| 2998 | 2974 | if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) is 0) return; |
|---|
| 2999 | 2975 | auto window = paintWindow (); |
|---|
| 3000 | | GdkRectangle* rect = new GdkRectangle (); |
|---|
| | 2976 | GdkRectangle rect; |
|---|
| 3001 | 2977 | if (redrawAll) { |
|---|
| 3002 | 2978 | int w, h; |
|---|
| … | … | |
| 3010 | 2986 | rect.height = height; |
|---|
| 3011 | 2987 | } |
|---|
| 3012 | | OS.gdk_window_invalidate_rect (window, rect, all); |
|---|
| 3013 | | } |
|---|
| 3014 | | |
|---|
| 3015 | | void release (bool destroy) { |
|---|
| | 2988 | OS.gdk_window_invalidate_rect (window, &rect, all); |
|---|
| | 2989 | } |
|---|
| | 2990 | |
|---|
| | 2991 | override void release (bool destroy) { |
|---|
| 3016 | 2992 | Control next = null, previous = null; |
|---|
| 3017 | 2993 | if (destroy && parent !is null) { |
|---|
| … | … | |
| 3033 | 3009 | } |
|---|
| 3034 | 3010 | |
|---|
| 3035 | | void releaseHandle () { |
|---|
| | 3011 | override void releaseHandle () { |
|---|
| 3036 | 3012 | super.releaseHandle (); |
|---|
| 3037 | 3013 | fixedHandle = null; |
|---|
| … | … | |
| 3039 | 3015 | } |
|---|
| 3040 | 3016 | |
|---|
| 3041 | | void releaseParent () { |
|---|
| | 3017 | override void releaseParent () { |
|---|
| 3042 | 3018 | parent.removeControl (this); |
|---|
| 3043 | 3019 | } |
|---|
| 3044 | 3020 | |
|---|
| 3045 | | void releaseWidget () { |
|---|
| | 3021 | override void releaseWidget () { |
|---|
| 3046 | 3022 | super.releaseWidget (); |
|---|
| 3047 | 3023 | if (display.currentControl is this) display.currentControl = null; |
|---|
| … | … | |
| 3219 | 3195 | if (ptr !is null) OS.g_free (ptr); |
|---|
| 3220 | 3196 | char[] name = color is null ? "<parent>" : "<none>" ; |
|---|
| 3221 | | char* pname = toStringz( name ); |
|---|
| 3222 | 3197 | ptr = cast(char*)OS.g_malloc (name.length+1); |
|---|
| 3223 | | memmove (ptr, pname, name.length+1); |
|---|
| | 3198 | ptr[ 0 .. name.length ] = name; |
|---|
| | 3199 | ptr[ name.length ] = '\0'; |
|---|
| 3224 | 3200 | OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr); |
|---|
| 3225 | 3201 | OS.gtk_rc_style_set_bg (style, index, color); |
|---|
| … | … | |
| 3402 | 3378 | auto window = OS.GTK_WIDGET_WINDOW (parentHandle); |
|---|
| 3403 | 3379 | Rectangle rect = getBounds (); |
|---|
| 3404 | | GdkWindowAttr* attributes = new GdkWindowAttr (); |
|---|
| | 3380 | GdkWindow |
|---|