From 1298bf00f577292a46c4ff22ff46a0e2ee3ba30d Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 16 Feb 2021 14:54:38 +0100 Subject: [PATCH] Remove FL_CFG_WIN_COCOA preprocessor variable from Fl_Sys_Menu_Bar.cxx --- src/Fl_MacOS_Sys_Menu_Bar.mm | 6 +----- src/Fl_Sys_Menu_Bar.cxx | 9 ++++----- src/Fl_System_Driver.H | 4 +++- src/drivers/Darwin/Fl_Darwin_System_Driver.H | 3 ++- src/drivers/Darwin/Fl_Darwin_System_Driver.cxx | 8 +++++++- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Fl_MacOS_Sys_Menu_Bar.mm b/src/Fl_MacOS_Sys_Menu_Bar.mm index c589f8118..e529f0769 100644 --- a/src/Fl_MacOS_Sys_Menu_Bar.mm +++ b/src/Fl_MacOS_Sys_Menu_Bar.mm @@ -1,7 +1,7 @@ // // MacOS system menu bar widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2021 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 @@ -42,10 +42,6 @@ static void move_tab_cb(Fl_Widget *, void *data); static void merge_all_windows_cb(Fl_Widget *, void *data); #endif -Fl_Sys_Menu_Bar_Driver *Fl_Sys_Menu_Bar::driver() { - return Fl_MacOS_Sys_Menu_Bar_Driver::driver(); -} - void Fl_MacOS_Sys_Menu_Bar_Driver::draw() { bar->deactivate(); // prevent Fl_Sys_Menu_Bar object from receiving events diff --git a/src/Fl_Sys_Menu_Bar.cxx b/src/Fl_Sys_Menu_Bar.cxx index 662cb0f19..267805cd4 100644 --- a/src/Fl_Sys_Menu_Bar.cxx +++ b/src/Fl_Sys_Menu_Bar.cxx @@ -1,7 +1,7 @@ // // system menu bar widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2021 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 @@ -15,9 +15,10 @@ // -#include "config_lib.h" +#include #include "Fl_Sys_Menu_Bar_Driver.H" #include +#include "Fl_System_Driver.H" Fl_Sys_Menu_Bar *fl_sys_menu_bar = 0; @@ -238,11 +239,9 @@ void Fl_Sys_Menu_Bar::create_window_menu() { } #if !defined(FL_DOXYGEN) -#if ! defined(FL_CFG_WIN_COCOA) Fl_Sys_Menu_Bar_Driver *Fl_Sys_Menu_Bar::driver() { - return NULL; + return Fl::system_driver()->sys_menu_bar_driver(); } -#endif // !FL_CFG_WIN_COCOA Fl_Sys_Menu_Bar_Driver *Fl_Sys_Menu_Bar_Driver::driver_ = 0; diff --git a/src/Fl_System_Driver.H b/src/Fl_System_Driver.H index 44b2333c0..59bf1de1a 100644 --- a/src/Fl_System_Driver.H +++ b/src/Fl_System_Driver.H @@ -2,7 +2,7 @@ // A base class for platform specific system calls // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2020 by Bill Spitzak and others. +// Copyright 2010-2021 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 @@ -42,6 +42,7 @@ class Fl_File_Icon; class Fl_File_Browser; class Fl_Pixmap; class Fl_Widget; +class Fl_Sys_Menu_Bar_Driver; /** \brief A base class for platform-specific system operations. @@ -239,6 +240,7 @@ public: virtual const char *meta_name() { return "Meta"; } virtual const char *alt_name() { return "Alt"; } virtual const char *control_name() { return "Ctrl"; } + virtual Fl_Sys_Menu_Bar_Driver *sys_menu_bar_driver() { return NULL; } }; #endif // FL_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 548277901..7d076a9ce 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -2,7 +2,7 @@ // Definition of Apple Darwin system driver // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2018 by Bill Spitzak and others. +// Copyright 2010-2021 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 @@ -83,6 +83,7 @@ public: virtual const char *meta_name(); virtual const char *alt_name(); virtual const char *control_name(); + virtual Fl_Sys_Menu_Bar_Driver *sys_menu_bar_driver(); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx index a08ff5891..e9c45d1d7 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.cxx @@ -1,7 +1,7 @@ // // Definition of Apple Darwin system driver. // -// Copyright 1998-2018 by Bill Spitzak and others. +// Copyright 1998-2021 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 @@ -22,6 +22,7 @@ #include #include #include +#include "../Cocoa/Fl_MacOS_Sys_Menu_Bar_Driver.H" #include #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 #include @@ -366,3 +367,8 @@ const char *Fl_Darwin_System_Driver::local_to_mac_roman(const char *t, int) { return t; } + +Fl_Sys_Menu_Bar_Driver *Fl_Darwin_System_Driver::sys_menu_bar_driver() +{ + return Fl_MacOS_Sys_Menu_Bar_Driver::driver(); +}