diff --git a/gb.gtk/src/gapplication.cpp b/gb.gtk/src/gapplication.cpp index 4aed863f6..c20ad5a92 100644 --- a/gb.gtk/src/gapplication.cpp +++ b/gb.gtk/src/gapplication.cpp @@ -511,18 +511,11 @@ __FOUND_WIDGET: case GDK_2BUTTON_PRESS: case GDK_BUTTON_RELEASE: { - save_control = control = find_child(control, (int)event->button.x_root, (int)event->button.y_root, button_grab); - /*if (event->type == GDK_BUTTON_PRESS) fprintf(stderr, "GDK_BUTTON_PRESS: %p / %p\n", control, button_grab); else if (event->type == GDK_BUTTON_RELEASE) fprintf(stderr, "GDK_BUTTON_RELEASE: %p / %p\n", control, button_grab);*/ - if (!control) - goto __HANDLE_EVENT; - - bool menu = false; - switch ((int)event->type) { case GDK_BUTTON_PRESS: type = gEvent_MousePress; break; @@ -530,6 +523,24 @@ __FOUND_WIDGET: default: type = gEvent_MouseRelease; break; } + save_control = find_child(control, (int)event->button.x_root, (int)event->button.y_root, button_grab); + + if (!save_control) + { + if (type == gEvent_MousePress && control->isTopLevel()) + { + gMainWindow *win = ((gMainWindow *)control); + if (win->isPopup()) + win->close(); + } + + goto __HANDLE_EVENT; + } + + control = save_control; + + bool menu = false; + if (event->type != GDK_BUTTON_RELEASE) { if (control->canFocus() && !control->hasFocus()) @@ -580,7 +591,7 @@ __FOUND_WIDGET: } } - if (type == gEvent_MousePress && control->isTopLevel()) + /*if (type == gEvent_MousePress && control->isTopLevel()) { gMainWindow *win = ((gMainWindow *)control); if (win->isPopup()) @@ -595,7 +606,7 @@ __FOUND_WIDGET: win->close(); } } - else if (type == gEvent_MouseRelease && control->_grab) + else*/ if (type == gEvent_MouseRelease && control->_grab) { gApplication::exitLoop(control); } @@ -1098,7 +1109,7 @@ void gApplication::setBusy(bool b) iter = g_list_next(iter); } - MAIN_do_iteration_just_events(); + //MAIN_do_iteration_just_events(); } static bool _dirty = false; diff --git a/gb.gtk/src/gcontrol.cpp b/gb.gtk/src/gcontrol.cpp index 416c9d5c1..69d6c39d2 100644 --- a/gb.gtk/src/gcontrol.cpp +++ b/gb.gtk/src/gcontrol.cpp @@ -873,7 +873,7 @@ void gControl::updateCursor(GdkCursor *cursor) GdkCursor *gControl::getGdkCursor() { - GdkPixbuf *pix; + const char *name; GdkCursor *cr = NULL; int m = _mouse; @@ -888,9 +888,36 @@ GdkCursor *gControl::getGdkCursor() if (m != CURSOR_DEFAULT) { + switch(m) + { + case GDK_BLANK_CURSOR: name = "none"; break; + case GDK_LEFT_PTR: name = "default"; break; + case GDK_CROSSHAIR: name = "crosshair"; break; + case GDK_WATCH: name = "wait"; break; + case GDK_XTERM: name = "text"; break; + case GDK_FLEUR: name = "move"; break; + case GDK_SB_H_DOUBLE_ARROW: name = "ew-resize"; break; + case GDK_SB_V_DOUBLE_ARROW: name = "ns-resize"; break; + case GDK_TOP_SIDE: name = "n-resize"; break; + case GDK_BOTTOM_SIDE: name = "s-resize"; break; + case GDK_LEFT_SIDE: name = "w-resize"; break; + case GDK_RIGHT_SIDE: name = "e-resize"; break; + case GDK_TOP_LEFT_CORNER: name = "nw-resize"; break; + case GDK_BOTTOM_RIGHT_CORNER: name = "se-resize"; break; + case GDK_TOP_RIGHT_CORNER: name = "ne-resize"; break; + case GDK_BOTTOM_LEFT_CORNER: name = "sw-resize"; break; + case GDK_LAST_CURSOR+1: name = "nwse-resize"; break; + case GDK_LAST_CURSOR+2: name = "nesw-resize"; break; + case GDK_HAND2: name = "pointer"; break; + default: name = "default"; + } + + cr = gdk_cursor_new_from_name(gdk_display_get_default(), name); + + /* if (m < GDK_LAST_CURSOR) { - cr = gdk_cursor_new((GdkCursorType)m); + cr = gdk_cursor_new_for_display(gdk_display_get_default(), (GdkCursorType)m); } else { @@ -906,7 +933,7 @@ GdkCursor *gControl::getGdkCursor() cr = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pix, 8, 8); g_object_unref(pix); } - } + }*/ } return cr;