summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Window.H1
-rw-r--r--src/Fl_Window.cxx7
-rw-r--r--src/Fl_Window_Driver.H4
-rw-r--r--src/Fl_cocoa.mm6
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H4
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H3
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx8
7 files changed, 29 insertions, 4 deletions
diff --git a/FL/Fl_Window.H b/FL/Fl_Window.H
index 544369160..c64efbf45 100644
--- a/FL/Fl_Window.H
+++ b/FL/Fl_Window.H
@@ -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
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index 50f39f04e..e6f14141b 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -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 window’s window device.
+ \li other platforms: 0.
+ */
+fl_uintptr_t Fl_Window::os_id() { return pWindowDriver->os_id();}
diff --git a/src/Fl_Window_Driver.H b/src/Fl_Window_Driver.H
index 3766980a3..b63d87a84 100644
--- a/src/Fl_Window_Driver.H
+++ b/src/Fl_Window_Driver.H
@@ -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
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index b6e3fe766..d978ebfc1 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -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);
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
index 3003e3904..60569ff3f 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
@@ -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 {
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index 71370d13a..a8224e8e1 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -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();
};
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index a91dadec3..8aad279ac 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -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