diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Double_Window.cxx | 9 | ||||
| -rw-r--r-- | src/Fl_Window.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 41 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 25 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 28 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 1 |
9 files changed, 60 insertions, 54 deletions
diff --git a/src/Fl_Double_Window.cxx b/src/Fl_Double_Window.cxx index 701f53274..05b6a5c78 100644 --- a/src/Fl_Double_Window.cxx +++ b/src/Fl_Double_Window.cxx @@ -51,11 +51,6 @@ void Fl_Double_Window::show() { } -/*char fl_can_do_alpha_blending() { - return Fl_Display_Device::display_device()->driver()->can_do_alpha_blending(); -}*/ - - void Fl_Double_Window::resize(int X,int Y,int W,int H) { int ow = w(); int oh = h(); @@ -65,6 +60,7 @@ void Fl_Double_Window::resize(int X,int Y,int W,int H) { driver()->destroy_double_buffer(); } + void Fl_Double_Window::hide() { Fl_X *myi = Fl_X::i(this); if (myi && myi->other_xid) { @@ -89,9 +85,6 @@ Fl_Double_Window::~Fl_Double_Window() { hide(); } - - - // // End of "$Id$". // diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index c6e3454ef..35c6c1945 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -506,6 +506,10 @@ void Fl_Window::show() { pWindowDriver->show(); } +void Fl_Window::resize(int X,int Y,int W,int H) { + pWindowDriver->resize(X, Y, W, H); +} + // // End of "$Id$". // diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index b48040b9b..40cc7c668 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -38,6 +38,10 @@ int Fl_Window_Driver::minw() {return pWindow->minw;} int Fl_Window_Driver::minh() {return pWindow->minh;} int Fl_Window_Driver::maxw() {return pWindow->maxw;} int Fl_Window_Driver::maxh() {return pWindow->maxh;} +void Fl_Window_Driver::force_position(int c) { pWindow->force_position(c); } +void Fl_Window_Driver::x(int X) {pWindow->x(X); } +void Fl_Window_Driver::y(int Y) {pWindow->y(Y); } + unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set;} void Fl_Window_Driver::flush_single() { pWindow->Fl_Window::flush(); } diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 7982b4ccc..68d1631d1 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3169,60 +3169,61 @@ void Fl_Cocoa_Window_Driver::show() { /* * resize a window */ -void Fl_Window::resize(int X,int Y,int W,int H) { +void Fl_Cocoa_Window_Driver::resize(int X,int Y,int W,int H) { int bx, by, bt; Fl_Window *parent; if (W<=0) W = 1; // OS X does not like zero width windows if (H<=0) H = 1; - int is_a_resize = (W != w() || H != h()); + int is_a_resize = (W != pWindow->w() || H != pWindow->h()); // printf("Fl_Window::resize(X=%d, Y=%d, W=%d, H=%d), is_a_resize=%d, resize_from_system=%p, this=%p\n", // X, Y, W, H, is_a_resize, resize_from_system, this); - if (X != x() || Y != y()) set_flag(FORCE_POSITION); + if (X != pWindow->x() || Y != pWindow->y()) force_position(1); else if (!is_a_resize) { resize_from_system = 0; return; } - if ( (resize_from_system!=this) && shown()) { + if ( (resize_from_system != pWindow) && pWindow->shown()) { if (is_a_resize) { - if (resizable()) { - if (W<minw) minw = W; // user request for resize takes priority - if (maxw && W>maxw) maxw = W; // over a previously set size_range - if (H<minh) minh = H; - if (maxh && H>maxh) maxh = H; - size_range(minw, minh, maxw, maxh); + if (pWindow->resizable()) { + int min_w = minw(), max_w = maxw(), min_h = minh(), max_h = maxh(); + if (W<min_w) min_w = W; // user request for resize takes priority + if (max_w && W>max_w) max_w = W; // over a previously set size_range + if (H<min_h) min_h = H; + if (max_h && H>max_h) max_h = H; + pWindow->size_range(min_w, min_h, max_w, max_h); } else { - size_range(W, H, W, H); + pWindow->size_range(W, H, W, H); } - Fl_Group::resize(X,Y,W,H); + pWindow->Fl_Group::resize(X,Y,W,H); // transmit changes in FLTK coords to cocoa get_window_frame_sizes(bx, by, bt); bx = X; by = Y; - parent = window(); + parent = pWindow->window(); while (parent) { bx += parent->x(); by += parent->y(); parent = parent->window(); } - NSRect r = NSMakeRect(bx, main_screen_height - (by + H), W, H + (border()?bt:0)); - if (visible_r()) [fl_xid(this) setFrame:r display:YES]; + NSRect r = NSMakeRect(bx, main_screen_height - (by + H), W, H + (pWindow->border()?bt:0)); + if (pWindow->visible_r()) [fl_xid(pWindow) setFrame:r display:YES]; } else { bx = X; by = Y; - parent = window(); + parent = pWindow->window(); while (parent) { bx += parent->x(); by += parent->y(); parent = parent->window(); } NSPoint pt = NSMakePoint(bx, main_screen_height - (by + H)); - if (visible_r()) [fl_xid(this) setFrameOrigin:pt]; // set cocoa coords to FLTK position + if (pWindow->visible_r()) [fl_xid(pWindow) setFrameOrigin:pt]; // set cocoa coords to FLTK position } } else { resize_from_system = 0; if (is_a_resize) { - Fl_Group::resize(X,Y,W,H); - if (shown()) { - redraw(); + pWindow->Fl_Group::resize(X,Y,W,H); + if (pWindow->shown()) { + pWindow->redraw(); } } else { x(X); y(Y); diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 9334c90d5..70b382e3a 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -1560,24 +1560,25 @@ int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by) //////////////////////////////////////////////////////////////// -void Fl_Window::resize(int X,int Y,int W,int H) { +void Fl_WinAPI_Window_Driver::resize(int X,int Y,int W,int H) { UINT flags = SWP_NOSENDCHANGING | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOOWNERZORDER; - int is_a_resize = (W != w() || H != h()); - int resize_from_program = (this != resize_bug_fix); + int is_a_resize = (W != pWindow->w() || H != pWindow->h()); + int resize_from_program = (pWindow != resize_bug_fix); if (!resize_from_program) resize_bug_fix = 0; - if (X != x() || Y != y()) { + if (X != pWindow->x() || Y != pWindow->y()) { force_position(1); } else { if (!is_a_resize) return; flags |= SWP_NOMOVE; } if (is_a_resize) { - Fl_Group::resize(X,Y,W,H); - if (visible_r()) { - redraw(); + pWindow->Fl_Group::resize(X,Y,W,H); + if (pWindow->visible_r()) { + pWindow->redraw(); // only wait for exposure if this window has a size - a window // with no width or height will never get an exposure event + Fl_X *i = Fl_X::i(pWindow); if (i && W>0 && H>0) i->wait_for_expose = 1; } @@ -1585,13 +1586,13 @@ void Fl_Window::resize(int X,int Y,int W,int H) { x(X); y(Y); flags |= SWP_NOSIZE; } - if (!border()) flags |= SWP_NOACTIVATE; - if (resize_from_program && shown()) { - if (!resizable()) size_range(w(),h(),w(),h()); + if (!pWindow->border()) flags |= SWP_NOACTIVATE; + if (resize_from_program && pWindow->shown()) { + if (!pWindow->resizable()) pWindow->size_range(pWindow->w(), pWindow->h(), pWindow->w(), pWindow->h()); int dummy_x, dummy_y, bt, bx, by; //Ignore window managing when resizing, so that windows (and more //specifically menus) can be moved offscreen. - if (Fl_X::fake_X_wm(this, dummy_x, dummy_y, bt, bx, by)) { + if (Fl_X::fake_X_wm(pWindow, dummy_x, dummy_y, bt, bx, by)) { X -= bx; Y -= by+bt; W += 2*bx; @@ -1601,7 +1602,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) { // will cause continouly new redraw events. if (W<=0) W = 1; if (H<=0) H = 1; - SetWindowPos(i->xid, 0, X, Y, W, H, flags); + SetWindowPos(fl_xid(pWindow), 0, X, Y, W, H, flags); } } diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 4ca3ad67d..1bccb6dad 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -2124,34 +2124,34 @@ fprintf(stderr,"\n");*/ //////////////////////////////////////////////////////////////// -void Fl_Window::resize(int X,int Y,int W,int H) { - int is_a_move = (X != x() || Y != y()); - int is_a_resize = (W != w() || H != h()); - int resize_from_program = (this != resize_bug_fix); +void Fl_X11_Window_Driver::resize(int X,int Y,int W,int H) { + int is_a_move = (X != pWindow->x() || Y != pWindow->y()); + int is_a_resize = (W != pWindow->w() || H != pWindow->h()); + int resize_from_program = (pWindow != resize_bug_fix); if (!resize_from_program) resize_bug_fix = 0; - if (is_a_move && resize_from_program) set_flag(FORCE_POSITION); + if (is_a_move && resize_from_program) force_position(1); else if (!is_a_resize && !is_a_move) return; if (is_a_resize) { - Fl_Group::resize(X,Y,W,H); - if (shown()) {redraw();} + pWindow->Fl_Group::resize(X,Y,W,H); + if (pWindow->shown()) {pWindow->redraw();} } else { x(X); y(Y); } - if (resize_from_program && is_a_resize && !resizable()) { - size_range(w(), h(), w(), h()); + if (resize_from_program && is_a_resize && !pWindow->resizable()) { + pWindow->size_range(pWindow->w(), pWindow->h(), pWindow->w(), pWindow->h()); } - if (resize_from_program && shown()) { + if (resize_from_program && pWindow->shown()) { if (is_a_resize) { - if (!resizable()) size_range(w(),h(),w(),h()); + if (!pWindow->resizable()) pWindow->size_range(pWindow->w(), pWindow->h(), pWindow->w(), pWindow->h()); if (is_a_move) { - XMoveResizeWindow(fl_display, i->xid, X, Y, W>0 ? W : 1, H>0 ? H : 1); + XMoveResizeWindow(fl_display, fl_xid(pWindow), X, Y, W>0 ? W : 1, H>0 ? H : 1); } else { - XResizeWindow(fl_display, i->xid, W>0 ? W : 1, H>0 ? H : 1); + XResizeWindow(fl_display, fl_xid(pWindow), W>0 ? W : 1, H>0 ? H : 1); } } else - XMoveWindow(fl_display, i->xid, X, Y); + XMoveWindow(fl_display, fl_xid(pWindow), X, Y); } } diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 4925f1c33..46428962b 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -76,6 +76,7 @@ public: virtual void make_current(); virtual void label(const char *name, const char *mininame); virtual void show(); + virtual void resize(int X,int Y,int W,int H); virtual void shape(const Fl_Image* img); // that one is implemented in Fl_Cocoa.mm because it uses Objective-c diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index 70129e75b..5a2053af8 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -81,6 +81,7 @@ public: virtual void make_current(); virtual void show(); virtual void label(const char *name,const char *iname); + virtual void resize(int X,int Y,int W,int H); virtual void shape(const Fl_Image* img); virtual void icons(const Fl_RGB_Image *icons[], int count); diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index 06e38a39c..89f8ca457 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -88,6 +88,7 @@ public: virtual void make_current(); virtual void show(); virtual void show_menu(); + virtual void resize(int X,int Y,int W,int H); virtual void label(const char *name, const char *mininame); virtual void destroy_double_buffer(); |
