Mercurial > projects > dwt-linux
diff dwt/widgets/Control.d @ 58:a5c274fa5af9
extended helloworld crashing
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 12 Jan 2008 07:02:08 +0100 |
parents | 93981635e709 |
children | 8cec8f536af3 |
line wrap: on
line diff
--- a/dwt/widgets/Control.d Sat Jan 12 01:53:16 2008 +0100 +++ b/dwt/widgets/Control.d Sat Jan 12 07:02:08 2008 +0100 @@ -52,7 +52,6 @@ import dwt.accessibility.Accessible; import Math = tango.math.Math; -import tango.stdc.string; import tango.stdc.stringz; import tango.core.Thread; import tango.io.Stdout; @@ -131,7 +130,7 @@ return display.getSystemFont ().handle; } -void deregister () { +override void deregister () { super.deregister (); if (fixedHandle !is null) display.removeWidget (fixedHandle); auto imHandle = imHandle (); @@ -179,7 +178,7 @@ OS.GTK_WIDGET_UNSET_FLAGS (focusHandle, OS.GTK_CAN_FOCUS); } -void fixStyle () { +public void fixStyle () { if (fixedHandle !is null) fixStyle (fixedHandle); } @@ -198,9 +197,9 @@ if ((state & BACKGROUND) !is 0) return; auto childStyle = parent.childStyle (); if (childStyle !is null) { - GdkColor* color = new GdkColor(); - OS.gtk_style_get_bg (childStyle, 0, color); - OS.gtk_widget_modify_bg (handle, 0, color); + GdkColor color; + OS.gtk_style_get_bg (childStyle, 0, &color); + OS.gtk_widget_modify_bg (handle, 0, &color); } } @@ -216,7 +215,7 @@ return this is display.getFocusControl(); } -void hookEvents () { +override void hookEvents () { /* Connect the keyboard signals */ auto focusHandle = focusHandle (); int focusMask = OS.GDK_KEY_PRESS_MASK | OS.GDK_KEY_RELEASE_MASK | OS.GDK_FOCUS_CHANGE_MASK; @@ -290,7 +289,7 @@ OS.g_signal_connect_closure_by_id (topHandle, display.signalIds [MAP], 0, display.closures [MAP], true); } -int /*long*/ hoverProc (int /*long*/ widget) { +override int /*long*/ hoverProc (GtkWidget* widget) { int x, y; int mask; OS.gdk_window_get_pointer (null, &x, &y, &mask); @@ -299,7 +298,7 @@ return 0; } -GtkWidget* topHandle() { +override GtkWidget* topHandle() { if (fixedHandle !is null) return fixedHandle; return super.topHandle (); } @@ -314,7 +313,7 @@ return paintHandle; } -GdkWindow* paintWindow () { +override GdkWindow* paintWindow () { auto paintHandle = paintHandle (); OS.gtk_widget_realize (paintHandle); return OS.GTK_WIDGET_WINDOW (paintHandle); @@ -417,7 +416,7 @@ return parent.childStyle (); } -void createWidget (int index) { +override void createWidget (int index) { state |= DRAG_DETECT; checkOrientation (parent); super.createWidget (index); @@ -475,16 +474,16 @@ Point computeNativeSize (GtkWidget* h, int wHint, int hHint, bool changed) { int width = wHint, height = hHint; if (wHint is SWT.DEFAULT && hHint is SWT.DEFAULT) { - GtkRequisition* requisition = new GtkRequisition (); - gtk_widget_size_request (h, requisition); + GtkRequisition requisition; + gtk_widget_size_request (h, &requisition); width = OS.GTK_WIDGET_REQUISITION_WIDTH (h); height = OS.GTK_WIDGET_REQUISITION_HEIGHT (h); } else if (wHint is SWT.DEFAULT || hHint is SWT.DEFAULT) { int reqWidth, reqHeight; OS.gtk_widget_get_size_request (h, &reqWidth, &reqHeight); OS.gtk_widget_set_size_request (h, wHint, hHint); - GtkRequisition* requisition = new GtkRequisition (); - gtk_widget_size_request (h, requisition); + GtkRequisition requisition; + gtk_widget_size_request (h, &requisition); OS.gtk_widget_set_size_request (h, reqWidth, reqHeight); width = wHint is SWT.DEFAULT ? requisition.width : wHint; height = hHint is SWT.DEFAULT ? requisition.height : hHint; @@ -499,14 +498,14 @@ * must be preceded by a call to gtk_widget_size_request(). */ auto topHandle = topHandle (); - GtkRequisition* requisition = new GtkRequisition (); - gtk_widget_size_request (topHandle, requisition); - GtkAllocation* allocation = new GtkAllocation (); + GtkRequisition requisition; + gtk_widget_size_request (topHandle, &requisition); + GtkAllocation allocation; allocation.x = OS.GTK_WIDGET_X (topHandle); allocation.y = OS.GTK_WIDGET_Y (topHandle); allocation.width = OS.GTK_WIDGET_WIDTH (topHandle); allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle); - OS.gtk_widget_size_allocate (topHandle, allocation); + OS.gtk_widget_size_allocate (topHandle, &allocation); } /** @@ -674,9 +673,9 @@ * all calls to gtk_widget_size_allocate() must be preceded by * a call to gtk_widget_size_request(). */ - GtkRequisition* requisition = new GtkRequisition (); - gtk_widget_size_request (topHandle, requisition); - GtkAllocation* allocation = new GtkAllocation (); + GtkRequisition requisition; + gtk_widget_size_request (topHandle, &requisition); + GtkAllocation allocation; if (move) { allocation.x = x; allocation.y = y; @@ -691,7 +690,7 @@ allocation.width = OS.GTK_WIDGET_WIDTH (topHandle); allocation.height = OS.GTK_WIDGET_HEIGHT (topHandle); } - OS.gtk_widget_size_allocate (topHandle, allocation); + OS.gtk_widget_size_allocate (topHandle, &allocation); } /* * Bug in GTK. Widgets cannot be sized smaller than 1x1. @@ -841,6 +840,8 @@ auto parentHandle = parent.parentingHandle (); Stdout.formatln( "setRelations {:x}", cast(uint)parentHandle ); + Stdout.formatln( "showWidget gtk_container_get_children {:x}", parentHandle ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentHandle) ); auto list = OS.gtk_container_get_children (cast(GtkContainer*)parentHandle); if (list is null) return; int count = OS.g_list_length (list); @@ -1839,7 +1840,7 @@ return sendDragEvent (button, stateMask, x, y, true); } -bool dragDetect (int x, int y, bool filter, bool [] consume) { +bool dragDetect (int x, int y, bool filter, bool* consume) { bool quit = false, dragging = false; while (!quit) { GdkEvent* eventPtr; @@ -1848,13 +1849,12 @@ if (eventPtr !is null) { break; } else { - try {Thread.sleep(50);} catch (Exception ex) {} + try {Thread.sleep(0.050);} catch (Exception ex) {} } } switch (cast(int)OS.GDK_EVENT_TYPE (eventPtr)) { case OS.GDK_MOTION_NOTIFY: { - GdkEventMotion* gdkMotionEvent = new GdkEventMotion (); - memmove (gdkMotionEvent, eventPtr, GdkEventMotion.sizeof); + GdkEventMotion* gdkMotionEvent = cast(GdkEventMotion*)eventPtr; if ((gdkMotionEvent.state & OS.GDK_BUTTON1_MASK) !is 0) { if (OS.gtk_drag_check_threshold (handle, x, y, cast(int) gdkMotionEvent.x, cast(int) gdkMotionEvent.y)) { dragging = true; @@ -1869,8 +1869,7 @@ } case OS.GDK_KEY_PRESS: case OS.GDK_KEY_RELEASE: { - GdkEventKey* gdkEvent = new GdkEventKey (); - memmove (gdkEvent, eventPtr, GdkEventKey.sizeof); + GdkEventKey* gdkEvent = cast(GdkEventKey*)eventPtr; if (gdkEvent.keyval is OS.GDK_Escape) quit = true; break; } @@ -1913,7 +1912,7 @@ oldDecorations.fixDecorations (newDecorations, this, menus); } -int /*long*/ fixedMapProc (GtkWidget* widget) { +override int /*long*/ fixedMapProc (GtkWidget* widget) { OS.GTK_WIDGET_SET_FLAGS (widget, OS.GTK_MAPPED); auto widgetList = OS.gtk_container_get_children (cast(GtkContainer*)widget); if (widgetList !is null) { @@ -2211,8 +2210,8 @@ auto screen = OS.gdk_screen_get_default (); if (screen !is null) { int monitorNumber = OS.gdk_screen_get_monitor_at_window (screen, paintWindow ()); - GdkRectangle* dest = new GdkRectangle (); - OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, dest); + GdkRectangle dest; + OS.gdk_screen_get_monitor_geometry (screen, monitorNumber, &dest); monitor = new dwt.widgets.Monitor.Monitor (); monitor.handle = monitorNumber; monitor.x = dest.x; @@ -2333,9 +2332,7 @@ return (state & HIDDEN) is 0; } -override int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* event) { - GdkEventButton* gdkEvent = new GdkEventButton (); - memmove (gdkEvent, event, GdkEventButton.sizeof); +override int /*long*/ gtk_button_press_event (GtkWidget* widget, GdkEventButton* gdkEvent) { if (gdkEvent.type is OS.GDK_3BUTTON_PRESS) return 0; /* * When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS, @@ -2360,10 +2357,10 @@ bool dragging = false; if ((state & DRAG_DETECT) !is 0 && hooks (SWT.DragDetect)) { if (gdkEvent.button is 1) { - bool [] consume = new bool [1]; - if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, consume)) { + bool consume = false; + if (dragDetect (cast(int) gdkEvent.x, cast(int) gdkEvent.y, true, &consume)) { dragging = true; - if (consume [0]) result = 1; + if (consume ) result = 1; } if (isDisposed ()) return 1; } @@ -2397,9 +2394,7 @@ return result; } -override int /*long*/ gtk_button_release_event (GtkWidget* widget, GdkEventButton* event) { - GdkEventButton* gdkEvent = new GdkEventButton (); - memmove (gdkEvent, event, GdkEventButton.sizeof); +override int /*long*/ gtk_button_release_event (GtkWidget* widget, GdkEventButton* gdkEvent) { /* * Feature in GTK. When button 4, 5, 6, or 7 is released, GTK * does not deliver a corresponding GTK event. Button 6 and 7 @@ -2424,10 +2419,8 @@ return 0; } -override int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* event) { +override int /*long*/ gtk_enter_notify_event (GtkWidget* widget, GdkEventCrossing* gdkEvent) { if (display.currentControl is this) return 0; - GdkEventCrossing* gdkEvent = new GdkEventCrossing (); - memmove (gdkEvent, event, GdkEventCrossing.sizeof); if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0; if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0; if (display.currentControl !is null && !display.currentControl.isDisposed ()) { @@ -2442,9 +2435,7 @@ } override int /*long*/ gtk_event_after (GtkWidget* widget, GdkEvent* gdkEvent) { - GdkEvent* event = new GdkEvent (); - memmove (event, gdkEvent, GdkEvent.sizeof); - switch (cast(int)event.type) { + switch (cast(int)gdkEvent.type) { case OS.GDK_BUTTON_PRESS: { if (widget !is eventHandle ()) break; /* @@ -2453,8 +2444,7 @@ * such as GtkTreeView to select items before a menu is shown. */ if ((state & MENU) is 0) { - GdkEventButton* gdkEventButton = new GdkEventButton (); - memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof); + GdkEventButton* gdkEventButton = cast(GdkEventButton*)gdkEvent; if (gdkEventButton.button is 3) { showMenu (cast(int) gdkEventButton.x_root, cast(int) gdkEventButton.y_root); } @@ -2463,8 +2453,7 @@ } case OS.GDK_FOCUS_CHANGE: { if (widget !is focusHandle ()) break; - GdkEventFocus* gdkEventFocus = new GdkEventFocus (); - memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof); + GdkEventFocus* gdkEventFocus = cast(GdkEventFocus*)gdkEvent; /* * Feature in GTK. The GTK combo box popup under some window managers @@ -2498,11 +2487,9 @@ return 0; } -override int /*long*/ gtk_expose_event (GtkWidget* widget, GdkEventExpose* eventPtr) { +override int /*long*/ gtk_expose_event (GtkWidget* widget, GdkEventExpose* gdkEvent) { if ((state & OBSCURED) !is 0) return 0; if (!hooks (SWT.Paint) && !filters (SWT.Paint)) return 0; - GdkEventExpose* gdkEvent = new GdkEventExpose (); - memmove(gdkEvent, eventPtr, GdkEventExpose.sizeof); Event event = new Event (); event.count = gdkEvent.count; event.x = gdkEvent.area.x; @@ -2555,23 +2542,21 @@ return 0; } -override int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* event) { +override int /*long*/ gtk_key_press_event (GtkWidget* widget, GdkEventKey* gdkEvent) { if (!hasFocus ()) return 0; - GdkEventKey* gdkEvent = new GdkEventKey (); - memmove (gdkEvent, event, GdkEventKey.sizeof); if (translateMnemonic (gdkEvent.keyval, gdkEvent)) return 1; // widget could be disposed at this point if (isDisposed ()) return 0; - if (filterKey (gdkEvent.keyval, event)) return 1; + if (filterKey (gdkEvent.keyval, gdkEvent)) return 1; // widget could be disposed at this point if (isDisposed ()) return 0; if (translateTraversal (gdkEvent)) return 1; // widget could be disposed at this point if (isDisposed ()) return 0; - return super.gtk_key_press_event (widget, event); + return super.gtk_key_press_event (widget, gdkEvent); } override int /*long*/ gtk_key_release_event (GtkWidget* widget, GdkEventKey* event) { @@ -2583,13 +2568,11 @@ return super.gtk_key_release_event (widget, event); } -override int /*long*/ gtk_leave_notify_event (GtkWidget* widget, GdkEventCrossing* event) { +override int /*long*/ gtk_leave_notify_event (GtkWidget* widget, GdkEventCrossing* gdkEvent) { if (display.currentControl !is this) return 0; display.removeMouseHoverTimeout (handle); int result = 0; if (sendLeaveNotify () || display.getCursorControl () is null) { - GdkEventCrossing* gdkEvent = new GdkEventCrossing (); - memmove (gdkEvent, event, GdkEventCrossing.sizeof); if (gdkEvent.mode !is OS.GDK_CROSSING_NORMAL && gdkEvent.mode !is OS.GDK_CROSSING_UNGRAB) return 0; if ((gdkEvent.state & (OS.GDK_BUTTON1_MASK | OS.GDK_BUTTON2_MASK | OS.GDK_BUTTON3_MASK)) !is 0) return 0; result = sendMouseEvent (SWT.MouseExit, 0, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1; @@ -2602,8 +2585,7 @@ int result = 0; auto eventPtr = OS.gtk_get_current_event (); if (eventPtr !is null) { - GdkEventKey* keyEvent = new GdkEventKey (); - memmove (keyEvent, eventPtr, GdkEventKey.sizeof); + GdkEventKey* keyEvent = cast(GdkEventKey*)eventPtr; if (keyEvent.type is OS.GDK_KEY_PRESS) { Control focusControl = display.getFocusControl (); auto focusHandle = focusControl !is null ? focusControl.focusHandle () : null; @@ -2619,9 +2601,7 @@ return result; } -override int /*long*/ gtk_motion_notify_event (GtkWidget* widget, GdkEventMotion* event) { - GdkEventMotion* gdkEvent = new GdkEventMotion (); - memmove (gdkEvent, event, GdkEventMotion.sizeof); +override int /*long*/ gtk_motion_notify_event (GtkWidget* widget, GdkEventMotion* gdkEvent) { if (this is display.currentControl && (hooks (SWT.MouseHover) || filters (SWT.MouseHover))) { display.addMouseHoverTimeout (handle); } @@ -2665,9 +2645,7 @@ return 0; } -override int /*long*/ gtk_scroll_event (GtkWidget* widget, GdkEventScroll* eventPtr) { - GdkEventScroll* gdkEvent = new GdkEventScroll (); - memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof); +override int /*long*/ gtk_scroll_event (GtkWidget* widget, GdkEventScroll* gdkEvent) { switch (cast(int)gdkEvent.direction) { case OS.GDK_SCROLL_UP: return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1; @@ -2700,9 +2678,7 @@ return 0; } -override int /*long*/ gtk_visibility_notify_event (GtkWidget* widget, GdkEventVisibility* event) { - GdkEventVisibility* gdkEvent = new GdkEventVisibility (); - memmove (gdkEvent, event, GdkEventVisibility.sizeof); +override int /*long*/ gtk_visibility_notify_event (GtkWidget* widget, GdkEventVisibility* gdkEvent) { auto paintWindow = paintWindow(); auto window = gdkEvent.window; if (window is paintWindow) { @@ -2712,10 +2688,10 @@ if ((state & OBSCURED) !is 0) { int width, height; OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &width, &height); - GdkRectangle* rect = new GdkRectangle (); + GdkRectangle rect; rect.width = width; rect.height = height; - OS.gdk_window_invalidate_rect (window, rect, false); + OS.gdk_window_invalidate_rect (window, &rect, false); } state &= ~OBSCURED; } @@ -2918,7 +2894,7 @@ return false; } -void register () { +override void register () { super.register (); if (fixedHandle !is null) display.addWidget (fixedHandle, this); auto imHandle = imHandle (); @@ -2997,7 +2973,7 @@ void redrawWidget (int x, int y, int width, int height, bool redrawAll, bool all, bool trim) { if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) is 0) return; auto window = paintWindow (); - GdkRectangle* rect = new GdkRectangle (); + GdkRectangle rect; if (redrawAll) { int w, h; OS.gdk_drawable_get_size (cast(GdkDrawable*)window, &w, &h); @@ -3009,10 +2985,10 @@ rect.width = width; rect.height = height; } - OS.gdk_window_invalidate_rect (window, rect, all); + OS.gdk_window_invalidate_rect (window, &rect, all); } -void release (bool destroy) { +override void release (bool destroy) { Control next = null, previous = null; if (destroy && parent !is null) { Control[] children = parent._getChildren (); @@ -3032,17 +3008,17 @@ } } -void releaseHandle () { +override void releaseHandle () { super.releaseHandle (); fixedHandle = null; parent = null; } -void releaseParent () { +override void releaseParent () { parent.removeControl (this); } -void releaseWidget () { +override void releaseWidget () { super.releaseWidget (); if (display.currentControl is this) display.currentControl = null; display.removeMouseHoverTimeout (handle); @@ -3218,9 +3194,9 @@ auto ptr = OS.gtk_rc_style_get_bg_pixmap_name (style, index); if (ptr !is null) OS.g_free (ptr); char[] name = color is null ? "<parent>" : "<none>" ; - char* pname = toStringz( name ); ptr = cast(char*)OS.g_malloc (name.length+1); - memmove (ptr, pname, name.length+1); + ptr[ 0 .. name.length ] = name; + ptr[ name.length ] = '\0'; OS.gtk_rc_style_set_bg_pixmap_name (style, index, ptr); OS.gtk_rc_style_set_bg (style, index, color); int flags = OS.gtk_rc_style_get_color_flags (style, index); @@ -3401,7 +3377,7 @@ auto parentHandle = parent.parentingHandle (); auto window = OS.GTK_WIDGET_WINDOW (parentHandle); Rectangle rect = getBounds (); - GdkWindowAttr* attributes = new GdkWindowAttr (); + GdkWindowAttr attributes; attributes.x = rect.x; attributes.y = rect.y; attributes.width = rect.width; @@ -3409,7 +3385,7 @@ attributes.event_mask = (0xFFFFFFFF & ~OS.ExposureMask); attributes.wclass = OS.GDK_INPUT_ONLY; attributes.window_type = OS.GDK_WINDOW_CHILD; - enableWindow = OS.gdk_window_new (window, attributes, OS.GDK_WA_X | OS.GDK_WA_Y); + enableWindow = OS.gdk_window_new (window, &attributes, OS.GDK_WA_X | OS.GDK_WA_Y); if (enableWindow !is null) { auto topHandle = topHandle (); OS.gdk_window_set_user_data (enableWindow, parentHandle); @@ -3421,10 +3397,10 @@ auto xWindow = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)enableWindow); int xScreen = OS.XDefaultScreen (xDisplay); int flags = OS.CWStackMode | OS.CWSibling; - XWindowChanges* changes = new XWindowChanges (); + XWindowChanges changes; changes.sibling = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)topWindow); changes.stack_mode = OS.Above; - OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes); + OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, &changes); } if (OS.GTK_WIDGET_VISIBLE (topHandle)) OS.gdk_window_show_unraised (enableWindow); } @@ -3553,6 +3529,8 @@ resizeHandle (1, 1); forceResize (); } + Stdout.formatln( "{}: setInitialBounds gtk_container_get_children {:x}", __LINE__, parent.parentingHandle() ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parent.parentingHandle()) ); } /** @@ -3593,7 +3571,7 @@ this.menu = menu; } -void setOrientation () { +override void setOrientation () { if ((style & SWT.RIGHT_TO_LEFT) !is 0) { if (handle !is null) OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL); if (fixedHandle !is null) OS.gtk_widget_set_direction (fixedHandle, OS.GTK_TEXT_DIR_RTL); @@ -3696,12 +3674,12 @@ if ((OS.GTK_WIDGET_FLAGS (handle) & OS.GTK_REALIZED) !is 0) { auto window = paintWindow (); Rectangle rect = getBounds (); - GdkWindowAttr* attributes = new GdkWindowAttr (); + GdkWindowAttr attributes; attributes.width = rect.width; attributes.height = rect.height; attributes.event_mask = OS.GDK_EXPOSURE_MASK; attributes.window_type = OS.GDK_WINDOW_CHILD; - redrawWindow = OS.gdk_window_new (window, attributes, 0); + redrawWindow = OS.gdk_window_new (window, &attributes, 0); if (redrawWindow !is null) { int mouseMask = OS.GDK_BUTTON_PRESS_MASK | OS.GDK_BUTTON_RELEASE_MASK | OS.GDK_ENTER_NOTIFY_MASK | OS.GDK_LEAVE_NOTIFY_MASK | @@ -3869,7 +3847,7 @@ OS.gdk_window_lower (window); } } else { - XWindowChanges* changes = new XWindowChanges (); + XWindowChanges changes; changes.sibling = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)(siblingWindow !is null ? siblingWindow : redrawWindow)); changes.stack_mode = above ? OS.Above : OS.Below; if (redrawWindow !is null && siblingWindow is null) changes.stack_mode = OS.Below; @@ -3886,24 +3864,34 @@ * When the receiver is not a top level shell, XReconfigureWMWindow () * behaves the same as XConfigureWindow (). */ - OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes); + OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, &changes); if (enableWindow !is null) { changes.sibling = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)window); changes.stack_mode = OS.Above; xWindow = OS.gdk_x11_drawable_get_xid (cast(GdkDrawable*)enableWindow); - OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, changes); + OS.XReconfigureWMWindow (xDisplay, xWindow, xScreen, flags, &changes); } } } + Stdout.formatln( "{}: setZOrder gtk_container_get_children {:x}", __LINE__, parent.parentingHandle() ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parent.parentingHandle()) ); if (fixChildren) { if (above) { + Stdout.formatln( "{}: setZOrder gtk_container_get_children {:x}", __LINE__, parent.parentingHandle() ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parent.parentingHandle()) ); parent.moveAbove (topHandle, siblingHandle); } else { + Stdout.formatln( "{}: setZOrder gtk_container_get_children {:x}", __LINE__, parent.parentingHandle() ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parent.parentingHandle()) ); parent.moveBelow (topHandle, siblingHandle); } } + Stdout.formatln( "{}: setZOrder gtk_container_get_children {:x}", __LINE__, parent.parentingHandle() ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parent.parentingHandle()) ); /* Make sure that the parent internal windows are on the bottom of the stack */ if (!above && fixChildren) parent.fixZOrder (); + Stdout.formatln( "{}: setZOrder gtk_container_get_children {:x}", __LINE__, parent.parentingHandle() ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parent.parentingHandle()) ); if (fixRelations) { /* determine the receiver's new index in the parent */ @@ -3973,8 +3961,11 @@ auto topHandle = topHandle (); auto parentHandle = parent.parentingHandle (); parent.setParentWindow (topHandle); + Stdout.formatln( "showWidget {:x} {}", parentHandle, topHandle ); + Stdout.formatln( "showWidget gtk_container_get_children {:x}", parentHandle ); + Stdout.formatln( "=> {}", OS.gtk_container_get_children (cast(GtkContainer*)parentHandle) ); OS.gtk_container_add (cast(GtkContainer*)parentHandle, topHandle); - if (handle !is null && handle !is topHandle) OS.gtk_widget_show (handle); + if (handle !is null && handle !is topHandle) OS.gtk_widget_show (handle); if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) is 0) { if (fixedHandle !is null) OS.gtk_widget_show (fixedHandle); } @@ -4254,14 +4245,13 @@ /* Do nothing */ } -int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { +override int /*long*/ windowProc (GtkWidget* handle, int /*long*/ arg0, int /*long*/ user_data) { switch (cast(int)/*64*/user_data) { case EXPOSE_EVENT_INVERSE: { if ((OS.GTK_VERSION < OS.buildVERSION (2, 8, 0)) && ((state & OBSCURED) is 0)) { Control control = findBackgroundControl (); if (control !is null && control.backgroundImage !is null) { - GdkEventExpose* gdkEvent = new GdkEventExpose (); - memmove (gdkEvent, cast(void*)arg0, GdkEventExpose.sizeof); + GdkEventExpose* gdkEvent = cast(GdkEventExpose*)arg0; auto paintWindow = paintWindow(); auto window = gdkEvent.window; if (window !is paintWindow) break;