Commit Graph

1063 Commits

Author SHA1 Message Date
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
Vadim Zeitlin
e7f4e232fa Use "class" for wxGTK wxWindowGesturesData definition
No real changes, just be consistent with wxWindowGesturesData forward
declaration as "class", clang (and MSVC) warn about mismatching keywords
being used for declaration and definition.
2017-11-21 18:45:53 +01:00
Vadim Zeitlin
bb2887930f Use wxPoint instead of (x,y) pair in wxPanGestureEvent
Using higher level objects makes the code generating and using this
event shorter and more clear.
2017-11-21 17:45:34 +01:00
Vadim Zeitlin
6ba3db7753 Destroy GtkGestures objects we create
We seem to be leaking memory otherwise.
2017-11-17 18:06:06 +01:00
Vadim Zeitlin
7b1dc191be Move wxGTK gesture-related data in a private opaque struct
This is a first step towards enabling gesture events only for the
windows that are interested in them as it will make it possible to avoid
wasting space on unused data in the windows that don't need it.

No real changes so far.
2017-11-17 18:06:06 +01:00
Vadim Zeitlin
06d936f3f7 Make tests for gestures in wxGTK code more clear
Use wxGTK_HAS_GESTURES_SUPPORT to guard gesture-related code instead of
checking for the 3.14 GTK+ version explicitly in several places.

No real changes.
2017-11-17 18:06:06 +01:00
prashantkn94
261b04b5a3 Merge multi-touch gestures event branch
This is a squashed commit of the SOC2017_GESTURES branch from
https://github.com/prashantkn94/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/551
2017-11-17 18:06:06 +01:00
Paul Cornett
21620da3e5 Move GTK3 wxNO_BORDER handling to wxControl
So wxNO_BORDER works with other controls, such as wxBitmapButton.
Also use GTK prefix on ApplyCssStyle(), and add an overload that
creates the GtkCssProvider.
2017-11-15 10:51:38 -08:00
Paul Cornett
4ffb9d342c Fix use of PANGO_VERSION_CHECK macro
PANGO_VERSION_CHECK is not available before Pango version 1.16
2017-05-30 09:50:03 -07:00
Artur Wieczorek
2afd8bfcaf Use faster function to retrieve a line from the paragraph
Because contents of the retrieved line is not going to be modified, faster
read-only function can be used for retrieval.
2017-05-29 20:31:42 +02:00
Vadim Zeitlin
7542632302 Fix keyboard event key codes when using Wayland
Correct the confusion between compile- and run-time checks for X11.

Closes #17848.
2017-04-26 22:30:36 +02:00
Paul Cornett
85302845ab avoid unused variable warning with GTK2 after 61c8a7ca 2016-12-14 09:32:11 -08:00
Paul Cornett
61c8a7ca60 Use "notify::gtk-theme-name" from GtkSettings to generate wxSysColourChangedEvent
"style-updated" occurs frequently for other reasons, such as switching focus between TLWs
2016-12-13 09:07:01 -08:00
Paul Cornett
ccd1d40dd9 Avoid generating scroll event when our scrollbar is disabled by other software
webkitgtk apparently manipulates our scrollbar GtkAdjustment directly, setting
all members to zero to disable it. Since we never do that, those values were
unexpected. This is a better fix for the problem papered over by 45d66f592
2016-12-12 10:55:19 -08:00
Paul Cornett
d5681ee4a8 Fix infinite sizing loop caused by 3b4ee5a0
Avoid the problems 3b4ee5a0 attempted to address in a much simpler way:
when a "size-allocate" is in progress, call gtk_widget_size_allocate()
directly, rather than deferring a call to gtk_widget_queue_resize().
See #17585
2016-12-09 21:38:35 -08:00
Paul Cornett
9bb5d0435a Fix non-default window background color with GTK+ >= 3.20
GTK+ no longer automatically paints non-default window background. See #17586
2016-11-09 20:06:26 -08:00
Paul Cornett
b47319d515 Avoid calling ScreenToClient() on invisible window while processing wxSetCursorEvent 2016-11-05 19:44:45 -07:00
Paul Cornett
e3f117c4f3 Avoid assert dialog in ClientToScreen()/ScreenToClient(), it's just too annoying 2016-11-03 09:38:39 -07:00
Paul Cornett
ebfa5a4128 Make sure all pointers to destructed window are removed from size revalidate list 2016-11-03 09:22:34 -07:00
Paul Cornett
bca7313499 Fix paint clipping region with GTK+ >= 3.20
Apparently the clip is no longer set properly. Fixes wxDC::Clear() overwriting
areas outside the window. Problem can be seen in the Audacity toolbars.
2016-11-03 09:14:30 -07:00
Paul Cornett
101c43d0aa Partial workaround for stale styling information with GTK3
We can trigger size events when we know the style cache has been updated.
See #16088
2016-11-01 23:18:26 -07:00
Paul Cornett
3b4ee5a031 Fix some sizing problems with GTK3
A change in size-allocate handling with GTK+ 3.20 exposed a flaw in our method for
deferring queue-resize requests. Using an idle callback to process the requests
did not work well with the GdkFrameClock-based system used since GTK+ 3.8. Using
the "check-resize" signal works better. Also with GTK+ >= 3.20, it seems necessary
to manually work the queue-resize up to the TLW, as otherwise the resized widgets
don't get updated without an external size-allocate event.
See #17585
2016-10-31 11:12:37 -07:00
Paul Cornett
5d04f41d47 Save and restore GtkStyleContext in a few places that were not doing it
Does not fix any known problem, but seems prudent
2016-08-31 10:01:27 -07:00
Vadim Zeitlin
8bb4495d95 Remove mouse capture assert from wxGTK wxWindow dtor
This assert was redundant as a similar check is done in the base class dtor.
And while usually this assert is just annoying, instead of being helpful, when
running the unit test suite which installs a custom assert handler throwing an
exception, it is actively harmful as generating 2 asserts during the
destruction of a window with mouse capture results in immediate termination
(even in C++98 mode, unfortunately the whole idea of throwing from dtor is
probably unsalvageable anyhow when using C++11).
2016-06-29 17:55:17 +02:00
Hans Mackowiak
1e70c05759 Add wxWindow::ApplyCssStyle() helper to wxGTK
This is useful for styling GTK+ 3 widgets.

See #17089.
2016-03-07 13:22:57 +01:00
Vadim Zeitlin
5e61689dbf Fix regression with MDI children accelerators
Since the changes of 8034e35391 (see #16870)
accelerators, including the standard ones such as Ctrl-F4 under MSW, didn't
work any longer inside the MDI children.

Fix this by extending IsTopNavigationDomain() to allow for checking whether
the given window should stop propagation of all keyboard events, as wxTLW
does, or only TAB navigation ones as wxMDIChildFrame and wxAuiFloatingFrame
do.
2016-02-28 01:24:20 +01:00
Paul Cornett
69a13d973c Avoid "Gtk-WARNING **: State doesn't match"
See https://github.com/wxWidgets/wxWidgets/pull/232
2016-02-24 20:57:48 -08:00