Compare commits

...

136 Commits

Author SHA1 Message Date
Carlos Garnacho d94d6e560b gtk,range: Have slider jump to the pointer coordinates on touch devices
This widget is too narrow to make touch interaction tricky enough, so
don't add the penalty of having the slider run farther from the touch
coordinates if it happens to miss the slider.
2012-01-05 02:03:26 +01:00
Carlos Garnacho 33b160569f gtk,scrolledwindow: Ensure the view snaps back when overshooting
Instead of just stopping the acceleration source ID, check whether
it's overshooting, and let it snap back if needed after ::grab-notify
and ::button-release-event
2012-01-05 01:38:16 +01:00
Carlos Garnacho fd941bd764 gtk,scrolledwindow: set slower inverse acceleration on the overshoot area
This is so snapping back is more fluid and noticeable.
2012-01-05 01:37:13 +01:00
Carlos Garnacho 18e451da6e gtk,scrolledwindow: Improve initial velocity calculation
Velocity calculation has been refactored out of the captured motion events
handler, and also has more tolerance defore determining that a drag is actually
still.
2012-01-05 01:37:13 +01:00
Carlos Garnacho 0e05d33eee gtk,menu: Don't popdown submenus on button release for touch devices
This is so submenus stay open as the parent menu item is pressed/released,
as the user would typically lift the finger in order to select a submenu
item.
2012-01-05 01:37:12 +01:00
Carlos Garnacho e5b2e528ca gtk,settings: Deprecate gtk-touchscreen-mode
It's not used anywhere in GTK+ anymore.
2012-01-05 01:37:12 +01:00
Carlos Garnacho 355a4cdc14 gtk,range: Remove gtk-touchscreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already catter dinamically for the "don't prelight on touch devices"
usecase.
2012-01-05 01:37:12 +01:00
Carlos Garnacho d45dc8f3c3 gtk,togglebutton: Remove gtk-touchcreen-mode usage
Emulated crossing events with mode GDK_CROSSING_TOUCH_PRESS/RELEASE
already catter dinamically for the "don't prelight on touch devices"
usecase.
2012-01-05 01:37:12 +01:00
Carlos Garnacho dd8cf478b0 gtk,menushell: Remove gtk-touchscreen-mode usage
This usage in a keybinding signal is hardly related to touchscreens,
so just remove it.
2012-01-05 01:37:12 +01:00
Carlos Garnacho c33786446c gtk,menu: Remove gtk-touchscreen-mode from scrolling code
scrolling is handled via ::captured-event dynamically, so remove
this now unused code.
2012-01-05 01:37:12 +01:00
Carlos Garnacho c4b7848aeb gtk,menu: Select the first item for touch devices
This was done through gtk-touchscreen-mode, now is handled
dynamically on the current event source device.
2012-01-05 01:37:12 +01:00
Carlos Garnacho 2d88021014 gtk,menu: Implement scrolling through ::captured-event for touch devices
This makes overflown menus scrollable via direct manipulation. Once past
the threshold, the item below the pointer is unselected and scrolling
starts.
2012-01-05 01:37:12 +01:00
Carlos Garnacho 5cf832da40 gtk,menu: handle item selection for touch devices dynamically
Instead of using gtk-touchscreen-mode, the behavior changes depending
on the source device in use.
2012-01-05 01:37:12 +01:00
Carlos Garnacho bbbc5198a3 gtk,textview: Pop up context menu on press-and-hold 2012-01-05 01:37:12 +01:00
Carlos Garnacho 2e4eaa7cfd gtk,textview: Also cancel DnD on ::grab-notify
If is about to start when the drag device is grabbed
somewhere else, unset drag start x/y so DnD doesn't
happen anyway.
2012-01-05 01:37:12 +01:00
Carlos Garnacho 07a4c8174f gtk,entry: Pop up menu on press-and-hold 2012-01-05 01:37:12 +01:00
Carlos Garnacho 5f20868ec8 gtk,label: Pop up menu on press-and-hold 2012-01-05 01:37:12 +01:00
Carlos Garnacho 5d2c04b9d1 xi2: Get the effective group state by ORing the XIGroupState values 2012-01-05 01:37:12 +01:00
Carlos Garnacho 62c32d742e gdk: Ensure that GdkPointerWindowInfo is only generated for pointers 2012-01-05 01:37:11 +01:00
Carlos Garnacho 736438ecfb gtk: Only set widget under device on non-virtual crossing events
_gtk_widget_set_device_window() is suppose to make accounting of
the topmost widget under the device at each time, so avoid setting
it on virtual crossing events as the device is already in another
window.
2012-01-05 01:37:11 +01:00
Carlos Garnacho b02c3cf4a9 gtk,scrolledwindow: remove scrollbars auto-hide
This is in a really sorry state, and scrollbars need to be
thought out for the new design anyway.
2012-01-05 01:37:11 +01:00
Carlos Garnacho cf4b293b75 gtk,scrolledwindow: capture crossing events when dragging
Also, instead of connecting 2 more times to ::captured-event,
have it all go through a single handler.
2012-01-05 01:37:11 +01:00
Carlos Garnacho 64534d1fc2 gtk,scrolledwindow: Add GtkKineticScrollingFlags
gtk_scrolled_window_set_kinetic_scrolling() now takes a set of flags,
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS makes the "capture button
press and maybe replay later" vs "let button press go through, but
trust in ::grab-broken to undo things" an opt-in, by default that
flag is set, which is the most conservative approach.
2012-01-05 01:37:11 +01:00
Carlos Garnacho 380299681a gtk,scrolledwindow: Grab only after starting drag
This is so the grab doesn't break the implicit grab on the
child widget's window, which avoids that the button press and
release are possibly sent to different windows, and after the
grab was actually broken.
2012-01-05 01:37:11 +01:00
Carlos Garnacho bbe6075408 gdk: Generate crossing events around touch devices' press/release
Anytime a touch device interacts, the crossing events generation
will change to a touch mode where only events with mode
GDK_CROSSING_TOUCH_PRESS/RELEASE are handled, and those are sent
around button press/release. Those are virtual as the master
device may still stay on the window.

Whenever there is a switch of slave device (the user starts
using another non-touch device), a crossing event with mode
GDK_CROSSING_DEVICE_SWITCH may generated if needed, and the normal
crossing event handling is resumed.
2012-01-05 01:37:11 +01:00
Carlos Garnacho 9615fa61a0 gdk: Keep track of the last slave device used
This last slave device (stored per master) is used to fill
in the missing slave device in synthesized crossing events
not directly caused by a device event (ie. due to configure
events or grabs)
2012-01-05 01:37:11 +01:00
Carlos Garnacho 5a0ec9859e gtk,tooltips: Use the source device instead of gtk-touchscreen-mode
This makes tooltips behavior dynamic based on the interacting device.
2012-01-05 01:37:11 +01:00
Carlos Garnacho 03d89b557a gtk,scrolledwindow: Clamp early overshooting when snapping back
Fixes the situation where overshooting in scrolled windows with a
small viewport could end up overshooting right to the opposite
side, and then back again indefinitely.
2012-01-05 01:37:11 +01:00
Carlos Garnacho d12924f241 gtk: Handle motion hints for ::captured-event
Request automatically more motion events in behalf of
the original widget if it listens to motion hints. So
the capturing widget doesn't need to handle such
implementation details.
2012-01-05 01:37:11 +01:00
Carlos Garnacho e349e46abd gtk,scrolledwindow: capture motions until the kinetic scrolling cancellation
If the widget which events are captured listens to motion hints, there
are situations where neither the scrolled window or the child widget
request more motions.
2012-01-05 01:37:11 +01:00
Carlos Garnacho 888be799d9 gtk,pah: Show a bigger press-and-hold indicator on touchscreens
On touch devices it uses a 2.5cm diameter via gdk_screen_get_width_mm()
in the hope that it'll pop out of the finger area.
2012-01-05 01:37:11 +01:00
Carlos Garnacho 365a4f7535 gtk,scrolledwindow: Unset dragging device on ::grab-notify
The child widget may still call gtk_(device_)grab_add, which left
the scrolled window in an inconsistent state.
2012-01-05 01:37:10 +01:00
Carlos Garnacho 6468ae821f gtk,scrolledwindow: Rework physics behind kinetic scrolling
The maths being used didn't resemble much about velocities or
friction/deceleration, so reimplement it in terms of velocity
vectors and decelerations, measured in pixels/ms^2.

Overshooting is also handled within the deceleration effect,
turning into a constant acceleration vector in the opposite
direction so it returns elastically within the boundaries.
2012-01-05 01:37:10 +01:00
Carlos Garnacho 4f04075a8f gtk,scrolledwindow: Implement overshooting
An extra GdkWindow has been added, this window is the parent
of the child widget, and is the one getting resized/moved when
overshooting.

The unclamped adjustments' values are also stored in
GtkScrolledWindowPrivate as a separate value, overshooting is
pretty specific to GtkScrolledWindow and it isn't worth to
expose API in GtkAlignment for this single purpose.

This method allows GtkScrollable children to be blissfully
unaware of overshooting, as otherwise they'd have to handle
rather odd adjustment values themselves.
2012-01-05 01:37:10 +01:00
Carlos Garnacho ae058ae7ef gtk,scrolledwindow: Add window for overshooting
This window is the child widget's parent window, and will
be the one that's moved when overshooting.
2012-01-05 01:37:10 +01:00
Carlos Garnacho 7f0fe69b6e scrolledwindow: Handle nested scrolled windows in kinetic scrolling
The innermost scrolled window always gets to capture the events, all
scrolled windows above it just let the event go through. Ideally
reaching a limit on the innermost scrolled window would propagate
the dragging up the hierarchy in order to keep following the touch
coords, although that'd involve rather evil hacks just to cater
for broken UIs.
2012-01-05 01:37:10 +01:00
Carlos Garnacho ce879ae739 gtk: Add event storing/replaying to GtkWidget::captured-event
It now returns a GtkCapturedEventFlags which tells whether the
widget captured the event, and additionally whether the event
should be stored for later replay.

gtk_widget_release_captured_events() has been added too so
all stored events are released onto the widget that was initially
to receive the events.
2012-01-05 01:37:10 +01:00
Carlos Garnacho df2bb4a92d scrolledwindow: Use event times when calculating deceleration
Using g_get_current_time() isn't going to be realistic on lagging
events.
2012-01-05 01:37:10 +01:00
Carlos Garnacho e45d9994a4 scrolledwindow: bypass kinetic scrolling if no scrollbars are shown 2012-01-05 01:37:10 +01:00
Carlos Garnacho 447ddb08fc scrolledwindow: Remove priv->event_window
It looks like a leftover from pre-captured-event iterations of
the patch, it is completely unnecessary now.
2012-01-05 01:37:10 +01:00
Carlos Garnacho 0df96ac738 scrolledwindow: Don't use p-a-h for the "let event go through" timeout
Just use a timeout there, the press-and-hold feedback is undesirable
here.
2012-01-05 01:37:10 +01:00
Carlos Garnacho 688d8c0796 gtk,pah: Hook directly into gtk_main_do_event()
Press and hold couldn't reasonably work if nested widgets
handle ::captured-event, once the widget inits press-and-hold,
it'd better also handle possible cancellation on motion and
button release, which isn't guaranteed with ::capture-event.

Also, tentatively start press-and-hold by default on the
grab_widget, and before event capturing happens, this avoids
awkward situations like the scrolled window preventing/delaying
press-and-hold to happen on the child textview for example.
2012-01-05 01:37:10 +01:00
Carlos Garnacho fb7047d212 scrolledwindow: Enable kinetic scrolling by default 2012-01-05 01:37:10 +01:00
Carlos Garnacho 1bb03e26a4 scrolledwindow: add another shortcut to bypass event capture
When clicked again close to the previous button press location
(assuming it had ~0 movement), the scrolled window wil allow
the child to handle the events immediately.

This is so the user doesn't have to wait to the p-a-h timeout
in order to operate on the scrolledwindow child.
2012-01-05 01:37:10 +01:00
Carlos Garnacho 7df706715c scrolledwindow: Only do kinetic scrolling on touch devices
This is sort of meaningless on pointer devices, besides it implies
a different input event handling on child widgets that's unnecessary
there.
2012-01-05 01:37:09 +01:00
Carlos Garnacho 40455db2f5 scrolledwindow: Don't crash on 0-sized motion buffer 2012-01-05 01:37:09 +01:00
Carlos Garnacho 64ec631874 scrolledwindow: Set also a GTK+ grab on p-a-h scrolling
This is so the widget is ensured to receive the events
regardless of the pointer position.
2012-01-05 01:37:09 +01:00
Carlos Garnacho de593da052 scrolledwindow: Add GdkDevice parameter to ::press-and-hold handler 2012-01-05 01:37:09 +01:00
Carlos Garnacho a308c35112 gtk: Handle press-and-hold for touch devices
Also, only react to the first button
2012-01-05 01:37:09 +01:00
Carlos Garnacho 412ba5cc2d gtk: Add a GdkDevice parameter to ::press-and-hold
This would be useful when popping up menus, just so we
know what device to trigger it for.
2012-01-05 01:37:09 +01:00
Carlos Garnacho e4e11aa4a2 gtk: Clean up press-and-hold code
The press and hold animation now fully relies on style context
transitions, finishing the p-a-h operation right after it
finishes. There's also no need to connect to ::drag-begin as
::grab-notify will also tell when a grab begins.
2012-01-05 01:37:09 +01:00
Carlos Garnacho e48285f759 tests: Add an entry to testpressandhold
Useful for checking behavior while selecting,
starting drags, subwindows...
2012-01-05 01:37:09 +01:00
Carlos Garnacho dcd2dba384 entry: Handle ::grab-notify
Store the device, and unset private fields whenever the device
is shadowed by another GTK+ grab, so popping up menus while
selecting (i.e. press-and-hold) doesn't leave it in a confused
state.
2012-01-05 01:37:09 +01:00
Carlos Garnacho 1a6a1118a4 gtk: Do not use deprecated APIs on press-and-hold 2012-01-05 01:37:09 +01:00
Carlos Garnacho d6476eb99a tests: Update testkineticscrolling to use GtkGrid 2012-01-05 01:37:09 +01:00
Carlos Garnacho cdd97bbff7 gtk: connect to grab-notify for press and hold
This is so press and hold is cancelled if a click actually
causes an inner widget to do a GTK+ grab.
2012-01-05 01:37:09 +01:00
Carlos Garnacho a447b2fee2 gtk: Propagate ::captured-event up the hierarchy for crossing events 2012-01-05 01:37:09 +01:00
Carlos Garnacho 4af317307f gtk: emit ::captured-event starting from the GTK grab widget 2012-01-05 01:37:09 +01:00
Carlos Garcia Campos aa0c220f7d scrolledwindow: Allow selections and drag-and-drop when kinetic scrolling is enabled
If the scrolling doesn't start after a long press, the scrolling is
cancelled and events are handled by child widget normally.
2012-01-05 01:37:08 +01:00
Carlos Garcia Campos 39966dbaf8 Add GtkWidget::press-and-hold signal
Press-and-hold signal is emitted when the mouse button is pressed for a
given amount of time, specified in the new "press-and-hold-timeout"
GtkSetting. It's commonly used in mobile platforms to emulate a right
click to show a context menu. This patch is based on previous patches by
Kristian Rietveld and Danielle Madeley.

https://bugzilla.gnome.org/show_bug.cgi?id=315645
2012-01-05 01:37:08 +01:00
Carlos Garnacho fbb70becef gtksettings: Set animation for press-and-hold through GtkStyleProvider
The "gtk-press-and-hold-timeout" setting has also been added, to control
its duration.
2012-01-05 01:37:08 +01:00
Carlos Garnacho 388dcb4234 themingengine: Implement press-and-hold notification renderer
gtk_render_activity() uses it for the GTK_STYLE_CLASS_PRESS_AND_HOLD
style class.
2012-01-05 01:25:39 +01:00
Carlos Garcia Campos e8a9fad467 scrolledwindow: Add auto-hide-scrollbars style property
To hide the scrollbars in kinetic mode when not scrolling.
2012-01-05 01:25:38 +01:00
Carlos Garcia Campos ccb7da408e tests: Add new test for kinetic scrolling 2012-01-05 01:25:38 +01:00
Carlos Garcia Campos 1764558d8c test: Add checkbox to enable/disable kinetic scrolling in scrolled window test 2012-01-05 01:25:38 +01:00
Carlos Garcia Campos 90ee273c66 scrolledwindow: Initial kinetic scrolling support 2012-01-05 01:25:38 +01:00
Carlos Garcia Campos b0b26cc2e0 timeline: Add _gtk_timeline_get_elapsed_time()
To get the time in milliseconds since the last frame
2012-01-05 01:25:38 +01:00
Carlos Garcia Campos 990e049510 Add GtkWidget::captured-event signal
https://bugzilla.gnome.org/show_bug.cgi?id=641836
2012-01-05 01:25:38 +01:00
Carlos Garnacho 8f013f4055 gdk: Add GDK_SOURCE_TOUCH
This device source applies to touch capable devices, most
notably touchscreens.
2012-01-05 01:25:38 +01:00
Ryan Lortie 0ea48c4139 GtkComboBoxText: allow id='' tag in builder markup
Presently, GtkComboBoxText lets you list the items for it in the
GtkBuilder markup like so:

<items>
  <item translatable='yes'>Red</item>
  <item translatable='yes'>Blue</item>
</items>

but has no way to set the "id" column for added items.  Add an id='' tag
for that purpose so that you can do:

  <item id='red' translatable='yes'>Red</item>

https://bugzilla.gnome.org/show_bug.cgi?id=667319
2012-01-04 17:00:35 -05:00
Xan Lopez eeb9de80e1 GtkNotebook: fix crash when DnD tabs between windows
When doing DnD between windows the tab label is set as the child of
the DnD info window. If this is happening the remove method of
GtkNotebook should not unparent the tab label, since it's been already
unparented, belongs to the DnD window and will be properly destroyed
when the DnD is over.

https://bugzilla.gnome.org/show_bug.cgi?id=639875
2012-01-04 08:48:46 +01:00
Javier Jardón 912375ff38 gtk/gtkcolorbutton.c: Do not use deprecated GdkColor api 2012-01-04 01:55:16 +01:00
Zeeshan Ali (Khattak) 3caa370bb5 gtkspinbutton: Respect value of inherited 'editable' property
When this property is set to 'FALSE', user's click on the buttons
should not actually update the value but rather result in error bell.

https://bugzilla.gnome.org/show_bug.cgi?id=667229
2012-01-04 00:49:35 +02:00
Federico Mena Quintero 022c576bd2 treeview: bgo#666685 - Crash when toggling the selected status of a row
The refactoring from e01af5c5c seems to have caused this inadvertently.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-01-03 15:08:34 -06:00
Javier Jardón abb7f40fb8 gtkcolorsel: Do not use deprecated GdkColor api 2012-01-03 18:00:57 +01:00
Javier Jardón 49d232d3a0 gtkcellview: Do not use deprecated GdkColor api 2012-01-03 18:00:57 +01:00
Chun-wei Fan 9f6e7d214c gtk/gtkprivate.c: Include stdlib.h
Include stdlib.h for getenv to avoid C4013/implicit declaration of ...
warnings
2012-01-04 00:52:44 +08:00
Javier Jardón 1796e2f6ba test/testgtk.c: Fix compilation warning 2012-01-03 16:58:42 +01:00
Matthias Clasen 266866e82c Fix problems with DND on some X servers
When the X server does not support the shape extension (as some
vnc implementations seem to), our DND code was always seeing
an empty input shape, so drops always missed their target.

http://bugzilla.gnome.org/show_bug.cgi?id=620240
2012-01-03 10:57:53 -05:00
Emmanuele Bassi c62a1fd522 Add symbolic constants for event emission control
Similar to https://bugzilla.gnome.org/show_bug.cgi?id=631413 in GLib,
GTK+ should have symbolic constants for controlling the event handling
instead of a mere boolean value.

The GDK_EVENT_PROPAGATE and GDK_EVENT_STOP constants map to FALSE and
TRUE respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=631414
2012-01-03 12:58:43 +00:00
Ignacio Casal Quinteiro f0b8fc69e8 textdisplay: use g_list_free_full 2012-01-01 22:38:30 +01:00
Kjell Ahlstedt 6aeab7b7cc comboboxtext: Set entry-text-column and id-column props in the constructor
This is cleaner than setting the value in the _new() functions and
makes binding and GtkBuilder instantiation easier. Bug #612396, comment 65.
2011-12-30 11:10:26 +01:00
Chun-wei Fan d273b817e8 Bug 667018-gtk/gtkwindow.c: Include deprecated/gtkstyle.h
This is needed for the prototype of gtk_widget_reset_rc_styles, to avoid
C4013/implicit declaration of ... warnings of that function
2011-12-30 17:25:48 +08:00
Chun-wei Fan 1a122a4367 gtk/gtkspinbutton.c: Remove lingering ';'
...so that C89 compilers will not complain
2011-12-30 17:25:47 +08:00
Yaron Shahrabani 42bf233d59 Updated Hebrew translation. 2011-12-30 11:12:58 +02:00
Chun-wei Fan 24e476caab gtk/Makefile.am: Update VS projects completion
Take the sources in gtk/deprecated/ into account-VS does not like '/'
in file paths.
2011-12-30 16:44:55 +08:00
Chun-wei Fan f166cddeb4 Update Visual C++ projects
-Update include paths for the GTK+ main projects to be consistent across
 the board
-Update demo projects to add a new demo source file, transparent.c
2011-12-30 16:40:06 +08:00
Chun-wei Fan bdb98fdfcc Update gdk/gdkconfig.h.win32
Apparently the deprecation warning macros are placed into gdkconfig.h
during the configure stage, so put these in the pre-configured
gdkconfig.h.win32 as well, as their definitions are needed for all builds.
2011-12-30 16:21:38 +08:00
Matthias Clasen 2637240abe Remove an unnecessary warning
Don't warn if there's more than one mnemonic label for a widget,
and skip invisible labels.

Bug 665015
2011-12-30 02:01:15 -05:00
Matthias Clasen d7e8388e9d Add a Since tag
gtk_css_provider_to_string is a post-3.0 addition.
Fixes bug 659516
2011-12-30 00:38:06 -05:00
Matthias Clasen 08c89c11d1 Drop -uninstalled.pc files
This has already been done in GLib, so follow suit here.
2011-12-30 00:28:15 -05:00
Matthias Clasen ebd28de588 XIM: gracefully deal with non-X backends
Patch by Young-Ho Cha, bug 660309.
2011-12-29 23:43:51 -05:00
Matthias Clasen 3c70a12785 GtkImContextSimple: fix tentative match handling
When switching to the compact table format, we inadvertedly lost
the 'tentative match' handling which allows to complete longer
compose sequences even if a prefix is a complete sequence.
This was pointed out in bug 666710.
2011-12-29 23:42:03 -05:00
Matthias Clasen 694bbf4ac0 Cosmetic changes to comments 2011-12-29 23:42:03 -05:00
Piotr Drąg 849770ac54 Updated POTFILES.skip 2011-12-29 17:49:58 +01:00
Benjamin Otte 45161fbb55 settings: Cache style properties
This way we don't need to compute them every lookup. (That's not the
real reason though - the real reason is that I want to add new APIs that
require the caching because they return consts).
2011-12-29 10:10:32 +01:00
Benjamin Otte 524938aa53 modifierstyle: Move Private typedef to public header 2011-12-29 10:10:22 +01:00
Benjamin Otte 84c061b861 reftests: Add test for empty grid with spacing
This used to crash.

https://bugzilla.gnome.org/show_bug.cgi?id=660139
2011-12-29 10:03:59 +01:00
Matthias Clasen 01320e5773 Fix problems with sticky handling
Reading a card32 property into a long may lead to undefined high
bits, so mask them off. Also, make the conditions for setting and
unsetting the stick flag opposites, to avoid unintended changes.
Patch by John Lindgren, bug 666842
2011-12-28 11:20:47 -05:00
Matthias Clasen 19b47b931e Update various EWMH interactions
The current EWMH has added 'source indication' fields to a number
of client messages. Set these to 1 to indicate a regular client.
Also fill the button field of _NET_WM_MOVERESIZE.
2011-12-28 11:16:54 -05:00
Javier Jardón 465301c64f tests/testgtk: Do not use GdkColor-based api 2011-12-26 17:12:20 +01:00
Daniel Mustieles deeac44abb Updated Spanish translation 2011-12-26 11:10:17 +01:00
Ignacio Casal Quinteiro 1abf7618c0 gtktextlayout: use g_slice for GtkTextLineDisplay 2011-12-25 18:13:51 +01:00
Ignacio Casal Quinteiro 359d8c9856 gtktextbtree: use g_slice 2011-12-25 17:49:03 +01:00
Benjamin Otte ab1699510e themingbackground: Avoid erroring cairo context 2011-12-23 22:30:45 +01:00
Benjamin Otte 396ae8f1de tests: Make widget-factory close when window is closed 2011-12-23 22:30:45 +01:00
Benjamin Otte 58d553c604 cssprovider: Fix leak
Thanks to the heroic valgrinding efforts of Olivier Sessnik, another
leak could be plugged.
2011-12-23 22:30:45 +01:00
Matthias Clasen fbc3db8ba9 Fix scroll_offset handling
scroll_offset can be negative here, so replace a > 0 test
by != 0.
2011-12-23 00:36:20 -05:00
Matthias Clasen f1bfdda3fd Only push the menu in if the position function said so 2011-12-23 00:36:20 -05:00
Matthias Clasen a553cb50ab Use gtk_widget_get_allocated_width/height where it makes sense 2011-12-23 00:36:20 -05:00
Matthias Clasen 53ce519b1f Remove an unneeded variable 2011-12-23 00:36:20 -05:00
Matthias Clasen 547baf0e5f Remove an unused struct 2011-12-23 00:36:19 -05:00
Benjamin Otte 9707d964f7 combobox: Don't allow an individual cell to cheat
Make sure we only set sensitive when the cell is sensitive and visible.
Also avoid invalid memory accesses if no cells existed.
2011-12-23 00:15:59 +01:00
Benjamin Otte 8a83f0c2d1 widget: Print a g_warning() when a cairo_t is invalid
Only print the warning on internal code, so we aren't too verbose.
2011-12-23 00:15:59 +01:00
Benjamin Otte d1c92c38df styleproperties: Move private struct declaration into public header 2011-12-23 00:15:59 +01:00
Benjamin Otte a61ba41167 x11: Don't handle focus events for NULL windows
The check was accidentally removed in the refactoring of
2ea328dfbc.
2011-12-23 00:15:59 +01:00
Matthias Clasen 18406b7b04 Revert "x11: Avoid spurious focus events on grabs"
This reverts commit db4a6040af.

This is causing bad focus confusion e.g. in gnome-terminal.
2011-12-22 16:03:56 +00:00
Javier Jardón a3abc18858 Deprecate all the public API that is using GdkColor struct 2011-12-22 02:59:39 +00:00
Javier Jardón 115d92aa11 gtkappchooserwidget: Use g_object_clear() 2011-12-22 02:57:35 +00:00
Ryan Lortie 182fbba2bf GtkModelMenu: drop extra & added by mistake 2011-12-21 17:15:16 -05:00
Cosimo Cecchi 157d9271fa application: don't unconditionally unref the GMenuModel in getters
Both the app-menu and menubar models can be NULL, so we shouldn't
blindly unref them, since g_object_unref() doesn't cope with NULL
pointers.
2011-12-21 12:20:15 +01:00
Cosimo Cecchi 72c04c064a application: mark menu/menubar getters as (transfer none)
Since they do not return a reference to the underlying GMenuModel.
2011-12-21 12:19:31 +01:00
Cosimo Cecchi 9ae0ffb9cb application: use the same variable names in definitions and declarations
gobject-introspection will be confused and mark the methods as not
introspectable otherwise.
2011-12-21 11:29:39 +01:00
Colin Walters 06307dd774 GtkAction: Hold a reference to proxy widgets
Previously we expect that a proxy widget holds a reference to the
action via gtk_activatable_do_set_related_action().  However, it
is possible for the widget to still be in a floating state when
it adds itself to the the action.

This is a problem when gtk_action_get_proxies() gets called, because
we return floating objects back to the user.  And language bindings
aren't going to be expecting that.

Fix this by calling ref_sink() and unref().

https://bugzilla.gnome.org/show_bug.cgi?id=657367
2011-12-20 15:36:48 -05:00
Matthias Clasen b5577781d1 GtkApplicationWindow: fix a typo
And add a link to the screenshots.
2011-12-20 14:10:39 -05:00
Javier Jardón 325142fba7 tests/testcombo.c: Use GdkRGBA instead GdkColor 2011-12-20 18:32:15 +00:00
Javier Jardón f84c124e53 gtk/gtkcellview.c: Use new GdkRGBA api instead GdkColor one 2011-12-20 18:32:15 +00:00
Javier Jardón e24634537e gtk/gtktrayicon-x11.c: Use new GdkRGBA api instead GDKColor one 2011-12-20 18:32:15 +00:00
Cosimo Cecchi 2827cd4518 button: deprecate the inner-border style property
Since we allocate the standard CSS border to the button now, and center
the child accordingly, there's no need for an additional inner-border
style property. Deprecate it and ignore its values.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi 0021ef19fa button: add CSS borders to the size request
And allocate the button children according to it as well.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Cosimo Cecchi fe59c5f954 button: add a border param to gtk_button_get_props()
We'll use it later to compute the child offsets.

https://bugzilla.gnome.org/show_bug.cgi?id=666600
2011-12-20 19:01:38 +01:00
Javier Jardón 9635759548 tests/testgtk.c: Remove death code 2011-12-20 17:51:59 +00:00
Ryan Lortie bac58abec3 gtkmodelmenuitem: don't crash on missing action 2011-12-20 10:51:58 -05:00
Daniel Mustieles 8f5e8b2d0b Updated Spanish translation 2011-12-20 14:45:14 +01:00
Cosimo Cecchi 13f5706488 treeview: fix an uninitialised variable warning 2011-12-20 11:41:46 +01:00
Matthias Clasen e65a8d0d40 Bump version 2011-12-19 18:41:10 -05:00
104 changed files with 5933 additions and 3335 deletions
-6
View File
@@ -63,10 +63,6 @@ gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc gdk-broadway-3.0.pc gdk-waylan
rm -f $@ && \
cp gdk-3.0.pc $@
gtk+-*-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc
rm -f $@ && \
cp gtk+-3.0-uninstalled.pc $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc
@@ -84,8 +80,6 @@ DISTCLEANFILES = \
gdk-3.0.pc \
gdk-x11-3.0.pc \
gail-3.0.pc \
gtk+-3.0-uninstalled.pc \
gail-3.0-uninstalled.pc \
config.lt
distclean-local:
+5
View File
@@ -27,6 +27,11 @@ Installation
See the file 'INSTALL'
Release notes for 3.4
=====================
* The -uninstalled variants of the pkg-config files have been dropped.
Release notes for 3.2
=====================
+4 -4
View File
@@ -69,7 +69,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;G_ENABLE_DEBUG;$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -91,7 +91,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
@@ -114,7 +114,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;G_ENABLE_DEBUG;$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -136,7 +136,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>$(GtkDefines);%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
+1
View File
@@ -202,6 +202,7 @@
<ClCompile Include="..\..\..\demos\gtk-demo\textscroll.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\textview.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\toolpalette.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\transparent.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\tree_store.c" />
<ClCompile Include="..\..\..\demos\gtk-demo\ui_manager.c" />
</ItemGroup>
@@ -125,6 +125,9 @@
<ClCompile Include="..\..\..\demos\gtk-demo\toolpalette.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\demos\gtk-demo\transparent.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\demos\gtk-demo\tree_store.c">
<Filter>Source Files</Filter>
</ClCompile>
+4 -4
View File
@@ -31,7 +31,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gtk"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="_DEBUG;G_ENABLE_DEBUG;$(GtkDefines)"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -63,7 +63,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="$(GtkDefines)"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
@@ -96,7 +96,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="_DEBUG;G_ENABLE_DEBUG;$(GtkDefines)"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@@ -128,7 +128,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32"
AdditionalIncludeDirectories="..\..\..\gdk;..\..\..\gdk\win32;..\..\..\gtk"
PreprocessorDefinitions="$(GtkDefines)"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
+1
View File
@@ -198,6 +198,7 @@
<File RelativePath="..\..\..\demos\gtk-demo\textscroll.c" />
<File RelativePath="..\..\..\demos\gtk-demo\textview.c" />
<File RelativePath="..\..\..\demos\gtk-demo\toolpalette.c" />
<File RelativePath="..\..\..\demos\gtk-demo\transparent.c" />
<File RelativePath="..\..\..\demos\gtk-demo\tree_store.c" />
<File RelativePath="..\..\..\demos\gtk-demo\ui_manager.c" />
</Filter>
+1 -3
View File
@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [3])
m4_define([gtk_micro_version], [6])
m4_define([gtk_micro_version], [7])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@@ -1734,8 +1734,6 @@ gdk-3.0.pc
gtk+-3.0.pc
gtk+-unix-print-3.0.pc
gail-3.0.pc
gtk+-3.0-uninstalled.pc
gail-3.0-uninstalled.pc
m4macros/Makefile
po/Makefile.in
po-properties/Makefile.in
+2
View File
@@ -757,6 +757,8 @@ GdkEventMask
GDK_CURRENT_TIME
GDK_PRIORITY_EVENTS
GDK_PRIORITY_REDRAW
GDK_EVENT_PROPAGATE
GDK_EVENT_STOP
<SUBSECTION>
gdk_events_pending
+3
View File
@@ -2936,6 +2936,9 @@ gtk_scrolled_window_get_min_content_width
gtk_scrolled_window_set_min_content_width
gtk_scrolled_window_get_min_content_height
gtk_scrolled_window_set_min_content_height
GtkKineticScrollingFlags
gtk_scrolled_window_set_kinetic_scrolling
gtk_scrolled_window_get_kinetic_scrolling
<SUBSECTION Standard>
GTK_SCROLLED_WINDOW
-11
View File
@@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: Gail
Description: GNOME Accessibility Implementation Library
Version: @VERSION@
Requires: atk gtk+-3.0
Libs: ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail.la ${pc_top_builddir}/${pcfiledir}/modules/other/gail/libgail-util/libgailutil.la
Cflags: -I${pc_top_builddir}/${pcfiledir}/modules/other/gail
+2
View File
@@ -89,6 +89,8 @@ gdk_cairo_get_clip_rectangle (cairo_t *cr,
* Sets the specified #GdkColor as the source color of @cr.
*
* Since: 2.8
*
* Deprecated: 3.4: Use gdk_cairo_set_source_rgba() instead
*/
void
gdk_cairo_set_source_color (cairo_t *cr,
+4 -2
View File
@@ -35,8 +35,6 @@ cairo_t * gdk_cairo_create (GdkWindow *window);
gboolean gdk_cairo_get_clip_rectangle (cairo_t *cr,
GdkRectangle *rect);
void gdk_cairo_set_source_color (cairo_t *cr,
const GdkColor *color);
void gdk_cairo_set_source_rgba (cairo_t *cr,
const GdkRGBA *rgba);
void gdk_cairo_set_source_pixbuf (cairo_t *cr,
@@ -57,6 +55,10 @@ cairo_region_t *
gdk_cairo_region_create_from_surface
(cairo_surface_t *surface);
GDK_DEPRECATED_FOR(gdk_cairo_set_source_rgba)
void gdk_cairo_set_source_color (cairo_t *cr,
const GdkColor *color);
G_END_DECLS
#endif /* __GDK_CAIRO_H__ */
+13
View File
@@ -14,6 +14,19 @@
G_BEGIN_DECLS
/* These macros are used to mark deprecated functions in GDK and
* GTK+ headers, and thus have to be exposed in installed headers.
* But please do *not* use them in other projects. Instead, use
* G_DEPRECATED or define your own wrappers around it.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define GDK_DEPRECATED
#define GDK_DEPRECATED_FOR(f)
#else
#define GDK_DEPRECATED G_DEPRECATED
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
#endif
#define GDK_WINDOWING_WIN32
+3 -1
View File
@@ -61,6 +61,7 @@ typedef enum
* of a stylus on a graphics tablet.
* @GDK_SOURCE_CURSOR: the device is a graphics tablet "puck" or similar device.
* @GDK_SOURCE_KEYBOARD: the device is a keyboard.
* @GDK_SOURCE_TOUCH: the device is a touch capable device.
*
* An enumeration describing the type of an input device in general terms.
*/
@@ -70,7 +71,8 @@ typedef enum
GDK_SOURCE_PEN,
GDK_SOURCE_ERASER,
GDK_SOURCE_CURSOR,
GDK_SOURCE_KEYBOARD
GDK_SOURCE_KEYBOARD,
GDK_SOURCE_TOUCH
} GdkInputSource;
/**
+22 -9
View File
@@ -899,15 +899,25 @@ switch_to_pointer_grab (GdkDisplay *display,
if (grab == NULL) /* Ungrabbed, send events */
{
pointer_window = NULL;
if (new_toplevel)
{
/* Find (possibly virtual) child window */
pointer_window =
_gdk_window_find_descendant_at (new_toplevel,
x, y,
NULL, NULL);
}
/* If the source device is a touch device, do not
* propagate any enter event yet, until one is
* synthesized when needed.
*/
if (source_device &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
info->need_touch_press_enter = TRUE;
pointer_window = NULL;
if (new_toplevel &&
!info->need_touch_press_enter)
{
/* Find (possibly virtual) child window */
pointer_window =
_gdk_window_find_descendant_at (new_toplevel,
x, y,
NULL, NULL);
}
if (pointer_window != last_grab->window)
synthesize_crossing_events (display, device, source_device,
@@ -1122,6 +1132,9 @@ _gdk_display_get_pointer_info (GdkDisplay *display,
{
GdkPointerWindowInfo *info;
if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
device = gdk_device_get_associated_device (device);
if (G_UNLIKELY (!device))
return NULL;
+2
View File
@@ -75,6 +75,8 @@ typedef struct
gdouble toplevel_x, toplevel_y;
guint32 state;
guint32 button;
GdkDevice *last_slave;
guint need_touch_press_enter : 1;
} GdkPointerWindowInfo;
typedef struct
+32 -1
View File
@@ -74,6 +74,25 @@ G_BEGIN_DECLS
*/
#define GDK_PRIORITY_REDRAW (G_PRIORITY_HIGH_IDLE + 20)
/**
* GDK_EVENT_PROPAGATE:
*
* Use this macro as the return value for continuing the propagation of
* an event handler.
*
* Since: 3.4
*/
#define GDK_EVENT_PROPAGATE (FALSE)
/**
* GDK_EVENT_STOP:
*
* Use this macro as the return value for stopping the propagation of
* an event handler.
*
* Since: 3.4
*/
#define GDK_EVENT_STOP (TRUE)
typedef struct _GdkEventAny GdkEventAny;
typedef struct _GdkEventExpose GdkEventExpose;
@@ -335,6 +354,15 @@ typedef enum
* @GDK_CROSSING_GTK_UNGRAB: crossing because a GTK+ grab is deactivated.
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
* state (e.g. sensitivity).
* @GDK_CROSSING_STATE_CHANGED: crossing because a GTK+ widget changed
* state (e.g. sensitivity).
* @GDK_CROSSING_TOUCH_PRESS: crossing because a touch device was pressed,
* this event is synthetic as the pointer might have not left the window.
* @GDK_CROSSING_TOUCH_RELEASE: crossing because a touch device was released.
* this event is synthetic as the pointer might have not left the window.
* @GDK_CROSSING_DEVICE_SWITCH: crossing because of a device switch (i.e.
* a mouse taking control of the pointer after a touch device), this event
* is synthetic as the pointer didn't leave the window.
*
* Specifies the crossing mode for #GdkEventCrossing.
*/
@@ -345,7 +373,10 @@ typedef enum
GDK_CROSSING_UNGRAB,
GDK_CROSSING_GTK_GRAB,
GDK_CROSSING_GTK_UNGRAB,
GDK_CROSSING_STATE_CHANGED
GDK_CROSSING_STATE_CHANGED,
GDK_CROSSING_TOUCH_PRESS,
GDK_CROSSING_TOUCH_RELEASE,
GDK_CROSSING_DEVICE_SWITCH
} GdkCrossingMode;
/**
+98 -14
View File
@@ -6542,6 +6542,8 @@ gdk_window_move_region (GdkWindow *window,
* implementing a custom widget.)
*
* See also gdk_window_set_background_pattern().
*
* Deprecated: 3.4: Use gdk_window_set_background_rgba() instead.
*/
void
gdk_window_set_background (GdkWindow *window,
@@ -8338,9 +8340,11 @@ send_crossing_event (GdkDisplay *display,
GdkEvent *event;
guint32 window_event_mask, type_event_mask;
GdkDeviceGrabInfo *grab;
GdkPointerWindowInfo *pointer_info;
gboolean block_event = FALSE;
grab = _gdk_display_has_device_grab (display, device, serial);
pointer_info = _gdk_display_get_pointer_info (display, device);
if (grab != NULL &&
!grab->owner_events)
@@ -8353,7 +8357,13 @@ send_crossing_event (GdkDisplay *display,
else
window_event_mask = window->event_mask;
if (type == GDK_LEAVE_NOTIFY)
if (pointer_info->need_touch_press_enter &&
mode != GDK_CROSSING_TOUCH_PRESS &&
mode != GDK_CROSSING_TOUCH_RELEASE)
{
block_event = TRUE;
}
else if (type == GDK_LEAVE_NOTIFY)
{
type_event_mask = GDK_LEAVE_NOTIFY_MASK;
window->devices_inside = g_list_remove (window->devices_inside, device);
@@ -9062,7 +9072,7 @@ do_synthesize_crossing_event (gpointer data)
_gdk_synthesize_crossing_events (display,
pointer_info->window_under_pointer,
new_window_under_pointer,
device, NULL,
device, pointer_info->last_slave,
GDK_CROSSING_NORMAL,
pointer_info->toplevel_x,
pointer_info->toplevel_y,
@@ -9177,7 +9187,7 @@ proxy_pointer_event (GdkDisplay *display,
guint state;
gdouble toplevel_x, toplevel_y;
guint32 time_;
gboolean non_linear;
gboolean non_linear, need_synthetic_enter = FALSE;
event_window = source_event->any.window;
gdk_event_get_coords (source_event, &toplevel_x, &toplevel_y);
@@ -9197,6 +9207,13 @@ proxy_pointer_event (GdkDisplay *display,
source_event->crossing.detail == GDK_NOTIFY_NONLINEAR_VIRTUAL))
non_linear = TRUE;
if (pointer_info->need_touch_press_enter &&
gdk_device_get_source (pointer_info->last_slave) != GDK_SOURCE_TOUCH)
{
pointer_info->need_touch_press_enter = FALSE;
need_synthetic_enter = TRUE;
}
/* If we get crossing events with subwindow unexpectedly being NULL
that means there is a native subwindow that gdk doesn't know about.
We track these and forward them, with the correct virtual window
@@ -9320,6 +9337,18 @@ proxy_pointer_event (GdkDisplay *display,
gdk_window_get_device_events (event_win, device) == 0)
return TRUE;
/* The last device to interact with the window was a touch device,
* which synthesized a leave notify event, so synthesize another enter
* notify to tell the pointer is on the window.
*/
if (need_synthetic_enter)
_gdk_synthesize_crossing_events (display,
NULL, pointer_window,
device, source_device,
GDK_CROSSING_DEVICE_SWITCH,
toplevel_x, toplevel_y,
state, time_, NULL,
serial, FALSE);
is_hint = FALSE;
if (event_win &&
@@ -9378,6 +9407,7 @@ proxy_button_event (GdkEvent *source_event,
GdkWindow *pointer_window;
GdkWindow *parent;
GdkEvent *event;
GdkPointerWindowInfo *pointer_info;
guint state;
guint32 time_;
GdkEventType type;
@@ -9397,6 +9427,7 @@ proxy_button_event (GdkEvent *source_event,
toplevel_window = convert_native_coords_to_toplevel (event_window,
toplevel_x, toplevel_y,
&toplevel_x, &toplevel_y);
pointer_info = _gdk_display_get_pointer_info (display, device);
if (type == GDK_BUTTON_PRESS &&
!source_event->any.send_event &&
@@ -9449,6 +9480,30 @@ proxy_button_event (GdkEvent *source_event,
gdk_window_get_device_events (event_win, device) == 0)
return TRUE;
if (type == GDK_BUTTON_PRESS &&
pointer_info->need_touch_press_enter)
{
GdkCrossingMode mode;
/* The last device to interact with the window was a touch device,
* which synthesized a leave notify event, so synthesize another enter
* notify to tell the pointer is on the window.
*/
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
mode = GDK_CROSSING_TOUCH_PRESS;
else
mode = GDK_CROSSING_DEVICE_SWITCH;
pointer_info->need_touch_press_enter = FALSE;
_gdk_synthesize_crossing_events (display,
NULL,
pointer_info->window_under_pointer,
device, source_device, mode,
toplevel_x, toplevel_y,
state, time_, source_event,
serial, FALSE);
}
event = _gdk_make_event (event_win, type, source_event, FALSE);
switch (type)
@@ -9469,7 +9524,23 @@ proxy_button_event (GdkEvent *source_event,
gdk_event_set_source_device (event, source_device);
if (type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
_gdk_event_button_generate (display, event);
else if (type == GDK_BUTTON_RELEASE &&
pointer_window == pointer_info->window_under_pointer &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
{
/* Synthesize a leave notify event
* whenever a touch device is released
*/
pointer_info->need_touch_press_enter = TRUE;
_gdk_synthesize_crossing_events (display,
pointer_window, NULL,
device, source_device,
GDK_CROSSING_TOUCH_RELEASE,
toplevel_x, toplevel_y,
state, time_, NULL,
serial, FALSE);
}
return TRUE;
case GDK_SCROLL:
@@ -9588,6 +9659,17 @@ _gdk_windowing_got_event (GdkDisplay *display,
{
GdkInputMode mode;
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
{
pointer_info = _gdk_display_get_pointer_info (display, device);
if (source_device != pointer_info->last_slave &&
gdk_device_get_device_type (source_device) == GDK_DEVICE_TYPE_SLAVE)
pointer_info->last_slave = source_device;
else
source_device = pointer_info->last_slave;
}
g_object_get (device, "input-mode", &mode, NULL);
_gdk_display_device_grab_update (display, device, source_device, serial);
@@ -9606,8 +9688,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
if (!event_window)
return;
pointer_info = _gdk_display_get_pointer_info (display, device);
#ifdef DEBUG_WINDOW_PRINTING
if (event->type == GDK_KEY_PRESS &&
(event->key.keyval == 0xa7 ||
@@ -9692,15 +9772,19 @@ _gdk_windowing_got_event (GdkDisplay *display,
}
}
/* Store last pointer window and position/state */
old_state = pointer_info->state;
old_button = pointer_info->button;
if (pointer_info)
{
/* Store last pointer window and position/state */
old_state = pointer_info->state;
old_button = pointer_info->button;
gdk_event_get_coords (event, &x, &y);
convert_native_coords_to_toplevel (event_window, x, y, &x, &y);
pointer_info->toplevel_x = x;
pointer_info->toplevel_y = y;
gdk_event_get_state (event, &pointer_info->state);
}
gdk_event_get_coords (event, &x, &y);
convert_native_coords_to_toplevel (event_window, x, y, &x, &y);
pointer_info->toplevel_x = x;
pointer_info->toplevel_y = y;
gdk_event_get_state (event, &pointer_info->state);
if (event->type == GDK_BUTTON_PRESS ||
event->type == GDK_BUTTON_RELEASE)
pointer_info->button = event->button.button;
+1
View File
@@ -657,6 +657,7 @@ void gdk_window_set_startup_id (GdkWindow *window,
const gchar *startup_id);
void gdk_window_set_transient_for (GdkWindow *window,
GdkWindow *parent);
GDK_DEPRECATED_FOR(gdk_window_set_background_rgba)
void gdk_window_set_background (GdkWindow *window,
const GdkColor *color);
void gdk_window_set_background_rgba (GdkWindow *window,
+1 -1
View File
@@ -742,7 +742,7 @@ _gdk_x11_device_xi2_translate_state (XIModifierState *mods_state,
{
gint group;
group = group_state->base + group_state->latched + group_state->locked;
group = group_state->base | group_state->latched | group_state->locked;
/* FIXME: do we need the XKB complications for this ? */
group = CLAMP(group, 0, 3);
+8 -11
View File
@@ -664,13 +664,14 @@ gdk_x11_device_manager_core_translate_event (GdkEventTranslator *translator,
case FocusIn:
case FocusOut:
_gdk_device_manager_core_handle_focus (window,
xevent->xfocus.window,
device_manager->core_keyboard,
NULL,
xevent->type == FocusIn,
xevent->xfocus.detail,
xevent->xfocus.mode);
if (window)
_gdk_device_manager_core_handle_focus (window,
device_manager->core_keyboard,
NULL,
xevent->type == FocusIn,
xevent->xfocus.detail,
xevent->xfocus.mode);
return_val = FALSE;
break;
default:
@@ -796,7 +797,6 @@ _gdk_x11_event_translate_keyboard_string (GdkEventKey *event)
*/
void
_gdk_device_manager_core_handle_focus (GdkWindow *window,
Window original,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in,
@@ -821,9 +821,6 @@ _gdk_device_manager_core_handle_focus (GdkWindow *window,
if (!toplevel)
return;
if (toplevel->focus_window == original)
return;
had_focus = HAS_FOCUS (toplevel);
switch (detail)
+4 -1
View File
@@ -254,6 +254,10 @@ create_device (GdkDeviceManager *device_manager,
input_source = GDK_SOURCE_ERASER;
else if (strstr (tmp_name, "cursor"))
input_source = GDK_SOURCE_CURSOR;
else if (strstr (tmp_name, "finger") ||
(strstr (tmp_name, "touch") &&
!strstr (tmp_name, "touchpad")))
input_source = GDK_SOURCE_TOUCH;
else if (strstr (tmp_name, "wacom") ||
strstr (tmp_name, "pen"))
input_source = GDK_SOURCE_PEN;
@@ -1228,7 +1232,6 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GUINT_TO_POINTER (xev->sourceid));
_gdk_device_manager_core_handle_focus (window,
xev->event,
device,
source_device,
(ev->evtype == XI_FocusIn) ? TRUE : FALSE,
-3
View File
@@ -20,8 +20,6 @@
#ifndef __GDK_DEVICE_MANAGER_PRIVATE_CORE_H__
#define __GDK_DEVICE_MANAGER_PRIVATE_CORE_H__
#include <X11/Xlib.h>
#include "gdkx11devicemanager-core.h"
#include "gdkdevicemanagerprivate.h"
@@ -40,7 +38,6 @@ struct _GdkX11DeviceManagerCoreClass
};
void _gdk_device_manager_core_handle_focus (GdkWindow *window,
Window original,
GdkDevice *device,
GdkDevice *source_device,
gboolean focus_in,
+6 -3
View File
@@ -203,7 +203,7 @@ do_net_wm_state_changes (GdkWindow *window)
}
else
{
if (toplevel->have_sticky || toplevel->on_all_desktops)
if (toplevel->have_sticky && toplevel->on_all_desktops)
gdk_synthesize_window_state (window,
0,
GDK_WINDOW_STATE_STICKY);
@@ -284,7 +284,7 @@ gdk_check_wm_desktop_changed (GdkWindow *window)
if (type != None)
{
desktop = (gulong *)data;
toplevel->on_all_desktops = (*desktop == 0xFFFFFFFF);
toplevel->on_all_desktops = ((*desktop & 0xFFFFFFFF) == 0xFFFFFFFF);
XFree (desktop);
}
else
@@ -1579,9 +1579,12 @@ device_grab_update_callback (GdkDisplay *display,
gpointer data,
gulong serial)
{
GdkPointerWindowInfo *pointer_info;
GdkDevice *device = data;
_gdk_display_device_grab_update (display, device, NULL, serial);
pointer_info = _gdk_display_get_pointer_info (display, device);
_gdk_display_device_grab_update (display, device,
pointer_info->last_slave, serial);
}
#define XSERVER_TIME_IS_LATER(time1, time2) \
+9 -4
View File
@@ -662,11 +662,16 @@ is_pointer_within_shape (GdkDisplay *display,
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
cairo_region_t *input_shape;
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeBounding);
child->shape = NULL;
if (gdk_display_supports_shapes (display))
child->shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeBounding);
#ifdef ShapeInput
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeInput);
input_shape = NULL;
if (gdk_display_supports_input_shapes (display))
input_shape = _gdk_x11_xwindow_get_shape (display_x11->xdisplay,
child->xid, ShapeInput);
if (child->shape && input_shape)
{
cairo_region_intersect (child->shape, input_shape);
+26 -18
View File
@@ -1765,7 +1765,7 @@ move_to_current_desktop (GdkWindow *window)
xclient.format = 32;
xclient.data.l[0] = *current_desktop;
xclient.data.l[1] = 0;
xclient.data.l[1] = 1; /* source indication */
xclient.data.l[2] = 0;
xclient.data.l[3] = 0;
xclient.data.l[4] = 0;
@@ -1804,7 +1804,7 @@ gdk_x11_window_focus (GdkWindow *window,
xclient.type = ClientMessage;
xclient.window = GDK_WINDOW_XID (window);
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display,
"_NET_ACTIVE_WINDOW");
"_NET_ACTIVE_WINDOW");
xclient.format = 32;
xclient.data.l[0] = 1; /* requestor type; we're an app */
xclient.data.l[1] = timestamp;
@@ -1988,7 +1988,7 @@ gdk_wmspec_change_state (gboolean add,
xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
xclient.data.l[1] = gdk_x11_atom_to_xatom_for_display (display, state1);
xclient.data.l[2] = gdk_x11_atom_to_xatom_for_display (display, state2);
xclient.data.l[3] = 0;
xclient.data.l[3] = 1; /* source indication */
xclient.data.l[4] = 0;
XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False,
@@ -3890,17 +3890,24 @@ _gdk_x11_xwindow_get_shape (Display *xdisplay,
shape = NULL;
rn = 0;
xrl = XShapeGetRectangles (xdisplay,
window,
shape_type, &rn, &ord);
/* Note that XShapeGetRectangles returns NULL in two situations:
* - the server doesn't support the SHAPE extension
* - the shape is empty
*
* Since we can't discriminate these here, we always return
* an empty shape. It is the callers responsibility to check
* whether the server supports the SHAPE extensions beforehand.
*/
xrl = XShapeGetRectangles (xdisplay, window, shape_type, &rn, &ord);
if (xrl == NULL || rn == 0)
if (rn == 0)
return cairo_region_create (); /* Empty */
if (ord != YXBanded)
{
/* This really shouldn't happen with any xserver, as they
generally convert regions to YXBanded internally */
* generally convert regions to YXBanded internally
*/
g_warning ("non YXBanded shape masks not supported");
XFree (xrl);
return NULL;
@@ -3915,10 +3922,10 @@ _gdk_x11_xwindow_get_shape (Display *xdisplay,
rl[i].height = xrl[i].height;
}
XFree (xrl);
shape = cairo_region_create_rectangles (rl, rn);
g_free (rl);
return shape;
}
@@ -3940,7 +3947,7 @@ gdk_x11_window_get_input_shape (GdkWindow *window)
{
#if defined(ShapeInput)
if (!GDK_WINDOW_DESTROYED (window) &&
gdk_display_supports_shapes (GDK_WINDOW_DISPLAY (window)))
gdk_display_supports_input_shapes (GDK_WINDOW_DISPLAY (window)))
return _gdk_x11_xwindow_get_shape (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
ShapeInput);
@@ -4015,9 +4022,10 @@ static void
wmspec_moveresize (GdkWindow *window,
gint direction,
GdkDevice *device,
gint button,
gint root_x,
gint root_y,
guint32 timestamp)
guint32 timestamp)
{
GdkDisplay *display = GDK_WINDOW_DISPLAY (window);
@@ -4035,9 +4043,9 @@ wmspec_moveresize (GdkWindow *window,
xclient.data.l[0] = root_x;
xclient.data.l[1] = root_y;
xclient.data.l[2] = direction;
xclient.data.l[3] = 0;
xclient.data.l[4] = 0;
xclient.data.l[3] = button;
xclient.data.l[4] = 1; /* source indication */
XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XROOTWIN (window), False,
SubstructureRedirectMask | SubstructureNotifyMask,
(XEvent *)&xclient);
@@ -4132,7 +4140,7 @@ wmspec_resize_drag (GdkWindow *window,
return;
}
wmspec_moveresize (window, direction, device, root_x, root_y, timestamp);
wmspec_moveresize (window, direction, device, button, root_x, root_y, timestamp);
}
static MoveResizeData *
@@ -4617,8 +4625,8 @@ gdk_x11_window_begin_move_drag (GdkWindow *window,
if (gdk_x11_screen_supports_net_wm_hint (GDK_WINDOW_SCREEN (window),
gdk_atom_intern_static_string ("_NET_WM_MOVERESIZE")))
wmspec_moveresize (window, _NET_WM_MOVERESIZE_MOVE, device, root_x, root_y,
timestamp);
wmspec_moveresize (window, _NET_WM_MOVERESIZE_MOVE,
device, button, root_x, root_y, timestamp);
else
emulate_move_drag (window, device, button, root_x, root_y, timestamp);
}
-10
View File
@@ -1,10 +0,0 @@
targets=@GDK_BACKENDS@
gtk_binary_version=@GTK_BINARY_VERSION@
Name: GTK+ Uninstalled
Description: GTK+ Graphical UI Library (${target} target), Not Installed
Version: @VERSION@
Requires: gdk-@GTK_API_VERSION@-uninstalled @GTK_PACKAGES@
Libs: ${pc_top_builddir}/${pcfiledir}/gtk/libgtk-3.la @GTK_EXTRA_LIBS@
Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@ -I${pc_top_builddir}/${pcfiledir} @GTK_EXTRA_CFLAGS@
+3 -3
View File
@@ -1024,7 +1024,7 @@ endif
dist-hook: ../build/win32/vs9/gtk.vcproj ../build/win32/vs10/gtk.vcxproj ../build/win32/vs10/gtk.vcxproj.filters
../build/win32/vs9/gtk.vcproj: ../build/win32/vs9/gtk.vcprojin
for F in $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources); do \
for F in `echo $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources) | tr '/' '\\'`; do \
case $$F in \
*.c) echo ' <File RelativePath="..\..\..\gtk\'$$F'" />' \
;; \
@@ -1034,7 +1034,7 @@ dist-hook: ../build/win32/vs9/gtk.vcproj ../build/win32/vs10/gtk.vcxproj ../buil
rm libgtk.sourcefiles
../build/win32/vs10/gtk.vcxproj: ../build/win32/vs10/gtk.vcxprojin
for F in $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources); do \
for F in `echo $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources) | tr '/' '\\'`; do \
case $$F in \
*.c) echo ' <ClCompile Include="..\..\..\gtk\'$$F'" />' \
;; \
@@ -1044,7 +1044,7 @@ dist-hook: ../build/win32/vs9/gtk.vcproj ../build/win32/vs10/gtk.vcxproj ../buil
rm libgtk.vs10.sourcefiles
../build/win32/vs10/gtk.vcxproj.filters: ../build/win32/vs10/gtk.vcxproj.filtersin
for F in $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources); do \
for F in `echo $(gtk_base_c_sources) $(gtk_os_win32_c_sources) $(gtk_use_win32_c_sources) | tr '/' '\\'`; do \
case $$F in \
*.c) echo ' <ClCompile Include="..\..\..\gtk\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
;; \
+8 -7
View File
@@ -197,20 +197,21 @@ find_label (GtkWidget *widget)
GList *labels;
GtkWidget *label;
GtkWidget *temp_widget;
GList *ptr;
labels = gtk_widget_list_mnemonic_labels (widget);
label = NULL;
if (labels)
ptr = labels;
while (ptr)
{
if (labels->data)
if (ptr->data && gtk_widget_get_visible (GTK_WIDGET (ptr->data)))
{
if (labels->next)
g_warning ("Widget (%s) has more than one label", G_OBJECT_TYPE_NAME (widget));
else
label = labels->data;
label = ptr->data;
break;
}
g_list_free (labels);
ptr = ptr->next;
}
g_list_free (labels);
/* Ignore a label within a button; bug #136602 */
if (label && GTK_IS_BUTTON (widget))
+3
View File
@@ -716,6 +716,7 @@ static void
remove_proxy (GtkAction *action,
GtkWidget *proxy)
{
g_object_unref (proxy);
action->private_data->proxies = g_slist_remove (action->private_data->proxies, proxy);
}
@@ -725,6 +726,8 @@ connect_proxy (GtkAction *action,
{
action->private_data->proxies = g_slist_prepend (action->private_data->proxies, proxy);
g_object_ref_sink (proxy);
if (action->private_data->action_group)
_gtk_action_group_emit_connect_proxy (action->private_data->action_group, action, proxy);
+1 -5
View File
@@ -993,11 +993,7 @@ gtk_app_chooser_widget_dispose (GObject *object)
{
GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (object);
if (self->priv->selected_app_info != NULL)
{
g_object_unref (self->priv->selected_app_info);
self->priv->selected_app_info = NULL;
}
g_clear_object (&self->priv->selected_app_info);
G_OBJECT_CLASS (gtk_app_chooser_widget_parent_class)->dispose (object);
}
+16 -12
View File
@@ -756,7 +756,7 @@ gtk_application_remove_accelerator (GtkApplication *application,
/**
* gtk_application_set_app_menu:
* @application: a #GtkApplication
* @app_menu: (allow-none): a #GMenuModel, or %NULL
* @model: (allow-none): a #GMenuModel, or %NULL
*
* Sets or unsets the application menu for @application.
*
@@ -773,9 +773,9 @@ gtk_application_remove_accelerator (GtkApplication *application,
*/
void
gtk_application_set_app_menu (GtkApplication *application,
GMenuModel *app_menu)
GMenuModel *model)
{
g_object_set (application, "app-menu", app_menu, NULL);
g_object_set (application, "app-menu", model, NULL);
}
/**
@@ -785,17 +785,19 @@ gtk_application_set_app_menu (GtkApplication *application,
* Returns the menu model that has been set with
* g_application_set_app_menu().
*
* Returns: the application menu of @application
* Returns: (transfer none): the application menu of @application
*
* Since: 3.4
*/
GMenuModel *
gtk_application_get_app_menu (GtkApplication *application)
{
GMenuModel *app_menu;
GMenuModel *app_menu = NULL;
g_object_get (application, "app-menu", &app_menu, NULL);
g_object_unref (app_menu);
if (app_menu)
g_object_unref (app_menu);
return app_menu;
}
@@ -803,7 +805,7 @@ gtk_application_get_app_menu (GtkApplication *application)
/**
* gtk_application_set_menubar:
* @application: a #GtkApplication
* @menubar: (allow-none): a #GMenuModel, or %NULL
* @model: (allow-none): a #GMenuModel, or %NULL
*
* Sets or unsets the menubar for windows of @application.
*
@@ -821,9 +823,9 @@ gtk_application_get_app_menu (GtkApplication *application)
*/
void
gtk_application_set_menubar (GtkApplication *application,
GMenuModel *menubar)
GMenuModel *model)
{
g_object_set (application, "menubar", menubar, NULL);
g_object_set (application, "menubar", model, NULL);
}
/**
@@ -833,17 +835,19 @@ gtk_application_set_menubar (GtkApplication *application,
* Returns the menu model that has been set with
* g_application_set_menubar().
*
* Returns: the menubar for windows of @application
* Returns: (transfer none): the menubar for windows of @application
*
* Since: 3.4
*/
GMenuModel *
gtk_application_get_menubar (GtkApplication *application)
{
GMenuModel *menubar;
GMenuModel *menubar = NULL;
g_object_get (application, "menubar", &menubar, NULL);
g_object_unref (menubar);
if (menubar)
g_object_unref (menubar);
return menubar;
}
+3 -1
View File
@@ -68,9 +68,11 @@
*
* If the desktop environment does not display the menubar, then
* #GApplicationWindow will automatically show a #GtkMenubar for it.
* (see the #GtkApplication docs for some screenshots of how this
* looks on different platforms).
* This behaviour can be overridden with the #GtkApplicationWindow:show-menubar
* property. If the desktop environment does not display the application
* menu, then it will automatilly be included in the menubar.
* menu, then it will automatically be included in the menubar.
*
* <example><title>A GtkApplicationWindow with a menubar</title>
* <programlisting><![CDATA[
+21 -29
View File
@@ -62,7 +62,6 @@
static const GtkBorder default_default_border = { 1, 1, 1, 1 };
static const GtkBorder default_default_outside_border = { 0, 0, 0, 0 };
static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
/* Time out before giving up on getting a key release when animating
* the close button.
@@ -503,6 +502,9 @@ gtk_button_class_init (GtkButtonClass *klass)
* Sets the border between the button edges and child.
*
* Since: 2.10
*
* Deprecated: 3.4: Use the standard border and padding CSS properties;
* the value of this style property is ignored.
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_boxed ("inner-border",
@@ -1400,8 +1402,8 @@ static void
gtk_button_get_props (GtkButton *button,
GtkBorder *default_border,
GtkBorder *default_outside_border,
GtkBorder *inner_border,
GtkBorder *padding,
GtkBorder *border,
gboolean *interior_focus)
{
GtkStyleContext *context;
@@ -1441,21 +1443,6 @@ gtk_button_get_props (GtkButton *button,
*default_outside_border = default_default_outside_border;
}
if (inner_border)
{
gtk_style_context_get_style (context,
"inner-border", &tmp_border,
NULL);
if (tmp_border)
{
*inner_border = *tmp_border;
gtk_border_free (tmp_border);
}
else
*inner_border = default_inner_border;
}
if (interior_focus)
{
gtk_style_context_get_style (context,
@@ -1465,6 +1452,9 @@ gtk_button_get_props (GtkButton *button,
if (padding)
gtk_style_context_get_padding (context, state, padding);
if (border)
gtk_style_context_get_border (context, state, border);
}
static void
@@ -1477,14 +1467,15 @@ gtk_button_size_allocate (GtkWidget *widget,
GtkStyleContext *context;
GtkWidget *child;
GtkBorder default_border;
GtkBorder inner_border;
GtkBorder padding;
GtkBorder border;
gint focus_width;
gint focus_pad;
context = gtk_widget_get_style_context (widget);
gtk_button_get_props (button, &default_border, NULL, &inner_border, &padding, NULL);
gtk_button_get_props (button, &default_border, NULL,
&padding, &border, NULL);
gtk_style_context_get_style (context,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
@@ -1502,20 +1493,18 @@ gtk_button_size_allocate (GtkWidget *widget,
child = gtk_bin_get_child (GTK_BIN (button));
if (child && gtk_widget_get_visible (child))
{
child_allocation.x = allocation->x + inner_border.left + padding.left;
child_allocation.y = allocation->y + inner_border.top + padding.top;
child_allocation.x = allocation->x + padding.left + border.left;
child_allocation.y = allocation->y + padding.top + border.top;
child_allocation.width =
allocation->width -
(padding.left + padding.right) -
inner_border.left -
inner_border.right;
(border.left + border.right);
child_allocation.height =
allocation->height -
(padding.top + padding.bottom) -
inner_border.top -
inner_border.bottom;
(border.top + border.bottom);
if (gtk_widget_get_can_default (GTK_WIDGET (button)))
{
@@ -1924,15 +1913,16 @@ gtk_button_get_size (GtkWidget *widget,
GtkStyleContext *context;
GtkWidget *child;
GtkBorder default_border;
GtkBorder inner_border;
GtkBorder padding;
GtkBorder border;
gint focus_width;
gint focus_pad;
gint minimum, natural;
context = gtk_widget_get_style_context (widget);
gtk_button_get_props (button, &default_border, NULL, &inner_border, &padding, NULL);
gtk_button_get_props (button, &default_border, NULL,
&padding, &border, NULL);
gtk_style_context_get_style (context,
"focus-line-width", &focus_width,
"focus-padding", &focus_pad,
@@ -1940,14 +1930,16 @@ gtk_button_get_size (GtkWidget *widget,
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
minimum = inner_border.left + inner_border.right + padding.left + padding.right;
minimum = padding.left + padding.right +
border.left + border.right;
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
minimum += default_border.left + default_border.right;
}
else
{
minimum = inner_border.top + inner_border.bottom + padding.top + padding.bottom;
minimum = padding.top + padding.bottom +
border.top + border.bottom;
if (gtk_widget_get_can_default (GTK_WIDGET (widget)))
minimum += default_border.top + default_border.bottom;
+8 -1
View File
@@ -380,13 +380,20 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
NULL,
GTK_PARAM_WRITABLE));
/**
* GtkCellRenderer:cell-background-gdk:
*
* Cell background as a #GdkColor
*
* Deprecated: 3.4: Use #GtkCellRenderer:cell-background-rgba instead.
*/
g_object_class_install_property (object_class,
PROP_CELL_BACKGROUND_GDK,
g_param_spec_boxed ("cell-background-gdk",
P_("Cell background color"),
P_("Cell background color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkCellRenderer:cell-background-rgba:
*
+16 -2
View File
@@ -290,13 +290,20 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
NULL,
GTK_PARAM_WRITABLE));
/**
* GtkCellRendererText:background-gdk:
*
* Background color as a #GdkColor
*
* Deprecated: 3.4: Use #GtkCellRendererText:background-rgba instead.
*/
g_object_class_install_property (object_class,
PROP_BACKGROUND_GDK,
g_param_spec_boxed ("background-gdk",
P_("Background color"),
P_("Background color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkCellRendererText:background-rgba:
@@ -320,13 +327,20 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
NULL,
GTK_PARAM_WRITABLE));
/**
* GtkCellRendererText:foreground-gdk:
*
* Foreground color as a #GdkColor
*
* Deprecated: 3.4: Use #GtkCellRendererText:foreground-rgba instead.
*/
g_object_class_install_property (object_class,
PROP_FOREGROUND_GDK,
g_param_spec_boxed ("foreground-gdk",
P_("Foreground color"),
P_("Foreground color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkCellRendererText:foreground-rgba:
+32 -9
View File
@@ -192,13 +192,21 @@ gtk_cell_view_class_init (GtkCellViewClass *klass)
P_("Background color as a string"),
NULL,
GTK_PARAM_WRITABLE));
/**
* GtkCellView:background-gdk
*
* The background color as a #GdkColor
*
* Deprecated: 3.4: Use #GtkCellView:background-rgba instead.
*/
g_object_class_install_property (gobject_class,
PROP_BACKGROUND_GDK,
g_param_spec_boxed ("background-gdk",
P_("Background color"),
P_("Background color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkCellView:background-rgba
*
@@ -440,20 +448,33 @@ gtk_cell_view_set_property (GObject *object,
break;
case PROP_BACKGROUND:
{
GdkColor color;
GdkRGBA color;
if (!g_value_get_string (value))
gtk_cell_view_set_background_color (view, NULL);
else if (gdk_color_parse (g_value_get_string (value), &color))
gtk_cell_view_set_background_color (view, &color);
gtk_cell_view_set_background_rgba (view, NULL);
else if (gdk_rgba_parse (&color, g_value_get_string (value)))
gtk_cell_view_set_background_rgba (view, &color);
else
g_warning ("Don't know color `%s'", g_value_get_string (value));
g_object_notify (object, "background-gdk");
g_object_notify (object, "background-rgba");
g_object_notify (object, "background-gdk");
}
break;
case PROP_BACKGROUND_GDK:
gtk_cell_view_set_background_color (view, g_value_get_boxed (value));
{
GdkColor *color;
GdkRGBA rgba;
color = g_value_get_boxed (value);
rgba.red = color->red / 65535.0;
rgba.green = color->green / 65535.0;
rgba.blue = color->blue / 65535.0;
rgba.alpha = 1.0;
gtk_cell_view_set_background_rgba (view, &rgba);
}
break;
case PROP_BACKGROUND_RGBA:
gtk_cell_view_set_background_rgba (view, g_value_get_boxed (value));
@@ -1267,6 +1288,8 @@ gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
* Sets the background color of @view.
*
* Since: 2.6
*
* Deprecated: 3.4: Use gtk_cell_view_set_background_rgba() instead.
*/
void
gtk_cell_view_set_background_color (GtkCellView *cell_view,
+3 -2
View File
@@ -75,8 +75,6 @@ GtkTreeModel *gtk_cell_view_get_model (GtkCellView *cell_v
void gtk_cell_view_set_displayed_row (GtkCellView *cell_view,
GtkTreePath *path);
GtkTreePath *gtk_cell_view_get_displayed_row (GtkCellView *cell_view);
void gtk_cell_view_set_background_color (GtkCellView *cell_view,
const GdkColor *color);
void gtk_cell_view_set_background_rgba (GtkCellView *cell_view,
const GdkRGBA *rgba);
gboolean gtk_cell_view_get_draw_sensitive (GtkCellView *cell_view);
@@ -90,6 +88,9 @@ GDK_DEPRECATED_FOR(gtk_widget_get_preferred_size)
gboolean gtk_cell_view_get_size_of_row (GtkCellView *cell_view,
GtkTreePath *path,
GtkRequisition *requisition);
GDK_DEPRECATED_FOR(gtk_cell_view_set_background_rgba)
void gtk_cell_view_set_background_color (GtkCellView *cell_view,
const GdkColor *color);
G_END_DECLS
+34 -5
View File
@@ -193,6 +193,8 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
* The selected color.
*
* Since: 2.4
*
* Deprecated: 3.4: Use #GtkColorButton:rgba instead.
*/
g_object_class_install_property (gobject_class,
PROP_COLOR,
@@ -200,7 +202,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
P_("Current Color"),
P_("The selected color"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkColorButton:alpha:
@@ -555,6 +557,8 @@ gtk_color_button_new (void)
* Returns: a new color button
*
* Since: 2.4
*
* Deprecated: 3.4: Use gtk_color_button_new_with_rgba() instead.
*/
GtkWidget *
gtk_color_button_new_with_color (const GdkColor *color)
@@ -691,6 +695,8 @@ gtk_color_button_clicked (GtkButton *button)
* Sets the current color to be @color.
*
* Since: 2.4
*
* Deprecated: Use gtk_color_button_set_rgba() instead.
*/
void
gtk_color_button_set_color (GtkColorButton *color_button,
@@ -741,6 +747,8 @@ gtk_color_button_set_alpha (GtkColorButton *color_button,
* Sets @color to be the current color in the #GtkColorButton widget.
*
* Since: 2.4
*
* Deprecated: 3.4: Use gtk_color_button_get_rgba() instead.
*/
void
gtk_color_button_get_color (GtkColorButton *color_button,
@@ -924,7 +932,19 @@ gtk_color_button_set_property (GObject *object,
gtk_color_button_set_title (color_button, g_value_get_string (value));
break;
case PROP_COLOR:
gtk_color_button_set_color (color_button, g_value_get_boxed (value));
{
GdkColor *color;
GdkRGBA rgba;
color = g_value_get_boxed (value);
rgba.red = color->red / 65535.0;
rgba.green = color->green / 65535.0;
rgba.blue = color->blue / 65535.0;
rgba.alpha = 1.0;
gtk_color_button_set_rgba (color_button, &rgba);
}
break;
case PROP_ALPHA:
gtk_color_button_set_alpha (color_button, g_value_get_uint (value));
@@ -945,7 +965,6 @@ gtk_color_button_get_property (GObject *object,
GParamSpec *pspec)
{
GtkColorButton *color_button = GTK_COLOR_BUTTON (object);
GdkColor color;
switch (param_id)
{
@@ -956,8 +975,18 @@ gtk_color_button_get_property (GObject *object,
g_value_set_string (value, gtk_color_button_get_title (color_button));
break;
case PROP_COLOR:
gtk_color_button_get_color (color_button, &color);
g_value_set_boxed (value, &color);
{
GdkColor color;
GdkRGBA rgba;
gtk_color_button_get_rgba (color_button, &rgba);
color.red = (guint16) (rgba.red * 65535 + 0.5);
color.green = (guint16) (rgba.green * 65535 + 0.5);
color.blue = (guint16) (rgba.blue * 65535 + 0.5);
g_value_set_boxed (value, &color);
}
break;
case PROP_ALPHA:
g_value_set_uint (value, gtk_color_button_get_alpha (color_button));
+9 -5
View File
@@ -75,14 +75,9 @@ struct _GtkColorButtonClass {
GType gtk_color_button_get_type (void) G_GNUC_CONST;
GtkWidget *gtk_color_button_new (void);
GtkWidget *gtk_color_button_new_with_color (const GdkColor *color);
GtkWidget *gtk_color_button_new_with_rgba (const GdkRGBA *rgba);
void gtk_color_button_set_color (GtkColorButton *color_button,
const GdkColor *color);
void gtk_color_button_set_alpha (GtkColorButton *color_button,
guint16 alpha);
void gtk_color_button_get_color (GtkColorButton *color_button,
GdkColor *color);
guint16 gtk_color_button_get_alpha (GtkColorButton *color_button);
void gtk_color_button_set_use_alpha (GtkColorButton *color_button,
gboolean use_alpha);
@@ -95,6 +90,15 @@ void gtk_color_button_set_title (GtkColorButton *color_button,
const gchar *title);
const gchar *gtk_color_button_get_title (GtkColorButton *color_button);
GDK_DEPRECATED_FOR(gtk_color_button_new_with_rgba)
GtkWidget *gtk_color_button_new_with_color (const GdkColor *color);
GDK_DEPRECATED_FOR(gtk_color_button_set_rgba)
void gtk_color_button_set_color (GtkColorButton *color_button,
const GdkColor *color);
GDK_DEPRECATED_FOR(gtk_color_button_get_rgba)
void gtk_color_button_get_color (GtkColorButton *color_button,
GdkColor *color);
G_END_DECLS
+42 -5
View File
@@ -329,13 +329,21 @@ gtk_color_selection_class_init (GtkColorSelectionClass *klass)
P_("Whether a palette should be used"),
FALSE,
GTK_PARAM_READWRITE));
/**
* GtkColorSelection:current-color
*
* The current GdkColor color.
*
* Deprecated: 3.4: Use #GtkColorSelection:current-rgba instead.
*/
g_object_class_install_property (gobject_class,
PROP_CURRENT_COLOR,
g_param_spec_boxed ("current-color",
P_("Current Color"),
P_("The current color"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
g_object_class_install_property (gobject_class,
PROP_CURRENT_ALPHA,
g_param_spec_uint ("current-alpha",
@@ -599,7 +607,19 @@ gtk_color_selection_set_property (GObject *object,
g_value_get_boolean (value));
break;
case PROP_CURRENT_COLOR:
gtk_color_selection_set_current_color (colorsel, g_value_get_boxed (value));
{
GdkColor *color;
GdkRGBA rgba;
color = g_value_get_boxed (value);
rgba.red = SCALE (color->red);
rgba.green = SCALE (color->green);;
rgba.blue = SCALE (color->blue);
rgba.alpha = 1.0;
gtk_color_selection_set_current_rgba (colorsel, &rgba);
}
break;
case PROP_CURRENT_ALPHA:
gtk_color_selection_set_current_alpha (colorsel, g_value_get_uint (value));
@@ -621,7 +641,6 @@ gtk_color_selection_get_property (GObject *object,
GParamSpec *pspec)
{
GtkColorSelection *colorsel = GTK_COLOR_SELECTION (object);
GdkColor color;
switch (prop_id)
{
@@ -632,8 +651,18 @@ gtk_color_selection_get_property (GObject *object,
g_value_set_boolean (value, gtk_color_selection_get_has_palette (colorsel));
break;
case PROP_CURRENT_COLOR:
gtk_color_selection_get_current_color (colorsel, &color);
g_value_set_boxed (value, &color);
{
GdkColor color;
GdkRGBA rgba;
gtk_color_selection_get_current_rgba (colorsel, &rgba);
color.red = UNSCALE (rgba.red);
color.green = UNSCALE (rgba.green);
color.blue = UNSCALE (rgba.blue);
g_value_set_boxed (value, &color);
}
break;
case PROP_CURRENT_ALPHA:
g_value_set_uint (value, gtk_color_selection_get_current_alpha (colorsel));
@@ -2488,6 +2517,8 @@ gtk_color_selection_set_has_palette (GtkColorSelection *colorsel,
*
* The first time this is called, it will also set
* the original color to be @color too.
*
* Deprecated: 3.4: Use gtk_color_selection_set_current_rgba() instead.
*/
void
gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
@@ -2556,6 +2587,8 @@ gtk_color_selection_set_current_alpha (GtkColorSelection *colorsel,
* @color: (out): a #GdkColor to fill in with the current color
*
* Sets @color to be the current color in the GtkColorSelection widget.
*
* Deprecated: 3.4: Use gtk_color_selection_get_current_rgba() instead.
*/
void
gtk_color_selection_get_current_color (GtkColorSelection *colorsel,
@@ -2602,6 +2635,8 @@ gtk_color_selection_get_current_alpha (GtkColorSelection *colorsel)
* as it might seem confusing to have that color change.
* Calling gtk_color_selection_set_current_color() will also
* set this color the first time it is called.
*
* Deprecated: 3.4: Use gtk_color_selection_set_previous_rgba() instead.
*/
void
gtk_color_selection_set_previous_color (GtkColorSelection *colorsel,
@@ -2661,6 +2696,8 @@ gtk_color_selection_set_previous_alpha (GtkColorSelection *colorsel,
* @color: (out): a #GdkColor to fill in with the original color value
*
* Fills @color in with the original color value.
*
* Deprecated: 3.4: Use gtk_color_selection_get_previous_rgba() instead.
*/
void
gtk_color_selection_get_previous_color (GtkColorSelection *colorsel,
+14 -8
View File
@@ -98,19 +98,11 @@ void gtk_color_selection_set_has_palette (GtkColorSelection *color
gboolean has_palette);
void gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
const GdkColor *color);
void gtk_color_selection_set_current_alpha (GtkColorSelection *colorsel,
guint16 alpha);
void gtk_color_selection_get_current_color (GtkColorSelection *colorsel,
GdkColor *color);
guint16 gtk_color_selection_get_current_alpha (GtkColorSelection *colorsel);
void gtk_color_selection_set_previous_color (GtkColorSelection *colorsel,
const GdkColor *color);
void gtk_color_selection_set_previous_alpha (GtkColorSelection *colorsel,
guint16 alpha);
void gtk_color_selection_get_previous_color (GtkColorSelection *colorsel,
GdkColor *color);
guint16 gtk_color_selection_get_previous_alpha (GtkColorSelection *colorsel);
void gtk_color_selection_set_current_rgba (GtkColorSelection *colorsel,
@@ -132,6 +124,20 @@ gchar* gtk_color_selection_palette_to_string (const GdkColor *colors,
GtkColorSelectionChangePaletteWithScreenFunc gtk_color_selection_set_change_palette_with_screen_hook (GtkColorSelectionChangePaletteWithScreenFunc func);
GDK_DEPRECATED_FOR(gtk_color_selection_set_current_rgba)
void gtk_color_selection_set_current_color (GtkColorSelection *colorsel,
const GdkColor *color);
GDK_DEPRECATED_FOR(gtk_color_selection_get_current_rgba)
void gtk_color_selection_get_current_color (GtkColorSelection *colorsel,
GdkColor *color);
GDK_DEPRECATED_FOR(gtk_color_selection_set_previous_rgba)
void gtk_color_selection_set_previous_color (GtkColorSelection *colorsel,
const GdkColor *color);
GDK_DEPRECATED_FOR(gtk_color_selection_get_previous_rgba)
void gtk_color_selection_get_previous_color (GtkColorSelection *colorsel,
GdkColor *color);
G_END_DECLS
#endif /* __GTK_COLOR_SELECTION_H__ */
+5 -3
View File
@@ -3885,13 +3885,15 @@ gtk_combo_box_list_select_func (GtkTreeSelection *selection,
NULL);
if (cell_visible && cell_sensitive)
break;
{
sensitive = TRUE;
break;
}
cell = cell->next;
}
g_list_free (cells);
sensitive = cell_sensitive;
g_list_free (cells);
}
g_list_free (columns);
+16 -8
View File
@@ -49,6 +49,9 @@
* The entry itself can be accessed by calling gtk_bin_get_child() on the
* combo box.
*
* You should not call gtk_combo_box_set_model() or attempt to pack more cells
* into this combo box via its GtkCellLayout interface.
*
* <refsect2 id="GtkComboBoxText-BUILDER-UI">
* <title>GtkComboBoxText as GtkBuildable</title>
* <para>
@@ -99,11 +102,15 @@ gtk_combo_box_text_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_properties)
{
GObject *object;
GObject *object;
const gint text_column = 0;
object = G_OBJECT_CLASS (gtk_combo_box_text_parent_class)->constructor
(type, n_construct_properties, construct_properties);
gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object), text_column);
gtk_combo_box_set_id_column (GTK_COMBO_BOX (object), 1);
if (!gtk_combo_box_get_has_entry (GTK_COMBO_BOX (object)))
{
GtkCellRenderer *cell;
@@ -111,7 +118,7 @@ gtk_combo_box_text_constructor (GType type,
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (object), cell, TRUE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (object), cell,
"text", 0,
"text", text_column,
NULL);
}
@@ -150,6 +157,7 @@ typedef struct {
GtkBuilder *builder;
GObject *object;
const gchar *domain;
gchar *id;
GString *string;
@@ -192,6 +200,8 @@ item_start_element (GMarkupParseContext *context,
}
else if (strcmp (names[i], "context") == 0)
data->context = g_strdup (values[i]);
else if (strcmp (names[i], "id") == 0)
data->id = g_strdup (values[i]);
else
g_warning ("Unknown custom combo box item attribute: %s", names[i]);
}
@@ -237,13 +247,15 @@ item_end_element (GMarkupParseContext *context,
g_string_append (data->string, translated);
}
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (data->object), data->string->str);
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (data->object), data->id, data->string->str);
}
data->translatable = FALSE;
g_string_set_size (data->string, 0);
g_free (data->context);
data->context = NULL;
g_free (data->id);
data->id = NULL;
data->is_text = FALSE;
}
@@ -309,7 +321,7 @@ gtk_combo_box_text_buildable_custom_finished (GtkBuildable *buildable,
* gtk_combo_box_text_new:
*
* Creates a new #GtkComboBoxText, which is a #GtkComboBox just displaying
* strings. See gtk_combo_box_entry_new_with_text().
* strings.
*
* Return value: A new #GtkComboBoxText
*
@@ -319,8 +331,6 @@ GtkWidget *
gtk_combo_box_text_new (void)
{
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
"entry-text-column", 0,
"id-column", 1,
NULL);
}
@@ -339,8 +349,6 @@ gtk_combo_box_text_new_with_entry (void)
{
return g_object_new (GTK_TYPE_COMBO_BOX_TEXT,
"has-entry", TRUE,
"entry-text-column", 0,
"id-column", 1,
NULL);
}
+10
View File
@@ -1215,6 +1215,8 @@ gtk_css_ruleset_matches (GtkCssRuleset *ruleset,
static void
gtk_css_scanner_destroy (GtkCssScanner *scanner)
{
if (scanner->section)
gtk_css_section_unref (scanner->section);
g_object_unref (scanner->provider);
if (scanner->file)
g_object_unref (scanner->file);
@@ -3055,6 +3057,12 @@ gtk_css_provider_get_default (void)
" border-width: 0;\n"
" padding: 2;\n"
"}\n"
"\n"
".press-and-hold {\n"
" background-color: alpha (@bg_color, 0.5);\n"
" color: alpha (lighter (@selected_bg_color), 0.8);\n"
" border-width: 10;\n"
"}\n"
"\n";
provider = gtk_css_provider_new ();
@@ -3291,6 +3299,8 @@ gtk_css_provider_print_colors (GHashTable *colors,
* this @provider.
*
* Returns: a new string representing the @provider.
*
* Since: 3.2
**/
char *
gtk_css_provider_to_string (GtkCssProvider *provider)
+76 -26
View File
@@ -147,6 +147,8 @@ struct _GtkEntryPrivate
GtkShadowType shadow_type;
GtkWidget *popup_menu;
GdkDevice *device;
GdkDevice *completion_device;
GdkWindow *text_area;
@@ -482,6 +484,11 @@ static void gtk_entry_toggle_overwrite (GtkEntry *entry);
static void gtk_entry_select_all (GtkEntry *entry);
static void gtk_entry_real_activate (GtkEntry *entry);
static gboolean gtk_entry_popup_menu (GtkWidget *widget);
static gboolean gtk_entry_press_and_hold (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y);
static void keymap_direction_changed (GdkKeymap *keymap,
GtkEntry *entry);
@@ -545,9 +552,13 @@ static void gtk_entry_paste (GtkEntry *entry,
GdkAtom selection);
static void gtk_entry_update_primary_selection (GtkEntry *entry);
static void gtk_entry_do_popup (GtkEntry *entry,
GdkEventButton *event);
GdkDevice *device,
guint32 _time,
guint button);
static gboolean gtk_entry_mnemonic_activate (GtkWidget *widget,
gboolean group_cycling);
static void gtk_entry_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_entry_check_cursor_blink (GtkEntry *entry);
static void gtk_entry_pend_cursor_blink (GtkEntry *entry);
static void gtk_entry_reset_blink_time (GtkEntry *entry);
@@ -692,6 +703,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->state_flags_changed = gtk_entry_state_flags_changed;
widget_class->screen_changed = gtk_entry_screen_changed;
widget_class->mnemonic_activate = gtk_entry_mnemonic_activate;
widget_class->grab_notify = gtk_entry_grab_notify;
widget_class->drag_drop = gtk_entry_drag_drop;
widget_class->drag_motion = gtk_entry_drag_motion;
@@ -701,6 +713,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->drag_data_delete = gtk_entry_drag_data_delete;
widget_class->popup_menu = gtk_entry_popup_menu;
widget_class->press_and_hold = gtk_entry_press_and_hold;
class->move_cursor = gtk_entry_move_cursor;
class->insert_at_cursor = gtk_entry_insert_at_cursor;
@@ -3771,7 +3784,8 @@ gtk_entry_button_press (GtkWidget *widget,
gtk_entry_reset_blink_time (entry);
priv->button = event->button;
priv->device = gdk_event_get_device ((GdkEvent *) event);
if (!gtk_widget_has_focus (widget))
{
priv->in_click = TRUE;
@@ -3783,8 +3797,10 @@ gtk_entry_button_press (GtkWidget *widget,
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
{
gtk_entry_do_popup (entry, event);
gtk_entry_do_popup (entry, event->device,
event->time, event->button);
priv->button = 0; /* Don't wait for release, since the menu will gtk_grab_add */
priv->device = NULL;
return TRUE;
}
@@ -3962,9 +3978,10 @@ gtk_entry_button_release (GtkWidget *widget,
priv->in_drag = 0;
}
priv->button = 0;
priv->device = NULL;
gtk_entry_update_primary_selection (entry);
return TRUE;
@@ -4073,7 +4090,8 @@ gtk_entry_motion_notify (GtkWidget *widget,
priv->in_drag = FALSE;
priv->button = 0;
priv->device = NULL;
gtk_target_list_unref (target_list);
}
}
@@ -8542,6 +8560,26 @@ gtk_entry_mnemonic_activate (GtkWidget *widget,
return TRUE;
}
static void
gtk_entry_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
GtkEntryPrivate *priv;
priv = GTK_ENTRY (widget)->priv;
if (priv->device &&
gtk_widget_device_is_shadowed (widget, priv->device))
{
/* Unset button so we don't expect
* a button release anymore
*/
priv->button = 0;
priv->device = NULL;
priv->in_drag = FALSE;
}
}
static void
append_action_signal (GtkEntry *entry,
GtkWidget *menu,
@@ -8744,15 +8782,17 @@ popup_targets_received (GtkClipboard *clipboard,
info_entry_priv->popup_menu);
if (info->device)
if (gdk_device_get_source (info->device) != GDK_SOURCE_KEYBOARD)
gtk_menu_popup_for_device (GTK_MENU (info_entry_priv->popup_menu),
info->device, NULL, NULL, NULL, NULL, NULL,
info->button, info->time);
else
{
gtk_menu_popup (GTK_MENU (info_entry_priv->popup_menu), NULL, NULL,
popup_position_func, entry,
0, gtk_get_current_event_time ());
gtk_menu_popup_for_device (GTK_MENU (info_entry_priv->popup_menu),
info->device, NULL, NULL,
popup_position_func,
entry, NULL,
0, info->time);
gtk_menu_shell_select_first (GTK_MENU_SHELL (info_entry_priv->popup_menu), FALSE);
}
}
@@ -8760,10 +8800,12 @@ popup_targets_received (GtkClipboard *clipboard,
g_object_unref (entry);
g_slice_free (PopupInfo, info);
}
static void
gtk_entry_do_popup (GtkEntry *entry,
GdkEventButton *event)
GdkDevice *device,
guint32 _time,
guint button)
{
PopupInfo *info = g_slice_new (PopupInfo);
@@ -8772,19 +8814,10 @@ gtk_entry_do_popup (GtkEntry *entry,
* we get them, then we actually pop up the menu.
*/
info->entry = g_object_ref (entry);
if (event)
{
info->button = event->button;
info->time = event->time;
info->device = event->device;
}
else
{
info->button = 0;
info->time = gtk_get_current_event_time ();
info->device = NULL;
}
info->button = button;
info->time = _time;
info->device = device;
gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_CLIPBOARD),
gdk_atom_intern_static_string ("TARGETS"),
@@ -8795,7 +8828,24 @@ gtk_entry_do_popup (GtkEntry *entry,
static gboolean
gtk_entry_popup_menu (GtkWidget *widget)
{
gtk_entry_do_popup (GTK_ENTRY (widget), NULL);
gtk_entry_do_popup (GTK_ENTRY (widget),
gtk_get_current_event_device (),
gtk_get_current_event_time (),
0);
return TRUE;
}
static gboolean
gtk_entry_press_and_hold (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y)
{
if (action == GTK_PRESS_AND_HOLD_TRIGGER)
gtk_entry_do_popup (GTK_ENTRY (widget),
device, GDK_CURRENT_TIME, 1);
return TRUE;
}
+27
View File
@@ -920,6 +920,33 @@ typedef enum {
GTK_BORDER_STYLE_OUTSET
} GtkBorderStyle;
typedef enum {
GTK_CAPTURED_EVENT_NONE = 0,
GTK_CAPTURED_EVENT_HANDLED = 1 << 0,
GTK_CAPTURED_EVENT_STORE = 1 << 1
} GtkCapturedEventFlags;
/**
* GtkKineticScrollingFlags:
* @GTK_KINETIC_SCROLLING_NONE: No kinetic scrolling.
* @GTK_KINETIC_SCROLLING_ENABLED: Kinetic scrolling is enabled.
* @GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS: The first button
* press is captured by the scrolled window, and then replayed
* if the button press is meant to go to the child widget. This
* flag should be enabled if the child widget(s) perform
* non-reversible actions on #GtkWidget::button-press-event.
* If the widget does not do so, and handles
* #GtkWidget::grab-broken-event, it might be better off without
* this flag.
*
* Describes the kinetic scrolling behavior of a #GtkScrolledWindow
*/
typedef enum {
GTK_KINETIC_SCROLLING_NONE = 0,
GTK_KINETIC_SCROLLING_ENABLED = 1 << 0,
GTK_KINETIC_SCROLLING_CAPTURE_BUTTON_PRESS = 1 << 1
} GtkKineticScrollingFlags;
G_END_DECLS
+50 -43
View File
@@ -68,14 +68,14 @@ struct _GtkComposeTableCompact
gint n_index_stride;
};
/* This file contains the table of the compose sequences,
/* This file contains the table of the compose sequences,
* static const guint16 gtk_compose_seqs_compact[] = {}
* IT is generated from the compose-parse.py script.
* It is generated from the compose-parse.py script.
*/
#include "gtkimcontextsimpleseqs.h"
/* From the values below, the value 23 means the number of different first keysyms
* that exist in the Compose file (from Xorg). When running compose-parse.py without
/* From the values below, the value 24 means the number of different first keysyms
* that exist in the Compose file (from Xorg). When running compose-parse.py without
* parameters, you get the count that you can put here. Needed when updating the
* gtkimcontextsimpleseqs.h header file (contains the compose sequences).
*/
@@ -253,7 +253,7 @@ check_table (GtkIMContextSimple *context_simple,
guint16 *prev_seq;
/* Back up to the first sequence that matches to make sure
* we find the exact match if their is one.
* we find the exact match if there is one.
*/
while (seq > table->data)
{
@@ -270,7 +270,6 @@ check_table (GtkIMContextSimple *context_simple,
gunichar value =
0x10000 * seq[table->max_seq_len] + seq[table->max_seq_len + 1];
/* We found a tentative match. See if there are any longer
* sequences containing this subsequence
*/
@@ -281,7 +280,7 @@ check_table (GtkIMContextSimple *context_simple,
{
priv->tentative_match = value;
priv->tentative_match_len = n_compose;
g_signal_emit_by_name (context_simple, "preedit-changed");
return TRUE;
@@ -368,26 +367,30 @@ check_win32_special_case_after_compact_match (GtkIMContextSimple *context_sim
#endif
static gboolean
check_compact_table (GtkIMContextSimple *context_simple,
const GtkComposeTableCompact *table,
gint n_compose)
check_compact_table (GtkIMContextSimple *context_simple,
const GtkComposeTableCompact *table,
gint n_compose)
{
GtkIMContextSimplePrivate *priv = context_simple->priv;
gint row_stride;
guint16 *seq_index;
guint16 *seq;
guint16 *seq;
gint i;
gboolean match;
gunichar value;
/* Will never match, if the sequence in the compose buffer is longer
* than the sequences in the table. Further, compare_seq (key, val)
* will overrun val if key is longer than val. */
* will overrun val if key is longer than val.
*/
if (n_compose > table->max_seq_len)
return FALSE;
seq_index = bsearch (priv->compose_buffer,
table->data, table->n_index_size,
sizeof (guint16) * table->n_index_stride,
compare_seq_index);
table->data,
table->n_index_size,
sizeof (guint16) * table->n_index_stride,
compare_seq_index);
if (!seq_index)
{
@@ -403,44 +406,47 @@ check_compact_table (GtkIMContextSimple *context_simple,
GTK_NOTE (MISC, g_print ("compact: %d ", *seq_index));
seq = NULL;
match = FALSE;
for (i = n_compose-1; i < table->max_seq_len; i++)
for (i = n_compose - 1; i < table->max_seq_len; i++)
{
row_stride = i + 1;
if (seq_index[i+1] - seq_index[i] > 0)
if (seq_index[i + 1] - seq_index[i] > 0)
{
seq = bsearch (priv->compose_buffer + 1,
table->data + seq_index[i], (seq_index[i+1] - seq_index[i]) / row_stride,
sizeof (guint16) * row_stride,
compare_seq);
seq = bsearch (priv->compose_buffer + 1,
table->data + seq_index[i],
(seq_index[i + 1] - seq_index[i]) / row_stride,
sizeof (guint16) * row_stride,
compare_seq);
if (seq)
if (seq)
{
if (i == n_compose - 1)
break;
{
value = seq[row_stride - 1];
match = TRUE;
}
else
{
if (match)
{
GTK_NOTE (MISC, g_print ("tentative match U+%04X ", value));
priv->tentative_match = value;
priv->tentative_match_len = n_compose;
}
g_signal_emit_by_name (context_simple, "preedit-changed");
GTK_NOTE (MISC, g_print ("yes\n"));
return TRUE;
GTK_NOTE (MISC, g_print ("yes\n"));
return TRUE;
}
}
}
}
if (!seq)
if (match)
{
GTK_NOTE (MISC, g_print ("no\n"));
return FALSE;
}
else
{
gunichar value;
value = seq[row_stride - 1];
gtk_im_context_simple_commit_char (GTK_IM_CONTEXT (context_simple), value);
#ifdef G_OS_WIN32
check_win32_special_case_after_compact_match (context_simple, n_compose, value);
@@ -480,7 +486,8 @@ check_normalize_nfc (gunichar* combination_buffer, gint n_compose)
/* Xorg reuses dead_tilde for the perispomeni diacritic mark.
* We check if base character belongs to Greek Unicode block,
* and if so, we replace tilde with perispomeni. */
* and if so, we replace tilde with perispomeni.
*/
if (combination_buffer[0] >= 0x390 && combination_buffer[0] <= 0x3FF)
{
for (i = 1; i < n_compose; i++ )
@@ -494,7 +501,7 @@ check_normalize_nfc (gunichar* combination_buffer, gint n_compose)
{
g_unicode_canonical_ordering (combination_buffer_temp, n_compose);
combination_utf8_temp = g_ucs4_to_utf8 (combination_buffer_temp, -1, NULL, NULL, NULL);
nfc_temp = g_utf8_normalize (combination_utf8_temp, -1, G_NORMALIZE_NFC);
nfc_temp = g_utf8_normalize (combination_utf8_temp, -1, G_NORMALIZE_NFC);
if (g_utf8_strlen (nfc_temp, -1) == 1)
{
@@ -589,9 +596,8 @@ check_algorithmically (GtkIMContextSimple *context_simple,
i--;
}
/* If the buffer normalizes to a single character,
* then modify the order of combination_buffer accordingly, if necessary,
* and return TRUE.
/* If the buffer normalizes to a single character, then modify the order
* of combination_buffer accordingly, if necessary, and return TRUE.
*/
if (check_normalize_nfc (combination_buffer, n_compose))
{
@@ -616,8 +622,8 @@ check_algorithmically (GtkIMContextSimple *context_simple,
/* In addition to the table-driven sequences, we allow Unicode hex
* codes to be entered. The method chosen here is similar to the
* one recommended in ISO 14755, but not exactly the same, since we
* don't want to steal 16 valuable key combinations.
*
* don't want to steal 16 valuable key combinations.
*
* A hex Unicode sequence must be started with Ctrl-Shift-U, followed
* by a sequence of hex digits entered with Ctrl-Shift still held.
* Releasing one of the modifiers or pressing space while the modifiers
@@ -668,7 +674,7 @@ check_hex (GtkIMContextSimple *context_simple,
n = strtoul (str->str, &nptr, 16);
/* if strtoul fails it probably means non-latin digits were used;
/* If strtoul fails it probably means non-latin digits were used;
* we should in principle handle that, but we probably don't.
*/
if (nptr - str->str < str->len)
@@ -837,6 +843,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
if (priv->tentative_match &&
g_unichar_validate (priv->tentative_match))
{
g_print ("committing tentative match on release\n");
gtk_im_context_simple_commit_char (context, priv->tentative_match);
priv->compose_buffer[0] = 0;
+45 -13
View File
@@ -439,6 +439,11 @@ static void gtk_label_hierarchy_changed (GtkWidget *widget,
static void gtk_label_screen_changed (GtkWidget *widget,
GdkScreen *old_screen);
static gboolean gtk_label_popup_menu (GtkWidget *widget);
static gboolean gtk_label_press_and_hold (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y);
static void gtk_label_create_window (GtkLabel *label);
static void gtk_label_destroy_window (GtkLabel *label);
@@ -492,7 +497,9 @@ static void gtk_label_move_cursor (GtkLabel *label,
static void gtk_label_copy_clipboard (GtkLabel *label);
static void gtk_label_select_all (GtkLabel *label);
static void gtk_label_do_popup (GtkLabel *label,
GdkEventButton *event);
GdkDevice *device,
guint32 _time,
guint button);
static gint gtk_label_move_forward_word (GtkLabel *label,
gint start);
static gint gtk_label_move_backward_word (GtkLabel *label,
@@ -588,6 +595,7 @@ gtk_label_class_init (GtkLabelClass *class)
widget_class->drag_data_get = gtk_label_drag_data_get;
widget_class->grab_focus = gtk_label_grab_focus;
widget_class->popup_menu = gtk_label_popup_menu;
widget_class->press_and_hold = gtk_label_press_and_hold;
widget_class->focus = gtk_label_focus;
widget_class->get_request_mode = gtk_label_get_request_mode;
widget_class->get_preferred_width = gtk_label_get_preferred_width;
@@ -4625,7 +4633,8 @@ gtk_label_button_press (GtkWidget *widget,
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
{
info->link_clicked = 1;
gtk_label_do_popup (label, event);
gtk_label_do_popup (label, event->device,
event->time, event->button);
return TRUE;
}
else if (event->button == 1)
@@ -4643,7 +4652,8 @@ gtk_label_button_press (GtkWidget *widget,
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
{
gtk_label_do_popup (label, event);
gtk_label_do_popup (label, event->device,
event->time, event->button);
return TRUE;
}
@@ -4908,6 +4918,8 @@ gtk_label_motion (GtkWidget *widget,
if ((event->state & GDK_BUTTON1_MASK) == 0)
return FALSE;
gdk_event_request_motions (event);
if (info->in_drag)
{
if (gtk_drag_check_threshold (widget,
@@ -6157,14 +6169,32 @@ copy_link_activate_cb (GtkMenuItem *menu_item,
static gboolean
gtk_label_popup_menu (GtkWidget *widget)
{
gtk_label_do_popup (GTK_LABEL (widget), NULL);
gtk_label_do_popup (GTK_LABEL (widget),
gtk_get_current_event_device (),
gtk_get_current_event_time (),
0);
return TRUE;
}
static gboolean
gtk_label_press_and_hold (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y)
{
if (action == GTK_PRESS_AND_HOLD_TRIGGER)
gtk_label_do_popup (GTK_LABEL (widget),
device, GDK_CURRENT_TIME, 1);
return TRUE;
}
static void
gtk_label_do_popup (GtkLabel *label,
GdkEventButton *event)
GdkDevice *device,
guint32 _time,
guint button)
{
GtkLabelPrivate *priv = label->priv;
GtkWidget *menuitem;
@@ -6186,7 +6216,7 @@ gtk_label_do_popup (GtkLabel *label,
have_selection =
priv->select_info->selection_anchor != priv->select_info->selection_end;
if (event)
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
{
if (priv->select_info->link_clicked)
link = priv->select_info->active_link;
@@ -6246,15 +6276,17 @@ gtk_label_do_popup (GtkLabel *label,
g_signal_emit (label, signals[POPULATE_POPUP], 0, menu);
if (event)
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
NULL, NULL,
event->button, event->time);
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
gtk_menu_popup_for_device (GTK_MENU (menu), device,
NULL, NULL, NULL, NULL, NULL,
button, _time);
else
{
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
popup_position_func, label,
0, gtk_get_current_event_time ());
gtk_menu_popup_for_device (GTK_MENU (menu),
device, NULL, NULL,
popup_position_func,
label, NULL,
0, _time);
gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
}
}
+187 -83
View File
@@ -129,6 +129,9 @@
#include "gtkwidgetprivate.h"
#include "gtkwindowprivate.h"
static gboolean gtk_propagate_captured_event (GtkWidget *widget,
GdkEvent *event,
GtkWidget *topmost);
/* Private type definitions
*/
@@ -1469,6 +1472,7 @@ gtk_main_do_event (GdkEvent *event)
{
GtkWidget *event_widget;
GtkWidget *grab_widget = NULL;
GtkWidget *topmost_widget = NULL;
GtkWindowGroup *window_group;
GdkEvent *rewritten_event = NULL;
GdkDevice *device;
@@ -1528,6 +1532,14 @@ gtk_main_do_event (GdkEvent *event)
if (!grab_widget)
grab_widget = gtk_window_group_get_current_grab (window_group);
/* Find out the topmost widget where captured event propagation
* should start, which is the widget holding the GTK+ grab
* if any, otherwise it's left NULL and events are emitted
* from the toplevel (or topmost parentless parent).
*/
if (grab_widget)
topmost_widget = grab_widget;
/* If the grab widget is an ancestor of the event widget
* then we send the event to the original event widget.
* This is the key to implementing modality.
@@ -1624,14 +1636,26 @@ gtk_main_do_event (GdkEvent *event)
case GDK_WINDOW_STATE:
case GDK_GRAB_BROKEN:
case GDK_DAMAGE:
gtk_widget_event (event_widget, event);
if (!_gtk_widget_captured_event (event_widget, event))
gtk_widget_event (event_widget, event);
break;
case GDK_SCROLL:
case GDK_BUTTON_PRESS:
case GDK_2BUTTON_PRESS:
case GDK_3BUTTON_PRESS:
gtk_propagate_event (grab_widget, event);
if ((event->type == GDK_BUTTON_PRESS) &&
event->button.button == 1)
{
/* Handle press and hold on the grab widget before propagating up,
* so a parent capturing events doesn't delay nor prevent a child
* from doing the press-and-hold action.
*/
_gtk_widget_press_and_hold_check_start (grab_widget, &event->button);
}
if (!gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_propagate_event (grab_widget, event);
break;
case GDK_KEY_PRESS:
@@ -1683,22 +1707,36 @@ gtk_main_do_event (GdkEvent *event)
case GDK_BUTTON_RELEASE:
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
gtk_propagate_event (grab_widget, event);
if ((event->type == GDK_BUTTON_RELEASE) &&
event->button.button == 1)
_gtk_widget_press_and_hold_check_cancel (grab_widget, &event->button);
else if (event->type == GDK_MOTION_NOTIFY)
_gtk_widget_press_and_hold_check_threshold (grab_widget,
&event->motion);
if (!gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_propagate_event (grab_widget, event);
break;
case GDK_ENTER_NOTIFY:
_gtk_widget_set_device_window (event_widget,
gdk_event_get_device (event),
event->any.window);
if (gtk_widget_is_sensitive (grab_widget))
if (event->crossing.detail != GDK_NOTIFY_VIRTUAL &&
event->crossing.detail != GDK_NOTIFY_NONLINEAR_VIRTUAL)
_gtk_widget_set_device_window (event_widget,
gdk_event_get_device (event),
event->any.window);
if (gtk_widget_is_sensitive (grab_widget) &&
!gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_widget_event (grab_widget, event);
break;
case GDK_LEAVE_NOTIFY:
_gtk_widget_set_device_window (event_widget,
gdk_event_get_device (event),
NULL);
if (gtk_widget_is_sensitive (grab_widget))
if (event->crossing.detail != GDK_NOTIFY_VIRTUAL &&
event->crossing.detail != GDK_NOTIFY_NONLINEAR_VIRTUAL)
_gtk_widget_set_device_window (event_widget,
gdk_event_get_device (event),
NULL);
if (gtk_widget_is_sensitive (grab_widget) &&
!gtk_propagate_captured_event (grab_widget, event, topmost_widget))
gtk_widget_event (grab_widget, event);
break;
@@ -2320,6 +2358,135 @@ gtk_get_event_widget (GdkEvent *event)
return widget;
}
static gboolean
propagate_event_up (GtkWidget *widget,
GdkEvent *event,
GtkWidget *topmost)
{
gboolean handled_event = FALSE;
/* Propagate event up the widget tree so that
* parents can see the button and motion
* events of the children.
*/
while (TRUE)
{
GtkWidget *tmp;
g_object_ref (widget);
/* Scroll events are special cased here because it
* feels wrong when scrolling a GtkViewport, say,
* to have children of the viewport eat the scroll
* event
*/
if (!gtk_widget_is_sensitive (widget))
handled_event = event->type != GDK_SCROLL;
else
handled_event = gtk_widget_event (widget, event);
tmp = gtk_widget_get_parent (widget);
g_object_unref (widget);
if (widget == topmost)
break;
widget = tmp;
if (handled_event || !widget)
break;
}
return handled_event;
}
static gboolean
propagate_event_down (GtkWidget *widget,
GdkEvent *event,
GtkWidget *topmost)
{
gint handled_event = FALSE;
GList *widgets = NULL;
GList *l;
widgets = g_list_prepend (widgets, g_object_ref (widget));
while (widget && widget != topmost)
{
widget = gtk_widget_get_parent (widget);
if (!widget)
break;
widgets = g_list_prepend (widgets, g_object_ref (widget));
if (widget == topmost)
break;
}
for (l = widgets; l && !handled_event; l = g_list_next (l))
{
widget = (GtkWidget *)l->data;
if (!gtk_widget_is_sensitive (widget))
handled_event = TRUE;
else
handled_event = _gtk_widget_captured_event (widget, event);
}
g_list_free_full (widgets, (GDestroyNotify)g_object_unref);
return handled_event;
}
static gboolean
propagate_event (GtkWidget *widget,
GdkEvent *event,
gboolean captured,
GtkWidget *topmost)
{
gboolean handled_event = FALSE;
gboolean (* propagate_func) (GtkWidget *widget, GdkEvent *event);
propagate_func = captured ? _gtk_widget_captured_event : gtk_widget_event;
if (event->type == GDK_KEY_PRESS || event->type == GDK_KEY_RELEASE)
{
/* Only send key events within Window widgets to the Window
* The Window widget will in turn pass the
* key event on to the currently focused widget
* for that window.
*/
GtkWidget *window;
window = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (window))
{
g_object_ref (widget);
/* If there is a grab within the window, give the grab widget
* a first crack at the key event
*/
if (widget != window && gtk_widget_has_grab (widget))
handled_event = propagate_func (widget, event);
if (!handled_event)
{
window = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (window))
{
if (gtk_widget_is_sensitive (window))
handled_event = propagate_func (window, event);
}
}
g_object_unref (widget);
return handled_event;
}
}
/* Other events get propagated up/down the widget tree */
return captured ?
propagate_event_down (widget, event, topmost) :
propagate_event_up (widget, event, topmost);
}
/**
* gtk_propagate_event:
* @widget: a #GtkWidget
@@ -2348,79 +2515,16 @@ void
gtk_propagate_event (GtkWidget *widget,
GdkEvent *event)
{
gint handled_event;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (event != NULL);
handled_event = FALSE;
g_object_ref (widget);
if ((event->type == GDK_KEY_PRESS) ||
(event->type == GDK_KEY_RELEASE))
{
/* Only send key events within Window widgets to the Window
* The Window widget will in turn pass the
* key event on to the currently focused widget
* for that window.
*/
GtkWidget *window;
window = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (window))
{
/* If there is a grab within the window, give the grab widget
* a first crack at the key event
*/
if (widget != window && gtk_widget_has_grab (widget))
handled_event = gtk_widget_event (widget, event);
if (!handled_event)
{
window = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (window))
{
if (gtk_widget_is_sensitive (window))
gtk_widget_event (window, event);
}
}
handled_event = TRUE; /* don't send to widget */
}
}
/* Other events get propagated up the widget tree
* so that parents can see the button and motion
* events of the children.
*/
if (!handled_event)
{
while (TRUE)
{
GtkWidget *tmp;
/* Scroll events are special cased here because it
* feels wrong when scrolling a GtkViewport, say,
* to have children of the viewport eat the scroll
* event
*/
if (!gtk_widget_is_sensitive (widget))
handled_event = event->type != GDK_SCROLL;
else
handled_event = gtk_widget_event (widget, event);
tmp = gtk_widget_get_parent (widget);
g_object_unref (widget);
widget = tmp;
if (!handled_event && widget)
g_object_ref (widget);
else
break;
}
}
else
g_object_unref (widget);
propagate_event (widget, event, FALSE, NULL);
}
static gboolean
gtk_propagate_captured_event (GtkWidget *widget,
GdkEvent *event,
GtkWidget *topmost)
{
return propagate_event (widget, event, TRUE, topmost);
}
+2
View File
@@ -36,6 +36,7 @@ BOOLEAN:OBJECT,BOXED,BOXED
BOOLEAN:OBJECT,OBJECT,OBJECT
BOOLEAN:OBJECT,STRING,STRING
BOOLEAN:OBJECT,ENUM
BOOLEAN:OBJECT,ENUM,INT,INT
BOOLEAN:INT
BOOLEAN:INT,INT
BOOLEAN:INT,INT,INT
@@ -47,6 +48,7 @@ BOOLEAN:BOOLEAN,BOOLEAN,BOOLEAN
BOOLEAN:STRING
ENUM:ENUM
ENUM:VOID
FLAGS:BOXED
INT:POINTER
OBJECT:VOID
STRING:DOUBLE
+238 -340
View File
@@ -110,6 +110,7 @@
#include "gtksettings.h"
#include "gtkprivate.h"
#include "gtkwidgetprivate.h"
#include "gtkdnd.h"
#include "gtkintl.h"
#include "gtktypebuiltins.h"
@@ -140,46 +141,6 @@ struct _GtkMenuAttachData
GtkMenuDetachFunc detacher;
};
struct _OldGtkMenuPrivate
{
gint x;
gint y;
gboolean initially_pushed_in;
GDestroyNotify position_func_data_destroy;
/* info used for the table */
guint *heights;
gint heights_length;
gint requested_height;
gint monitor_num;
/* Cached layout information */
gint n_rows;
gint n_columns;
guint accel_size;
gchar *title;
/* Arrow states */
GtkStateFlags lower_arrow_state;
GtkStateFlags upper_arrow_state;
/* navigation region */
int navigation_x;
int navigation_y;
int navigation_width;
int navigation_height;
guint have_layout : 1;
guint seen_item_enter : 1;
guint have_position : 1;
guint ignore_button_release : 1;
guint no_toggle_size : 1;
};
struct _GtkMenuPopdownData
{
GtkMenu *menu;
@@ -267,12 +228,14 @@ static void gtk_menu_scroll_to (GtkMenu *menu,
gint offset);
static void gtk_menu_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static GtkCapturedEventFlags
gtk_menu_captured_event (GtkWidget *widget,
GdkEvent *event);
static void gtk_menu_stop_scrolling (GtkMenu *menu);
static void gtk_menu_remove_scroll_timeout (GtkMenu *menu);
static gboolean gtk_menu_scroll_timeout (gpointer data);
static gboolean gtk_menu_scroll_timeout_initial (gpointer data);
static void gtk_menu_start_scrolling (GtkMenu *menu);
static void gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
@@ -550,6 +513,7 @@ gtk_menu_class_init (GtkMenuClass *class)
widget_class->get_preferred_width = gtk_menu_get_preferred_width;
widget_class->get_preferred_height = gtk_menu_get_preferred_height;
widget_class->get_preferred_height_for_width = gtk_menu_get_preferred_height_for_width;
widget_class->captured_event = gtk_menu_captured_event;
container_class->remove = gtk_menu_remove;
container_class->get_child_property = gtk_menu_get_child_property;
@@ -1097,6 +1061,7 @@ gtk_menu_init (GtkMenu *menu)
priv->needs_destruction_ref = TRUE;
priv->monitor_num = -1;
priv->drag_start_y = -1;
context = gtk_widget_get_style_context (GTK_WIDGET (menu));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_MENU);
@@ -1502,7 +1467,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
GtkMenuShell *menu_shell;
gboolean grab_keyboard;
GtkWidget *parent_toplevel;
GdkDevice *keyboard, *pointer;
GdkDevice *keyboard, *pointer, *source_device = NULL;
g_return_if_fail (GTK_IS_MENU (menu));
g_return_if_fail (device == NULL || GDK_IS_DEVICE (device));
@@ -1639,6 +1604,7 @@ gtk_menu_popup_for_device (GtkMenu *menu,
(current_event->type != GDK_ENTER_NOTIFY))
menu_shell->priv->ignore_enter = TRUE;
source_device = gdk_event_get_source_device (current_event);
gdk_event_free (current_event);
}
else
@@ -1708,17 +1674,9 @@ gtk_menu_popup_for_device (GtkMenu *menu,
gtk_menu_scroll_to (menu, priv->scroll_offset);
/* if no item is selected, select the first one */
if (!menu_shell->priv->active_menu_item)
{
gboolean touchscreen_mode;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
if (touchscreen_mode)
gtk_menu_shell_select_first (menu_shell, TRUE);
}
if (!menu_shell->priv->active_menu_item &&
source_device && gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
gtk_menu_shell_select_first (menu_shell, TRUE);
/* Once everything is set up correctly, map the toplevel */
gtk_widget_show (priv->toplevel);
@@ -3353,34 +3311,6 @@ gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
g_free (nat_heights);
}
static gboolean
gtk_menu_button_scroll (GtkMenu *menu,
GdkEventButton *event)
{
GtkMenuPrivate *priv = menu->priv;
if (priv->upper_arrow_prelight || priv->lower_arrow_prelight)
{
gboolean touchscreen_mode;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
if (touchscreen_mode)
gtk_menu_handle_scrolling (menu,
event->x_root, event->y_root,
event->type == GDK_BUTTON_PRESS,
FALSE);
return TRUE;
}
return FALSE;
}
static gboolean
pointer_in_menu_window (GtkWidget *widget,
gdouble x_root,
@@ -3417,13 +3347,16 @@ static gboolean
gtk_menu_button_press (GtkWidget *widget,
GdkEventButton *event)
{
GdkDevice *source_device;
GtkWidget *event_widget;
GtkMenu *menu;
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
/* Don't pass down to menu shell for presses over scroll arrows
*/
if (gtk_menu_button_scroll (GTK_MENU (widget), event))
return TRUE;
source_device = gdk_event_get_source_device ((GdkEvent *) event);
event_widget = gtk_get_event_widget ((GdkEvent *) event);
menu = GTK_MENU (widget);
/* Don't pass down to menu shell if a non-menuitem part of the menu
* was clicked. The check for the event_widget being a GtkMenuShell
@@ -3432,10 +3365,16 @@ gtk_menu_button_press (GtkWidget *widget,
* the menu or on its border are delivered relative to
* menu_shell->window.
*/
if (GTK_IS_MENU_SHELL (gtk_get_event_widget ((GdkEvent *) event)) &&
if (GTK_IS_MENU_SHELL (event_widget) &&
pointer_in_menu_window (widget, event->x_root, event->y_root))
return TRUE;
if (GTK_IS_MENU_ITEM (event_widget) &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH &&
GTK_MENU_ITEM (event_widget)->priv->submenu != NULL &&
!gtk_widget_is_drawable (GTK_MENU_ITEM (event_widget)->priv->submenu))
menu->priv->ignore_button_release = TRUE;
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->button_press_event (widget, event);
}
@@ -3454,11 +3393,6 @@ gtk_menu_button_release (GtkWidget *widget,
if (event->type != GDK_BUTTON_RELEASE)
return FALSE;
/* Don't pass down to menu shell for releases over scroll arrows
*/
if (gtk_menu_button_scroll (GTK_MENU (widget), event))
return TRUE;
/* Don't pass down to menu shell if a non-menuitem part of the menu
* was clicked (see comment in button_press()).
*/
@@ -3702,10 +3636,14 @@ gtk_menu_motion_notify (GtkWidget *widget,
GtkMenu *menu;
GtkMenuShell *menu_shell;
GtkWidget *parent;
GdkDevice *source_device;
gboolean need_enter;
if (GTK_IS_MENU (widget))
source_device = gdk_event_get_source_device ((GdkEvent *) event);
if (GTK_IS_MENU (widget) &&
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
{
GtkMenuPrivate *priv = GTK_MENU(widget)->priv;
@@ -3869,90 +3807,17 @@ gtk_menu_scroll_by (GtkMenu *menu,
gtk_menu_scroll_to (menu, offset);
}
static void
gtk_menu_do_timeout_scroll (GtkMenu *menu,
gboolean touchscreen_mode)
{
GtkMenuPrivate *priv = menu->priv;
gboolean upper_visible;
gboolean lower_visible;
upper_visible = priv->upper_arrow_visible;
lower_visible = priv->lower_arrow_visible;
gtk_menu_scroll_by (menu, priv->scroll_step);
if (touchscreen_mode &&
(upper_visible != priv->upper_arrow_visible ||
lower_visible != priv->lower_arrow_visible))
{
/* We are about to hide a scroll arrow while the mouse is pressed,
* this would cause the uncovered menu item to be activated on button
* release. Therefore we need to ignore button release here
*/
GTK_MENU_SHELL (menu)->priv->ignore_enter = TRUE;
priv->ignore_button_release = TRUE;
}
}
static gboolean
gtk_menu_scroll_timeout (gpointer data)
{
GtkMenu *menu;
gboolean touchscreen_mode;
menu = GTK_MENU (data);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
gtk_menu_scroll_by (menu, menu->priv->scroll_step);
return TRUE;
}
static gboolean
gtk_menu_scroll_timeout_initial (gpointer data)
{
GtkMenu *menu;
guint timeout;
gboolean touchscreen_mode;
menu = GTK_MENU (data);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-timeout-repeat", &timeout,
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
gtk_menu_remove_scroll_timeout (menu);
menu->priv->scroll_timeout =
gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout, menu);
return FALSE;
}
static void
gtk_menu_start_scrolling (GtkMenu *menu)
{
guint timeout;
gboolean touchscreen_mode;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-timeout-repeat", &timeout,
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
menu->priv->scroll_timeout =
gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout_initial, menu);
}
static gboolean
gtk_menu_scroll (GtkWidget *widget,
GdkEventScroll *event)
@@ -4076,14 +3941,9 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
gboolean in_arrow;
gboolean scroll_fast = FALSE;
gint top_x, top_y;
gboolean touchscreen_mode;
menu_shell = GTK_MENU_SHELL (menu);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
gdk_window_get_position (gtk_widget_get_window (priv->toplevel),
&top_x, &top_y);
x -= top_x;
@@ -4101,82 +3961,44 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
in_arrow = TRUE;
}
if (touchscreen_mode)
priv->upper_arrow_prelight = in_arrow;
if ((priv->upper_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
{
gboolean arrow_pressed = FALSE;
if (priv->upper_arrow_visible && !priv->tearoff_active)
{
if (touchscreen_mode)
scroll_fast = (y < rect.y + MENU_SCROLL_FAST_ZONE);
if (enter && in_arrow &&
(!priv->upper_arrow_prelight ||
priv->scroll_fast != scroll_fast))
{
if (enter && priv->upper_arrow_prelight)
{
if (priv->scroll_timeout == 0)
{
/* Deselect the active item so that
* any submenus are popped down
*/
gtk_menu_shell_deselect (menu_shell);
priv->upper_arrow_prelight = TRUE;
priv->scroll_fast = scroll_fast;
gtk_menu_remove_scroll_timeout (menu);
priv->scroll_step = -MENU_SCROLL_STEP2; /* always fast */
/* Deselect the active item so that
* any submenus are popped down
*/
gtk_menu_shell_deselect (menu_shell);
if (!motion)
{
/* Only do stuff on click. */
gtk_menu_start_scrolling (menu);
arrow_pressed = TRUE;
}
}
else
{
arrow_pressed = TRUE;
}
}
else if (!enter)
{
gtk_menu_stop_scrolling (menu);
}
gtk_menu_remove_scroll_timeout (menu);
priv->scroll_step = scroll_fast
? -MENU_SCROLL_STEP2
: -MENU_SCROLL_STEP1;
priv->scroll_timeout =
gdk_threads_add_timeout (scroll_fast
? MENU_SCROLL_TIMEOUT2
: MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
else /* !touchscreen_mode */
else if (!enter && !in_arrow && priv->upper_arrow_prelight)
{
scroll_fast = (y < rect.y + MENU_SCROLL_FAST_ZONE);
if (enter && in_arrow &&
(!priv->upper_arrow_prelight ||
priv->scroll_fast != scroll_fast))
{
priv->upper_arrow_prelight = TRUE;
priv->scroll_fast = scroll_fast;
/* Deselect the active item so that
* any submenus are popped down
*/
gtk_menu_shell_deselect (menu_shell);
gtk_menu_remove_scroll_timeout (menu);
priv->scroll_step = scroll_fast
? -MENU_SCROLL_STEP2
: -MENU_SCROLL_STEP1;
priv->scroll_timeout =
gdk_threads_add_timeout (scroll_fast
? MENU_SCROLL_TIMEOUT2
: MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
else if (!enter && !in_arrow && priv->upper_arrow_prelight)
{
gtk_menu_stop_scrolling (menu);
}
gtk_menu_stop_scrolling (menu);
}
}
/* gtk_menu_start_scrolling() might have hit the top of the
* menu, so check if the button isn't insensitive before
/* check if the button isn't insensitive before
* changing it to something else.
*/
if ((priv->upper_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
@@ -4211,82 +4033,44 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
in_arrow = TRUE;
}
if (touchscreen_mode)
priv->lower_arrow_prelight = in_arrow;
if ((priv->lower_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
{
gboolean arrow_pressed = FALSE;
if (priv->lower_arrow_visible && !priv->tearoff_active)
{
if (touchscreen_mode)
scroll_fast = (y > rect.y + rect.height - MENU_SCROLL_FAST_ZONE);
if (enter && in_arrow &&
(!priv->lower_arrow_prelight ||
priv->scroll_fast != scroll_fast))
{
if (enter && priv->lower_arrow_prelight)
{
if (priv->scroll_timeout == 0)
{
/* Deselect the active item so that
* any submenus are popped down
*/
gtk_menu_shell_deselect (menu_shell);
priv->lower_arrow_prelight = TRUE;
priv->scroll_fast = scroll_fast;
gtk_menu_remove_scroll_timeout (menu);
priv->scroll_step = MENU_SCROLL_STEP2; /* always fast */
/* Deselect the active item so that
* any submenus are popped down
*/
gtk_menu_shell_deselect (menu_shell);
if (!motion)
{
/* Only do stuff on click. */
gtk_menu_start_scrolling (menu);
arrow_pressed = TRUE;
}
}
else
{
arrow_pressed = TRUE;
}
}
else if (!enter)
{
gtk_menu_stop_scrolling (menu);
}
gtk_menu_remove_scroll_timeout (menu);
priv->scroll_step = scroll_fast
? MENU_SCROLL_STEP2
: MENU_SCROLL_STEP1;
priv->scroll_timeout =
gdk_threads_add_timeout (scroll_fast
? MENU_SCROLL_TIMEOUT2
: MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
else /* !touchscreen_mode */
else if (!enter && !in_arrow && priv->lower_arrow_prelight)
{
scroll_fast = (y > rect.y + rect.height - MENU_SCROLL_FAST_ZONE);
if (enter && in_arrow &&
(!priv->lower_arrow_prelight ||
priv->scroll_fast != scroll_fast))
{
priv->lower_arrow_prelight = TRUE;
priv->scroll_fast = scroll_fast;
/* Deselect the active item so that
* any submenus are popped down
*/
gtk_menu_shell_deselect (menu_shell);
gtk_menu_remove_scroll_timeout (menu);
priv->scroll_step = scroll_fast
? MENU_SCROLL_STEP2
: MENU_SCROLL_STEP1;
priv->scroll_timeout =
gdk_threads_add_timeout (scroll_fast
? MENU_SCROLL_TIMEOUT2
: MENU_SCROLL_TIMEOUT1,
gtk_menu_scroll_timeout, menu);
}
else if (!enter && !in_arrow && priv->lower_arrow_prelight)
{
gtk_menu_stop_scrolling (menu);
}
gtk_menu_stop_scrolling (menu);
}
}
/* gtk_menu_start_scrolling() might have hit the bottom of the
* menu, so check if the button isn't insensitive before
/* check if the button isn't insensitive before
* changing it to something else.
*/
if ((priv->lower_arrow_state & GTK_STATE_FLAG_INSENSITIVE) == 0)
@@ -4316,19 +4100,18 @@ gtk_menu_enter_notify (GtkWidget *widget,
{
GtkWidget *menu_item;
GtkWidget *parent;
gboolean touchscreen_mode;
GdkDevice *source_device;
if (event->mode == GDK_CROSSING_GTK_GRAB ||
event->mode == GDK_CROSSING_GTK_UNGRAB ||
event->mode == GDK_CROSSING_STATE_CHANGED)
return TRUE;
g_object_get (gtk_widget_get_settings (widget),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
menu_item = gtk_get_event_widget ((GdkEvent*) event);
if (GTK_IS_MENU (widget))
if (GTK_IS_MENU (widget) &&
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
@@ -4337,7 +4120,8 @@ gtk_menu_enter_notify (GtkWidget *widget,
event->x_root, event->y_root, TRUE, TRUE);
}
if (!touchscreen_mode && GTK_IS_MENU_ITEM (menu_item))
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH &&
GTK_IS_MENU_ITEM (menu_item))
{
GtkWidget *menu = gtk_widget_get_parent (menu_item);
@@ -4394,6 +4178,7 @@ gtk_menu_leave_notify (GtkWidget *widget,
GtkMenu *menu;
GtkMenuItem *menu_item;
GtkWidget *event_widget;
GdkDevice *source_device;
if (event->mode == GDK_CROSSING_GTK_GRAB ||
event->mode == GDK_CROSSING_GTK_UNGRAB ||
@@ -4406,7 +4191,10 @@ gtk_menu_leave_notify (GtkWidget *widget,
if (gtk_menu_navigating_submenu (menu, event->x_root, event->y_root))
return TRUE;
gtk_menu_handle_scrolling (menu, event->x_root, event->y_root, FALSE, TRUE);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH)
gtk_menu_handle_scrolling (menu, event->x_root, event->y_root, FALSE, TRUE);
event_widget = gtk_get_event_widget ((GdkEvent*) event);
@@ -4441,6 +4229,138 @@ gtk_menu_leave_notify (GtkWidget *widget,
return GTK_WIDGET_CLASS (gtk_menu_parent_class)->leave_notify_event (widget, event);
}
static gboolean
pointer_on_menu_widget (GtkMenu *menu,
gdouble x_root,
gdouble y_root)
{
GtkMenuPrivate *priv = menu->priv;
GtkAllocation allocation;
gint window_x, window_y;
gtk_widget_get_allocation (GTK_WIDGET (menu), &allocation);
gdk_window_get_position (gtk_widget_get_window (priv->toplevel),
&window_x, &window_y);
if (x_root >= window_x && x_root < window_x + allocation.width &&
y_root >= window_y && y_root < window_y + allocation.height)
return TRUE;
return FALSE;
}
static GtkCapturedEventFlags
gtk_menu_captured_event (GtkWidget *widget,
GdkEvent *event)
{
GdkDevice *source_device;
GtkCapturedEventFlags flags;
GtkMenuPrivate *priv;
GtkMenu *menu;
menu = GTK_MENU (widget);
priv = menu->priv;
flags = GTK_CAPTURED_EVENT_NONE;
if (!priv->upper_arrow_visible && !priv->lower_arrow_visible)
return flags;
source_device = gdk_event_get_source_device (event);
switch (event->type)
{
case GDK_BUTTON_PRESS:
if (event->button.button == 1 &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH &&
pointer_on_menu_widget (menu, event->button.x_root, event->button.y_root))
{
priv->drag_start_y = event->button.y_root;
priv->initial_drag_offset = priv->scroll_offset;
priv->drag_scroll_started = FALSE;
}
else
priv->drag_start_y = -1;
priv->drag_already_pressed = TRUE;
break;
case GDK_BUTTON_RELEASE:
if (priv->drag_scroll_started)
{
flags = GTK_CAPTURED_EVENT_HANDLED;
priv->drag_scroll_started = FALSE;
priv->drag_start_y = -1;
priv->drag_already_pressed = FALSE;
}
break;
case GDK_MOTION_NOTIFY:
if (event->motion.state & GDK_BUTTON1_MASK &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
{
if (!priv->drag_already_pressed)
{
if (pointer_on_menu_widget (menu,
event->motion.x_root,
event->motion.y_root))
{
priv->drag_start_y = event->motion.y_root;
priv->initial_drag_offset = priv->scroll_offset;
priv->drag_scroll_started = FALSE;
}
else
priv->drag_start_y = -1;
priv->drag_already_pressed = TRUE;
}
if (priv->drag_start_y < 0 &&
!priv->drag_scroll_started)
break;
if (priv->drag_scroll_started)
{
gint offset, view_height;
GtkBorder arrow_border;
gdouble y_diff;
y_diff = event->motion.y_root - priv->drag_start_y;
offset = priv->initial_drag_offset - y_diff;
view_height = gdk_window_get_height (gtk_widget_get_window (widget));
get_arrows_border (menu, &arrow_border);
if (priv->upper_arrow_visible)
view_height -= arrow_border.top;
if (priv->lower_arrow_visible)
view_height -= arrow_border.bottom;
offset = CLAMP (offset, 0, priv->requested_height - view_height);
gtk_menu_scroll_to (menu, offset);
flags = GTK_CAPTURED_EVENT_HANDLED;
}
else if (gtk_drag_check_threshold (widget,
0, priv->drag_start_y,
0, event->motion.y_root))
{
priv->drag_scroll_started = TRUE;
flags = GTK_CAPTURED_EVENT_HANDLED;
gtk_menu_shell_deselect (GTK_MENU_SHELL (menu));
}
}
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
if (priv->drag_scroll_started)
flags = GTK_CAPTURED_EVENT_HANDLED;
break;
default:
break;
}
return flags;
}
static void
gtk_menu_stop_navigating_submenu (GtkMenu *menu)
{
@@ -4653,7 +4573,6 @@ gtk_menu_position (GtkMenu *menu,
GtkRequisition requisition;
gint x, y;
gint scroll_offset;
gint menu_height;
GdkScreen *screen;
GdkScreen *pointer_screen;
GdkRectangle monitor;
@@ -4826,12 +4745,10 @@ gtk_menu_position (GtkMenu *menu,
if (priv->initially_pushed_in)
{
menu_height = requisition.height;
if (y + menu_height > monitor.y + monitor.height)
if (y + requisition.height > monitor.y + monitor.height)
{
scroll_offset -= y + menu_height - (monitor.y + monitor.height);
y = (monitor.y + monitor.height) - menu_height;
scroll_offset -= y + requisition.height - (monitor.y + monitor.height);
y = (monitor.y + monitor.height) - requisition.height;
}
if (y < monitor.y)
@@ -4839,10 +4756,9 @@ gtk_menu_position (GtkMenu *menu,
scroll_offset += monitor.y - y;
y = monitor.y;
}
}
/* FIXME: should this be done in the various position_funcs ? */
x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width));
x = CLAMP (x, monitor.x, MAX (monitor.x, monitor.x + monitor.width - requisition.width));
}
if (GTK_MENU_SHELL (menu)->priv->active)
{
@@ -4851,17 +4767,7 @@ gtk_menu_position (GtkMenu *menu,
priv->position_y = y;
}
if (y + requisition.height > monitor.y + monitor.height)
requisition.height = (monitor.y + monitor.height) - y;
if (y < monitor.y)
{
scroll_offset += monitor.y - y;
requisition.height -= monitor.y - y;
y = monitor.y;
}
if (scroll_offset > 0)
if (scroll_offset != 0)
{
GtkBorder arrow_border;
@@ -4898,19 +4804,10 @@ static void
gtk_menu_stop_scrolling (GtkMenu *menu)
{
GtkMenuPrivate *priv = menu->priv;
gboolean touchscreen_mode;
gtk_menu_remove_scroll_timeout (menu);
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
if (!touchscreen_mode)
{
priv->upper_arrow_prelight = FALSE;
priv->lower_arrow_prelight = FALSE;
}
priv->upper_arrow_prelight = FALSE;
priv->lower_arrow_prelight = FALSE;
}
static void
@@ -4918,7 +4815,6 @@ gtk_menu_scroll_to (GtkMenu *menu,
gint offset)
{
GtkMenuPrivate *priv = menu->priv;
GtkAllocation allocation;
GtkBorder arrow_border, padding;
GtkWidget *widget;
gint x, y;
@@ -4935,9 +4831,8 @@ gtk_menu_scroll_to (GtkMenu *menu,
gtk_adjustment_set_value (priv->tearoff_adjustment, offset);
/* Move/resize the viewport according to arrows: */
gtk_widget_get_allocation (widget, &allocation);
view_width = allocation.width;
view_height = allocation.height;
view_width = gtk_widget_get_allocated_width (widget);
view_height = gtk_widget_get_allocated_height (widget);
gtk_widget_style_get (GTK_WIDGET (menu),
"vertical-padding", &vertical_padding,
@@ -5718,7 +5613,6 @@ gtk_menu_real_move_scroll (GtkMenu *menu,
}
}
/**
* gtk_menu_set_monitor:
* @menu: a #GtkMenu
@@ -5795,11 +5689,13 @@ static void
gtk_menu_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
GtkMenu *menu;
GtkWidget *toplevel;
GtkWindowGroup *group;
GtkWidget *grab;
GdkDevice *pointer;
menu = GTK_MENU (widget);
pointer = _gtk_menu_shell_get_grab_device (GTK_MENU_SHELL (widget));
if (!pointer ||
@@ -5816,6 +5712,8 @@ gtk_menu_grab_notify (GtkWidget *widget,
if (GTK_MENU_SHELL (widget)->priv->active && !GTK_IS_MENU_SHELL (grab))
gtk_menu_shell_cancel (GTK_MENU_SHELL (widget));
menu->priv->drag_scroll_started = FALSE;
}
/**
+12 -5
View File
@@ -1690,13 +1690,20 @@ static void
gtk_real_menu_item_select (GtkMenuItem *menu_item)
{
GtkMenuItemPrivate *priv = menu_item->priv;
gboolean touchscreen_mode;
GdkDevice *source_device = NULL;
GdkEvent *current_event;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_item)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
current_event = gtk_get_current_event ();
if (!touchscreen_mode && priv->submenu &&
if (current_event)
{
source_device = gdk_event_get_source_device (current_event);
gdk_event_free (current_event);
}
if ((!source_device ||
gdk_device_get_source (source_device) != GDK_SOURCE_TOUCH) &&
priv->submenu &&
(!gtk_widget_get_mapped (priv->submenu) ||
GTK_MENU (priv->submenu)->priv->tearoff_active))
{
+5
View File
@@ -100,6 +100,8 @@ struct _GtkMenuPrivate
guint seen_item_enter : 1;
guint ignore_button_release : 1;
guint no_toggle_size : 1;
guint drag_already_pressed : 1;
guint drag_scroll_started : 1;
/* info used for the table */
guint *heights;
@@ -126,6 +128,9 @@ struct _GtkMenuPrivate
gint navigation_height;
guint navigation_timeout;
gdouble drag_start_y;
gint initial_drag_offset;
};
G_END_DECLS
+4 -32
View File
@@ -1084,13 +1084,11 @@ gtk_menu_shell_enter_notify (GtkWidget *widget,
if (!gtk_widget_get_visible (GTK_MENU_ITEM (menu_item)->priv->submenu))
{
gboolean touchscreen_mode;
GdkDevice *source_device;
g_object_get (gtk_widget_get_settings (widget),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
if (touchscreen_mode)
if (gdk_device_get_source (source_device) == GDK_SOURCE_TOUCH)
_gtk_menu_item_popup_submenu (menu_item, TRUE);
}
}
@@ -1612,45 +1610,19 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
GtkMenuShellPrivate *priv = menu_shell->priv;
GtkMenuShell *parent_menu_shell = NULL;
gboolean had_selection;
gboolean touchscreen_mode;
priv->in_unselectable_item = FALSE;
had_selection = priv->active_menu_item != NULL;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu_shell)),
"gtk-touchscreen-mode", &touchscreen_mode,
NULL);
if (priv->parent_menu_shell)
parent_menu_shell = GTK_MENU_SHELL (priv->parent_menu_shell);
switch (direction)
{
case GTK_MENU_DIR_PARENT:
if (touchscreen_mode &&
priv->active_menu_item &&
GTK_MENU_ITEM (priv->active_menu_item)->priv->submenu &&
gtk_widget_get_visible (GTK_MENU_ITEM (priv->active_menu_item)->priv->submenu))
if (parent_menu_shell)
{
/* if we are on a menu item that has an open submenu but the
* focus is not in that submenu (e.g. because it's empty or
* has only insensitive items), close that submenu instead of
* running into the code below which would close *this* menu.
*/
_gtk_menu_item_popdown_submenu (priv->active_menu_item);
_gtk_menu_shell_update_mnemonics (menu_shell);
}
else if (parent_menu_shell)
{
if (touchscreen_mode)
{
/* close menu when returning from submenu. */
_gtk_menu_item_popdown_submenu (GTK_MENU (menu_shell)->priv->parent_menu_item);
_gtk_menu_shell_update_mnemonics (parent_menu_shell);
break;
}
if (GTK_MENU_SHELL_GET_CLASS (parent_menu_shell)->submenu_placement ==
GTK_MENU_SHELL_GET_CLASS (menu_shell)->submenu_placement)
gtk_menu_shell_deselect (menu_shell);
+1 -1
View File
@@ -79,7 +79,7 @@ gtk_model_menu_binding_append_item (GtkModelMenuBinding *binding,
if ((section = g_menu_model_get_item_link (model, item_index, "section")))
{
g_menu_model_get_item_attribute (model, item_index, "label", "s", &heading);
g_menu_model_get_item_attribute (model, item_index, "label", "s", heading);
gtk_model_menu_binding_append_model (binding, section, FALSE);
}
else
+5 -4
View File
@@ -238,14 +238,15 @@ gtk_model_menu_item_setup (GtkModelMenuItem *item,
g_action_observable_register_observer (actions, item->action_name, G_ACTION_OBSERVER (item));
if (g_action_group_query_action (G_ACTION_GROUP (actions), item->action_name, &enabled, &type, NULL, NULL, &state))
gtk_model_menu_item_action_added (G_ACTION_OBSERVER (item), actions, item->action_name, type, enabled, state);
{
gtk_model_menu_item_action_added (G_ACTION_OBSERVER (item), actions, item->action_name, type, enabled, state);
if (state != NULL)
g_variant_unref (state);
}
else
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
if (state != NULL)
g_variant_unref (state);
path = _gtk_accel_path_for_action (item->action_name, item->target);
gtk_menu_item_set_accel_path (GTK_MENU_ITEM (item), path);
g_free (path);
+1 -2
View File
@@ -21,10 +21,9 @@
#include "gtkmodifierstyle.h"
#include "gtkintl.h"
typedef struct GtkModifierStylePrivate GtkModifierStylePrivate;
typedef struct StylePropertyValue StylePropertyValue;
struct GtkModifierStylePrivate
struct _GtkModifierStylePrivate
{
GtkStyleProperties *style;
GHashTable *color_properties;
+2 -1
View File
@@ -35,11 +35,12 @@ G_BEGIN_DECLS
typedef struct _GtkModifierStyle GtkModifierStyle;
typedef struct _GtkModifierStyleClass GtkModifierStyleClass;
typedef struct _GtkModifierStylePrivate GtkModifierStylePrivate;
struct _GtkModifierStyle
{
GObject parent_object;
gpointer priv;
GtkModifierStylePrivate *priv;
};
struct _GtkModifierStyleClass
+4 -1
View File
@@ -4958,7 +4958,10 @@ gtk_notebook_real_remove (GtkNotebook *notebook,
gtk_widget_unparent (page->child);
tab_label = page->tab_label;
if (tab_label)
/* Do not unparent the tab label if it's already in another
hierarchy. It means we are in the middle of a DnD and it's
already taken care of. */
if (tab_label && NOTEBOOK_IS_TAB_LABEL_PARENT (notebook, page))
{
g_object_ref (tab_label);
gtk_notebook_remove_tab_label (notebook, page);
+18
View File
@@ -27,10 +27,12 @@
#include "config.h"
#include <locale.h>
#include <stdlib.h>
#include "gdk/gdk.h"
#include "gtkprivate.h"
#include "gtkenums.h"
#if !defined G_OS_WIN32 && !(defined GDK_WINDOWING_QUARTZ && defined QUARTZ_RELOCATION)
@@ -158,6 +160,22 @@ _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
return continue_emission;
}
gboolean
_gtk_captured_enum_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
gboolean continue_emission;
GtkCapturedEventFlags flags;
flags = g_value_get_flags (handler_return);
g_value_set_flags (return_accu, flags);
continue_emission = (flags & GTK_CAPTURED_EVENT_HANDLED) == 0;
return continue_emission;
}
GdkModifierType
_gtk_replace_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType modifiers)
+4
View File
@@ -59,6 +59,10 @@ gboolean _gtk_single_string_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
gboolean _gtk_captured_enum_accumulator (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy);
GdkModifierType _gtk_replace_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType modifiers);
+16 -15
View File
@@ -2005,14 +2005,10 @@ gtk_range_draw (GtkWidget *widget,
GtkStateFlags state = 0;
gint focus_line_width = 0;
gint focus_padding = 0;
gboolean touchscreen;
gboolean draw_trough = TRUE;
GtkStyleContext *context;
context = gtk_widget_get_style_context (widget);
g_object_get (gtk_widget_get_settings (widget),
"gtk-touchscreen-mode", &touchscreen,
NULL);
if (GTK_IS_SCALE (widget) &&
gtk_adjustment_get_upper (priv->adjustment) == gtk_adjustment_get_lower (priv->adjustment))
@@ -2282,7 +2278,7 @@ gtk_range_draw (GtkWidget *widget,
if (!sensitive)
state = GTK_STATE_FLAG_INSENSITIVE;
else if (!touchscreen && priv->mouse_location == MOUSE_SLIDER)
else if (priv->mouse_location == MOUSE_SLIDER)
state = GTK_STATE_FLAG_PRELIGHT;
if (priv->grab_location == MOUSE_SLIDER)
@@ -2314,25 +2310,25 @@ gtk_range_draw (GtkWidget *widget,
draw_stepper (range, STEPPER_A, cr,
priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
priv->grab_location == MOUSE_STEPPER_A,
!touchscreen && priv->mouse_location == MOUSE_STEPPER_A);
priv->mouse_location == MOUSE_STEPPER_A);
if (priv->has_stepper_b)
draw_stepper (range, STEPPER_B, cr,
priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
priv->grab_location == MOUSE_STEPPER_B,
!touchscreen && priv->mouse_location == MOUSE_STEPPER_B);
priv->mouse_location == MOUSE_STEPPER_B);
if (priv->has_stepper_c)
draw_stepper (range, STEPPER_C, cr,
priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_UP : GTK_ARROW_LEFT,
priv->grab_location == MOUSE_STEPPER_C,
!touchscreen && priv->mouse_location == MOUSE_STEPPER_C);
priv->mouse_location == MOUSE_STEPPER_C);
if (priv->has_stepper_d)
draw_stepper (range, STEPPER_D, cr,
priv->orientation == GTK_ORIENTATION_VERTICAL ? GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
priv->grab_location == MOUSE_STEPPER_D,
!touchscreen && priv->mouse_location == MOUSE_STEPPER_D);
priv->mouse_location == MOUSE_STEPPER_D);
return FALSE;
}
@@ -2533,7 +2529,8 @@ gtk_range_button_press (GtkWidget *widget,
{
GtkRange *range = GTK_RANGE (widget);
GtkRangePrivate *priv = range->priv;
GdkDevice *device;
GdkDevice *device, *source_device;
GdkInputSource source;
if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
@@ -2543,13 +2540,17 @@ gtk_range_button_press (GtkWidget *widget,
return FALSE;
device = gdk_event_get_device ((GdkEvent *) event);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
source = gdk_device_get_source (source_device);
priv->mouse_x = event->x;
priv->mouse_y = event->y;
if (gtk_range_update_mouse_location (range))
gtk_widget_queue_draw (widget);
if (priv->mouse_location == MOUSE_TROUGH &&
if (source != GDK_SOURCE_TOUCH &&
priv->mouse_location == MOUSE_TROUGH &&
event->button == 1)
{
/* button 1 steps by page increment, as with button 2 on a stepper
@@ -2598,17 +2599,17 @@ gtk_range_button_press (GtkWidget *widget,
return TRUE;
}
else if ((priv->mouse_location == MOUSE_TROUGH &&
event->button == 2) ||
(source == GDK_SOURCE_TOUCH || event->button == 2)) ||
priv->mouse_location == MOUSE_SLIDER)
{
gboolean need_value_update = FALSE;
/* Any button can be used to drag the slider, but you can start
* dragging the slider with a trough click using button 2;
* On button 2 press, we warp the slider to mouse position,
* then begin the slider drag.
* On button 2 press and touch devices, we warp the slider to
* mouse position, then begin the slider drag.
*/
if (event->button == 2)
if (event->button == 2 || source == GDK_SOURCE_TOUCH)
{
gdouble slider_low_value, slider_high_value, new_value;
+1013 -13
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -117,6 +117,9 @@ void gtk_scrolled_window_set_min_content_width (GtkScrolledWindow *sc
gint gtk_scrolled_window_get_min_content_height (GtkScrolledWindow *scrolled_window);
void gtk_scrolled_window_set_min_content_height (GtkScrolledWindow *scrolled_window,
gint height);
void gtk_scrolled_window_set_kinetic_scrolling (GtkScrolledWindow *scrolled_window,
GtkKineticScrollingFlags flags);
GtkKineticScrollingFlags gtk_scrolled_window_get_kinetic_scrolling (GtkScrolledWindow *scrolled_window);
gint _gtk_scrolled_window_get_scrollbar_spacing (GtkScrolledWindow *scrolled_window);
+95 -15
View File
@@ -33,6 +33,7 @@
#include "gtkprivate.h"
#include "gtkcssproviderprivate.h"
#include "gtksymboliccolor.h"
#include "gtkanimationdescription.h"
#include "gtktypebuiltins.h"
#include "gtkversion.h"
@@ -96,9 +97,10 @@
*/
#define DEFAULT_TIMEOUT_INITIAL 200
#define DEFAULT_TIMEOUT_REPEAT 20
#define DEFAULT_TIMEOUT_EXPAND 500
#define DEFAULT_TIMEOUT_INITIAL 200
#define DEFAULT_TIMEOUT_REPEAT 20
#define DEFAULT_TIMEOUT_EXPAND 500
#define DEFAULT_TIMEOUT_PRESS_AND_HOLD 800
typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue;
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
@@ -110,6 +112,7 @@ struct _GtkSettingsPrivate
GdkScreen *screen;
GtkCssProvider *theme_provider;
GtkCssProvider *key_theme_provider;
GtkStyleProperties *style;
};
typedef enum
@@ -205,7 +208,8 @@ enum {
PROP_IM_PREEDIT_STYLE,
PROP_IM_STATUS_STYLE,
PROP_SHELL_SHOWS_APP_MENU,
PROP_SHELL_SHOWS_MENUBAR
PROP_SHELL_SHOWS_MENUBAR,
PROP_PRESS_AND_HOLD_TIMEOUT
};
/* --- prototypes --- */
@@ -696,13 +700,16 @@ gtk_settings_class_init (GtkSettingsClass *class)
* functionality.
*
* Since: 2.10
*
* Deprecated: 3.4. Generally the behavior touchscreen input should be
* performed dynamically based on gdk_event_get_source_device().
*/
result = settings_install_property_parser (class,
g_param_spec_boolean ("gtk-touchscreen-mode",
P_("Enable Touchscreen Mode"),
P_("When TRUE, there are no motion notify events delivered on this screen"),
FALSE,
GTK_PARAM_READWRITE),
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
NULL);
g_assert (result == PROP_TOUCHSCREEN_MODE);
@@ -1345,22 +1352,40 @@ gtk_settings_class_init (GtkSettingsClass *class)
NULL);
g_assert (result == PROP_SHELL_SHOWS_MENUBAR);
/**
* GtkSettings:gtk-press-and-hold-timeout:
*
* The amount of time, in milliseconds, a button has to be pressed
* before the press-and-hold signal with the trigger action is emitted.
*
* Since: 3.2
*/
result = settings_install_property_parser (class,
g_param_spec_int ("gtk-press-and-hold-timeout",
P_("Press And Hold Timeout"),
P_("Timeout before press-and-hold action activates"),
0, G_MAXINT,
DEFAULT_TIMEOUT_PRESS_AND_HOLD,
GTK_PARAM_READWRITE),
NULL);
g_assert (result == PROP_PRESS_AND_HOLD_TIMEOUT);
g_type_class_add_private (class, sizeof (GtkSettingsPrivate));
}
static GtkStyleProperties *
gtk_settings_get_style (GtkStyleProvider *provider,
GtkWidgetPath *path)
static void
settings_ensure_style (GtkSettings *settings)
{
GtkSettingsPrivate *priv = settings->priv;
PangoFontDescription *font_desc;
gchar *font_name, *color_scheme;
GtkSettings *settings;
GtkStyleProperties *props;
gchar **colors;
guint i;
settings = GTK_SETTINGS (provider);
props = gtk_style_properties_new ();
if (priv->style)
return;
priv->style = gtk_style_properties_new ();
g_object_get (settings,
"gtk-font-name", &font_name,
@@ -1396,7 +1421,7 @@ gtk_settings_get_style (GtkStyleProvider *provider,
continue;
color = gtk_symbolic_color_new_literal (&col);
gtk_style_properties_map_color (props, name, color);
gtk_style_properties_map_color (priv->style, name, color);
gtk_symbolic_color_unref (color);
}
@@ -1420,7 +1445,7 @@ gtk_settings_get_style (GtkStyleProvider *provider,
pango_font_description_unset_fields (font_desc,
PANGO_FONT_MASK_STYLE);
gtk_style_properties_set (props, 0,
gtk_style_properties_set (priv->style, 0,
"font", font_desc,
NULL);
@@ -1428,8 +1453,46 @@ gtk_settings_get_style (GtkStyleProvider *provider,
g_strfreev (colors);
g_free (color_scheme);
g_free (font_name);
}
return props;
static GtkStyleProperties *
gtk_settings_get_style (GtkStyleProvider *provider,
GtkWidgetPath *path)
{
GtkSettings *settings;
settings = GTK_SETTINGS (provider);
settings_ensure_style (settings);
/* Set animation for press and hold */
if (gtk_widget_path_iter_has_class (path, 0, GTK_STYLE_CLASS_PRESS_AND_HOLD))
{
GtkAnimationDescription *anim_desc;
GtkStyleProperties *copy;
gint duration;
copy = gtk_style_properties_new ();
gtk_style_properties_merge (copy, settings->priv->style, TRUE);
g_object_get (settings,
"gtk-press-and-hold-timeout", &duration,
NULL);
anim_desc = _gtk_animation_description_new (duration,
GTK_TIMELINE_PROGRESS_LINEAR,
FALSE);
gtk_style_properties_set (copy,
GTK_STATE_FLAG_ACTIVE,
"transition", anim_desc,
NULL);
_gtk_animation_description_unref (anim_desc);
return copy;
}
return g_object_ref (settings->priv->style);
}
static void
@@ -1459,6 +1522,9 @@ gtk_settings_finalize (GObject *object)
if (priv->key_theme_provider)
g_object_unref (priv->key_theme_provider);
if (priv->style)
g_object_unref (priv->style);
G_OBJECT_CLASS (gtk_settings_parent_class)->finalize (object);
}
@@ -1668,6 +1734,18 @@ gtk_settings_get_property (GObject *object,
}
}
static void
settings_invalidate_style (GtkSettings *settings)
{
GtkSettingsPrivate *priv = settings->priv;
if (priv->style)
{
g_object_unref (priv->style);
priv->style = NULL;
}
}
static void
gtk_settings_notify (GObject *object,
GParamSpec *pspec)
@@ -1690,9 +1768,11 @@ gtk_settings_notify (GObject *object,
break;
case PROP_COLOR_SCHEME:
settings_update_color_scheme (settings);
settings_invalidate_style (settings);
gtk_style_context_reset_widgets (priv->screen);
break;
case PROP_FONT_NAME:
settings_invalidate_style (settings);
gtk_style_context_reset_widgets (priv->screen);
break;
case PROP_KEY_THEME_NAME:
+10 -8
View File
@@ -924,7 +924,7 @@ gtk_spin_button_panel_draw (GtkSpinButton *spin_button,
cairo_t *cr,
GdkWindow *panel)
{
GtkSpinButtonPrivate *priv = spin_button->priv;;
GtkSpinButtonPrivate *priv = spin_button->priv;
GtkStyleContext *context;
GtkStateFlags state;
GtkWidget *widget;
@@ -1348,15 +1348,17 @@ gtk_spin_button_button_press (GtkWidget *widget,
gtk_widget_grab_focus (widget);
priv->button = event->button;
if (gtk_editable_get_editable (GTK_EDITABLE (widget)))
if (gtk_editable_get_editable (GTK_EDITABLE (widget))) {
gtk_spin_button_update (spin);
if (event->button == 1)
start_spinning (spin, event->window, gtk_adjustment_get_step_increment (priv->adjustment));
else if (event->button == 2)
start_spinning (spin, event->window, gtk_adjustment_get_page_increment (priv->adjustment));
else
priv->click_child = event->window;
if (event->button == 1)
start_spinning (spin, event->window, gtk_adjustment_get_step_increment (priv->adjustment));
else if (event->button == 2)
start_spinning (spin, event->window, gtk_adjustment_get_page_increment (priv->adjustment));
else
priv->click_child = event->window;
} else
gtk_widget_error_bell (widget);
return TRUE;
}
+2 -2
View File
@@ -2222,8 +2222,8 @@ gtk_status_icon_position_menu (GtkMenu *menu,
gdk_window_get_origin (window, x, y);
gtk_widget_get_preferred_size (GTK_WIDGET (menu),
&menu_req, NULL);
menu_req.width = gtk_widget_get_allocated_width (GTK_WIDGET (menu));
menu_req.height = gtk_widget_get_allocated_height (GTK_WIDGET (menu));
gtk_widget_get_allocation (widget, &allocation);
if (_gtk_tray_icon_get_orientation (tray_icon) == GTK_ORIENTATION_VERTICAL)
+7
View File
@@ -647,6 +647,13 @@ struct _GtkStyleContextClass
*/
#define GTK_STYLE_CLASS_RIGHT "right"
/**
* GTK_STYLE_CLASS_PRESS_AND_HOLD:
*
* A CSS class for the press and hold activity indicator.
*/
#define GTK_STYLE_CLASS_PRESS_AND_HOLD "press-and-hold"
/* Predefined set of widget regions */
/**
+1 -2
View File
@@ -58,7 +58,6 @@
* should use the APIs provided by #GtkThemingEngine instead.
*/
typedef struct GtkStylePropertiesPrivate GtkStylePropertiesPrivate;
typedef struct PropertyData PropertyData;
typedef struct ValueData ValueData;
@@ -73,7 +72,7 @@ struct PropertyData
GArray *values;
};
struct GtkStylePropertiesPrivate
struct _GtkStylePropertiesPrivate
{
GHashTable *color_map;
GHashTable *properties;
+2 -1
View File
@@ -39,6 +39,7 @@ G_BEGIN_DECLS
typedef struct _GtkStyleProperties GtkStyleProperties;
typedef struct _GtkStylePropertiesClass GtkStylePropertiesClass;
typedef struct _GtkStylePropertiesPrivate GtkStylePropertiesPrivate;
typedef struct _GtkSymbolicColor GtkSymbolicColor;
typedef struct _GtkGradient GtkGradient;
@@ -46,7 +47,7 @@ typedef struct _GtkGradient GtkGradient;
struct _GtkStyleProperties
{
GObject parent_object;
gpointer priv;
GtkStylePropertiesPrivate *priv;
};
struct _GtkStylePropertiesClass
+4 -4
View File
@@ -4720,7 +4720,7 @@ gtk_text_line_new (void)
{
GtkTextLine *line;
line = g_new0(GtkTextLine, 1);
line = g_slice_new0 (GtkTextLine);
line->dir_strong = PANGO_DIRECTION_NEUTRAL;
line->dir_propagated_forward = PANGO_DIRECTION_NEUTRAL;
line->dir_propagated_back = PANGO_DIRECTION_NEUTRAL;
@@ -4751,7 +4751,7 @@ gtk_text_line_destroy (GtkTextBTree *tree, GtkTextLine *line)
ld = next;
}
g_free (line);
g_slice_free (GtkTextLine, line);
}
static void
@@ -4862,7 +4862,7 @@ gtk_text_btree_node_new (void)
{
GtkTextBTreeNode *node;
node = g_new (GtkTextBTreeNode, 1);
node = g_slice_new (GtkTextBTreeNode);
node->node_data = NULL;
@@ -5513,7 +5513,7 @@ gtk_text_btree_node_free_empty (GtkTextBTree *tree,
summary_list_destroy (node->summary);
node_data_list_destroy (node->node_data);
g_free (node);
g_slice_free (GtkTextBTreeNode, node);
}
static NodeData*
+1 -4
View File
@@ -937,10 +937,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
if (widgets)
*widgets = tmp_widgets;
else
{
g_list_foreach (tmp_widgets, (GFunc)g_object_unref, NULL);
g_list_free (tmp_widgets);
}
g_list_free_full (tmp_widgets, g_object_unref);
g_slist_free (line_list);
}
+2 -2
View File
@@ -2143,7 +2143,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
DV (g_print ("creating one line display cache (%s)\n", G_STRLOC));
display = g_new0 (GtkTextLineDisplay, 1);
display = g_slice_new0 (GtkTextLineDisplay);
display->size_only = size_only;
display->line = line;
@@ -2486,7 +2486,7 @@ gtk_text_layout_free_line_display (GtkTextLayout *layout,
if (display->pg_bg_rgba)
gdk_rgba_free (display->pg_bg_rgba);
g_free (display);
g_slice_free (GtkTextLineDisplay, display);
}
}
+19 -3
View File
@@ -200,13 +200,20 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
NULL,
GTK_PARAM_WRITABLE));
/**
* GtkTextTag:background-gdk:
*
* Background color as a #GdkColor.
*
* Deprecated: 3.4: Use #GtkTextTag:background-rgba instead.
*/
g_object_class_install_property (object_class,
PROP_BACKGROUND_GDK,
g_param_spec_boxed ("background-gdk",
P_("Background color"),
P_("Background color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkTextTag:background-rgba:
@@ -239,13 +246,20 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
NULL,
GTK_PARAM_WRITABLE));
/**
* GtkTextTag:foreground-gdk:
*
* Foreground color as a #GdkColor.
*
* Deprecated: 3.4: Use #GtkTextTag:foreground-rgba instead.
*/
g_object_class_install_property (object_class,
PROP_FOREGROUND_GDK,
g_param_spec_boxed ("foreground-gdk",
P_("Foreground color"),
P_("Foreground color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkTextTag:foreground-rgba:
@@ -553,6 +567,8 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
* The paragraph background color as a as a #GdkColor.
*
* Since: 2.8
*
* Deprecated: 3.4: Use #GtkTextTag:paragraph-background-rgba instead.
*/
g_object_class_install_property (object_class,
PROP_PARAGRAPH_BACKGROUND_GDK,
@@ -560,7 +576,7 @@ gtk_text_tag_class_init (GtkTextTagClass *klass)
P_("Paragraph background color"),
P_("Paragraph background color as a GdkColor"),
GDK_TYPE_COLOR,
GTK_PARAM_READWRITE));
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
/**
* GtkTextTag:paragraph-background-rgba:
+54 -26
View File
@@ -378,6 +378,11 @@ static void gtk_text_view_drag_data_received (GtkWidget *widget,
guint time);
static gboolean gtk_text_view_popup_menu (GtkWidget *widget);
static gboolean gtk_text_view_press_and_hold (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y);
static void gtk_text_view_move_cursor (GtkTextView *text_view,
GtkMovementStep step,
@@ -463,7 +468,9 @@ static void gtk_text_view_set_virtual_cursor_pos (GtkTextView *text_view,
gint y);
static void gtk_text_view_do_popup (GtkTextView *text_view,
GdkEventButton *event);
GdkDevice *device,
guint32 _time,
guint button);
static void cancel_pending_scroll (GtkTextView *text_view);
static void gtk_text_view_queue_scroll (GtkTextView *text_view,
@@ -631,7 +638,8 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
widget_class->drag_data_received = gtk_text_view_drag_data_received;
widget_class->popup_menu = gtk_text_view_popup_menu;
widget_class->press_and_hold = gtk_text_view_press_and_hold;
container_class->add = gtk_text_view_add;
container_class->remove = gtk_text_view_remove;
container_class->forall = gtk_text_view_forall;
@@ -4268,8 +4276,15 @@ gtk_text_view_grab_notify (GtkWidget *widget,
if (priv->grab_device &&
gtk_widget_device_is_shadowed (widget, priv->grab_device))
{
if (priv->drag_start_x >= 0)
{
priv->drag_start_x = -1;
priv->drag_start_y = -1;
}
gtk_text_view_end_selection_drag (GTK_TEXT_VIEW (widget));
gtk_text_view_unobscure_mouse_cursor (GTK_TEXT_VIEW (widget));
priv->grab_device = NULL;
}
}
@@ -4547,7 +4562,8 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
if (gdk_event_triggers_context_menu ((GdkEvent *) event))
{
gtk_text_view_do_popup (text_view, event);
gtk_text_view_do_popup (text_view, event->device,
event->time, event->button);
return TRUE;
}
else if (event->button == 1)
@@ -4570,6 +4586,7 @@ gtk_text_view_button_press_event (GtkWidget *widget, GdkEventButton *event)
gtk_widget_get_modifier_mask (widget,
GDK_MODIFIER_INTENT_EXTEND_SELECTION)))
{
priv->grab_device = event->device;
priv->drag_start_x = event->x;
priv->drag_start_y = event->y;
priv->pending_place_cursor_button = event->button;
@@ -8310,16 +8327,18 @@ popup_targets_received (GtkClipboard *clipboard,
signals[POPULATE_POPUP],
0,
priv->popup_menu);
if (info->device)
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
info->device, NULL, NULL, NULL, NULL, NULL,
info->button, info->time);
if (gdk_device_get_source (info->device) != GDK_SOURCE_KEYBOARD)
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
info->device, NULL, NULL, NULL, NULL, NULL,
info->button, info->time);
else
{
gtk_menu_popup (GTK_MENU (priv->popup_menu), NULL, NULL,
popup_position_func, text_view,
0, gtk_get_current_event_time ());
gtk_menu_popup_for_device (GTK_MENU (priv->popup_menu),
info->device, NULL, NULL,
popup_position_func,
text_view, NULL,
0, info->time);
gtk_menu_shell_select_first (GTK_MENU_SHELL (priv->popup_menu), FALSE);
}
}
@@ -8330,7 +8349,9 @@ popup_targets_received (GtkClipboard *clipboard,
static void
gtk_text_view_do_popup (GtkTextView *text_view,
GdkEventButton *event)
GdkDevice *device,
guint32 _time,
guint button)
{
PopupInfo *info = g_new (PopupInfo, 1);
@@ -8339,19 +8360,9 @@ gtk_text_view_do_popup (GtkTextView *text_view,
* we get them, then we actually pop up the menu.
*/
info->text_view = g_object_ref (text_view);
if (event)
{
info->button = event->button;
info->time = event->time;
info->device = event->device;
}
else
{
info->button = 0;
info->time = gtk_get_current_event_time ();
info->device = NULL;
}
info->button = button;
info->time = _time;
info->device = device;
gtk_clipboard_request_contents (gtk_widget_get_clipboard (GTK_WIDGET (text_view),
GDK_SELECTION_CLIPBOARD),
@@ -8363,7 +8374,24 @@ gtk_text_view_do_popup (GtkTextView *text_view,
static gboolean
gtk_text_view_popup_menu (GtkWidget *widget)
{
gtk_text_view_do_popup (GTK_TEXT_VIEW (widget), NULL);
gtk_text_view_do_popup (GTK_TEXT_VIEW (widget),
gtk_get_current_event_device (),
gtk_get_current_event_time (),
0);
return TRUE;
}
static gboolean
gtk_text_view_press_and_hold (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y)
{
if (action == GTK_PRESS_AND_HOLD_TRIGGER)
gtk_text_view_do_popup (GTK_TEXT_VIEW (widget), device,
GDK_CURRENT_TIME, 1);
return TRUE;
}
+14 -11
View File
@@ -304,9 +304,6 @@ _gtk_theming_background_paint (GtkThemingBackground *bg,
"background-repeat", &repeat,
NULL);
/* Fill background color first */
cairo_fill_preserve (cr);
if (cairo_pattern_get_surface (bg->pattern, &surface) != CAIRO_STATUS_SUCCESS)
surface = NULL;
@@ -327,16 +324,22 @@ _gtk_theming_background_paint (GtkThemingBackground *bg,
scale_height = bg->image_rect.height;
}
cairo_translate (cr, bg->image_rect.x, bg->image_rect.y);
cairo_scale (cr, scale_width, scale_height);
cairo_set_source (cr, bg->pattern);
cairo_scale (cr, 1.0 / scale_width, 1.0 / scale_height);
cairo_translate (cr, -bg->image_rect.x, -bg->image_rect.y);
if (scale_width && scale_height)
{
/* Fill background color first */
cairo_fill_preserve (cr);
g_free (repeat);
cairo_translate (cr, bg->image_rect.x, bg->image_rect.y);
cairo_scale (cr, scale_width, scale_height);
cairo_set_source (cr, bg->pattern);
cairo_scale (cr, 1.0 / scale_width, 1.0 / scale_height);
cairo_translate (cr, -bg->image_rect.x, -bg->image_rect.y);
cairo_pattern_destroy (bg->pattern);
bg->pattern = NULL;
g_free (repeat);
cairo_pattern_destroy (bg->pattern);
bg->pattern = NULL;
}
}
cairo_fill (cr);
+61
View File
@@ -2596,6 +2596,63 @@ render_spinner (GtkThemingEngine *engine,
cairo_restore (cr);
}
static void
render_press_and_hold (GtkThemingEngine *engine,
cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
gdouble height)
{
gdouble progress, radius, border_width;
GdkRGBA color, bg_color;
GtkStateFlags flags;
GtkBorder border;
cairo_save (cr);
if (!gtk_theming_engine_state_is_running (engine,
GTK_STATE_FLAG_ACTIVE,
&progress))
progress = 0;
flags = gtk_theming_engine_get_state (engine);
gtk_theming_engine_get_background_color (engine, flags, &bg_color);
gtk_theming_engine_get_color (engine, flags, &color);
gtk_theming_engine_get_border (engine, flags, &border);
border_width = (gdouble) MAX (MAX (border.top, border.bottom),
MAX (border.left, border.right));
radius = MIN (width, height) / 2;
if (border_width == 0 ||
border_width >= radius - border_width)
border_width = MAX (1, radius / 4);
cairo_set_line_width (cr, border_width);
radius -= border_width;
/* Arcs start from the negative Y axis */
cairo_arc (cr,
width / 2, height / 2,
radius,
- G_PI_2, - G_PI_2 + (2 * G_PI));
gdk_cairo_set_source_rgba (cr, &bg_color);
cairo_stroke (cr);
cairo_arc (cr,
width / 2, height / 2,
radius,
- G_PI_2,
- G_PI_2 + (2 * G_PI * progress));
gdk_cairo_set_source_rgba (cr, &color);
cairo_stroke (cr);
cairo_restore (cr);
}
static void
gtk_theming_engine_render_activity (GtkThemingEngine *engine,
cairo_t *cr,
@@ -2608,6 +2665,10 @@ gtk_theming_engine_render_activity (GtkThemingEngine *engine,
{
render_spinner (engine, cr, x, y, width, height);
}
else if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_PRESS_AND_HOLD))
{
render_press_and_hold (engine, cr, x, y, width, height);
}
else
{
gtk_theming_engine_render_background (engine, cr, x, y, width, height);
+22 -3
View File
@@ -35,6 +35,7 @@ struct GtkTimelinePriv
guint source_id;
GTimer *timer;
gdouble elapsed_time;
gdouble progress;
gdouble last_progress;
@@ -309,16 +310,15 @@ gtk_timeline_run_frame (GtkTimeline *timeline)
{
GtkTimelinePriv *priv;
gdouble delta_progress, progress;
guint elapsed_time;
priv = timeline->priv;
elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000);
priv->elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000);
g_timer_start (priv->timer);
if (priv->animations_enabled)
{
delta_progress = (gdouble) elapsed_time / priv->duration;
delta_progress = (gdouble) priv->elapsed_time / priv->duration;
progress = priv->last_progress;
if (priv->direction == GTK_TIMELINE_DIRECTION_BACKWARD)
@@ -509,6 +509,25 @@ _gtk_timeline_is_running (GtkTimeline *timeline)
return (priv->source_id != 0);
}
/**
* gtk_timeline_get_elapsed_time:
* @timeline: A #GtkTimeline
*
* Returns the elapsed time since the last GtkTimeline::frame signal
*
* Return Value: elapsed time in milliseconds since the last frame
**/
guint
_gtk_timeline_get_elapsed_time (GtkTimeline *timeline)
{
GtkTimelinePriv *priv;
g_return_val_if_fail (GTK_IS_TIMELINE (timeline), 0);
priv = timeline->priv;
return priv->elapsed_time;
}
/**
* gtk_timeline_get_fps:
* @timeline: A #GtkTimeline
+1
View File
@@ -84,6 +84,7 @@ void _gtk_timeline_pause (GtkTimeline
void _gtk_timeline_rewind (GtkTimeline *timeline);
gboolean _gtk_timeline_is_running (GtkTimeline *timeline);
guint _gtk_timeline_get_elapsed_time (GtkTimeline *timeline);
guint _gtk_timeline_get_fps (GtkTimeline *timeline);
void _gtk_timeline_set_fps (GtkTimeline *timeline,
+2 -6
View File
@@ -658,13 +658,9 @@ gtk_toggle_button_update_state (GtkButton *button)
{
GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
GtkToggleButtonPrivate *priv = toggle_button->priv;
gboolean depressed, touchscreen;
gboolean depressed;
GtkStateFlags new_state = 0;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (button)),
"gtk-touchscreen-mode", &touchscreen,
NULL);
new_state = gtk_widget_get_state_flags (GTK_WIDGET (button)) &
~(GTK_STATE_FLAG_INCONSISTENT |
GTK_STATE_FLAG_PRELIGHT |
@@ -680,7 +676,7 @@ gtk_toggle_button_update_state (GtkButton *button)
else
depressed = priv->active;
if (!touchscreen && button->priv->in_button && (!button->priv->button_down || priv->draw_indicator))
if (button->priv->in_button && (!button->priv->button_down || priv->draw_indicator))
new_state |= GTK_STATE_FLAG_PRELIGHT;
if (depressed)
+17 -5
View File
@@ -1537,22 +1537,34 @@ _gtk_tooltip_hide (GtkWidget *widget)
}
static gboolean
tooltips_enabled (GdkWindow *window)
tooltips_enabled (GdkEvent *event)
{
GdkDevice *source_device;
GdkInputSource source;
GdkWindow *window;
gboolean enabled;
gboolean touchscreen;
GdkScreen *screen;
GtkSettings *settings;
window = event->any.window;
source_device = gdk_event_get_source_device (event);
if (!source_device)
return FALSE;
source = gdk_device_get_source (source_device);
screen = gdk_window_get_screen (window);
settings = gtk_settings_get_for_screen (screen);
g_object_get (settings,
"gtk-touchscreen-mode", &touchscreen,
"gtk-enable-tooltips", &enabled,
NULL);
return (!touchscreen && enabled);
if (enabled &&
source != GDK_SOURCE_TOUCH)
return TRUE;
return FALSE;
}
void
@@ -1564,7 +1576,7 @@ _gtk_tooltip_handle_event (GdkEvent *event)
GdkDisplay *display;
GtkTooltip *current_tooltip;
if (!tooltips_enabled (event->any.window))
if (!tooltips_enabled (event))
return;
/* Returns coordinates relative to has_tooltip_widget's allocation. */
+2 -2
View File
@@ -961,8 +961,8 @@ gtk_tray_icon_realize (GtkWidget *widget)
if (icon->priv->manager_visual_rgba)
{
/* Set a transparent background */
GdkColor transparent = { 0, 0, 0, 0 }; /* Only pixel=0 matters */
gdk_window_set_background (window, &transparent);
GdkRGBA transparent = { 0.0, 0.0, 0.0, 0.0 };
gdk_window_set_background_rgba (window, &transparent);
}
else
{
+4 -4
View File
@@ -10736,8 +10736,6 @@ gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
{
GtkRBTree *new_tree = NULL;
GtkRBNode *new_node = NULL;
GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL;
GtkTreePath *cursor_path = NULL;
if (!gtk_widget_has_focus (GTK_WIDGET (tree_view)))
@@ -10750,8 +10748,8 @@ gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
tree_view->priv->cursor_node);
_gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node,
cursor_tree,
tree_view->priv->cursor_node,
tree_view->priv->cursor_tree,
cursor_path,
GTK_TREE_SELECT_MODE_TOGGLE,
FALSE);
@@ -12922,6 +12920,8 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
cursor_changed = (node->children == tree_view->priv->cursor_tree)
|| _gtk_rbtree_contains (node->children, tree_view->priv->cursor_tree);
}
else
cursor_changed = FALSE;
if (gtk_tree_row_reference_valid (tree_view->priv->anchor))
{
+637
View File
@@ -398,6 +398,8 @@ struct _GtkWidgetPrivate
/* The widget's parent */
GtkWidget *parent;
GSList *captured_events;
#ifdef G_ENABLE_DEBUG
/* Number of gtk_widget_push_verify_invariants () */
guint verifying_invariants_count;
@@ -479,6 +481,8 @@ enum {
QUERY_TOOLTIP,
DRAG_FAILED,
STYLE_UPDATED,
CAPTURED_EVENT,
PRESS_AND_HOLD,
LAST_SIGNAL
};
@@ -534,6 +538,24 @@ struct _GtkStateData
guint operation : 2;
};
typedef struct
{
/* The widget */
GtkWidget *widget;
/* animation */
GtkWidget *popup;
guint delay_animation_id;
guint size;
gint start_x;
gint start_y;
gint current_x;
gint current_y;
GdkDevice *device;
} PressAndHoldData;
/* --- prototypes --- */
static void gtk_widget_base_class_init (gpointer g_class);
static void gtk_widget_class_init (GtkWidgetClass *klass);
@@ -700,6 +722,10 @@ static void gtk_widget_set_device_enabled_internal (GtkWidget *widget,
GdkDevice *device,
gboolean recurse,
gboolean enabled);
static gboolean event_window_is_still_viewable (GdkEvent *event);
static gboolean gtk_widget_press_and_hold_cancel (GtkWidget *widget);
/* --- variables --- */
static gpointer gtk_widget_parent_class = NULL;
@@ -728,6 +754,7 @@ static GQuark quark_visual = 0;
static GQuark quark_modifier_style = 0;
static GQuark quark_enabled_devices = 0;
static GQuark quark_size_groups = 0;
static GQuark quark_press_and_hold = 0;
GParamSpecPool *_gtk_widget_child_property_pool = NULL;
GObjectNotifyContext *_gtk_widget_child_property_notify_context = NULL;
@@ -852,6 +879,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
quark_modifier_style = g_quark_from_static_string ("gtk-widget-modifier-style");
quark_enabled_devices = g_quark_from_static_string ("gtk-widget-enabled-devices");
quark_size_groups = g_quark_from_static_string ("gtk-widget-size-groups");
quark_press_and_hold = g_quark_from_static_string ("gtk-widget-press-and-hold");
style_property_spec_pool = g_param_spec_pool_new (FALSE);
_gtk_widget_child_property_pool = g_param_spec_pool_new (TRUE);
@@ -930,6 +958,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->grab_broken_event = NULL;
klass->query_tooltip = gtk_widget_real_query_tooltip;
klass->style_updated = gtk_widget_real_style_updated;
klass->press_and_hold = NULL;
klass->show_help = gtk_widget_real_show_help;
@@ -1793,6 +1822,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
* #GtkWidget::key-press-event) and finally a generic
* #GtkWidget::event-after signal.
*
* An event can be captured before ::event signal is emitted by connecting to
* ::captured-event event signal.
*
* Returns: %TRUE to stop other handlers from being invoked for the event
* and to cancel the emission of the second specific ::event signal.
* %FALSE to propagate the event further and to allow the emission of
@@ -1829,6 +1861,53 @@ gtk_widget_class_init (GtkWidgetClass *klass)
G_TYPE_NONE, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GtkWidget::captured-event:
* @widget: the object which received the signal.
* @event: the #GdkEvent which triggered this signal
*
* The ::captured-event signal is emitted before the ::event signal to
* allow capturing an event before the specialized events are emitted.
* The event is propagated starting from the top-level container to
* the widget that received the event going down the hierarchy.
*
* This signal returns a #GtkCapturedEventFlags with the handling
* status of the event, if %GTK_CAPTURED_EVENT_HANDLED is enabled,
* the event will be considered to be handled, and thus not propagated
* further.
*
* If, additionally, %GTK_CAPTURED_EVENT_STORE is enabled, the event will
* be stored so it can possibly be re-sent at a later stage. See
* gtk_widget_release_captured_events().
*
* If no flags are enabled, the captured event will be propagated even
* further, eventually triggering the emission of the #GtkWidget::event
* signal on the widget that received the event if no parent widgets
* captured it.
*
* <note><para>Enabling %GTK_CAPTURED_EVENT_STORE without
* %GTK_CAPTURED_EVENT_HANDLED is not allowed to avoid doubly
* event emission.</para></note>
*
* <warning><para>%GTK_CAPTURED_EVENT_STORE will not keep any track of
* event parity (eg. ensuring that button/key presses and releases
* are paired, or focus/crossing events) nor consistency, so use with
* discretion.</para></warning>
*
* Returns: a #GtkCapturedEventFlags specifying what to do with the event.
*
* Since: 3.4
*/
widget_signals[CAPTURED_EVENT] =
g_signal_new (I_("captured-event"),
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkWidgetClass, captured_event),
_gtk_captured_enum_accumulator, NULL,
_gtk_marshal_FLAGS__BOXED,
GTK_TYPE_CAPTURED_EVENT_FLAGS, 1,
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
* GtkWidget::button-press-event:
* @widget: the object which received the signal.
@@ -3000,6 +3079,66 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__UINT,
G_TYPE_BOOLEAN, 1, G_TYPE_UINT);
/**
* GtkWidget::press-and-hold:
* @widget: the object which received the signal
* @action: a #GtkPressAndHoldAction specifying the action
* @x: if the action is not %GTK_PRESS_AND_HOLD_CANCEL, the x coordinate
* of the cursor position where the request has been emitted, relative
* to widget->window, otherwise undefined
* @y: if the action is not %GTK_PRESS_AND_HOLD_CANCEL, the y coordinate
* of the cursor position where the request has been emitted, relative
* to widget->window, otherwise undefined
*
* Connect to this signal and correctly handle all of its actions if you
* want your widget to support the press-n-hold operation. The
* press-and-hold operation is defined as keeping a mouse button pressed
* for a given amount of time (specified in the "press-and-hold-timeout"
* GtkSetting); during this time the mouse is only allowed to move a little
* bit (not past the drag threshold), else the press-and-hold operation will
* be terminated.
*
* From the above passage we can distill three actions for which this
* signal will be emitted: query, emitted when the mouse button goes
* down; trigger, emitted if the mouse button has been kept down for the
* specified amount of time and movements did not pass the drag threshold;
* and cancel, emitted when the press-and-hold operation has been terminated
* before the trigger action has been emitted.
*
* For query, @action will be set to %GTK_PRESS_AND_HOLD_QUERY, @x and @y
* will be set to the cursor position.
* A return value of %FALSE means no press-and-hold action should occur
* for these coordinates on the given widget, when %TRUE is returned
* a trigger action may be emitted later on.
*
* The trigger action is emitted by setting @action to be
* %GTK_PRESS_AND_HOLD_TRIGGER, the @x and @y coordinates are set to the
* cursor's current location (this includes any movements made between
* the original query and this trigger). In this case the return value
* is ignored.
*
* When @action is %GTK_WIDGET_PRESS_AND_HOLD_CANCEL, @x and @y are both
* undefined. The return value is ignored too as
* this action is only there for informational purposes.
*
* Returns: a boolean indicating how to proceed based on the value of
* @action, as described above.
*
* Since: 3.2
*/
widget_signals[PRESS_AND_HOLD] =
g_signal_new (I_("press-and-hold"),
G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkWidgetClass, press_and_hold),
_gtk_boolean_handled_accumulator, NULL,
_gtk_marshal_BOOLEAN__OBJECT_ENUM_INT_INT,
G_TYPE_BOOLEAN, 4,
GDK_TYPE_DEVICE,
GTK_TYPE_PRESS_AND_HOLD_ACTION,
G_TYPE_INT,
G_TYPE_INT);
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_F10, GDK_SHIFT_MASK,
"popup-menu", 0);
@@ -4422,6 +4561,12 @@ gtk_widget_realize (GtkWidget *widget)
_gtk_widget_enable_device_events (widget);
gtk_widget_update_devices_mask (widget, TRUE);
/* Enable button motion events for press and hold */
if (!gtk_widget_get_has_window (widget))
gdk_window_set_events (priv->window,
gdk_window_get_events (priv->window) | GDK_BUTTON_MOTION_MASK);
gtk_widget_add_events (widget, GDK_BUTTON_MOTION_MASK);
gtk_widget_pop_verify_invariants (widget);
}
}
@@ -5724,6 +5869,19 @@ _gtk_widget_draw_internal (GtkWidget *widget,
g_signal_emit (widget, widget_signals[DRAW],
0, cr,
&result);
if (cairo_status (cr) &&
_gtk_cairo_get_event (cr))
{
/* We check the event so we only warn about internal GTK calls.
* Errors might come from PDF streams having write failures and
* we don't want to spam stderr in that case.
* We do want to catch errors from
*/
g_warning ("drawing failure for widget `%s': %s",
G_OBJECT_TYPE_NAME (widget),
cairo_status_to_string (cairo_status (cr)));
}
}
context = gtk_widget_get_style_context (widget);
@@ -5850,6 +6008,68 @@ gtk_widget_event (GtkWidget *widget,
return gtk_widget_event_internal (widget, event);
}
gboolean
_gtk_widget_captured_event (GtkWidget *widget,
GdkEvent *event)
{
GtkCapturedEventFlags flags;
GtkWidgetPrivate *priv;
gboolean return_val;
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
g_return_val_if_fail (WIDGET_REALIZED_FOR_EVENT (widget, event), TRUE);
priv = widget->priv;
if (event->type == GDK_EXPOSE)
{
g_warning ("Events of type GDK_EXPOSE cannot be synthesized. To get "
"the same effect, call gdk_window_invalidate_rect/region(), "
"followed by gdk_window_process_updates().");
return TRUE;
}
if (!event_window_is_still_viewable (event))
return TRUE;
g_object_ref (widget);
g_signal_emit (widget, widget_signals[CAPTURED_EVENT], 0, event, &flags);
/* Only store events that have been handled, so we don't end up
* sending twice the same event.
*/
if (flags & GTK_CAPTURED_EVENT_STORE)
{
if ((flags & GTK_CAPTURED_EVENT_HANDLED) != 0)
priv->captured_events = g_slist_prepend (priv->captured_events,
gdk_event_copy (event));
else
g_warning ("Captured events can only be stored if they are claimed "
"to be handled by the capturing widget. The use of "
"GTK_CAPTURED_EVENT_HANDLED is mandatory if using "
"GTK_CAPTURED_EVENT_STORE.");
}
/* The widget that was originally to receive the event
* handles motion hints, but the capturing widget might
* not, so ensure we get further motion events.
*/
if ((flags & GTK_CAPTURED_EVENT_HANDLED) != 0 &&
event->type == GDK_MOTION_NOTIFY &&
event->motion.is_hint &&
(gdk_window_get_events (event->any.window) &
GDK_POINTER_MOTION_HINT_MASK) != 0)
gdk_event_request_motions (&event->motion);
return_val = (flags & GTK_CAPTURED_EVENT_HANDLED) != 0 ||
!WIDGET_REALIZED_FOR_EVENT (widget, event);
g_object_unref (widget);
return return_val;
}
/* Returns TRUE if a translation should be done */
gboolean
_gtk_widget_get_translation_to_window (GtkWidget *widget,
@@ -6387,6 +6607,14 @@ void
_gtk_widget_grab_notify (GtkWidget *widget,
gboolean was_grabbed)
{
PressAndHoldData *data;
data = g_object_get_qdata (G_OBJECT (widget), quark_press_and_hold);
if (data && data->device &&
gtk_widget_device_is_shadowed (widget, data->device))
gtk_widget_press_and_hold_cancel (widget);
g_signal_emit (widget, widget_signals[GRAB_NOTIFY], 0, was_grabbed);
}
@@ -6701,6 +6929,344 @@ gtk_widget_has_focus (GtkWidget *widget)
return widget->priv->has_focus;
}
/* --- Press and hold --- */
static inline PressAndHoldData *
gtk_widget_peek_press_and_hold_data (GtkWidget *widget)
{
return g_object_get_qdata (G_OBJECT (widget), quark_press_and_hold);
}
static void
press_and_hold_data_free (PressAndHoldData *data)
{
if (data->popup)
gtk_widget_destroy (data->popup);
if (data->delay_animation_id)
g_source_remove (data->delay_animation_id);
g_slice_free (PressAndHoldData, data);
}
static inline void
gtk_widget_set_press_and_hold_data (GtkWidget *widget,
PressAndHoldData *data)
{
g_object_set_qdata_full (G_OBJECT (widget),
quark_press_and_hold,
data,
(GDestroyNotify) press_and_hold_data_free);
}
static inline PressAndHoldData *
gtk_widget_get_press_and_hold_data (GtkWidget *widget)
{
PressAndHoldData *data;
data = gtk_widget_peek_press_and_hold_data (widget);
if (!data)
{
data = g_slice_new0 (PressAndHoldData);
data->widget = widget;
gtk_widget_set_press_and_hold_data (widget, data);
}
return data;
}
static gboolean
gtk_widget_press_and_hold_cancel (GtkWidget *widget)
{
PressAndHoldData *data;
gboolean return_value;
data = gtk_widget_peek_press_and_hold_data (widget);
g_assert (data != NULL);
g_signal_emit (widget, widget_signals[PRESS_AND_HOLD],
0,
data->device,
GTK_PRESS_AND_HOLD_CANCEL,
-1, -1,
&return_value);
gtk_widget_set_press_and_hold_data (widget, NULL);
return FALSE;
}
gboolean
_gtk_widget_press_and_hold_check_cancel (GtkWidget *widget,
GdkEventButton *event)
{
PressAndHoldData *data;
if (event->type != GDK_BUTTON_RELEASE)
return FALSE;
data = gtk_widget_peek_press_and_hold_data (widget);
if (data &&
data->device == gdk_event_get_device ((GdkEvent *) event))
{
gtk_widget_press_and_hold_cancel (widget);
return TRUE;
}
return FALSE;
}
gboolean
_gtk_widget_press_and_hold_check_threshold (GtkWidget *widget,
GdkEventMotion *event)
{
PressAndHoldData *data;
GdkDevice *device;
if (event->type != GDK_MOTION_NOTIFY)
return FALSE;
data = gtk_widget_peek_press_and_hold_data (widget);
if (!data)
return FALSE;
device = gdk_event_get_device ((GdkEvent *) event);
if (data->device != device)
return FALSE;
_gtk_widget_find_at_coords (event->window, event->x, event->y,
&data->current_x, &data->current_y);
/* Stop press-and-hold if we dragged too far from the starting point */
if (gtk_drag_check_threshold (widget, data->start_x, data->start_y,
data->current_x, data->current_y))
{
gtk_widget_press_and_hold_cancel (widget);
return TRUE;
}
if (data->popup)
gtk_window_move (GTK_WINDOW (data->popup),
event->x_root - data->size / 2,
event->y_root - data->size / 2);
return FALSE;
}
static gboolean
gtk_widget_press_and_hold_timeout (gpointer user_data)
{
gboolean return_value;
GtkWidget *widget = GTK_WIDGET (user_data);
PressAndHoldData *data;
data = gtk_widget_peek_press_and_hold_data (widget);
g_assert (data != NULL);
/* Done, clean up and emit the trigger signal */
g_signal_emit (widget, widget_signals[PRESS_AND_HOLD],
0,
data->device,
GTK_PRESS_AND_HOLD_TRIGGER,
data->current_x, data->current_y,
&return_value);
gtk_widget_set_press_and_hold_data (widget, NULL);
return FALSE;
}
static gboolean
press_and_hold_animation_draw (GtkWidget *widget,
cairo_t *cr,
gpointer user_data)
{
PressAndHoldData *data;
GtkStyleContext *context;
GtkStateFlags state;
gint width, height;
data = gtk_widget_peek_press_and_hold_data (GTK_WIDGET (user_data));
g_assert (data != NULL);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
context = gtk_widget_get_style_context (widget);
state = gtk_widget_get_state_flags (widget);
gtk_style_context_set_state (context, state);
if (!gtk_style_context_state_is_running (context, GTK_STATE_FLAG_ACTIVE, NULL))
{
/* The animation just finished, so hide the widget
* and finish the press and hold operation.
*/
gdk_threads_add_idle (gtk_widget_press_and_hold_timeout,
user_data);
gtk_widget_hide (widget);
return FALSE;
}
if (!gtk_widget_is_composited (widget))
{
cairo_t *mask_cr;
cairo_region_t *region;
cairo_surface_t *mask;
mask = cairo_image_surface_create (CAIRO_FORMAT_A1, width, height);
mask_cr = cairo_create (mask);
gtk_render_activity (context, mask_cr, 0, 0, width, height);
cairo_destroy (mask_cr);
region = gdk_cairo_region_create_from_surface (mask);
gdk_window_shape_combine_region (gtk_widget_get_window (widget), region, 0, 0);
cairo_region_destroy (region);
cairo_surface_destroy (mask);
}
else
{
cairo_save (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (cr);
cairo_restore (cr);
}
gtk_render_activity (context, cr, 0, 0, width, height);
return FALSE;
}
static gboolean
gtk_widget_press_and_hold_begin_animation_timeout (gpointer user_data)
{
GtkWidget *widget = GTK_WIDGET (user_data);
PressAndHoldData *data;
gint x, y;
data = gtk_widget_peek_press_and_hold_data (widget);
g_assert (data != NULL);
gdk_window_get_device_position (gdk_screen_get_root_window (gtk_widget_get_screen (widget)),
data->device, &x, &y, NULL);
gtk_window_move (GTK_WINDOW (data->popup),
x - data->size / 2,
y - data->size / 2);
gtk_widget_show (data->popup);
gtk_widget_set_state_flags (GTK_WIDGET (data->popup),
GTK_STATE_FLAG_ACTIVE, FALSE);
return FALSE;
}
static gboolean
gtk_widget_press_and_hold_query (GtkWidget *widget,
GdkDevice *device,
gint x,
gint y)
{
gboolean return_value = FALSE;
g_signal_emit (widget, widget_signals[PRESS_AND_HOLD],
0,
device,
GTK_PRESS_AND_HOLD_QUERY,
x, y,
&return_value);
return return_value;
}
gboolean
_gtk_widget_press_and_hold_check_start (GtkWidget *widget,
GdkEventButton *event)
{
PressAndHoldData *data = gtk_widget_peek_press_and_hold_data (widget);
if (event->type != GDK_BUTTON_PRESS)
return FALSE;
/* Press and hold already in process? */
if (data)
return FALSE;
data = gtk_widget_get_press_and_hold_data (widget);
if (gtk_widget_press_and_hold_query (widget, data->device,
event->x, event->y))
{
gint timeout, begin_ani_timeout;
GdkScreen *screen;
GdkVisual *visual;
GtkStyleContext *context;
cairo_region_t *region;
GdkDevice *source_device;
GdkInputSource source;
_gtk_widget_find_at_coords (event->window,
event->x, event->y,
&data->start_x, &data->start_y);
data->current_x = data->start_x;
data->current_y = data->start_y;
g_object_get (gtk_widget_get_settings (GTK_WIDGET (widget)),
"gtk-press-and-hold-timeout", &timeout,
"gtk-timeout-initial", &begin_ani_timeout,
NULL);
screen = gtk_widget_get_screen (widget);
visual = gdk_screen_get_rgba_visual (screen);
data->popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_screen (GTK_WINDOW (data->popup), screen);
if (visual)
gtk_widget_set_visual (data->popup, visual);
gtk_widget_set_app_paintable (data->popup, TRUE);
gtk_widget_realize (data->popup);
context = gtk_widget_get_style_context (data->popup);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_PRESS_AND_HOLD);
g_signal_connect (data->popup, "draw",
G_CALLBACK (press_and_hold_animation_draw),
widget);
source_device = gdk_event_get_source_device ((GdkEvent *) event);
source = gdk_device_get_source (source_device);
if (source == GDK_SOURCE_TOUCH)
{
/* Have an indicator with 2.5cm of diameter */
data->size = (25 * gdk_screen_get_width (screen)) /
gdk_screen_get_width_mm (screen);
}
else
data->size = gdk_display_get_default_cursor_size (gtk_widget_get_display (widget));
gtk_window_resize (GTK_WINDOW (data->popup), data->size, data->size);
region = cairo_region_create ();
gdk_window_input_shape_combine_region (gtk_widget_get_window (data->popup), region, 0, 0);
cairo_region_destroy (region);
/* delay loading the animation by the double click timeout */
data->delay_animation_id =
gdk_threads_add_timeout (begin_ani_timeout,
gtk_widget_press_and_hold_begin_animation_timeout,
widget);
data->device = gdk_event_get_device ((GdkEvent *) event);
}
return FALSE;
}
/**
* gtk_widget_has_visible_focus:
* @widget: a #GtkWidget
@@ -10154,6 +10720,12 @@ gtk_widget_finalize (GObject *object)
_gtk_widget_free_cached_sizes (widget);
if (priv->captured_events)
{
g_slist_foreach (priv->captured_events, (GFunc) gdk_event_free, NULL);
g_slist_free (priv->captured_events);
}
if (g_object_is_floating (object))
g_warning ("A floating object was finalized. This means that someone\n"
"called g_object_unref() on an object that had only a floating\n"
@@ -13901,3 +14473,68 @@ _gtk_widget_set_style (GtkWidget *widget,
{
widget->priv->style = style;
}
/**
* gtk_widget_release_captured_events:
* @widget: the #GtkWidget holding the events
* @emit: #TRUE if the events must be emitted on the targed widget
*
* Releases the events that a widget has captured and stored
* in the #GtkWidget::captured-event signal. if @emit is #TRUE,
* the events will be emitted on the target widget (the widget
* that would receive the event if no signal capturing happened)
*
* Since: 3.4
**/
void
gtk_widget_release_captured_events (GtkWidget *widget,
gboolean emit)
{
GtkWidgetPrivate *priv;
GSList *l;
g_return_if_fail (GTK_IS_WIDGET (widget));
priv = widget->priv;
if (emit)
{
priv->captured_events = g_slist_reverse (priv->captured_events);
for (l = priv->captured_events; l; l = l->next)
{
GtkWidget *event_widget;
GdkEvent *event = l->data;
event_widget = gtk_get_event_widget (event);
switch (event->type)
{
case GDK_PROPERTY_NOTIFY:
case GDK_FOCUS_CHANGE:
case GDK_CONFIGURE:
case GDK_MAP:
case GDK_UNMAP:
case GDK_SELECTION_CLEAR:
case GDK_SELECTION_REQUEST:
case GDK_SELECTION_NOTIFY:
case GDK_CLIENT_EVENT:
case GDK_VISIBILITY_NOTIFY:
case GDK_WINDOW_STATE:
case GDK_GRAB_BROKEN:
case GDK_DAMAGE:
/* These events are capturable, but don't bubble up */
gtk_widget_event (event_widget, event);
break;
default:
/* All other capturable events do bubble up */
gtk_propagate_event (event_widget, event);
break;
}
}
}
g_slist_foreach (priv->captured_events, (GFunc) gdk_event_free, NULL);
g_slist_free (priv->captured_events);
priv->captured_events = NULL;
}
+17 -2
View File
@@ -49,6 +49,13 @@ typedef enum
GTK_WIDGET_HELP_WHATS_THIS
} GtkWidgetHelpType;
typedef enum
{
GTK_PRESS_AND_HOLD_QUERY,
GTK_PRESS_AND_HOLD_TRIGGER,
GTK_PRESS_AND_HOLD_CANCEL
} GtkPressAndHoldAction;
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
* Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
*/
@@ -425,6 +432,14 @@ struct _GtkWidgetClass
void (* style_updated) (GtkWidget *widget);
GtkCapturedEventFlags (* captured_event) (GtkWidget *widget,
GdkEvent *event);
gboolean (* press_and_hold) (GtkWidget *widget,
GdkDevice *device,
GtkPressAndHoldAction action,
gint x,
gint y);
/*< private >*/
GtkWidgetClassPrivate *priv;
@@ -435,8 +450,6 @@ struct _GtkWidgetClass
void (*_gtk_reserved4) (void);
void (*_gtk_reserved5) (void);
void (*_gtk_reserved6) (void);
void (*_gtk_reserved7) (void);
void (*_gtk_reserved8) (void);
};
struct _GtkWidgetAuxInfo
@@ -892,6 +905,8 @@ GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget);
GdkModifierType gtk_widget_get_modifier_mask (GtkWidget *widget,
GdkModifierIntent intent);
void gtk_widget_release_captured_events (GtkWidget *widget,
gboolean emit);
G_END_DECLS
+10
View File
@@ -163,6 +163,16 @@ void _gtk_widget_set_style (GtkWidget *widget,
GtkStyle *style);
gboolean _gtk_widget_captured_event (GtkWidget *widget,
GdkEvent *event);
gboolean _gtk_widget_press_and_hold_check_start (GtkWidget *widget,
GdkEventButton *event);
gboolean _gtk_widget_press_and_hold_check_cancel (GtkWidget *widget,
GdkEventButton *event);
gboolean _gtk_widget_press_and_hold_check_threshold (GtkWidget *widget,
GdkEventMotion *event);
G_END_DECLS
#endif /* __GTK_WIDGET_PRIVATE_H__ */
+2
View File
@@ -52,6 +52,8 @@
#include "gtktypebuiltins.h"
#include "a11y/gtkwindowaccessible.h"
#include "deprecated/gtkstyle.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
#endif
+2
View File
@@ -650,6 +650,8 @@ gtk_im_context_xim_new (void)
GtkIMContextXIM *result;
const gchar *charset;
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
return NULL;
result = g_object_new (GTK_TYPE_IM_CONTEXT_XIM, NULL);
result->locale = g_strdup (setlocale (LC_CTYPE, NULL));
+1
View File
@@ -36,6 +36,7 @@ tests/reftests/css-match-style-property-order.ref.ui
tests/reftests/css-match-style-property-order.ui
tests/reftests/entry-progress-coloring.ref.ui
tests/reftests/entry-progress-coloring.ui
tests/reftests/grid-empty-with-spacing.ui
tests/reftests/grid-wfh.ref.ui
tests/reftests/grid-wfh.ui
tests/reftests/label-shadows.ref.ui
+275 -241
View File
File diff suppressed because it is too large Load Diff
+2059 -2146
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -37,6 +37,7 @@ tests/reftests/css-match-style-property-order.ref.ui
tests/reftests/css-match-style-property-order.ui
tests/reftests/entry-progress-coloring.ref.ui
tests/reftests/entry-progress-coloring.ui
tests/reftests/grid-empty-with-spacing.ui
tests/reftests/grid-wfh.ref.ui
tests/reftests/grid-wfh.ui
tests/reftests/label-shadows.ref.ui
+10
View File
@@ -63,6 +63,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testicontheme \
testimage \
testinput \
testkineticscrolling \
testlockbutton \
testmenubars \
testmountoperation \
@@ -76,6 +77,7 @@ noinst_PROGRAMS = $(TEST_PROGS) \
testorientable \
testoverlay \
testprint \
testpressandhold \
testrecentchooser \
testrecentchoosermenu \
testrichtext \
@@ -179,6 +181,7 @@ testgrid_DEPENDENCIES = $(TEST_DEPS)
testgtk_DEPENDENCIES = $(TEST_DEPS)
testinput_DEPENDENCIES = $(TEST_DEPS)
testimage_DEPENDENCIES = $(TEST_DEPS)
testkineticscrolling_DEPENDENCIES = $(TEST_DEPS)
testlockbutton_DEPENDENCIES = $(TEST_DEPS)
testmenubars_DEPENDENCIES = $(TEST_DEPS)
testmountoperation_DEPENDENCIES = $(TEST_DEPS)
@@ -194,6 +197,7 @@ testappchooserbutton_DEPENDENCIES = $(TEST_DEPS)
testorientable_DEPENDENCIES = $(TEST_DEPS)
testoverlay_DEPENDENCIES = $(TEST_DEPS)
testprint_DEPENDENCIES = $(TEST_DEPS)
testpressandhold_DEPENDENCIES = $(TEST_DEPS)
testrecentchooser_DEPENDENCIES = $(TEST_DEPS)
testrecentchoosermenu_DEPENDENCIES = $(TEST_DEPS)
testrichtext_DEPENDENCIES = $(TEST_DEPS)
@@ -277,6 +281,7 @@ testiconview_LDADD = $(LDADDS)
testiconview_keynav_LDADD = $(LDADDS)
testinput_LDADD = $(LDADDS)
testimage_LDADD = $(LDADDS)
testkineticscrolling_LDADD = $(LDADDS)
testlockbutton_LDADD = $(LDADDS)
testmenubars_LDADD = $(LDADDS)
testmountoperation_LDADD = $(LDADDS)
@@ -292,6 +297,7 @@ testappchooserbutton_LDADD = $(LDADDS)
testorientable_LDADD = $(LDADDS)
testoverlay_LDADD = $(LDADDS)
testprint_LDADD = $(LDADDS)
testpressandhold_LDADD = $(LDADDS)
testrecentchooser_LDADD = $(LDADDS)
testrecentchoosermenu_LDADD = $(LDADDS)
testrichtext_LDADD = $(LDADDS)
@@ -405,6 +411,9 @@ testprint_SOURCES = \
testprintfileoperation.h \
testprintfileoperation.c
testpressandhold_SOURCES = \
testpressandhold.c
testsocket_SOURCES = \
testsocket.c \
testsocket_common.c
@@ -521,6 +530,7 @@ testpixbuf_save_SOURCES = testpixbuf-save.c
widget_factory_SOURCES = widget-factory.c
testkineticscrolling_SOURCES = testkineticscrolling.c
EXTRA_DIST += \
gradient1.png \
+2
View File
@@ -107,6 +107,8 @@ EXTRA_DIST += \
entry-progress-coloring.ref.ui \
entry-progress-coloring.ui \
green-20x20.png \
grid-empty-with-spacing.ref.ui \
grid-empty-with-spacing.ui \
grid-expand.css \
grid-expand.ref.ui \
grid-expand.ui \
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">5</property>
<property name="column_spacing">5</property>
</object>
</child>
</object>
</interface>
+28
View File
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="type">popup</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">5</property>
<property name="column_spacing">5</property>
<child>
<object class="GtkLabel" id="label1">
<property name="can_focus">False</property>
<property name="label" translatable="yes">invisible</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
+5 -4
View File
@@ -1092,7 +1092,7 @@ main (int argc, char **argv)
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
GdkColor color;
GdkRGBA color;
GtkCellArea *area;
gtk_init (&argc, &argv);
@@ -1285,10 +1285,11 @@ main (int argc, char **argv)
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (tmp), renderer,
"text", 1,
NULL);
color.red = 0xffff;
color.blue = 0xffff;
color.red = 1.0;
color.blue = 1.0;
color.green = 0;
gtk_cell_view_set_background_color (GTK_CELL_VIEW (tmp), &color);
color.alpha = 1.0;
gtk_cell_view_set_background_rgba (GTK_CELL_VIEW (tmp), &color);
displayed_row_changed (GTK_COMBO_BOX (combobox), GTK_CELL_VIEW (tmp));
g_signal_connect (combobox, "changed", G_CALLBACK (displayed_row_changed), tmp);
+5 -54
View File
@@ -430,14 +430,14 @@ pattern_set_bg (GtkWidget *widget,
GdkWindow *child,
gint level)
{
static const GdkColor colors[] = {
{ 0, 0x4444, 0x4444, 0xffff },
{ 0, 0x8888, 0x8888, 0xffff },
{ 0, 0xaaaa, 0xaaaa, 0xffff }
static GdkRGBA colors[] = {
{ 0.27, 0.27, 1.0, 1.0 },
{ 0.53, 0.53, 1.0, 1.0},
{ 0.67, 0.67, 1.0, 1.0 }
};
gdk_window_set_user_data (child, widget);
gdk_window_set_background (child, &colors[level]);
gdk_window_set_background_rgba (child, &colors[level]);
}
static void
@@ -4811,55 +4811,6 @@ create_cursors (GtkWidget *widget)
* GtkColorSelection
*/
void
color_selection_ok (GtkWidget *w,
GtkColorSelectionDialog *cs)
{
GtkWidget *colorsel;
GdkColor color;
colorsel = gtk_color_selection_dialog_get_color_selection (cs);
gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (colorsel), &color);
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (colorsel), &color);
}
void
color_selection_changed (GtkWidget *w,
GtkColorSelectionDialog *cs)
{
GtkWidget *colorsel;
GdkColor color;
colorsel = gtk_color_selection_dialog_get_color_selection (cs);
gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (colorsel), &color);
gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (colorsel), &color);
}
#if 0 /* unused */
static void
opacity_toggled_cb (GtkWidget *w,
GtkColorSelectionDialog *cs)
{
GtkColorSelection *colorsel;
colorsel = GTK_COLOR_SELECTION (cs->colorsel);
gtk_color_selection_set_has_opacity_control (colorsel,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)));
}
static void
palette_toggled_cb (GtkWidget *w,
GtkColorSelectionDialog *cs)
{
GtkColorSelection *colorsel;
colorsel = GTK_COLOR_SELECTION (cs->colorsel);
gtk_color_selection_set_has_palette (colorsel,
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w)));
}
#endif
void
create_color_selection (GtkWidget *widget)
{

Some files were not shown because too many files have changed in this diff Show More