Commit Graph

348 Commits

Author SHA1 Message Date
Albrecht Schlosser
58c21c0bc6 Fix Visual Studio build with HiDPI support.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12241 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-05-21 14:48:44 +00:00
Manolo Gouy
f48750b0f4 Introduce HiDPI + rescaling support for the X11 platform (+ partial support for WIN32)
Corresponds to STR #3320
1) HiDPI support consists in detecting the adequate scaling factor for the screen on which
FLTK maps a window, and scaling all FLTK units by this factor. FLTK tries to detect the correct
value of this factor at startup (see more details below). Environment variable
FLTK_SCALING_FACTOR can also be used to set this value.
2) Rescaling support consists in changing the scaling factor of all FLTK windows
in reply to ctrl/+/-/0/ keystrokes.

More details for the various platforms :

- X11: Support is very advanced. Some details need still to be improved.
Automatic detection of the correct starting value of the scaling factor works well
with the gnome desktop. The present code contains no support for this on
other desktops.  FLTK_SCALING_FACTOR provides a workaround.

-WIN32: Support is incomplete at this point, although many test
applications have partial or complete HiDPI and scaling support.
The current value of the system's scaling factor is correctly detected
at application startup. Apps respond to changes of this value in real time.
Support needs to define the FLTK_HIDPI_SUPPORT preprocessor variable
at compile time. This way, standard builds produce a code with the
default WIN32 HiDPI support, that is, where all graphics goes to an internal
buffer that gets enlarged by the system and then mapped to the HiDPI
display. To experiment with (or develop) the new HiDPI support requires
a modified build procedure in which  FLTK_HIDPI_SUPPORT is defined
at compile time. When the support will be complete, the requirement for the
definition of this preprocessor variable will be removed. The present commit
contains support for a single scaling factor. Eventually, per-screen scaling
factors should be implemented, as done for X11.

- MacOS: this commit does not give new HiDPI for this platform.
Eventually, window rescaling in reply to command/+/-/0/ is desirable.
Per-screen scaling factor makes no sense on this platform because
the OS itself takes care of the difference between the resolutions of
traditional and retina displays.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12239 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-05-17 11:54:18 +00:00
Manolo Gouy
43935dffeb Add static void Fl_Surface_Device::push_current(Fl_Surface_Device *new_current) and pop_current() to set/unset the current drawing surface.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12140 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-12-07 15:09:52 +00:00
Manolo Gouy
5bb4e853c7 Remove Fl_Image_Surface::end_current() to be called after usage of the drawing surface.
This ensures API compatibility with FLTK 1.3 where Fl_Surface_Device->set_current()
is used to change the current drawing surface.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12125 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-11-30 07:09:48 +00:00
Manolo Gouy
c530cdeda6 Use Fl_Graphics_Driver::default_driver() when convenient.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12088 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-11-09 09:49:48 +00:00
Albrecht Schlosser
e3670dfda6 Fix inconsistent interpretation of ld() in image handling (STR #3308).
Documentation has been fixed and clarified, and ld() handling is now
consistent in Fl_(RGB_)Image, their subclasses and fl_draw_image()
and similar functions.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@12029 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-10-14 16:35:52 +00:00
Manolo Gouy
eabbc41ef1 Avoid compilation warnings with -Wmaybe-uninitialized
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11993 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-29 13:28:40 +00:00
Manolo Gouy
827fa250f3 Remove fl_wait() that is not part of the public API.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11953 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-20 12:58:51 +00:00
Manolo Gouy
c06374378f Remove fl_ready() not in public API and mostly same as Fl_XXX_Screen_Driver::ready()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11951 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-19 16:59:59 +00:00
Manolo Gouy
c5960df5fb Rewrite fl_open_callback() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11929 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-09 15:56:33 +00:00
Albrecht Schlosser
9fd31ed94e Fix buffer overflow in CR/LF conversion.
An already present CR/LF combination causes us to jump two characters,
but we failed to update the length counter when doing this.

This also makes sure we handle the corner case of a CR as the last
character.

Note: porting Pierre Ossman's commit (svn r11873) to branch-1.3-porting.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11913 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-09-01 10:35:21 +00:00
Manolo Gouy
0e404ab7d7 Fix slight mis-scaling when pasting Enhanced metafile from clipboard
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11904 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-28 15:37:45 +00:00
Manolo Gouy
87d28f5eab Use desktop scaling factor also when pasting an Enhanced Metafile
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11900 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-28 06:45:59 +00:00
Manolo Gouy
5dbfe413ae Fix computation of Fl_Window::decorated_w() and decorated_h() when apps are resized through display setting.
Under Windows 10:
when the user sets the value of "Change the size of text, apps and other items" in display settings
to above 100 %, the computation of Fl_Window::decorated_w() and decorated_h() has to
take the scaling factor into account.
This factor is also necessary to draw correctly window title bars.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11893 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-25 12:42:50 +00:00
Manolo Gouy
a7ce881c7d Remove unused variable.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11892 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-24 08:57:21 +00:00
Manolo Gouy
0267781cec Change return type of Fl_Screen_Driver::read_win_rectangle() to Fl_RGB_Image*
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11884 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-23 09:38:46 +00:00
Manolo Gouy
5ec684f236 Minor simplification.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11678 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-22 17:13:40 +00:00
Manolo Gouy
163c65dc6f Avoid the expression "foreign language" in comments.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11676 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-20 07:19:19 +00:00
Matthias Melcher
769d151a12 Virtualized add_fd and remove_fd into System Driver
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11668 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 22:45:22 +00:00
Manolo Gouy
cd4498021e Have headers x.H, win32.H and mac.H share a unique definition of class Fl_X
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11667 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 20:47:25 +00:00
Manolo Gouy
1e8a53ecc4 Move private_dc from Fl_X for WIN32 platform to Fl_WinAPI_Window_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11664 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 19:37:49 +00:00
Manolo Gouy
4aa388d4ff Add static Fl_XXX_Window_Driver *driver(Fl_Window*) to get the platform-specific driver of a window.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11663 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 17:34:15 +00:00
Manolo Gouy
24487a719f Move Fl_X::make_fullscreen() for WIN32 platform to Fl_WinAPI_Window_Driver:: make_fullscreen().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11660 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 15:47:23 +00:00
Manolo Gouy
1e060f6408 Transform Fl_X::make(Fl_Window*) for WIN32 platform into virtual Fl_X* Fl_Window_Driver::makeWindow().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11659 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 15:33:58 +00:00
Manolo Gouy
c0f14ca2f0 Move other_xid member variable from class Fl_X to class F_Window_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11654 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-18 17:02:44 +00:00
Manolo Gouy
e790ac9653 Move wait_for_expose member variable from class Fl_X to class Fl_Window_Driver.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11653 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-18 16:11:15 +00:00
Manolo Gouy
0629b40afd Move set_cursor() member functions from class Fl_X to classes Fl_Window_Driver and derived.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11652 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-18 14:31:07 +00:00
Manolo Gouy
cb95d40067 Remove Fl_X::setwindow(Fl_Window*) from WIN32 and USE_X11 Fl_X classes.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11649 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-18 12:48:40 +00:00
Manolo Gouy
85b5f02a8b Replace member function void Fl_X::flush() by virtual void Fl_Window_Driver::flush()
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11646 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-18 11:58:46 +00:00
Matthias Melcher
e2495a760a MSWindows fixes for previous commits.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11644 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-17 17:45:44 +00:00
Matthias Melcher
cc57af841a virtualizes fl_set_spot and fl_reset_spot
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11640 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-17 14:22:02 +00:00
Manolo Gouy
c6c92e4037 Remove set_icons() from the virtual API of class Fl_Window_Driver because it is internal to some drivers.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11636 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-17 05:41:05 +00:00
Manolo Gouy
c4953935b0 Continue removing non window-related member-functions from class Fl_X.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11633 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-16 13:15:49 +00:00
Manolo Gouy
b0ce80f56b Continue removing non window-related member-functions from class Fl_X.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11632 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-16 12:28:50 +00:00
Manolo Gouy
2fcb4f4192 Move platform-dependent implementations of fl_open/close_display() to the Fl_Screen_Driver class
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11619 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-15 15:36:10 +00:00
Manolo Gouy
15715cd898 Move platform-dependent implementations of Fl::en/dis/able_im() to the Fl_Screen_Driver class
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11618 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-15 15:12:22 +00:00
Manolo Gouy
397a3b83bf Move platform-dependent implementations of fl_clipboard_notify_changes() to the Fl_System_Driver class
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11617 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-15 15:01:27 +00:00
Manolo Gouy
b1f8f3e2aa Move platform-dependent implementations of Fl::clipboard_contains() to the Fl_System_Driver class
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11616 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-15 14:49:46 +00:00
Manolo Gouy
d683841f9f Move the platform-dependent implementations of Fl::paste() to the Fl_System_Driver class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11615 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-15 14:32:13 +00:00
Manolo Gouy
7508a033c5 Continue moving to Fl_System_Driver the platform_dependent implementations of member functions of the Fl class.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11614 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-15 14:18:37 +00:00
Albrecht Schlosser
aafd8b6031 Fix VisualC++ build (Visual Studio 2015).
IDE generated with CMake, still many warnings, but compiles and runs.

Note: we *must* get rid of all VisualStudio-specific #define's like:

 #define unlink _unlink

This one led to a compilation error (not a warning).

src/Fl_File_Icon.cxx: I had to add _MSC_VER (WIN32) distinction as in
  previous code (FLTK 1.3). Obviously MinGW is more Unixy than MS VC++
  since MinGW compiled and linked the code. Needs a better fix ...


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11580 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-11 00:46:11 +00:00
Manolo Gouy
6879d54fc4 Rewrite Fl_lock.cxx under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11578 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-10 20:38:04 +00:00
Albrecht Schlosser
020a96b4a8 Fix more compiler warnings.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11536 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-05 21:15:45 +00:00
Manolo Gouy
b3af5591ca Stop using fl_read_image() to read window decoration.
Use instead an API internal to each platform code base.
fl_read_image() is used only for its documented feature
of reading inside the current window or an offscreen buffer.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11518 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-03 08:36:19 +00:00
Manolo Gouy
d011d5b4f0 Replace src/Fl_Font.H by one file for each platform.
This file contained nearly only platform-specific code.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11507 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-02 13:22:48 +00:00
Manolo Gouy
d67f395031 Rewrite functions XRectangleRegion(), XDestroyRegion() under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11479 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-30 20:16:40 +00:00
Manolo Gouy
4fcefc68f8 Remove the platform-dependent type xchar
File fl_utf8.h defines the xchar type with a platform-dependent value (wchar_t or unsigned short).
But it is used exclusively by WIN32 code (0 use in cross-platform code, 0 use in APPLE
or in USE_X11 code).
Thus, we can just get rid of this type and replace it by wchar_t where it is used.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11459 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-29 09:29:51 +00:00
Manolo Gouy
915d6c643a Isolate the definition of the 3 public, OS-dependent types (Fl_Offscreen, Fl_Region, Fl_Bitmask).
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11432 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-26 14:36:11 +00:00
Manolo Gouy
8e14321df4 Remove duplicate #include directive
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11421 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-25 15:39:51 +00:00
Manolo Gouy
a69133d317 Separating platform-dependent from platform-independent code: make src/Fl.cxx cross-platform.
File src/Fl_win32.cxx is now compiled instead of included in Fl.cxx.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11420 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-03-25 13:08:48 +00:00