Commit Graph

349 Commits

Author SHA1 Message Date
ManoloFLTK
7f7e0e4ea1 Replace Fl_Window_Driver::is_a_rescale() by Fl_Window::is_a_rescale()
so it can be called by any user code.
2020-05-08 17:08:33 +02:00
Albrecht Schlosser
924289a40c X11: Fix X Input Methods (XIM) (STR 3502, 3192)
Revert commit 958d912ffc using 'XSetLocaleModifiers("@im=");'
which was incorrect (STR 3192).

Apply fix for STR 3502, using 'XSetLocaleModifiers("");' which appears
to be the correct solution for using X Input Methods (XIM).

This has also been backported to FLTK 1.3.6 in branch-1.3, see
commit 219ae5e455.
2020-02-10 13:38:26 +01:00
darealshinji
71dc3269cd Eliminate -Wunknown-pragmas and -Wsign-compare warnings on GCC 2020-02-09 15:31:57 +01:00
Albrecht Schlosser
b8ab77e39c Don't "export" X11 specific fl_open_display() function
The X11 specific overloaded function fl_open_display(Display *)
has never been documented but exposed (and "exported" in the ABI)
in FL/platform.H which is not necessary. This internal function
is now static and no longer exposed in the ABI.

Don't confuse with fl_open_display() w/o arguments which is still
exported and declared in FL/platform.H.
2020-02-03 15:58:13 +01:00
Albrecht Schlosser
a9bdb7a7b4 Fix disabling of deprecated warnings
Fix cut'n'paste error: needs #pragma pop instead of push.
2020-01-31 15:54:51 +01:00
Albrecht Schlosser
65a798f9a2 Disable X11 "deprecated declaration" warning
... for GCC >= 4.6 and clang compilers.

This annoying warning exists on X11 (Linux/Unix/macOS) platforms
because we need to use XKeycodeToKeysym() although it is deprecated.
See STR 2913 for discussion and details.
2020-01-31 15:06:21 +01:00
ManoloFLTK
2f64c6a861 Concentrate source code that supports Darwin + XQuartz + fink as test platform 2019-10-30 17:25:49 +01:00
ManoloFLTK
f20c07d757 X11: support copy/paste of image via clipboard within a single app
X11 requires to process differently paste if both copy and paste are within the
same app or are in 2 separate apps. This was implemented for paste of text.
It's now also implemented for paste of image.
2019-07-18 17:46:10 +02:00
ManoloFLTK
499ec5c291 Replace static void Fl_Window_Driver::default_icons() by virtual Fl_Screen_Driver::default_icons() 2019-03-25 18:47:29 +01:00
ManoloFLTK
8e9512330d X11 platform: keep GUI scaling after screen is reconfigured 2019-03-11 16:38:35 +01:00
ManoloFLTK
4e2ba8c888 X11 platform: follow when the OS changes the Xft.dpi resource
Under gnome, Tweaks -> Fonts ->Scaling factor allows to change
the size of all fonts handled by gnome.
With that change, FLTK apps obey to changes to Xft.dpi.
2019-03-11 16:20:29 +01:00
ManoloFLTK
5f6efb741d Improve static function react_to_screen_reconfiguration() 2019-03-06 14:59:47 +01:00
ManoloFLTK
d988930461 Process env var FLTK_SCALING_FACTOR consistently across platforms.
The procedure to set screen scaling factors becomes:
1) each screen scaling factor is set to 1
2) the OS is queried according to each platform to get screen scaling factor
values
3) The value of FLTK_SCALING_FACTOR, if present, is used to multiply
scaling factors
2019-03-06 11:10:37 +01:00
ManoloFLTK
21c0134931 New member function const Fl_Image* Fl_Window::shape() replaces int Fl_Window::is_shaped()
The new function allows to get the window's shaping image
and delete it after use, if appropriate.
2019-02-23 10:21:27 +01:00
ManoloFLTK
2c12bf4e1a X11 platform: account for window scaling in drag-n-drop operations. 2019-02-09 16:28:26 +01:00
Manolo Gouy
b6f65b1c87 X11: simplify the use of member function Fl_X11_Screen_Driver::init_workarea().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13044 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-09-07 09:24:35 +00:00
Manolo Gouy
643bb3bbbb Remove private member variable Fl_X11_Window_Driver::current_cursor_ that's no longer used.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@13003 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-08-03 18:20:37 +00:00
Manolo Gouy
7ebe8e21b0 Move Fl_Window_Driver.H from FL/ to src/
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12974 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-26 13:43:18 +00:00
Manolo Gouy
bfac49015c Fix for STR#3475: X11 platform, re-use current screen scaling factor when processing a screen reconfiguration event.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12939 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-06-08 11:31:30 +00:00
Manolo Gouy
8b7f7c78b2 Remove public member function Fl_Window_Driver *Fl_Window::driver() so class Fl_Window_Driver is not in FLTK public API.
This function is replaced by static Fl_Window_Driver* Fl_Window_Driver::(const Fl_Window *win).
The purpose is to have class Fl_Window_Driver outside from FLTK ABI.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12915 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-12 09:36:36 +00:00
Manolo Gouy
2b7aac129b Rename Fl_Paged_Device::start_job() to begin_job() and Fl_Paged_Device::start_page() to begin_page().
The new function names begin_job() and begin_page() better match end_job() and end_page() with which
they must be used by pair.
The old names start_job() and start_page() are maintained for API compatibility with FLTK 1.3.x

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12910 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-05-09 14:16:35 +00:00
Albrecht Schlosser
42d8aba117 Replace FL/x.H with FL/platform.H - step 2 (STR #3435).
This second step replaces FL/x.H with FL/platform.H in all source files.
Dependencies have been adjusted as well.

This commit completes the replacement of FL/x.H with FL/platform.H.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12641 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2018-01-31 21:17:17 +00:00
Albrecht Schlosser
1af23ab32f Fix doxygen and other comments, coding style, and alignment.
Replace QT style doxygen markers "/*!" with Javadoc markers "/**".

This commit does not change executable code.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12497 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-15 10:37:29 +00:00
Albrecht Schlosser
41f92be2f1 Replace remaining calls to unlink() with fl_unlink().
Tested under Linux, MinGW, and Visual Studio 2015.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12496 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-10-15 10:18:53 +00:00
Manolo Gouy
c4e04e4c7f Improve rescaling when window moved across screens: make sure center stays on new screen.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12367 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-07-30 16:21:57 +00:00
Manolo Gouy
c88466928d Replace static protected bool Fl_Window_Driver::is_a_rescale by a private static variable and a public getter.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12364 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-07-28 15:51:05 +00:00
Manolo Gouy
3f572e327f Rename Fl_Window_Driver::in_resize_after_scale_change to 'is_a_rescale' which is more expressive.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12358 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-07-27 14:38:35 +00:00
Manolo Gouy
9c47bc322c Remove Fl_Window_Driver::reuse_cursor() that is no longer used since commit r12349.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12350 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-07-25 11:31:19 +00:00
Manolo Gouy
225c3d6da3 Rewrite Fl_Window_Driver::resize_after_scale_change() removing calls to Fl_Window::hide() and Fl_Window::show().
Windows are now rescaled with a call to Fl_Window::resize() which has been slightly modified.
Static member variable bool Fl_Window_Driver::in_resize_after_scale_change is created,
and is true if and only if Fl_Window::resize() is called by Fl_Window_Driver::resize_after_scale_change().
This new flag allows Fl_Window::resize() to perform correctly the rescaling of the window.
Fl_Gl_Window::resize() and Fl_Double_Window::resize() also consult the value of
the Fl_Window_Driver::in_resize_after_scale_change flag.
The platform-specific Fl_WinAPI_Window_Driver::resize() and Fl_X11_Window_Driver::resize()
also use  the Fl_Window_Driver::in_resize_after_scale_change flag.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12349 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-07-25 10:57:24 +00:00
Manolo Gouy
8dccfc8838 HiDPI support under WIN32 platform: completed.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12285 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-07-03 17:31:57 +00:00
Manolo Gouy
322b62a9f1 HiDPI support: keep window's cursor after rescaling.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12275 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-06-28 13:33:53 +00:00
Manolo Gouy
2cda5a4fa6 Make Fl_Screen_Driver::get_mouse(int&, int&) return the number of the mouse-containing screen.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12264 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-06-17 06:53:44 +00:00
Manolo Gouy
8de22cfa42 Scaling for X11 platform: avoid undrawn right and bottom window margins when manually resizing windows
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12255 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-06-10 06:10:37 +00:00
Manolo Gouy
90efebb97e Divide virtual Fl_Screen_Driver::open_display() in a platform-specific part followed by a platform-independent part.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12245 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-06-01 14:05:47 +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
Pierre Ossman
cebc3d71be Pre-multiply alpha on cursors on X11, as required by XRender.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12177 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2017-02-20 12:40:50 +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
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
707d7f0dda Improve documentation, fix Fl_Window::icon(NULL).
This is now documented as legal to reset a window icon.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11882 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-08-20 17:09:28 +00:00
Manolo Gouy
e6b4af2c47 Fix how to access clipboard content at program start.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11710 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-05-04 05:59:18 +00:00
Manolo Gouy
d47b431750 Fix potential memory leak under X11 when pasted image is not accepted by the receiving app.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11709 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-05-03 14:28:45 +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
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
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
f29fb8c539 Complete the implementations of virtual Fl_X* Fl_Window_Driver::makeWindow() with the X11 platform.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11661 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
2016-04-19 16:00:30 +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