Commit Graph

418 Commits

Author SHA1 Message Date
Albrecht Schlosser
2252ba9839 X11: don't send FL_RELEASE event after FL_MOUSEWHEEL
Horizontal mousewheel events use pseudo button numbers 6 and 7, resp.,
similar to vertical mousewheel events which use buttons 4 and 5.

The old code erroneously sent FL_RELEASE events for buttons 6 and 7
although it was prevented for buttons 4 and 5 explicitly.
2024-07-07 20:00:43 +02:00
Albrecht Schlosser
3cc5c090f9 X11: update XDND protocol from version 4 to 5 (#988)
Some applications insist on sending XDND protocol version 5 and
rejected (ignored) FLTK as DND receiver because we allowed only
protocol version 4. Known apps: Google Chrome and Chromium.

This commit enables XDND protocol version 5 in FLTK programs as
DND receiver.
2024-06-15 12:11:41 +02:00
ManoloFLTK
f3f69b892d Remove useless Fl_Window_Driver accessors after new member Fl_Window::get_size_range() 2024-05-27 11:39:27 +02:00
ManoloFLTK
f56999aaf8 Add detailed comment about getting all supported XDND data types 2024-05-11 07:43:27 +02:00
ManoloFLTK
32b9c120f0 Fix DnD from Wayland gnome app to X11 FLTK app
This DnD gives two data types of the dragged text: text and a gnome-specific type.
The code previously accepted DnD with 1 data type or 4 or more data types,
and processed situations with 2 or 3 data types in a special way that fails
with gnome source apps.
The new code processes situations with 2 and 3 data types just like other ones.
This works OK when dragging from gnome wayland apps.
2024-05-10 20:26:53 +02:00
ManoloFLTK
6763b357f4 Improve use of fl_create_print_window() under X11 2024-04-04 12:01:04 +02:00
Albrecht Schlosser
af90841fbc Update dependencies, whitespace, and Fl_File_Chooser.cxx
Rewrite src/Fl_File_Chooser.cxx from its .fl source file
2024-03-19 15:39:18 +01:00
ManoloFLTK
61c0f79397 Fix "FLTK on NetBSD very slow on X11 with Unicode locale" (#935) 2024-03-18 14:05:48 +01:00
ManoloFLTK
f8380476c2 using xlib to query the new DPI (old #910) (PR #913)
Thanks to Mike Qin for finding how to query the possibly changed DPI value
of an X11 display while an FLTK app keeps running without running
an external command in a pipe.
2024-03-12 15:40:45 +01:00
ManoloFLTK
a0ff3f6f5c Fix Scaling window up/down also scales X/Y position on secondary displays only (#925) 2024-03-04 16:25:45 +01:00
ManoloFLTK
5ba756e60a X11: improve moving window back & forth across screens (#919) 2024-03-04 10:10:04 +01:00
ManoloFLTK
bbbc3a739c X11: Window scaling makes window lose resizable status if resizable_ is NULL (#923) 2024-03-03 20:53:16 +01:00
ManoloFLTK
42ff55026e Fix "commit 96bacd3 may crash on X11" (#873) 2023-12-21 14:22:08 +01:00
ManoloFLTK
96bacd3f9d Procedure to instruct FLTK to use given X11 connexion (#149) 2023-12-19 15:48:26 +01:00
Albrecht Schlosser
0c712e50bc Fix X11 '_NET_ACTIVE_WINDOW' message (STR 3396)
Send a valid timestamp rather than 0.

For details see STR 3396.
2023-12-13 19:07:30 +01:00
Albrecht Schlosser
44bb080c0f Remove friend declaration from Fl_Window.H (see STR 3354)
Although this was not strictly necessary I decided to implement the
proposed patch, but in a slightly different way.

This adds a static public method for internal use only but it wouldn't
do any harm if a user called it.
2023-11-17 16:55:37 +01:00
ManoloFLTK
0ae927a00e Add Fl_Window::maximize() and Fl_Window::un_maximize() 2023-11-05 19:42:55 +01:00
ManoloFLTK
50b04b565b Fix Crashes and warnings when Fl_Double_Window is smaller than 1x1 (#798) 2023-10-17 09:37:01 +02:00
ManoloFLTK
336bd01f16 X11 platform: give number keys layout-independent keysym's
Without this, the sudoku app is unusable with a French keyboard
2023-08-16 12:35:50 +02:00
Albrecht Schlosser
8c5c7aa7f4 Handle shift + mousewheel event on Linux (STR 3521)
Pressing the shift key while using the mousewheel changes
horizontal to vertical scrolling and vice versa. This allows users
with a standard mouse with only one scroll button to use it for both
scrolling directions.

Note: other mice that have either two buttons or a scroll ball can
generate both horizontal and vertical scrolling in one action. This
commit does not affect such behavior.

This patch has been provided by Manolo in file 'scroll.patch'
(see STR 3521).
2023-08-13 17:07:26 +02:00
Albrecht Schlosser
a4c6c18b3d Fix doxygen doc generation and document platform specific files
Pure platform specific files like 'src/*_win32.cxx' are excluded from
doxygen processing and don't need doxygen specific guard macros.

Document this fact prominently at the beginning of each file.

Fix exclude patterns and remove duplicates from Doxyfile.in.
2023-05-09 22:36:41 +02:00
ManoloFLTK
868ab9696f Rename class Fl_Display_Cairo_Graphics_Driver to Fl_X11_Cairo_Graphics_Driver 2023-02-14 11:52:21 +01:00
ManoloFLTK
f459fdb637 Allow scaled image in Fl_Window::cursor(const Fl_RGB_Image *, int, int) 2023-02-13 12:11:04 +01:00
ManoloFLTK
f3e21ddad2 Fix for "Rename Fl_X* Fl_Window::i private class member" (#223) 2023-01-13 21:16:17 +01:00
Albrecht Schlosser
8dd3ff8e12 X11: Optionally copy selection buffer to clipboard (STR 3229)
The new method Fl::selection_to_clipboard(int) enables copying
selection data to the clipboard on X11 if it is set to 1.

This feature was requested by STR 3229 and the implementation was
inspired by an `xterm` feature named "Select to Clipboard" which can
be enabled by 'ctrl + middle mouse button + "Select to Clipboard"'
in an xterm window.
2023-01-06 16:45:22 +01:00
Matthias Melcher
473b5d8b5b Fixing false FL_OVERRIDE 2022-12-30 20:54:03 +01:00
Matthias Melcher
44c874b731
Use FL_OVERRIDE for all overridden virtual methods (#611)
FL_OVERRIDE is defined as `override` for C++11 and higher
FL_OVERRIDE is defined as `override` for VisualC 2015 and newer
Don't interfere with Fl_Widget::override()
2022-12-30 19:14:36 +01:00
ManoloFLTK
37bf3835b0 Create class Fl_Unix_Screen_Driver used by X11 and Wayland platforms 2022-11-07 06:49:40 +01:00
ManoloFLTK
4b945a3086 Wayland/X11 hybrid: use "bool fl_disable_wayland;" declaration. 2022-11-05 19:47:37 +01:00
ManoloFLTK
857462529b Allow DnD from Wayland FLTK app to X11 FLTK app (#516) 2022-10-17 19:16:01 +02:00
ManoloFLTK
2ffd4e4f1a Replace all calls to sprintf() by calls to snprintf(). 2022-09-26 16:12:18 +02:00
ManoloFLTK
eb0bba4058 Fix Fl_X11_Window_Driver::fullscreen_on() and Fl_X11_Window_Driver::fullscreen_off(). 2022-09-23 14:25:32 +02:00
ManoloFLTK
eb314f5653 Allow use of Fl_Window::default_icon() with a scaled image - Part 2.
Default icons are handled according to their scaled size, if there scaled.
2022-09-17 09:03:34 +02:00
ManoloFLTK
87ee126e1f Allow use of Fl_Window::default_icon() with a scaled image. 2022-09-12 11:07:03 +02:00
Albrecht Schlosser
76858fc040 Fix compiler warning [-Wunused-function]
warning: ‘int xrender_supported()’ defined but not used

This happens only with certain configure options, particularly if
  FLTK_USE_CAIRO is set, i.e. drawing with Cairo is enabled.
2022-09-02 16:28:53 +02:00
ManoloFLTK
b75d7526fd Simplify Fl_Window_Driver::screen_num() member functions. 2022-09-01 11:55:41 +02:00
Albrecht Schlosser
746135f0ae X11: Fix rescaling of non-resizable window (issue #491) 2022-08-29 18:55:01 +02:00
ManoloFLTK
c720aae515 Make hybrid Wayland/X11 platform. 2022-08-29 12:15:32 +02:00
ManoloFLTK
f77c4737bb Fix for issue #471: Different Fl_Window::resize() behavior between v1.3.8 and v1.4 2022-07-27 16:53:43 +02:00
Albrecht Schlosser
ef72df0dc7 Improve X11 selection data transfer (INCR) protocol (#451)
This improves reading large selections and fixes one more bug.

- Fix reading selection data size of clients that don't send the size.
  These clients don't respect the ICCCM. Using a default size instead.

- Improve memory allocation by pre-allocating at least 4 MB and
  extending by 4 MB to reduce the number of realloc() operations.
  This may waste up to 4 MB buffer space but this is only an issue
  if clients don't send an appropriate size (see above).

- Limit the initial allocation to 200 MB in case clients send higher
  values. This is very unlikely and might be a bug in these clients.
  Default extension as above would apply anyway.

- Add more comments and optional debug statements (commented out).

Note: reading selections (clipboard) from other clients using the
  INCR protocol is implemented but the opposite (providing large
  selections (clipboard) by using the INCR protocol is not.
2022-07-02 15:44:46 +02:00
Albrecht Schlosser
c555629162 Fix "Segfault if using very large selections" (issue #451)
- Fix reading the size (aka "lower bound") of selection data.

- Use Fl::fatal() to terminate the process if memory for the selection
  (aka clipboard) data can't be allocated. This should rarely
  happen but if it does this is at least a "clean" exit and does
  not overwrite arbitrary data waiting for later errors that are
  hard to debug (as the old code would have done).

  Todo: find a better solution because this can be caused by
  another faulty process (the "selection owner"). It would be good
  if we could ignore the transfer rather than killing the process.

- Continue processing the INCR protocol if another "unexpected" event
  is received. Such events can definitely happen but the current code
  can't deal with this because other events might cause recursions.
  Hence such events are currently ignored.

  Example: pressing and holding ctrl/v would trigger another clipboard
  transfer while we're still processing one.

Todo: maybe process "other" events correctly while processing the INCR
  protocol. The current processing is done inside a function and would
  need to call fl_handle() with potential recursions, hence this would
  likely need major refactoring.
2022-07-01 17:39:41 +02:00
Albrecht Schlosser
42c27da735 Reformat, remove unnecessary code, add comments 2022-07-01 17:39:41 +02:00
ManoloFLTK
02870242ee Move input method support to Fl_Screen_Driver from Fl_Graphics_Driver 2022-06-19 10:23:24 +02:00
ManoloFLTK
bf5b902180 Rename member Fl_Graphics_Driver::p to xpoint to avoid shadowing. 2022-03-21 14:39:00 +01:00
ManoloFLTK
49dae86edf Fix for issue #418 : some warnings about unused functions. 2022-03-21 12:12:07 +01:00
Albrecht Schlosser
5ebb76050b Fix size_range() - continued (issue #392)
- fix window size of GL windows as reported for test/glpuzzle.cxx
- fix window not resizing on ctrl/+/- (X11 only)

Unfortunately the previous commit "optimized" a necessary X11 message
away. This is now fixed.

Fixes #392.
2022-03-05 15:50:49 +01:00
ManoloFLTK
3718effc43 Add the Wayland platform to FLTK 1.4 2022-03-04 15:41:00 +01:00
Albrecht Schlosser
091712bea8 Fix default size_range() calculation (issue #392, STR 3352) 2022-03-01 13:45:51 +01:00
Albrecht Schlosser
cdd1933661 X11: Disable "boxcheat" hack
For details see comment in src/Fl_x.cxx: this "Hack to speed up
bg box drawing" is now disabled for several reasons. The code
is still available if the macro ENABLE_BOXCHEAT is defined.
2022-02-22 19:55:11 +01:00
Albrecht Schlosser
84c06419bc Remove obsolete/disabled "boxcheat" code
Windows platform: Remove comments about obsolete code and one
exported declaration of the variable 'fl_background_pixel' which
is used only on the X11 platform.

X11 platform: Remove comments.

Other platforms: not affected.
2022-02-21 20:38:33 +01:00