summaryrefslogtreecommitdiff
path: root/src/drivers/Cocoa
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2016-02-13 16:12:57 +0000
committerMatthias Melcher <fltk@matthiasm.com>2016-02-13 16:12:57 +0000
commitd8f96b579d9359f62b984b2043a8f8c6854efe98 (patch)
tree00b5fa4cd4a195aa82431b0c211a717d6e4b6d86 /src/drivers/Cocoa
parent4af616a7a27c3104938bf580502c762becd4417b (diff)
Moed Fl::visual and System_Scheme to the driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11166 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Cocoa')
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx46
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h9
2 files changed, 55 insertions, 0 deletions
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
index e34f8b998..5bd136bcd 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.cxx
@@ -20,12 +20,16 @@
#include "../../config_lib.h"
#include "Fl_Cocoa_Screen_Driver.h"
#include <FL/Fl.H>
+#include <FL/x.H>
#include <FL/fl_ask.h>
#include <stdio.h>
extern "C" void NSBeep(void);
+extern double fl_mac_flush_and_wait(double time_to_wait);
+extern int fl_ready();
+
/**
Creates a driver that manages all screen and display related calls.
@@ -121,6 +125,42 @@ void Fl_Cocoa_Screen_Driver::flush() {
}
+double Fl_Cocoa_Screen_Driver::wait(double time_to_wait)
+{
+ Fl::run_checks();
+ return fl_mac_flush_and_wait(time_to_wait);
+}
+
+
+int Fl_Cocoa_Screen_Driver::ready()
+{
+ return fl_ready();
+}
+
+
+extern void fl_fix_focus(); // in Fl.cxx
+
+extern void *fl_capture;
+
+
+void Fl_Cocoa_Screen_Driver::grab(Fl_Window* win)
+{
+ if (win) {
+ if (!Fl::grab_) {
+ fl_capture = Fl_X::i(Fl::first_window())->xid;
+ Fl_X::i(Fl::first_window())->set_key_window();
+ }
+ Fl::grab_ = win;
+ } else {
+ if (Fl::grab_) {
+ fl_capture = 0;
+ Fl::grab_ = 0;
+ fl_fix_focus();
+ }
+ }
+}
+
+
// simulation of XParseColor:
int Fl_Cocoa_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b)
{
@@ -182,6 +222,12 @@ void Fl_Cocoa_Screen_Driver::get_system_colors()
}
+const char *Fl_Cocoa_Screen_Driver::get_system_scheme()
+{
+ return getenv("FLTK_SCHEME");
+}
+
+
//
// End of "$Id$".
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h
index b06192205..22c17b165 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h
+++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.h
@@ -39,6 +39,9 @@
*/
+class Fl_Window;
+
+
class FL_EXPORT Fl_Cocoa_Screen_Driver : public Fl_Screen_Driver
{
protected:
@@ -47,6 +50,8 @@ protected:
float dpi_v[MAX_SCREENS];
public:
+ // --- display management
+ // --- screen configuration
virtual void init();
virtual int x();
virtual int y();
@@ -59,9 +64,13 @@ public:
virtual void beep(int type);
// --- global events
virtual void flush();
+ virtual double wait(double time_to_wait);
+ virtual int ready();
+ virtual void grab(Fl_Window* win);
// --- global colors
virtual int parse_color(const char* p, uchar& r, uchar& g, uchar& b);
virtual void get_system_colors();
+ virtual const char *get_system_scheme();
};