Provide Fl_Window_Driver accessor methods for public Fl_Window attributes.
These methods are intended to be used instead of pWindow->method() for better code readability and easier porting of methods from Fl_Window to Fl_Window_Driver. New methods: x(), y(), y(), h(), shown(), parent(), border(), visible(), and visible_r(). We should add more such methods if appropriate. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11414 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
abc12cd376
commit
4a31fd7aed
@ -25,10 +25,11 @@
|
||||
#define FL_WINDOW_DRIVER_H
|
||||
|
||||
#include <FL/Fl_Export.H>
|
||||
#include <FL/Fl_Window.H>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
class Fl_Window;
|
||||
class Fl_X;
|
||||
class Fl_Image;
|
||||
class Fl_Shared_Image;
|
||||
@ -52,6 +53,26 @@ public:
|
||||
virtual ~Fl_Window_Driver();
|
||||
static Fl_Window_Driver *newWindowDriver(Fl_Window *);
|
||||
|
||||
// --- frequently used accessors to public window data
|
||||
/** returns the x coordinate of the window. */
|
||||
int x() const { return pWindow->x(); }
|
||||
/** returns the y coordinate of the window. */
|
||||
int y() const { return pWindow->y(); }
|
||||
/** returns the width of the window. */
|
||||
int w() const { return pWindow->w(); }
|
||||
/** returns the width of the window. */
|
||||
int h() const { return pWindow->h(); }
|
||||
/** returns whether the window has a border. */
|
||||
int border() const { return pWindow->border(); }
|
||||
/** returns whether the window itself is visible(). */
|
||||
int visible() const { return pWindow->visible(); }
|
||||
/** returns whether the window and all its parents is visible(). */
|
||||
int visible_r() const { return pWindow->visible_r(); }
|
||||
/** returns whether the window is shown(). */
|
||||
int shown() const { return pWindow->shown(); }
|
||||
/** returns the parent of the window. */
|
||||
Fl_Group *parent() const { return pWindow->parent(); }
|
||||
|
||||
// --- accessors to private window data
|
||||
int minw();
|
||||
int minh();
|
||||
|
@ -163,7 +163,7 @@ void Fl_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Sh
|
||||
int Fl_Window_Driver::hide_common() {
|
||||
pWindow->clear_visible();
|
||||
|
||||
if (!pWindow->shown()) return 1;
|
||||
if (!shown()) return 1;
|
||||
|
||||
// remove from the list of windows:
|
||||
Fl_X* ip = Fl_X::i(pWindow);
|
||||
@ -198,7 +198,7 @@ int Fl_Window_Driver::hide_common() {
|
||||
|
||||
|
||||
void Fl_Window_Driver::use_border() {
|
||||
if (pWindow->shown()) {
|
||||
if (shown()) {
|
||||
pWindow->hide(); // hide and then show to reflect the new state of the window border
|
||||
pWindow->show();
|
||||
}
|
||||
|
@ -3118,7 +3118,7 @@ const char *fl_filename_name( const char *name )
|
||||
* set the window title bar name
|
||||
*/
|
||||
void Fl_Cocoa_Window_Driver::label(const char *name, const char *mininame) {
|
||||
if (pWindow->shown() || Fl_X::i(pWindow)) {
|
||||
if (shown() || Fl_X::i(pWindow)) {
|
||||
q_set_window_title(fl_xid(pWindow), name, mininame);
|
||||
}
|
||||
}
|
||||
@ -3129,11 +3129,11 @@ void Fl_Cocoa_Window_Driver::label(const char *name, const char *mininame) {
|
||||
*/
|
||||
void Fl_Cocoa_Window_Driver::show() {
|
||||
Fl_X *top = NULL;
|
||||
if (pWindow->parent()) top = Fl_X::i(pWindow->top_window());
|
||||
if (!pWindow->shown() && (!pWindow->parent() || (top && ![top->xid isMiniaturized]))) {
|
||||
if (parent()) top = Fl_X::i(pWindow->top_window());
|
||||
if (!shown() && (!parent() || (top && ![top->xid isMiniaturized]))) {
|
||||
Fl_X::make(pWindow);
|
||||
} else {
|
||||
if ( !pWindow->parent() ) {
|
||||
if ( !parent() ) {
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if ([i->xid isMiniaturized]) {
|
||||
i->w->redraw();
|
||||
@ -3156,15 +3156,15 @@ void Fl_Cocoa_Window_Driver::resize(int X,int Y,int W,int H) {
|
||||
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 != pWindow->w() || H != pWindow->h());
|
||||
int is_a_resize = (W != w() || H != 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 != pWindow->x() || Y != pWindow->y()) force_position(1);
|
||||
if (X != x() || Y != y()) force_position(1);
|
||||
else if (!is_a_resize) {
|
||||
resize_from_system = 0;
|
||||
return;
|
||||
}
|
||||
if ( (resize_from_system != pWindow) && pWindow->shown()) {
|
||||
if ( (resize_from_system != pWindow) && shown()) {
|
||||
if (is_a_resize) {
|
||||
if (pWindow->resizable()) {
|
||||
int min_w = minw(), max_w = maxw(), min_h = minh(), max_h = maxh();
|
||||
@ -3186,8 +3186,8 @@ void Fl_Cocoa_Window_Driver::resize(int X,int Y,int W,int H) {
|
||||
by += parent->y();
|
||||
parent = parent->window();
|
||||
}
|
||||
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];
|
||||
NSRect r = NSMakeRect(bx, main_screen_height - (by + H), W, H + (border()?bt:0));
|
||||
if (visible_r()) [fl_xid(pWindow) setFrame:r display:YES];
|
||||
} else {
|
||||
bx = X; by = Y;
|
||||
parent = pWindow->window();
|
||||
@ -3197,14 +3197,14 @@ void Fl_Cocoa_Window_Driver::resize(int X,int Y,int W,int H) {
|
||||
parent = parent->window();
|
||||
}
|
||||
NSPoint pt = NSMakePoint(bx, main_screen_height - (by + H));
|
||||
if (pWindow->visible_r()) [fl_xid(pWindow) setFrameOrigin:pt]; // set cocoa coords to FLTK position
|
||||
if (visible_r()) [fl_xid(pWindow) setFrameOrigin:pt]; // set cocoa coords to FLTK position
|
||||
}
|
||||
}
|
||||
else {
|
||||
resize_from_system = 0;
|
||||
if (is_a_resize) {
|
||||
pWindow->Fl_Group::resize(X,Y,W,H);
|
||||
if (pWindow->shown()) {
|
||||
if (shown()) {
|
||||
pWindow->redraw();
|
||||
}
|
||||
} else {
|
||||
@ -3528,7 +3528,7 @@ void Fl_Cocoa_Window_Driver::map() {
|
||||
void Fl_Cocoa_Window_Driver::unmap() {
|
||||
Window xid = fl_xid(pWindow);
|
||||
if (pWindow && xid) {
|
||||
if (pWindow->parent()) [[xid parentWindow] removeChildWindow:xid]; // necessary with at least 10.5
|
||||
if (parent()) [[xid parentWindow] removeChildWindow:xid]; // necessary with at least 10.5
|
||||
[xid orderOut:nil];
|
||||
}
|
||||
}
|
||||
@ -4266,20 +4266,20 @@ Window fl_xid(const Fl_Window* w)
|
||||
|
||||
int Fl_Cocoa_Window_Driver::decorated_w()
|
||||
{
|
||||
if (!pWindow->shown() || pWindow->parent() || !pWindow->border() || !pWindow->visible())
|
||||
return pWindow->w();
|
||||
if (!shown() || parent() || !border() || !visible())
|
||||
return w();
|
||||
int bx, by, bt;
|
||||
get_window_frame_sizes(bx, by, bt);
|
||||
return pWindow->w() + 2 * bx;
|
||||
return w() + 2 * bx;
|
||||
}
|
||||
|
||||
int Fl_Cocoa_Window_Driver::decorated_h()
|
||||
{
|
||||
if (!pWindow->shown() || pWindow->parent() || !pWindow->border() || !pWindow->visible())
|
||||
return pWindow->h();
|
||||
if (!shown() || parent() || !border() || !visible())
|
||||
return h();
|
||||
int bx, by, bt;
|
||||
get_window_frame_sizes(bx, by, bt);
|
||||
return pWindow->h() + bt + by;
|
||||
return h() + bt + by;
|
||||
}
|
||||
|
||||
// clip the graphics context to rounded corners
|
||||
@ -4325,27 +4325,27 @@ void Fl_X::draw_layer_to_context(CALayer *layer, CGContextRef gc, int w, int h)
|
||||
void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Image*& left, Fl_Shared_Image*& bottom, Fl_Shared_Image*& right)
|
||||
{
|
||||
left = bottom = right = NULL;
|
||||
int htop = pWindow->decorated_h() - pWindow->h();
|
||||
int htop = pWindow->decorated_h() - h();
|
||||
CALayer *layer = get_titlebar_layer(pWindow);
|
||||
CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
|
||||
uchar *rgba = new uchar[4 * pWindow->w() * htop * 4];
|
||||
CGContextRef auxgc = CGBitmapContextCreate(rgba, 2 * pWindow->w(), 2 * htop, 8, 8 * pWindow->w(), cspace, kCGImageAlphaPremultipliedLast);
|
||||
uchar *rgba = new uchar[4 * w() * htop * 4];
|
||||
CGContextRef auxgc = CGBitmapContextCreate(rgba, 2 * w(), 2 * htop, 8, 8 * w(), cspace, kCGImageAlphaPremultipliedLast);
|
||||
CGColorSpaceRelease(cspace);
|
||||
CGContextScaleCTM(auxgc, 2, 2);
|
||||
if (layer) {
|
||||
Fl_X::draw_layer_to_context(layer, auxgc, pWindow->w(), htop);
|
||||
Fl_X::draw_layer_to_context(layer, auxgc, w(), htop);
|
||||
} else {
|
||||
CGImageRef img = Fl_X::CGImage_from_window_rect(pWindow, 0, -htop, pWindow->w(), htop);
|
||||
CGImageRef img = Fl_X::CGImage_from_window_rect(pWindow, 0, -htop, w(), htop);
|
||||
CGContextSaveGState(auxgc);
|
||||
Fl_X::clip_to_rounded_corners(auxgc, pWindow->w(), htop);
|
||||
CGContextDrawImage(auxgc, CGRectMake(0, 0, pWindow->w(), htop), img);
|
||||
Fl_X::clip_to_rounded_corners(auxgc, w(), htop);
|
||||
CGContextDrawImage(auxgc, CGRectMake(0, 0, w(), htop), img);
|
||||
CGContextRestoreGState(auxgc);
|
||||
CFRelease(img);
|
||||
}
|
||||
Fl_RGB_Image *top_rgb = new Fl_RGB_Image(rgba, 2 * pWindow->w(), 2 * htop, 4);
|
||||
Fl_RGB_Image *top_rgb = new Fl_RGB_Image(rgba, 2 * w(), 2 * htop, 4);
|
||||
top_rgb->alloc_array = 1;
|
||||
top = Fl_Shared_Image::get(top_rgb);
|
||||
top->scale(pWindow->w(),htop);
|
||||
top->scale(w(),htop);
|
||||
CGContextRelease(auxgc);
|
||||
}
|
||||
|
||||
|
@ -1563,10 +1563,10 @@ int Fl_X::fake_X_wm(const Fl_Window* w,int &X,int &Y, int &bt,int &bx, int &by)
|
||||
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 != pWindow->w() || H != pWindow->h());
|
||||
int is_a_resize = (W != w() || H != h());
|
||||
int resize_from_program = (pWindow != resize_bug_fix);
|
||||
if (!resize_from_program) resize_bug_fix = 0;
|
||||
if (X != pWindow->x() || Y != pWindow->y()) {
|
||||
if (X != x() || Y != y()) {
|
||||
force_position(1);
|
||||
} else {
|
||||
if (!is_a_resize) return;
|
||||
@ -1574,7 +1574,7 @@ void Fl_WinAPI_Window_Driver::resize(int X,int Y,int W,int H) {
|
||||
}
|
||||
if (is_a_resize) {
|
||||
pWindow->Fl_Group::resize(X,Y,W,H);
|
||||
if (pWindow->visible_r()) {
|
||||
if (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
|
||||
@ -1586,9 +1586,9 @@ void Fl_WinAPI_Window_Driver::resize(int X,int Y,int W,int H) {
|
||||
x(X); y(Y);
|
||||
flags |= SWP_NOSIZE;
|
||||
}
|
||||
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());
|
||||
if (!border()) flags |= SWP_NOACTIVATE;
|
||||
if (resize_from_program && shown()) {
|
||||
if (!pWindow->resizable()) pWindow->size_range(w(), h(), w(), 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.
|
||||
@ -2200,7 +2200,7 @@ int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) {
|
||||
//static inline int can_boxcheat(uchar b) {return (b==1 || (b&2) && b<=15);}
|
||||
|
||||
void Fl_WinAPI_Window_Driver::show() {
|
||||
if (!pWindow->shown()) {
|
||||
if (!shown()) {
|
||||
// if (can_boxcheat(box())) fl_background_pixel = fl_xpixel(color());
|
||||
Fl_X::make(pWindow);
|
||||
} else {
|
||||
@ -2356,7 +2356,7 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
|
||||
{
|
||||
Fl_RGB_Image *r_top, *r_left, *r_bottom, *r_right;
|
||||
top = left = bottom = right = NULL;
|
||||
if (!pWindow->shown() || pWindow->parent() || !pWindow->border() || !pWindow->visible()) return;
|
||||
if (!shown() || parent() || !border() || !visible()) return;
|
||||
int wsides, hbottom, bt;
|
||||
RECT r = border_width_title_bar_height(wsides, hbottom, bt);
|
||||
int htop = bt + hbottom;
|
||||
@ -2367,7 +2367,7 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
|
||||
Fl::check();
|
||||
void* save_gc = fl_graphics_driver->gc();
|
||||
fl_graphics_driver->gc(GetDC(NULL));
|
||||
int ww = pWindow->w() + 2 * wsides;
|
||||
int ww = w() + 2 * wsides;
|
||||
// capture the 4 window sides from screen
|
||||
fl_window = NULL; // force use of read_win_rectangle() by fl_read_image()
|
||||
uchar *rgb;
|
||||
@ -2378,12 +2378,12 @@ void Fl_WinAPI_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top
|
||||
top = Fl_Shared_Image::get(r_top);
|
||||
}
|
||||
if (wsides) {
|
||||
rgb = fl_read_image(NULL, r.left, r.top + htop, wsides, pWindow->h());
|
||||
r_left = new Fl_RGB_Image(rgb, wsides, pWindow->h(), 3);
|
||||
rgb = fl_read_image(NULL, r.left, r.top + htop, wsides, h());
|
||||
r_left = new Fl_RGB_Image(rgb, wsides, h(), 3);
|
||||
r_left->alloc_array = 1;
|
||||
left = Fl_Shared_Image::get(r_left);
|
||||
rgb = fl_read_image(NULL, r.right - wsides, r.top + htop, wsides, pWindow->h());
|
||||
r_right = new Fl_RGB_Image(rgb, wsides, pWindow->h(), 3);
|
||||
rgb = fl_read_image(NULL, r.right - wsides, r.top + htop, wsides, h());
|
||||
r_right = new Fl_RGB_Image(rgb, wsides, h(), 3);
|
||||
r_right->alloc_array = 1;
|
||||
right = Fl_Shared_Image::get(r_right);
|
||||
rgb = fl_read_image(NULL, r.left, r.bottom-hbottom, ww, hbottom);
|
||||
|
18
src/Fl_x.cxx
18
src/Fl_x.cxx
@ -2125,26 +2125,26 @@ fprintf(stderr,"\n");*/
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
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 is_a_move = (X != x() || Y != y());
|
||||
int is_a_resize = (W != w() || H != h());
|
||||
int resize_from_program = (pWindow != resize_bug_fix);
|
||||
if (!resize_from_program) resize_bug_fix = 0;
|
||||
if (is_a_move && resize_from_program) force_position(1);
|
||||
else if (!is_a_resize && !is_a_move) return;
|
||||
if (is_a_resize) {
|
||||
pWindow->Fl_Group::resize(X,Y,W,H);
|
||||
if (pWindow->shown()) {pWindow->redraw();}
|
||||
if (shown()) {pWindow->redraw();}
|
||||
} else {
|
||||
x(X); y(Y);
|
||||
}
|
||||
|
||||
if (resize_from_program && is_a_resize && !pWindow->resizable()) {
|
||||
pWindow->size_range(pWindow->w(), pWindow->h(), pWindow->w(), pWindow->h());
|
||||
pWindow->size_range(w(), h(), w(), h());
|
||||
}
|
||||
|
||||
if (resize_from_program && pWindow->shown()) {
|
||||
if (resize_from_program && shown()) {
|
||||
if (is_a_resize) {
|
||||
if (!pWindow->resizable()) pWindow->size_range(pWindow->w(), pWindow->h(), pWindow->w(), pWindow->h());
|
||||
if (!pWindow->resizable()) pWindow->size_range(w(), h(), w(), h());
|
||||
if (is_a_move) {
|
||||
XMoveResizeWindow(fl_display, fl_xid(pWindow), X, Y, W>0 ? W : 1, H>0 ? H : 1);
|
||||
} else {
|
||||
@ -2255,7 +2255,7 @@ void Fl_X11_Window_Driver::fullscreen_on() {
|
||||
right = fullscreen_screen_right();
|
||||
|
||||
if ((top < 0) || (bottom < 0) || (left < 0) || (right < 0)) {
|
||||
top = Fl::screen_num(pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h());
|
||||
top = Fl::screen_num(x(), y(), w(), h());
|
||||
bottom = top;
|
||||
left = top;
|
||||
right = top;
|
||||
@ -2867,7 +2867,7 @@ const char *fl_filename_name(const char *name) {
|
||||
}
|
||||
|
||||
void Fl_X11_Window_Driver::label(const char *name, const char *iname) {
|
||||
if (pWindow->shown() && !pWindow->parent()) {
|
||||
if (shown() && !parent()) {
|
||||
if (!name) name = "";
|
||||
int namelen = strlen(name);
|
||||
if (!iname) iname = fl_filename_name(name);
|
||||
@ -2896,7 +2896,7 @@ void Fl_X11_Window_Driver::label(const char *name, const char *iname) {
|
||||
static inline int can_boxcheat(uchar b) {return (b==1 || ((b&2) && b<=15));}
|
||||
|
||||
void Fl_X11_Window_Driver::show() {
|
||||
if (!pWindow->shown()) {
|
||||
if (!shown()) {
|
||||
fl_open_display();
|
||||
// Don't set background pixel for double-buffered windows...
|
||||
if (pWindow->type() != FL_DOUBLE_WINDOW && can_boxcheat(pWindow->box())) {
|
||||
|
@ -101,7 +101,7 @@ void Fl_Cocoa_Window_Driver::draw_begin()
|
||||
if (shape_data_) {
|
||||
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
||||
if (shape_data_->mask && (&CGContextClipToMask != NULL)) {
|
||||
CGContextClipToMask(gc, CGRectMake(0,0,pWindow->w(),pWindow->h()), shape_data_->mask); // requires Mac OS 10.4
|
||||
CGContextClipToMask(gc, CGRectMake(0,0,w(),h()), shape_data_->mask); // requires Mac OS 10.4
|
||||
}
|
||||
CGContextSaveGState(gc);
|
||||
# endif
|
||||
@ -114,13 +114,13 @@ void Fl_Cocoa_Window_Driver::draw_end()
|
||||
// on OS X, windows have no frame. Before OS X 10.7, to resize a window, we drag the lower right
|
||||
// corner. This code draws a little ribbed triangle for dragging.
|
||||
CGContextRef gc = (CGContextRef)Fl_Surface_Device::surface()->driver()->gc();
|
||||
if (fl_mac_os_version < 100700 && gc && !pWindow->parent() && pWindow->resizable() &&
|
||||
if (fl_mac_os_version < 100700 && gc && !parent() && pWindow->resizable() &&
|
||||
(!size_range_set() || minh() != maxh() || minw() != maxw())) {
|
||||
int dx = Fl::box_dw(pWindow->box())-Fl::box_dx(pWindow->box());
|
||||
int dy = Fl::box_dh(pWindow->box())-Fl::box_dy(pWindow->box());
|
||||
if (dx<=0) dx = 1;
|
||||
if (dy<=0) dy = 1;
|
||||
int x1 = pWindow->w()-dx-1, x2 = x1, y1 = pWindow->h()-dx-1, y2 = y1;
|
||||
int x1 = w()-dx-1, x2 = x1, y1 = h()-dx-1, y2 = y1;
|
||||
Fl_Color c[4] = {
|
||||
pWindow->color(),
|
||||
fl_color_average(pWindow->color(), FL_WHITE, 0.7f),
|
||||
@ -229,7 +229,7 @@ void Fl_Cocoa_Window_Driver::hide() {
|
||||
// MacOS X manages a single pointer per application. Make sure that hiding
|
||||
// a toplevel window will not leave us with some random pointer shape, or
|
||||
// worst case, an invisible pointer
|
||||
if (ip && !pWindow->parent()) pWindow->cursor(FL_CURSOR_DEFAULT);
|
||||
if (ip && !parent()) pWindow->cursor(FL_CURSOR_DEFAULT);
|
||||
if ( hide_common() ) return;
|
||||
Fl_X::q_release_context(ip);
|
||||
if ( ip->xid == fl_window )
|
||||
|
@ -40,13 +40,13 @@ Fl_Pico_Window_Driver::~Fl_Pico_Window_Driver()
|
||||
|
||||
int Fl_Pico_Window_Driver::decorated_w()
|
||||
{
|
||||
return pWindow->w();
|
||||
return w();
|
||||
}
|
||||
|
||||
|
||||
int Fl_Pico_Window_Driver::decorated_h()
|
||||
{
|
||||
return pWindow->h();
|
||||
return h();
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -512,11 +512,11 @@ Window fl_window;
|
||||
//void Fl_Image_Surface::translate(int x, int y) { }
|
||||
//void Fl_Image_Surface::untranslate() { }
|
||||
|
||||
void Fl::add_fd(int, int, void (*)(int, void*), void*)
|
||||
void Fl::add_fd(int, int, Fl_FD_Handler, void*)
|
||||
{
|
||||
}
|
||||
|
||||
void Fl::add_fd(int, void (*)(int, void*), void*)
|
||||
void Fl::add_fd(int, Fl_FD_Handler, void*)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,12 +58,12 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
|
||||
Fl_PicoAndroid_Screen_Driver *scr = (Fl_PicoAndroid_Screen_Driver*)Fl::screen_driver();
|
||||
|
||||
Fl_Group::current(0);
|
||||
if (pWindow->parent() && !Fl_X::i(pWindow->window())) {
|
||||
if (parent() && !Fl_X::i(pWindow->window())) {
|
||||
pWindow->set_visible();
|
||||
return 0L;
|
||||
}
|
||||
Window parent;
|
||||
if (pWindow->parent()) {
|
||||
if (parent()) {
|
||||
parent = fl_xid(pWindow->window());
|
||||
} else {
|
||||
parent = 0;
|
||||
@ -73,9 +73,9 @@ Fl_X *Fl_PicoAndroid_Window_Driver::makeWindow()
|
||||
x->w = pWindow;
|
||||
x->region = 0;
|
||||
if (!pWindow->force_position()) {
|
||||
// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pWindow->w(), pWindow->h(), 0);
|
||||
// pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0);
|
||||
} else {
|
||||
// pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0);
|
||||
// pNativeWindow = SDL_CreateWindow(pWindow->label(), x(), y(), w(), h(), 0);
|
||||
}
|
||||
pNativeWindow = scr->pApp->window;
|
||||
// x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
|
||||
|
@ -45,12 +45,12 @@ Fl_PicoSDL_Window_Driver::~Fl_PicoSDL_Window_Driver()
|
||||
Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
|
||||
{
|
||||
Fl_Group::current(0);
|
||||
if (pWindow->parent() && !Fl_X::i(pWindow->window())) {
|
||||
if (parent() && !Fl_X::i(pWindow->window())) {
|
||||
pWindow->set_visible();
|
||||
return 0L;
|
||||
}
|
||||
Window parent;
|
||||
if (pWindow->parent()) {
|
||||
if (parent()) {
|
||||
parent = fl_xid(pWindow->window());
|
||||
} else {
|
||||
parent = 0;
|
||||
@ -60,9 +60,9 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
|
||||
x->w = pWindow;
|
||||
x->region = 0;
|
||||
if (!pWindow->force_position()) {
|
||||
pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, pWindow->w(), pWindow->h(), 0);
|
||||
pNativeWindow = SDL_CreateWindow(pWindow->label(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w(), h(), 0);
|
||||
} else {
|
||||
pNativeWindow = SDL_CreateWindow(pWindow->label(), pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h(), 0);
|
||||
pNativeWindow = SDL_CreateWindow(pWindow->label(), x(), y(), w(), h(), 0);
|
||||
}
|
||||
x->xid = SDL_CreateRenderer(pNativeWindow, -1, SDL_RENDERER_ACCELERATED);
|
||||
x->next = Fl_X::first;
|
||||
@ -83,7 +83,7 @@ Fl_X *Fl_PicoSDL_Window_Driver::makeWindow()
|
||||
|
||||
void Fl_PicoSDL_Window_Driver::flush_single()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
pWindow->make_current();
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return;
|
||||
|
@ -94,14 +94,14 @@ int Fl_WinAPI_Window_Driver::decorated_w()
|
||||
{
|
||||
int bt, bx, by;
|
||||
border_width_title_bar_height(bx, by, bt);
|
||||
return pWindow->w() + 2 * bx;
|
||||
return w() + 2 * bx;
|
||||
}
|
||||
|
||||
int Fl_WinAPI_Window_Driver::decorated_h()
|
||||
{
|
||||
int bt, bx, by;
|
||||
border_width_title_bar_height(bx, by, bt);
|
||||
return pWindow->h() + bt + 2 * by;
|
||||
return h() + bt + 2 * by;
|
||||
}
|
||||
|
||||
|
||||
@ -248,10 +248,10 @@ static HRGN bitmap2region(Fl_Image* image) {
|
||||
void Fl_WinAPI_Window_Driver::draw_begin()
|
||||
{
|
||||
if (shape_data_) {
|
||||
if ((shape_data_->lw_ != pWindow->w() || shape_data_->lh_ != pWindow->h()) && shape_data_->shape_) {
|
||||
if ((shape_data_->lw_ != w() || shape_data_->lh_ != h()) && shape_data_->shape_) {
|
||||
// size of window has changed since last time
|
||||
shape_data_->lw_ = pWindow->w();
|
||||
shape_data_->lh_ = pWindow->h();
|
||||
shape_data_->lw_ = w();
|
||||
shape_data_->lh_ = h();
|
||||
Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_);
|
||||
HRGN region = bitmap2region(temp);
|
||||
SetWindowRgn(fl_xid(pWindow), region, TRUE); // the system deletes the region when it's no longer needed
|
||||
@ -263,13 +263,13 @@ void Fl_WinAPI_Window_Driver::draw_begin()
|
||||
|
||||
void Fl_WinAPI_Window_Driver::flush_double()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return; // window not yet created
|
||||
|
||||
if (!i->other_xid) {
|
||||
i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
|
||||
i->other_xid = fl_create_offscreen(w(), h());
|
||||
pWindow->clear_damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
|
||||
@ -280,7 +280,7 @@ void Fl_WinAPI_Window_Driver::flush_double()
|
||||
fl_end_offscreen();
|
||||
}
|
||||
|
||||
int X,Y,W,H; fl_clip_box(0,0,pWindow->w(),pWindow->h(),X,Y,W,H);
|
||||
int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H);
|
||||
if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y);
|
||||
}
|
||||
|
||||
@ -289,7 +289,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay()
|
||||
{
|
||||
Fl_Overlay_Window *oWindow = pWindow->as_overlay_window();
|
||||
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i) return; // window not yet created
|
||||
@ -298,7 +298,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay()
|
||||
pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY));
|
||||
|
||||
if (!i->other_xid) {
|
||||
i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
|
||||
i->other_xid = fl_create_offscreen(w(), h());
|
||||
pWindow->clear_damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
|
||||
@ -310,7 +310,7 @@ void Fl_WinAPI_Window_Driver::flush_overlay()
|
||||
}
|
||||
|
||||
if (eraseoverlay) fl_clip_region(0);
|
||||
int X, Y, W, H; fl_clip_box(0, 0, pWindow->w(), pWindow->h(), X, Y, W, H);
|
||||
int X, Y, W, H; fl_clip_box(0, 0, w(), h(), X, Y, W, H);
|
||||
if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y);
|
||||
|
||||
if (oWindow->overlay_ == oWindow) oWindow->draw_overlay();
|
||||
@ -407,7 +407,7 @@ void Fl_Window::default_icons(HICON big_icon, HICON small_icon) {
|
||||
|
||||
|
||||
void Fl_WinAPI_Window_Driver::wait_for_expose() {
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
while (!i || i->wait_for_expose) {
|
||||
Fl::wait();
|
||||
@ -430,7 +430,7 @@ void Fl_WinAPI_Window_Driver::make_current() {
|
||||
}
|
||||
|
||||
void Fl_WinAPI_Window_Driver::label(const char *name,const char *iname) {
|
||||
if (pWindow->shown() && !pWindow->parent()) {
|
||||
if (shown() && !parent()) {
|
||||
if (!name) name = "";
|
||||
size_t l = strlen(name);
|
||||
// WCHAR *lab = (WCHAR*) malloc((l + 1) * sizeof(short));
|
||||
@ -568,7 +568,7 @@ void Fl_X::make_fullscreen(int X, int Y, int W, int H) {
|
||||
|
||||
void Fl_WinAPI_Window_Driver::fullscreen_on() {
|
||||
pWindow->_set_fullscreen();
|
||||
Fl_X::i(pWindow)->make_fullscreen(pWindow->x(), pWindow->y(), pWindow->w(), pWindow->h());
|
||||
Fl_X::i(pWindow)->make_fullscreen(x(), y(), w(), h());
|
||||
Fl::handle(FL_FULLSCREEN, pWindow);
|
||||
}
|
||||
|
||||
@ -588,7 +588,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
|
||||
style |= WS_CAPTION;
|
||||
break;
|
||||
case 2:
|
||||
if (pWindow->border()) {
|
||||
if (border()) {
|
||||
style |= WS_THICKFRAME | WS_CAPTION;
|
||||
}
|
||||
break;
|
||||
@ -596,7 +596,7 @@ void Fl_WinAPI_Window_Driver::fullscreen_off(int X, int Y, int W, int H) {
|
||||
Fl_X::i(pWindow)->xid = xid;
|
||||
// Adjust for decorations (but not if that puts the decorations
|
||||
// outside the screen)
|
||||
if ((X != pWindow->x()) || (Y != pWindow->y())) {
|
||||
if ((X != x()) || (Y != y())) {
|
||||
X -= bx;
|
||||
Y -= by+bt;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ void Fl_X11_Window_Driver::take_focus()
|
||||
void Fl_X11_Window_Driver::draw_begin()
|
||||
{
|
||||
if (shape_data_) {
|
||||
if (( shape_data_->lw_ != pWindow->w() || shape_data_->lh_ != pWindow->h() ) && shape_data_->shape_) {
|
||||
if (( shape_data_->lw_ != w() || shape_data_->lh_ != h() ) && shape_data_->shape_) {
|
||||
// size of window has changed since last time
|
||||
combine_mask();
|
||||
}
|
||||
@ -204,7 +204,7 @@ void Fl_X11_Window_Driver::draw_begin()
|
||||
|
||||
void Fl_X11_Window_Driver::flush_double()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
#if USE_XDBE
|
||||
if (can_xdbe()) flush_double_dbe(0); else
|
||||
#endif
|
||||
@ -216,7 +216,7 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay)
|
||||
pWindow->make_current(); // make sure fl_gc is non-zero
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
if (!i->other_xid) {
|
||||
i->other_xid = fl_create_offscreen(pWindow->w(), pWindow->h());
|
||||
i->other_xid = fl_create_offscreen(w(), h());
|
||||
pWindow->clear_damage(FL_DAMAGE_ALL);
|
||||
}
|
||||
if (pWindow->damage() & ~FL_DAMAGE_EXPOSE) {
|
||||
@ -226,14 +226,14 @@ void Fl_X11_Window_Driver::flush_double(int erase_overlay)
|
||||
fl_window = i->xid;
|
||||
}
|
||||
if (erase_overlay) fl_clip_region(0);
|
||||
int X,Y,W,H; fl_clip_box(0,0,pWindow->w(),pWindow->h(),X,Y,W,H);
|
||||
int X,Y,W,H; fl_clip_box(0,0,w(),h(),X,Y,W,H);
|
||||
if (i->other_xid) fl_copy_offscreen(X, Y, W, H, i->other_xid, X, Y);
|
||||
}
|
||||
|
||||
|
||||
void Fl_X11_Window_Driver::flush_overlay()
|
||||
{
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
int erase_overlay = (pWindow->damage()&FL_DAMAGE_OVERLAY);
|
||||
pWindow->clear_damage((uchar)(pWindow->damage()&~FL_DAMAGE_OVERLAY));
|
||||
#if USE_XDBE
|
||||
@ -322,8 +322,8 @@ void Fl_X11_Window_Driver::combine_mask()
|
||||
#endif
|
||||
}
|
||||
if (!XShapeCombineMask_f) return;
|
||||
shape_data_->lw_ = pWindow->w();
|
||||
shape_data_->lh_ = pWindow->h();
|
||||
shape_data_->lw_ = w();
|
||||
shape_data_->lh_ = h();
|
||||
Fl_Image* temp = shape_data_->shape_->copy(shape_data_->lw_, shape_data_->lh_);
|
||||
Pixmap pbitmap = XCreateBitmapFromData(fl_display, fl_xid(pWindow),
|
||||
(const char*)*temp->data(),
|
||||
@ -383,7 +383,7 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F
|
||||
{
|
||||
Fl_RGB_Image *r_top, *r_left, *r_bottom, *r_right;
|
||||
top = left = bottom = right = NULL;
|
||||
if (pWindow->decorated_h() == pWindow->h()) return;
|
||||
if (pWindow->decorated_h() == h()) return;
|
||||
Window from = fl_window;
|
||||
Fl_Surface_Device *previous = Fl_Surface_Device::surface();
|
||||
Fl_Display_Device::display_device()->set_current();
|
||||
@ -402,22 +402,22 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F
|
||||
fl_window = parent;
|
||||
uchar *rgb;
|
||||
if (htop) {
|
||||
rgb = fl_read_image(NULL, 0, 0, - (pWindow->w() + 2 * wsides), htop);
|
||||
r_top = new Fl_RGB_Image(rgb, pWindow->w() + 2 * wsides, htop, 3);
|
||||
rgb = fl_read_image(NULL, 0, 0, - (w() + 2 * wsides), htop);
|
||||
r_top = new Fl_RGB_Image(rgb, w() + 2 * wsides, htop, 3);
|
||||
r_top->alloc_array = 1;
|
||||
top = Fl_Shared_Image::get(r_top);
|
||||
}
|
||||
if (wsides) {
|
||||
rgb = fl_read_image(NULL, 0, htop, -wsides, pWindow->h());
|
||||
r_left = new Fl_RGB_Image(rgb, wsides, pWindow->h(), 3);
|
||||
rgb = fl_read_image(NULL, 0, htop, -wsides, h());
|
||||
r_left = new Fl_RGB_Image(rgb, wsides, h(), 3);
|
||||
r_left->alloc_array = 1;
|
||||
left = Fl_Shared_Image::get(r_left);
|
||||
rgb = fl_read_image(NULL, pWindow->w() + wsides, htop, -wsides, pWindow->h());
|
||||
r_right = new Fl_RGB_Image(rgb, wsides, pWindow->h(), 3);
|
||||
rgb = fl_read_image(NULL, w() + wsides, htop, -wsides, h());
|
||||
r_right = new Fl_RGB_Image(rgb, wsides, h(), 3);
|
||||
r_right->alloc_array = 1;
|
||||
right = Fl_Shared_Image::get(r_right);
|
||||
rgb = fl_read_image(NULL, 0, htop + pWindow->h(), -(pWindow->w() + 2*wsides), hbottom);
|
||||
r_bottom = new Fl_RGB_Image(rgb, pWindow->w() + 2*wsides, hbottom, 3);
|
||||
rgb = fl_read_image(NULL, 0, htop + h(), -(w() + 2*wsides), hbottom);
|
||||
r_bottom = new Fl_RGB_Image(rgb, w() + 2*wsides, hbottom, 3);
|
||||
r_bottom->alloc_array = 1;
|
||||
bottom = Fl_Shared_Image::get(r_bottom);
|
||||
}
|
||||
@ -426,7 +426,7 @@ void Fl_X11_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, F
|
||||
}
|
||||
|
||||
void Fl_X11_Window_Driver::wait_for_expose() {
|
||||
if (!pWindow->shown()) return;
|
||||
if (!shown()) return;
|
||||
Fl_X *i = Fl_X::i(pWindow);
|
||||
while (!i || i->wait_for_expose) {
|
||||
Fl::wait();
|
||||
@ -436,7 +436,7 @@ void Fl_X11_Window_Driver::wait_for_expose() {
|
||||
|
||||
// make X drawing go into this window (called by subclass flush() impl.)
|
||||
void Fl_X11_Window_Driver::make_current() {
|
||||
if (!pWindow->shown()) {
|
||||
if (!shown()) {
|
||||
fl_alert("Fl_Window::make_current(), but window is not shown().");
|
||||
Fl::fatal("Fl_Window::make_current(), but window is not shown().");
|
||||
}
|
||||
@ -453,7 +453,7 @@ void Fl_X11_Window_Driver::make_current() {
|
||||
void Fl_X11_Window_Driver::show_menu()
|
||||
{
|
||||
#if HAVE_OVERLAY
|
||||
if (!pWindow->shown() && ((Fl_Menu_Window*)pWindow)->overlay() && fl_find_overlay_visual()) {
|
||||
if (!shown() && ((Fl_Menu_Window*)pWindow)->overlay() && fl_find_overlay_visual()) {
|
||||
XInstallColormap(fl_display, fl_overlay_colormap);
|
||||
fl_background_pixel = int(fl_transparent_pixel);
|
||||
Fl_X::make_xid(pWindow, fl_overlay_visual, fl_overlay_colormap);
|
||||
@ -497,12 +497,12 @@ void Fl_X11_Window_Driver::unmap() {
|
||||
// the window full screen will lose the size of the border off the
|
||||
// bottom and right.
|
||||
void Fl_X11_Window_Driver::use_border() {
|
||||
if (pWindow->shown()) Fl_X::i(pWindow)->sendxjunk();
|
||||
if (shown()) Fl_X::i(pWindow)->sendxjunk();
|
||||
}
|
||||
|
||||
void Fl_X11_Window_Driver::size_range() {
|
||||
Fl_Window_Driver::size_range();
|
||||
if (pWindow->shown()) Fl_X::i(pWindow)->sendxjunk();
|
||||
if (shown()) Fl_X::i(pWindow)->sendxjunk();
|
||||
}
|
||||
|
||||
void Fl_X11_Window_Driver::iconize() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user