diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2016-02-13 16:12:57 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2016-02-13 16:12:57 +0000 |
| commit | d8f96b579d9359f62b984b2043a8f8c6854efe98 (patch) | |
| tree | 00b5fa4cd4a195aa82431b0c211a717d6e4b6d86 /src/drivers/WinAPI | |
| parent | 4af616a7a27c3104938bf580502c762becd4417b (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/WinAPI')
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx | 58 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h | 9 |
2 files changed, 67 insertions, 0 deletions
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx index 9c3b450cd..3d39ba7ed 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.cxx @@ -19,6 +19,8 @@ #include "../../config_lib.h" #include "Fl_WinAPI_Screen_Driver.h" +#include <FL/Fl.H> +#include <FL/x.H> #include <FL/fl_ask.h> #include <stdio.h> @@ -40,6 +42,17 @@ Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() } +int Fl_Screen_Driver::visual(int flags) +{ + fl_GetDC(0); + if (flags & FL_DOUBLE) return 0; + if (!(flags & FL_INDEX) && + GetDeviceCaps(fl_gc,BITSPIXEL) <= 8) return 0; + if ((flags & FL_RGB8) && GetDeviceCaps(fl_gc,BITSPIXEL)<24) return 0; + return 1; +} + + // We go the much more difficult route of individually picking some multi-screen // functions from the USER32.DLL . If these functions are not available, we // will gracefully fall back to single monitor support. @@ -240,6 +253,45 @@ void Fl_WinAPI_Screen_Driver::flush() } +double Fl_WinAPI_Screen_Driver::wait(double time_to_wait) +{ + return fl_wait(time_to_wait); +} + + +int Fl_WinAPI_Screen_Driver::ready() +{ + return fl_ready(); +} + + +extern void fl_fix_focus(); // in Fl.cxx + +// We have to keep track of whether we have captured the mouse, since +// MSWindows shows little respect for this... Grep for fl_capture to +// see where and how this is used. +extern HWND fl_capture; + + +void Fl_WinAPI_Screen_Driver::grab(Fl_Window* win) +{ + if (win) { + if (!Fl::grab_) { + SetActiveWindow(fl_capture = fl_xid(Fl::first_window())); + SetCapture(fl_capture); + } + Fl::grab_ = win; + } else { + if (Fl::grab_) { + fl_capture = 0; + ReleaseCapture(); + Fl::grab_ = 0; + fl_fix_focus(); + } + } +} + + // simulation of XParseColor: int Fl_WinAPI_Screen_Driver::parse_color(const char* p, uchar& r, uchar& g, uchar& b) { @@ -295,6 +347,12 @@ void Fl_WinAPI_Screen_Driver::get_system_colors() } +const char *Fl_WinAPI_Screen_Driver::get_system_scheme() +{ + return getenv("FLTK_SCHEME"); +} + + // diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h index b44b70ebb..d6f5f01f1 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.h @@ -29,6 +29,9 @@ #include <FL/x.H> +class Fl_Window; + + class FL_EXPORT Fl_WinAPI_Screen_Driver : public Fl_Screen_Driver { protected: @@ -40,6 +43,8 @@ protected: BOOL screen_cb(HMONITOR mon, HDC, LPRECT r); public: + // --- display management + virtual int visual(int flags); // --- screen configuration virtual void init(); virtual int x(); @@ -53,9 +58,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(); }; |
