diff --git a/gb.qt4/src/CWidget.cpp b/gb.qt4/src/CWidget.cpp index e0223cde3..9b054e424 100644 --- a/gb.qt4/src/CWidget.cpp +++ b/gb.qt4/src/CWidget.cpp @@ -417,6 +417,14 @@ void CWIDGET_move(void *_object, int x, int y) { QWidget *wid = get_widget(THIS); + if (GB.Is(THIS, CLASS_Window)) + { + CWINDOW *win = (CWINDOW *)_object; + win->x = x; + win->y = y; + win->mustCenter = false; + } + if (wid) { if (x == wid->x() && y == wid->y()) @@ -425,15 +433,10 @@ void CWIDGET_move(void *_object, int x, int y) wid->move(x, y); } - if (GB.Is(THIS, CLASS_Window)) - { - ((CWINDOW *)_object)->x = x; - ((CWINDOW *)_object)->y = y; - } - CWIDGET_after_geometry_change(THIS, false); } +/* void CWIDGET_move_cached(void *_object, int x, int y) { if (GB.Is(THIS, CLASS_Window)) @@ -444,6 +447,7 @@ void CWIDGET_move_cached(void *_object, int x, int y) CWIDGET_after_geometry_change(THIS, false); } +*/ void CWIDGET_resize(void *_object, int w, int h) { @@ -492,6 +496,7 @@ void CWIDGET_resize(void *_object, int w, int h) CWIDGET_after_geometry_change(THIS, true); } +/* void CWIDGET_resize_cached(void *_object, int w, int h) { if (GB.Is(THIS, CLASS_Window)) @@ -502,12 +507,31 @@ void CWIDGET_resize_cached(void *_object, int w, int h) CWIDGET_after_geometry_change(THIS, true); } - +*/ void CWIDGET_move_resize(void *_object, int x, int y, int w, int h) { QWidget *wid = get_widget(THIS); + if (wid) + { + if (w < 0) + w = wid->width(); + + if (h < 0) + h = wid->height(); + } + + if (GB.Is(THIS, CLASS_Window)) + { + CWINDOW *win = (CWINDOW *)_object; + win->x = x; + win->y = y; + win->w = w; + win->h = h; + win->mustCenter = false; + } + if (wid) { if (w < 0) @@ -528,14 +552,6 @@ void CWIDGET_move_resize(void *_object, int x, int y, int w, int h) wid->setGeometry(x, y, qMax(0, w), qMax(0, h)); } - if (GB.Is(THIS, CLASS_Window)) - { - ((CWINDOW *)_object)->x = x; - ((CWINDOW *)_object)->y = y; - ((CWINDOW *)_object)->w = w; - ((CWINDOW *)_object)->h = h; - } - CWIDGET_after_geometry_change(THIS, true); } @@ -577,6 +593,7 @@ void CWIDGET_move_resize(void *_object, int x, int y, int w, int h) } #endif +/* void CWIDGET_move_resize_cached(void *_object, int x, int y, int w, int h) { if (GB.Is(THIS, CLASS_Window)) @@ -589,6 +606,7 @@ void CWIDGET_move_resize_cached(void *_object, int x, int y, int w, int h) CWIDGET_after_geometry_change(THIS, true); } +*/ void CWIDGET_check_hovered() { diff --git a/gb.qt4/src/CWindow.cpp b/gb.qt4/src/CWindow.cpp index f693df8f6..5d6e1c7a1 100644 --- a/gb.qt4/src/CWindow.cpp +++ b/gb.qt4/src/CWindow.cpp @@ -698,6 +698,7 @@ END_METHOD BEGIN_METHOD_VOID(CWINDOW_show_modal) THIS->ret = 0; + THIS->mustCenter = true; if (!emit_open_event(THIS)) { @@ -1574,7 +1575,6 @@ MyMainWindow::MyMainWindow(QWidget *parent, const char *name, bool embedded) : _border = true; _resizable = true; //state = StateNormal; - mustCenter = false; _deleted = false; _type = _NET_WM_WINDOW_TYPE_NORMAL; _enterLoop = false; @@ -1828,8 +1828,6 @@ void MyMainWindow::showModal(void) old = MyApplication::eventLoop; MyApplication::eventLoop = &eventLoop; - mustCenter = true; - #ifndef NO_X_WINDOW if (CWINDOW_Active) X11_set_transient_for(winId(), CWINDOW_Active->widget.widget->winId()); @@ -2466,10 +2464,10 @@ void MyMainWindow::center(bool force = false) QPoint p; QRect r; - if (!force && !mustCenter) + if (!force && !THIS->mustCenter) return; - mustCenter = false; + THIS->mustCenter = false; r = QApplication::desktop()->availableGeometry(QApplication::desktop()->screenNumber(this)); diff --git a/gb.qt4/src/CWindow.h b/gb.qt4/src/CWindow.h index 2d3dd9a48..e97741117 100644 --- a/gb.qt4/src/CWindow.h +++ b/gb.qt4/src/CWindow.h @@ -80,11 +80,11 @@ typedef unsigned minsize : 1; unsigned title : 1; unsigned stateChange : 1; - //unsigned opening : 1; unsigned closing : 1; unsigned hideMenuBar : 1; unsigned showMenuBar : 1; unsigned sticky : 1; + unsigned mustCenter : 1; } CWINDOW; @@ -156,7 +156,6 @@ private: QSizeGrip *sg; QMenuBar *mb; - bool mustCenter; bool _activate; bool _border; bool _resizable;