Issue #359 RFE: access the MacOS windowid .

This commit is contained in:
ManoloFLTK 2022-03-21 11:41:40 +01:00
parent 7e76929aff
commit a9412b41bb
7 changed files with 29 additions and 4 deletions

View File

@ -556,6 +556,7 @@ public:
int screen_num();
void screen_num(int screen_num);
static bool is_a_rescale();
fl_uintptr_t os_id();
};
#endif

View File

@ -876,3 +876,10 @@ const Fl_Image* Fl_Window::shape() {return pWindowDriver->shape();}
/** Returns true when a window is being rescaled */
bool Fl_Window::is_a_rescale() {return Fl_Window_Driver::is_a_rescale_;}
/** Returns a platform-specific identification of a shown window, or 0 if not shown.
\li X11 platform: the window's XID.
\li macOS platform: The window number of the windows window device.
\li other platforms: 0.
*/
fl_uintptr_t Fl_Window::os_id() { return pWindowDriver->os_id();}

View File

@ -2,7 +2,7 @@
// A base class for platform specific window handling code
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2018 by Bill Spitzak and others.
// Copyright 2010-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -190,6 +190,8 @@ public:
virtual void reposition_menu_window(int x, int y);
virtual void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1);
static Fl_Window *menu_parent();
virtual fl_uintptr_t os_id() { return 0; }
};
#endif // FL_WINDOW_DRIVER_H

View File

@ -4665,6 +4665,12 @@ void Fl_Cocoa_Screen_Driver::default_icons(const Fl_RGB_Image *icons[], int coun
}
}
fl_uintptr_t Fl_Cocoa_Window_Driver::os_id() {
return [fl_xid(pWindow) windowNumber];
}
// Deprecated in 1.4 - only for backward compatibility with 1.3
void Fl::insertion_point_location(int x, int y, int height) {
Fl_Cocoa_Screen_Driver::insertion_point_location(x, y, height);

View File

@ -2,7 +2,7 @@
// Definition of Apple Cocoa window driver
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2018 by Bill Spitzak and others.
// Copyright 2010-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -162,6 +162,8 @@ public:
//icons
virtual void icons(const Fl_RGB_Image *icons[], int count);
NSImage *icon_image;
virtual fl_uintptr_t os_id();
};
class Fl_Cocoa_Plugin : public Fl_Plugin {

View File

@ -2,7 +2,7 @@
// Definition of X11 window driver
// for the Fast Light Tool Kit (FLTK).
//
// Copyright 2010-2018 by Bill Spitzak and others.
// Copyright 2010-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -129,6 +129,7 @@ public:
void set_icons(); // driver-internal support function
virtual void capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl_RGB_Image*& left, Fl_RGB_Image*& bottom, Fl_RGB_Image*& right);
virtual int scroll(int src_x, int src_y, int src_w, int src_h, int dest_x, int dest_y, void (*draw_area)(void*, int,int,int,int), void* data);
virtual fl_uintptr_t os_id();
};

View File

@ -1,7 +1,7 @@
//
// Definition of X11 window driver.
//
// Copyright 1998-2020 by Bill Spitzak and others.
// Copyright 1998-2022 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -518,4 +518,10 @@ int Fl_X11_Window_Driver::screen_num() {
}
return screen_num_ >= 0 ? screen_num_ : 0;
}
fl_uintptr_t Fl_X11_Window_Driver::os_id() {
return fl_xid(pWindow);
}
#endif // USE_XFT