Browse Source

Issue #359 RFE: access the MacOS windowid .

pull/420/head
ManoloFLTK 3 years ago
parent
commit
a9412b41bb
  1. 1
      FL/Fl_Window.H
  2. 7
      src/Fl_Window.cxx
  3. 4
      src/Fl_Window_Driver.H
  4. 6
      src/Fl_cocoa.mm
  5. 4
      src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
  6. 3
      src/drivers/X11/Fl_X11_Window_Driver.H
  7. 8
      src/drivers/X11/Fl_X11_Window_Driver.cxx

1
FL/Fl_Window.H

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

7
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 */ /** Returns true when a window is being rescaled */
bool Fl_Window::is_a_rescale() {return Fl_Window_Driver::is_a_rescale_;} 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();}

4
src/Fl_Window_Driver.H

@ -2,7 +2,7 @@
// A base class for platform specific window handling code // A base class for platform specific window handling code
// for the Fast Light Tool Kit (FLTK). // 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 // 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 // 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 reposition_menu_window(int x, int y);
virtual void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1); virtual void menu_window_area(int &X, int &Y, int &W, int &H, int nscreen = -1);
static Fl_Window *menu_parent(); static Fl_Window *menu_parent();
virtual fl_uintptr_t os_id() { return 0; }
}; };
#endif // FL_WINDOW_DRIVER_H #endif // FL_WINDOW_DRIVER_H

6
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 // Deprecated in 1.4 - only for backward compatibility with 1.3
void Fl::insertion_point_location(int x, int y, int height) { void Fl::insertion_point_location(int x, int y, int height) {
Fl_Cocoa_Screen_Driver::insertion_point_location(x, y, height); Fl_Cocoa_Screen_Driver::insertion_point_location(x, y, height);

4
src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H

@ -2,7 +2,7 @@
// Definition of Apple Cocoa window driver // Definition of Apple Cocoa window driver
// for the Fast Light Tool Kit (FLTK). // 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 // 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 // the file "COPYING" which should have been included with this file. If this
@ -162,6 +162,8 @@ public:
//icons //icons
virtual void icons(const Fl_RGB_Image *icons[], int count); virtual void icons(const Fl_RGB_Image *icons[], int count);
NSImage *icon_image; NSImage *icon_image;
virtual fl_uintptr_t os_id();
}; };
class Fl_Cocoa_Plugin : public Fl_Plugin { class Fl_Cocoa_Plugin : public Fl_Plugin {

3
src/drivers/X11/Fl_X11_Window_Driver.H

@ -2,7 +2,7 @@
// Definition of X11 window driver // Definition of X11 window driver
// for the Fast Light Tool Kit (FLTK). // 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 // 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 // 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 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 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 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();
}; };

8
src/drivers/X11/Fl_X11_Window_Driver.cxx

@ -1,7 +1,7 @@
// //
// Definition of X11 window driver. // 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 // 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 // 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; return screen_num_ >= 0 ? screen_num_ : 0;
} }
fl_uintptr_t Fl_X11_Window_Driver::os_id() {
return fl_xid(pWindow);
}
#endif // USE_XFT #endif // USE_XFT

Loading…
Cancel
Save