Commit Graph

1089 Commits

Author SHA1 Message Date
Paul Cornett
edc47d8fed Fix appearance of GTK3 single-line wxTextCtrl with non-default background
...and more text than will fit. See #18663
2020-02-09 08:13:01 -08:00
Paul Cornett
0ca45d1a59 Remove redundant checks for NULL before calling delete 2020-02-02 23:51:39 -08:00
Paul Cornett
948ddc6e0f Eliminate -Wcast-qual warnings with GCC and Clang
Use const_cast, mutable, and various other changes to avoid -Wcast-qual
2020-02-02 22:50:32 -08:00
Vadim Zeitlin
3a09975465 Create WXSendContextMenuEvent() helper function
Put common code from all the different ports into it.

This is not very useful right now, but it will allow to change this
function once, instead of applying the same change to all ports, in the
upcoming commit.
2020-01-07 18:22:09 +01:00
Paul Cornett
0fab5eb071 Allow scrollwheel events when mouse is captured with GTK3, see #18593 2019-11-25 20:52:12 -08:00
Paul Cornett
4697ce23d9 Don't allow DestroyClippingRegion() to remove paint update area clipping with GTK3
See #18560
2019-10-31 23:30:18 -07:00
Vadim Zeitlin
e790f03950 Fix popup menu position on non-primary displays in wxGTK
If the popup menu position was explicitly specified, it wasn't taken
into account correctly in wxGTK code as it always clamped it to the
primary display boundaries, even if the window showing the menu wasn't
on this monitor at all, typically resulting in the menu shown at the
left or right edge of the monitor instead of the correct position.

Fix this by using the display containing the window instead. This
requires passing the window, or rather the menu from which it can be
retrieved, to wxPopupMenuPositionCallback too, so add a helper struct to
pass both the position and the menu to it.

Closes https://github.com/wxWidgets/wxWidgets/pull/1621
2019-10-29 13:55:41 +01:00
Paul Cornett
82caca68ba Fix drawing border with GTK3 when non-native control is a child of a native widget
Such as wxSearchCtrl in GtkToolbar. See #18522
2019-10-06 08:28:44 -07:00
Paul Cornett
cf4f3a92c5 Avoid Gdk-CRITICAL warnings when GTKFindWindow() is passed an unrealized widget 2019-08-25 17:57:55 -07:00
Paul Cornett
f99153dbd1 Remove wxGLCanvas "size-allocate" signal handler
There is already a handler in wxWindow which will do the same thing.
2019-06-12 23:25:29 -07:00
Paul Cornett
955a60a3e1 Avoid possible memory leak 2019-04-05 11:10:03 -07:00
Vadim Zeitlin
b0133392b7 Fall back on the main widget if connect one isn't focusable
If neither main widget nor connect widget is focusable (which notably
happens when they're the same anyhow, as is the case for wxChoice, for
example), still use the main widget as mnemonic instead of not using any
mnemonic at all.

This fixes activation of a wxChoice preceded by wxStaticText by pressing
the key combination corresponding to the label mnemonic, which didn't
work previously.
2019-03-27 15:41:53 +01:00
Vadim Zeitlin
01ed0842ff Set mnemonics for the closest preceding label
Due to a wrong "else" in RealizeTabOrder() implementation, we could set
the mnemonic widget for a previous widget using mnemonics (i.e.
wxStaticText or wxStaticBox) rather than the one closest to the actual
control activated by the mnemonic.
2019-03-27 15:39:39 +01:00
Paul Cornett
993334c48a Avoid clipping wxCheckBox focus indicator on GTK3
GtkCheckButton "outline" is drawn outside of widget's allocation with Adwaita theme
See #18353, #18043
2019-03-12 10:11:20 -07:00
Paul Cornett
d4b4b3c48c Fix non-Unicode build 2019-03-06 09:49:04 -08:00
Scott Talbert
eaee931011 Fix sending of EVT_KEY_DOWN on wxGTK for non-ASCII characters
Instead of returning early if the keycode is invalid, try setting the unicode
character first, and if neither are valid, return.

Fixes #18054
2019-01-27 09:01:05 -08:00
Paul Cornett
942362063d Avoid blocking paint events from long-running mouse event handlers
If a mouse event handler calls Refresh(), increase the likelyhood that a
paint event can be issued before the next mouse event occurs, by requesting
more mouse events from the the end of the handler rather than the start.
See #18314
2018-12-31 10:45:44 -08:00
Vadim Zeitlin
5ba1ba1162 Fix creating disabled windows in wxGTK too
Don't forbid calling Enable() before creating the window and just do
nothing in this case and do disable the window when it's actually
created if it's supposed to be disabled.

Note that this doesn't work for classes overriding Enable() directly,
such as wxButton or wxCheckBox, currently.
2018-12-09 19:20:50 +01:00
Vadim Zeitlin
4405176bb9 Return correct scale factor for not yet realized windows in wxGTK
wxWindow::GetContentScaleFactor() always returned 1 before the window
was shown in wxGTK, which was rather annoying as typically icons are
initialized on application startup, i.e. before showing the windows, and
so the wrong scale factor was silently used for them.
2018-10-31 20:24:06 -07:00
Paul Cornett
25a54a9b56 build fix for wxUniversal 2018-10-28 09:16:06 -07:00
Paul Cornett
3ec4e53aa1 Avoid setting "pending" focus to a window which already has the focus. 2018-07-26 09:21:03 -07:00
Vadim Zeitlin
4059f24cf5 Reset pending focus when losing focus in wxGTK
It could happen that the window remained as the global "pending focus"
even after it lost its focus, resulting in FindFocus() still returning
it as the currently focused window, even though it didn't have focus any
more.

This notably broke focus logic of wxCompositeWindow and could result in
missing wxEVT_KILL_FOCUS for windows using it, such as wxDatePickerCtrl,
and quite likely was responsible for other focus problems in wxGTK as
well.
2018-07-25 18:18:18 +02:00
Vadim Zeitlin
c9cce7e071 Refactor focus debug logging in wxGTK
No real changes, just add a helper wxDumpWindow() function to make focus
logging less verbose and slightly more readable (as the label is not
shown any more if it's empty).
2018-07-25 18:18:18 +02:00
Vadim Zeitlin
7eef4a4549 Fix build with GTK+ < 2.20 due to undefined key code constants
Include gdk/gdkkeysyms.h from wx/gtk/private/gtk2-compat.h as it must be
included before it for the compatibility header to define the new names
for the key constants even when using old GTK+ versions.
2018-05-22 17:01:07 +02:00
Vadim Zeitlin
c0b0562533 Avoid many -Wparentheses warnings from gtk/gtk.h with gcc8
Add wx/gtk/private/wrapgtk.h wrapping gtk/gtk.h in pragmas disabling
these warnings and include it everywhere instead of directly including
gtk/gtk.h.

Also include wx/gtk/private/gtk2-compat.h from this wrapper header as it
was included by 90% of the files including gtk/gtk.h itself and it seems
to be better and simpler to just always include it.
2018-05-21 12:34:04 +02:00
Paul Cornett
9bfa890480 Build fixes for __WXUNIVERSAL__==1 2018-05-11 10:16:49 -07:00
Vadim Zeitlin
e5a1a29e77 Fix wxGTK build with glib < 2.32 and streamline the code a bit
Define g_signal_handlers_disconnect_by_data() if it's not available,
i.e. when using glib older than 2.32 where it was added, to fix the
build under old systems such as CentOS 6 broken by the changes of
8278f7b618 (see #18084).

Also use it elsewhere instead of g_signal_handlers_disconnect_matched()
as it's more readable.

Closes https://github.com/wxWidgets/wxWidgets/pull/760
2018-03-11 22:22:45 +01:00
Vadim Zeitlin
1148b2e0fe Make GTKHandleDeferredFocusOut() non-static
Slightly simplify the code by making it a member function.

No real changes.
2018-02-03 23:56:44 +01:00
Vadim Zeitlin
f8674c7ff0 Remove unnecessary check for gs_deferredFocusOut
GTKHandleDeferredFocusOut() is only ever called when gs_deferredFocusOut
is non-null, so there is no need to check for it inside this function
again.

No real changes.
2018-02-03 23:30:31 +01:00
Vadim Zeitlin
8565d8f2fc Set window field of wxEVT_SET_FOCUS events in wxGTK
It is often useful to know where is the focus coming from, for example
to determine if was in another window of the same composite control.

Remember the last focus in yet another global variable in wxGTK code to
allow setting wxFocusEvent::m_window correctly when generating
wxEVT_SET_FOCUS events.
2018-01-30 13:56:51 +01:00
Paul Cornett
84c3bc123e Prevent widgets from drawing outside their allocation with GTK+3
See #18043
2018-01-28 22:19:46 -08:00
Paul Cornett
5efba4ce47 Avoid invisible wxTextCtrl selection with GTK+3
See #18036
2018-01-03 20:22:12 -08:00
Paul Cornett
72fe3a1d07 Avoid gdk_window_set_composited() with GTK+4 2017-12-19 21:40:38 -08:00
Paul Cornett
ba4da9fdf9 Use "new" GDK keysym names
Old names are no longer available with GTK+4
2017-12-17 21:51:16 -08:00
Paul Cornett
ea5cd6dbfc Avoid GdkDeviceManager with GTK+4 2017-12-17 10:36:58 -08:00
Paul Cornett
db00ab9c02 Avoid gtk_show_uri() with GTK+3.9x 2017-12-07 10:51:57 -08:00
Paul Cornett
be37dd4862 Fix keyboard navigation for controls which are initially disabled
See #16806
2017-12-03 14:41:57 -08:00
Vadim Zeitlin
289fbcf5be Fix use of GDK_TOUCHPAD_GESTURE_MASK with GTK+ 3.14..3.16
Define GDK_TOUCHPAD_GESTURE_MASK ourselves if GTK+ headers don't define
it and don't use it during run-time if GTK+ version is less than 3.18,
in which it was added.
2017-12-02 21:29:09 +01:00
Vadim Zeitlin
3e0adbf541 Merge branch 'gesture-events'
Integrate GSoC 2017 work by Prashant Kumar implementing support for
gesture events.

Closes https://github.com/wxWidgets/wxWidgets/pull/551

Closes https://github.com/wxWidgets/wxWidgets/pull/565
2017-12-02 18:46:53 +01:00
Vadim Zeitlin
fc9244614a Request GDK_TOUCHPAD_GESTURE_MASK events in wxGTK
This is apparently needed in order to get the gesture events.
2017-11-30 21:36:49 +01:00
Paul Cornett
bca2d063bb Avoid using NULL style provider
Fixes assertions with wxNotebook
2017-11-26 00:00:44 -08:00
Vadim Zeitlin
302fc5190a Merge branch 'gtk2-version-checks'
Simplify GTK+ 2 version checks with a helper function.

See https://github.com/wxWidgets/wxWidgets/pull/614
2017-11-25 22:18:31 +01:00
Paul Cornett
6830767839 Fix STL build broken in 003faa9 2017-11-25 11:26:07 -08:00
Paul Cornett
003faa993e Use CSS for window font and colors on GTK3
Avoids deprecated gtk_widget_override_* functions
2017-11-25 10:13:34 -08:00
Vadim Zeitlin
25da7a58ef Allow safely disabling touch events from a touch event handler
Don't delete the window wxWindowGesturesData when calling
EnableTouchEvents(wxTOUCH_NONE) but just free it, to make it safe to
call EnableTouchEvents() even from a touch event handler, which later
returns to wxGTK code that could still use the gestures data object.
2017-11-23 13:33:36 +01:00
Vadim Zeitlin
d6af0236c5 Simplify GTK+ 2 version checks with a helper function
Use wx_is_at_least_gtk2(minor) instead of gtk_check_version(2, minor)
because it is more clear and also works as expected (i.e. returns true)
when using GTK+ 3 instead of creating difficult to notice bugs in the
code by failing the version check in this case.

See #18004.
2017-11-23 13:15:31 +01:00
Vadim Zeitlin
020c598c18 Rename wxExternalField methods to not mention "Window"
This class doesn't have to be used with wxWindow or similar as object
type, so use a more neutral "Object" instead of "Window".
2017-11-22 03:05:03 +01:00
Vadim Zeitlin
1863f494f3 Use wxExternalField for gestures data in wxGTK too
Don't waste memory on gesture data in all windows.
2017-11-22 03:05:03 +01:00
Vadim Zeitlin
a8dfaa569b Allow enabling individual touch gesture events
Implement support for enabling just some gesture events instead of
having to choose between getting none or all of them.

Also make wxTOUCH_NONE really disable the gestures events generation
instead of just doing nothing as before.
2017-11-22 03:05:02 +01:00
Vadim Zeitlin
842dd1cfd9 Add wxWindow::EnableTouchEvents()
Don't request touch event generation for all windows by default, this
has an inherent overhead and is not needed for 99% of the application
windows, so require calling EnableTouchEvents() explicitly to do it
instead.

Note that this requires properly initializing gesture recognizers in
wxOSX now that they're not always allocated, otherwise releasing them
when destroying the window would crash.
2017-11-22 02:24:24 +01:00