Compare commits

...

276 Commits

Author SHA1 Message Date
Matt Watson c9f4c86b1f animatedstyle: don't share styleanimations
Because of our port of css animation and css transition to
progress tracker, we should not think of animated styles as
immutable objects that can map any timestamp to css values.
Rather, timestamps can correspond to different values depending
on the value of GTK_SLOWDOWN over the course of the animation.

To keep animated styles and style animations totally immutable,
we will not share styleanimations between animatedstyles, and
make a new copy of a styleanimation for each timestamp.
2016-04-06 15:40:53 -07:00
Matt Watson 945f4a45d5 animatedstyle: just ref current style if timestamp the same 2016-04-06 15:40:53 -07:00
Matt Watson e56a1ddce3 animatedstyle: fail to create new style if timestamp goes backwards
With slowdown factor, we will only we be able to handle timestamps
that monotonically increase.
2016-04-06 15:40:53 -07:00
Matt Watson b1c94375e8 cssanimation: port to progress tracker 2016-04-06 15:40:53 -07:00
Matt Watson 865201f11f csstransition: port to progress tracker 2016-04-06 15:40:53 -07:00
Matt Watson f5a8201b0f entry: port to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson 4bf81e6ab5 progressbar: port to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson a09586175e scrolledwindow: port indicator fade to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson 3fed034b0c popover: port to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson c2b97c1b22 switch: port to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson 5d5ee76a8b revealer: port to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson abc8b34683 stack: skip first frame for animations
Not the ideal solution for this problem, but in practice leads to
much better performance on lower end hardware.

Stack does a double draw on the first frame of its animation, of
both the old contents (into a cairo surface) and the new contents.
Homogeneous stacks only need to reallocate contents on the first
frame.

On lower powered hardware where our frames will be a good deal
slower than the refresh rate anyway, we can assure a smother
experience by waiting a frame to start tweening where frame duration
will be more consistent.
2016-04-06 15:40:52 -07:00
Matt Watson d3961dacad stack: port to progress tracker 2016-04-06 15:40:52 -07:00
Matt Watson e962ebab82 inspector: add slider to control slowdown factor 2016-04-06 15:40:52 -07:00
Matt Watson ed75fa655b progresstracker: add GTK_SLOWDOWN environment variable
As we consolidate widgets to use progress tracker, this will allow
us to control the speed of all animations in a centralized place
2016-04-06 15:40:52 -07:00
Matt Watson 44a9c0e36d progresstracker: simple struct to track animation progress 2016-04-06 15:40:52 -07:00
Lapo Calamandrei 85e37925f0 Adwaita: transparent textview border border
So it will play nicely with gedit color combinations.
See https://bugzilla.gnome.org/show_bug.cgi?id=764203
2016-04-04 12:03:11 +02:00
Tom Tryfonidis d5b78d474a Updated Greek translation
(cherry picked from commit 40afffb9fd)
2016-04-04 09:28:33 +00:00
Matthias Clasen 2f0354fcf9 Move GdkDeviceManager to deprecated section
It has been superseded by GdkSeat.
2016-04-03 23:41:20 -04:00
Matthias Clasen 8ef12fda83 Add an index for 3.22 api additions 2016-04-03 23:33:57 -04:00
Matthias Clasen 9bfc8371fe wayland: Remove an unused vfunc 2016-04-03 18:18:17 -04:00
Matthias Clasen 59e40f3d6f wayland: Remove unused field 2016-04-03 18:18:17 -04:00
Kristjan SCHMIDT 62a7447c5f Updated Esperanto translation 2016-04-03 02:20:00 +02:00
Kristjan SCHMIDT f052f1554b Updated Esperanto translation 2016-04-03 00:46:18 +02:00
Timm Bäder 58891c1fe5 headerbar: Don't underallocate the label box
We use a label_sizing_box to make sure the headerbar can always contain
both a title and a subtitle without resizing when showing/hiding either
of them, but we should only do that for the height; the min width of the
label_box can be larger than that of the label_sizing_box.
2016-04-02 17:03:52 +02:00
Lapo Calamandrei d23c6c6246 Adwaita: style textview border
see https://bugzilla.gnome.org/show_bug.cgi?id=764203
2016-04-02 16:24:52 +02:00
Lapo Calamandrei f2f1725b40 Adwaita: cosmetic fixes 2016-04-02 16:03:02 +02:00
Carlos Garnacho 2784eacf00 wayland: Avoid NULL slave devices in GdkSeat::get_slaves
Just because we're asked for a capability, it doesn't mean we have
it.
2016-04-01 19:10:36 +02:00
Lapo Calamandrei b1205a9c96 Adwaita: set secondary caret color to selection blue
see https://bugzilla.gnome.org/show_bug.cgi?id=764204
2016-04-01 16:48:13 +02:00
Rui Matos 4bfa6c30bf gtkwindow: Don't allow unresizable windows to be smaller than required
Commit cdc580463e made it so that
unresizable windows can't be smaller than a set default size but it
lost the logic to ensure these windows remain at least big enough to
comply with their requisition.

https://bugzilla.gnome.org/show_bug.cgi?id=764174
2016-04-01 15:30:03 +02:00
Timm Bäder 84dfda1a2b widget: Always warn when underallocating widgets 2016-04-01 10:04:25 +02:00
Matthias Clasen 4c698bc824 wayland: Print out more debug info
Print out the subpixel layout and frame rates that the compositor
sends us.
2016-03-31 20:31:00 -04:00
Alexander Larsson 4c10800bcc gdkwindow: Remove O(n-children) code in gdk_window_invalidate
When we invalidate a window we need to also invalidate all child windows
that are native (non-native are automatically invalidated as we track
invalidation once per native window only). This was done in a pretty
inefficient way, recursing over the entire tree.

This makes the invalidation much faster by only looking at the native
children of the native window we're in, filtering out those that
are not a descendant of the client side window we're interested in.
Given that there are very few native subwindows this is much faster.
2016-03-31 18:56:18 +02:00
Matthias Clasen d1acb786a7 icon theme: Make the builtin hicolor index match reality
We were missing all of the status directories, and a few sizes.
This was causing us to not find image-missing on systems without
hicolor icon theme (this basically only happens on Windows).

https://bugzilla.gnome.org/show_bug.cgi?id=764378
2016-03-31 07:12:50 -04:00
Theppitak Karoonboonyanan a93e477a4d Updated Thai translation. 2016-03-31 09:13:42 +07:00
Matthias Clasen 6faafbff6e Use AM_DISTCHECK_CONFIGURE_FLAGS
This is preferred over DISTCHECK_CONFIGURE_FLAGS in modern automake.
2016-03-30 21:54:04 -04:00
Matthias Clasen d8da5879aa Adwaita: theme acceleditor > label
We need to have an opaque background here, otherwise the underlying
cell shines through.

https://bugzilla.gnome.org/show_bug.cgi?id=764376
2016-03-30 19:50:22 -04:00
Matthias Clasen 72178fd0c9 Accel cell renderer: Set a css name
Give the event box we use here the distinctive name "acceleditor".
2016-03-30 19:50:22 -04:00
Benjamin Otte 71a5f07620 widget: queue a redraw only if resize highlighting is enabled
e8aa9b0440 introduced a new debug mode
that highlights resizes. Unfortunately it has the side effect of
always queueing redraws even when the debug mode is not enabled.
Make the redraw conditional.
2016-03-30 21:44:58 +02:00
Debarshi Ray fd143a2b38 window: Make the sample code obey the party line on geometry widgets
The geometry_widget parameter is deprecated [1]. If one is passed, we
remove GDK_HINT_BASE_SIZE and GDK_HINT_RESIZE_INC from the mask [2].

[1] commit 08974a1e9a
[2] commit f7cc4abbad

https://bugzilla.gnome.org/show_bug.cgi?id=764321
2016-03-30 13:21:50 +02:00
Руслан Ижбулатов bde5281ae8 GDK W32: Use a dumb window class for decorative windows
Currently only one kind of decorative window is in use - the shape
indicator that is shown when snapping windows to the edge of the screen.

When normal toplevel class is used, its window procedure expects certain
motions from GDK (passing user data to CreateWindowEx(), registering
handle in a hash map etc), and might crash if that is not done.

Dumb window doesn't require anything, it can just be.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:04:46 +00:00
Руслан Ижбулатов cfbb8c5252 GDK W32: Add/subtract shadow when (un)snapping
Now halfleft/halfright/fullup snaps do hug screen edges as intended.

Documents AeroSnap behaviour when snapped windows are drag-resized
(currently this implementation handles this in a very simplistic way).

Don't believe GTK when it tells us that window shadow is 0, preserve
previous values (but do remember that GTK wants no shadow, in case
we need that).

Fixes a couple of bugs in unsnapping (check offset against the half
of the window; don't put pointer in the middle of the window vertically
if it still fits in the top half).

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:04:37 +00:00
Руслан Ижбулатов f853283d7b GDK W32: Add/subtract shadow when drag-resizing
Implements gdk_win32_window_set_shadow_width().
Uses shadow width/height to adjust max tracking size, allowing
windows to be drag-resized to cover the whole desktop.

Also uses SM_C*VIRTUALSCREEN instead of SM_C*MAXTRACK.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:03:56 +00:00
Руслан Ижбулатов b0131616b2 GDK W32: Draw snap indicators for AeroSnap
Indicator is a bare layered click-through native window,
painted completely by GDK, including animation.

This commit also isolates some of the more spam-ish debug logging
under ifdef.

This commit also changes the system metric used for maximal window
height for the snapping purposes. Turns out, SM_CYMAXTRACK is way
too large, use SM_CYVIRTUALSCREEN instead.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:03:41 +00:00
Руслан Ижбулатов b420c53773 GDK W32: Add drag-to-snap feature to AeroSnap
This implements the part of AeroSnap that snaps windows when you
drag them (while moving or resizing) to the edge of the screen.

It also fixes drag behaviour for snapped and maximized windows
(if such windows are dragged, first they must be unmaximized/unsnapped).

Note that this code does not take into account the shadow width, and
because of that the under-pointer-position-preserving window moves
might not look as such for maximized windows, which lack the shadow
when maximized, but do have the shadow when unmaximized.

This commit also doesn't cover some corner-cases the same way AeroSnap does.

Also, the snapping indicator (which is supposed to be a window shape that
shows where the window will be if the drag op is stopped at its current
point) is not being drawn, all routines responsible for its creation,
moving and drawing are stubs.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:00:07 +00:00
Руслан Ижбулатов 2ea96cf946 GDK W32: Improve AeroSnap - don't resize windows that fit
This is what AeroSnap does. If a window is being unsnapped on
a new monitor, check if the work area is large enough for the
window to fit in its normal size. If the window fits, just
reposition it so that the ratio of
left-window-edge-to-screen-edge / right-window-edge-to-screen-edge
remains the same, without scaling the window.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 09:00:02 +00:00
Руслан Ижбулатов 0ce217cf94 GDK W32: Re-implement AeroSnap for CSD windows
It works exactly like AeroSnap.
Except for shift+win+left/right, which is left for AeroSnap
to handle (AeroSnap takes action before we get the message,
so there's no way for us to override it).
The only thing that doesn't work is shift+win+left/right on
a maximized window, for reasons unknown at the moment.

This only implements winkey+stuff behaviour of AeroSnap,
not the drag-to-the-edge-and-something-funny-happens one.

https://bugzilla.gnome.org/show_bug.cgi?id=763013
2016-03-30 08:59:56 +00:00
Debarshi Ray 27a1b50bc6 window: Fix gtk_window_set_geometry_hints documentation
The geometry_widget parameter is ignored from 3.20 onwards [1], not
3.18 as mentioned in the documentation.

[1] commit 08974a1e9a

https://bugzilla.gnome.org/show_bug.cgi?id=764321
2016-03-29 19:31:59 +02:00
Emmanuele Bassi 6267b6b6eb Bump to 3.21.0
Otherwise newly added API will start warning.
2016-03-29 16:24:14 +01:00
Руслан Ижбулатов 77eebbda5c GDK W32: Erase hidden layered windows before showing them
If a layered window was hidden and is made visible, erase its
contents before showing it. GDK will schedule a redraw, but until
then we generally don't want to show old contents.

https://bugzilla.gnome.org/show_bug.cgi?id=763783
2016-03-29 14:30:19 +00:00
Руслан Ижбулатов cea8c29a26 GDK W32: Implement show_window_menu()
This is achieved by sending undocumented message WM_SYSMENU
to the window.
Before doing that, the window is given WS_SYSMENU style
(to enable window menu) and some combination of
WS_MAXIMIZEBOX (for "Mazimize" item)
WS_MINIMIZEBOX (for "Minimize" item)
WS_SIZEBOX (for "Size" item)
depending on which operations are currently permissible.

WM_SYSMENU is processed by DefWindowProc(), which results
in showing the window menu. We remove extra styles
at the first opportunity (WM_INITMENU message), as they
alter the way our window is rendered.

https://bugzilla.gnome.org/show_bug.cgi?id=763851
2016-03-29 13:47:49 +00:00
Lapo Calamandrei 38f94194a6 Adwaita: set caret-color for drop targets 2016-03-29 15:06:11 +02:00
Lapo Calamandrei e7cd3dddd8 Adwaita: cosmetic fix 2016-03-29 15:01:57 +02:00
Matthias Clasen 43a568395b Add some tests for GdkRectangle
In particular, we're testing corner cases with empty rectangles
here.
2016-03-28 19:54:55 -04:00
Matthias Clasen 669336cf95 Expand visual tests a bit 2016-03-28 19:28:57 -04:00
Matthias Clasen 785a425516 Add tests for seat apis
These are just some basic sanity tests.
2016-03-28 19:22:36 -04:00
Matthias Clasen 6f2d5a6290 Move autotestkeywords to testsuite
All the 'make check' and installed tests are now in testsuite/,
and tests/ is just a collection manual test programs.
2016-03-28 17:56:13 -04:00
Benjamin Otte a91237d65e window: Remove suspicious branch
While this commit was found to make emacs windows shrink (and it was
reverted in the gtk-3-20 branch for that reason), that was the only
observed breakage, while the reversal broke several of our unit tests.

Closer study of the emacs sources revealed that it does some really
unsupportable things like doing its own X event handling behind GTK+'s
back and freely mixing sizes of GtkWindows and GdkWindows obtained in
various ways. I've filed a bug against emacs with suggestions for how
to avoid the shrinking window, regardless of this commit.

Original commit message:

It seems this branch is not needed anymore. It was originally added in
1999 to support gtk_widget_realize(), but all those reasons seem
obsolete today.
Instead just call gtk_widget_realize().

If you end up at this commit when bisecting:
There is no bug that made me remove this code, it was purely meant to be
cleanup / dead code removal. I seem to have introduced a new bug or
bisecting wouldn't have let you here. So it seems we should just revert
this commit.
2016-03-28 17:05:09 -04:00
Timm Bäder aeed695e26 gtkapplication: _get_app_menu can return NULL 2016-03-28 18:18:20 +02:00
Aurimas Černius a9f94ba67f Updated Lithuanian translation 2016-03-28 17:48:10 +03:00
Matthias Clasen 568feffa69 Use dngettext instead of ngettext
Since we are a library, we have to pass the domain explicitly.

https://bugzilla.gnome.org/show_bug.cgi?id=764261
2016-03-27 19:00:31 -04:00
Matthias Clasen 5dabfa7b39 places sidebar: Plug a small memory leak
_gtk_trash_moniotr_get_icon is transfer full, so we have
to unref the icon.
2016-03-27 18:42:25 -04:00
Cosimo Cecchi b6b53fc19c GtkClipboard: fix a typo 2016-03-27 08:39:44 -07:00
Cosimo Cecchi efea673c31 GtkCssSection: remove duplicated documentation
Fixes a build time warning.
2016-03-27 08:35:13 -07:00
Cosimo Cecchi 26f9dc6508 scale: fix marks node position for scales with value
We should only count the value node as the first/last one if its
position matches.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi 9f48b6b07a range: use gadget pointers for grab/mouse locations
Simplify code and remove the mouse location indirection.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi 6efc06ef5c scale: remove impossible case
We only create the gadget when the markup is not empty, so we don't
need to check again here.
2016-03-26 22:43:53 -07:00
Cosimo Cecchi b989910293 scale: cache pango layouts for mark labels
Constantly creating pango layouts while drawing means that animations
will be slow. Instead, cache the pango layout in the mark structure.
2016-03-26 22:43:53 -07:00
Matthias Clasen 7e15ac8927 Add an index for 3.22 api additions 2016-03-26 23:32:45 -04:00
Matthias Clasen 100cf2442e Add a function to get the selection of a clipboard
This was requested in
http://bugzilla.gnome.org/show_bug.cgi?id=730821
2016-03-26 23:30:21 -04:00
Matthias Clasen cb738bc201 Remove private clipboard api from public headers 2016-03-26 23:17:53 -04:00
Matthias Clasen 0d0980f30e filter model: Mark property nicks and blurbs for translation
Better descriptions are not going to happen... might as well
admit it.
2016-03-26 18:59:02 -04:00
Matthias Clasen b1b271ab09 Drop some more code
This ifdefed out function was only used in the code I just nuked,
so it can go as well.
2016-03-26 18:53:55 -04:00
Matthias Clasen 543ad3aabb file chooser: Drop unused code
We've never restored filechooser positions, and we aren't going to.
2016-03-26 18:52:04 -04:00
Matthias Clasen 59d8cba482 wayland: Get min/max keycode from xkb keymap
Instead of hardcoding 8/255 here.
2016-03-26 18:48:27 -04:00
Matthias Clasen 7249897dc8 Drop irritating FIXMEs in docs
There is nothing to fix here, so don't make gnome-builder pick
these lines up for its todo list.
2016-03-26 18:39:39 -04:00
Matthias Clasen 8d874cf0f8 Stop using pango_split_file_list
Add a copy of this deprecated utility in gtkutils.c and use
it instead of the pango API.
2016-03-26 18:19:37 -04:00
Matthias Clasen 6994fe03ee Split off copied pango utils in their own source
This will make it easier to use them in more than one place.
2016-03-26 18:12:16 -04:00
Matthias Clasen e2d89b9931 Revert "window: Remove suspicious branch"
This reverts commit 67ab00e01e.

Bisection showed that this commit caused emacs windows to shrink
to a small size when first shown.
2016-03-26 17:38:40 -04:00
Matthias Clasen 1057f249bd wayland: Add debug output for pixel formats
Use GDK_DEBUG=misc to see information about wl_shm pixel formats
supported by the compositor.
2016-03-26 16:08:01 -04:00
Matthias Clasen f06fc8d378 Deprecate gdk_visual_get_colormap_size
Since we don't have API for colormaps anymore, this is not
a useful function.
2016-03-26 15:15:28 -04:00
Matthias Clasen ce0074b034 Deprecate gdk_visual_get_byte_order
This function is only useful when working with XImages,
and is not meaningfully implemented in other backends.
2016-03-26 15:07:09 -04:00
Matthias Clasen c6cdddd68d wayland: Fix up visual implementation
Don't return visuals that don't match the requested depth
and/or visual type.
2016-03-26 14:58:48 -04:00
Matthias Clasen 89973118f3 Add some more visual tests
These are just basic tests to ensure that the visual implementation
of a backend is sound.
2016-03-26 14:56:36 -04:00
Matthias Clasen aa4c5459b7 Deprecate gdk_visual_get_bits_per_rgb
This function is pretty useless, since the Wayland backend returns
0 for this, and the Windows backend 42 (!).
2016-03-26 14:20:23 -04:00
Matthias Clasen c448061d49 Add version macros for 3.22 2016-03-26 14:08:10 -04:00
Matthias Clasen 7fe1037e84 range: Simplify highlight allocation
Since we are really only interested in the center point of the
slider allocation, the pre-computed slider geometry is perfectly
fine, just use it always. This avoids the complication with
gadget visibility.
2016-03-26 13:50:42 -04:00
Matthias Clasen e33188ad41 range: Avoid miscalculating highlight allocation
The slider gadget may be turned invisible as side-effect of
gtk_range_calc_slider(). If that happens,
gtk_css_gadget_get_content_allocation() returns { 0, 0, 0, 0},
which leads us to calculate a negative allocation for the highlight
node. Avoid this, by just reusing our already calculated slider
allocation in this case (it is not technically the same as the
content, allocation, but the difference hardly matter here.

https://bugzilla.gnome.org/show_bug.cgi?id=764022
2016-03-26 10:50:00 -04:00
Matthias Clasen 2374e2aa3b Add a test for the system rgba visual
The main point of this test is to ensure that the pixel_details
getters work as expected.
2016-03-26 10:10:57 -04:00
Matthias Clasen e48e29db3b wayland: Fully initialize the visual
The pixel details (mask, shift and precision) are supposed to
be filled in for TrueColor visuals.
2016-03-26 10:10:57 -04:00
Matthias Clasen 8206b824fa Make gdk_visual_get_*_pixel_details work again
These functions are supposed to return the numbers of consecutive
1 bits in each components mask as precision. However, due to a
copy-paste mistake when this code was moved around in
commit 70d689cddd, the precision
was always reported as zero. This affects only a few applications
that directly set window background on X11 windows, such as emacs.

https://bugzilla.gnome.org/show_bug.cgi?id=764210
2016-03-26 09:35:53 -04:00
Jordi Mas 120c296ff6 Update Catalan translation 2016-03-26 08:10:28 +01:00
Matthias Clasen 82bde5b84d HighContrastInverse: Fix suggested-action colors
Choose a suitable foreground color instead of hardcoding white.

https://bugzilla.gnome.org/show_bug.cgi?id=764170
2016-03-25 22:45:55 -04:00
Matthias Clasen fab9c17b89 gtk3-demo: Show more button styles
Add examples for suggested-action and destructive-action
buttons in the style classes example.
2016-03-25 22:45:55 -04:00
Matthias Clasen 258ba6c8a4 gtk3-demo: Rename "CSS Theming" group
Call it just "Themeing" to avoid the repetition of CSS.
2016-03-25 22:45:55 -04:00
Balázs Úr 12bc02db94 Updated Hungarian translation 2016-03-26 00:47:32 +00:00
Руслан Ижбулатов b9b67e05e1 GDK W32: Optimize clipboard handling a bit
Delay as long as possible before calling OpenClipboard(),
call CloseClipboard() as quickly as possible after that.
Don't call OpenClipboard() when we don't need to (for example,
we don't need to open clipboard to call GetClipboardOwner()).

Also, print out actual W32 error code in some cases where it
was not printed before.

https://bugzilla.gnome.org/show_bug.cgi?id=763907
2016-03-26 00:03:50 +00:00
Руслан Ижбулатов 692c3b11ff GDK W32: Print error code along with the error message
Error codes can be easily looked up in an error code list
and/or googled up. Error messages, while descriptive, often
describe the wrong thing, and the messages themselves are not
part of the documentation of a function, unlike error codes.
It would be preferable to have the code, or both.

https://bugzilla.gnome.org/show_bug.cgi?id=763913
2016-03-25 22:04:58 +00:00
Руслан Ижбулатов c4c00299b2 GDK W32: Print more debug info about events
1) Print timestamps for events
2) Print wParam and lParam (in hex form) for messages

https://bugzilla.gnome.org/show_bug.cgi?id=763913
2016-03-25 22:04:57 +00:00
Piotr Drąg 24d2f85b23 Updated POTFILES.in 2016-03-25 21:27:21 +01:00
Christoph Reiter 72346cb209 inspector: add slider for adjusting the font scale
https://bugzilla.gnome.org/show_bug.cgi?id=761435
2016-03-25 16:10:28 -04:00
Matthias Clasen 826f729b6f stack switcher: Add a missing include 2016-03-25 15:52:33 -04:00
Matthias Clasen 6ac7b54378 dnd: Move GtkDragDest to a separate file
This follows what was done for GtkDragSource in
415030d25f and shaves another
500 lines off gtkdnd.c.
2016-03-25 15:37:20 -04:00
Wolfgang Stöggl db93386f23 Updated German translation
(cherry picked from commit 5e5372ce74)
2016-03-25 18:20:37 +00:00
Wolfgang Stöggl ea21ee3039 Updated German translation
(cherry picked from commit c08f4bd2a9)
2016-03-25 18:17:52 +00:00
Mohammed Sadik d47c7f7ba0 gtkaboutdialog: don't break ABI in GtkLicense enum
As the elements in the enum are not explicitly numbered, inserting an
element between some other elements shall change the values of elements
after the insertion. So append the new element at the end.

Anyway, no code should rely on the position of an element in an enum.

https://bugzilla.gnome.org/show_bug.cgi?id=763850
2016-03-25 18:38:46 +01:00
Matthias Clasen 4c8557fa35 Add a css node test for scales 2016-03-25 13:22:11 -04:00
Olivier Fourdan 5d34cf64a2 popover: raise when showing
Some other widget might have mapped and raised another child window of
the toplevel in the meantime, causing the popover window to be covered.

Raise the popover window to avoid the issue.

Bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=763627
2016-03-25 17:23:34 +01:00
Jordi Mas 19034a2352 Fix Catalan translation 2016-03-25 14:27:16 +01:00
Milo Casagrande fae1effec9 Updated Italian translation
(cherry picked from commit be624e71f4)
2016-03-25 10:58:40 +00:00
Razvan Chitu 65687ba392 trashmonitor: change trash monitoring process
The trash is monitored for state changes - going from empty to non-empty and the
other way round. Monitoring is done by handling change signals from a regular
file monitor. On each signal, an enumeration of the trash contents is started in
order to see if it is empty or not. This causes issues when many files are
trashed, because the gvfs trash backend is flooded with enumeration requests,
resulting in CPU usage spikes. In order to fix this, the "item-count" attribute
of the trash should be queried instead.

Replace asynchronous enumeration with asynchronous information query and update
the trash state based on the "item-count" attribute. Emit state change signal
only when the state actually changes.

https://bugzilla.gnome.org/show_bug.cgi?id=763600
2016-03-24 23:20:14 -04:00
Mohammed Sadik 40e777ae30 gtkaboutdialog: Add support for GNU Affero GPLv3+
Add support for GNU Affero GPLv3 (or later) to GtkLicense enum

https://bugzilla.gnome.org/show_bug.cgi?id=763850
2016-03-24 23:18:40 -04:00
Matthias Clasen caa804613d add a css style test for font: smaller 2016-03-24 22:58:43 -04:00
Matthias Clasen 447325b1e4 3.20.1 2016-03-24 22:43:27 -04:00
Matthias Clasen 24f54d50c4 Update css node test for GtkSwitch changes 2016-03-24 22:43:27 -04:00
Matthias Clasen 1716e0b038 Revert "add a css style test for font: smaller"
This reverts commit a4ed154b03.

The misparsing that is tested here will not be fixed in 3.20,
so keep this test out of the stable branch.
2016-03-24 22:43:27 -04:00
Mario Blättermann b3ad4af969 Updated German translation 2016-03-25 00:41:41 +00:00
Benjamin Otte cd78fa15ed menu: Clip children to view window
Don't overdraw the arrow allocations.

https://bugzilla.gnome.org/show_bug.cgi?id=764118
2016-03-24 20:25:49 +01:00
Inaki Larranaga Murgoitio 31a032e042 Updated Basque language 2016-03-24 20:17:19 +01:00
Inaki Larranaga Murgoitio b08ba9def0 Updated Basque language 2016-03-24 20:15:34 +01:00
Inaki Larranaga Murgoitio 5875101a34 Updated Basque language 2016-03-24 20:14:02 +01:00
Inaki Larranaga Murgoitio 1f16eb4344 Updated Basque language 2016-03-24 19:59:24 +01:00
Jakub Steiner ac62bc0df9 High Contrast Inverse: switches
- make sure both non active and active states are contrasty

https://bugzilla.gnome.org/show_bug.cgi?id=763802
2016-03-24 16:43:20 +01:00
Jakub Steiner 7ac7b523d8 High Contrast Inverse: set contrasty selected items
- selected bg was set lighter without appropriate fg color

https://bugzilla.gnome.org/show_bug.cgi?id=763804
2016-03-24 16:35:19 +01:00
Jakub Steiner adb2b5c758 High Contrast Inverse: scale trough fix
- make the trough more visible for HCI

https://bugzilla.gnome.org/show_bug.cgi?id=763805
2016-03-24 16:32:01 +01:00
Piotr Drąg 7e72f42483 Updated POTFILES.skip 2016-03-24 15:35:11 +01:00
Matthias Clasen a4ed154b03 add a css style test for font: smaller 2016-03-24 08:25:11 -04:00
Lapo Calamandrei 16dc164292 Adwaita: avoid sizing transition on the scale...
... since it ends up jumpy.
2016-03-24 13:15:23 +01:00
Lapo Calamandrei f5b6ab4557 Adwaita: placesview connect to server label padding
adds some padding to the "connect to server" label
2016-03-24 11:33:33 +01:00
Lapo Calamandrei aa821429b1 Adwaita: fix menu scroll arrows positioning
adresses the style part of
https://bugzilla.gnome.org/show_bug.cgi?id=764118
2016-03-24 11:25:52 +01:00
Dušan Kazik dc2e5fdf9c Updated Slovak translation 2016-03-24 06:51:38 +00:00
Benjamin Otte 41195f6300 switch: An active switch is :checked
Fix an oversight that should have happened in the gadget refactoring:
An active switch should be :checked, just like togglebuttons,
checkbuttons, etc.
2016-03-23 18:14:57 +01:00
Christoph Reiter 3f077ec36f quartz: fix pixelated image surfaces in retina/hidpi mode
gtk+ currently depends on the scaling factor and the cairo device scale
of both the backend surfaces and image surfaces to be equal.

Until now we didn't apply a cairo device scale at all and depended on the
automatic scaling of CGContexts. This works when drawing with cairo but
fails in case of image surfaces, which get requested at a too small size.

To make the quartz backend behave more like the X11 one, set the cairo device
scale on the surface in gdk_quartz_ref_cairo_surface(). As this conflicts
with the default scaling done by CGContext (we would get double scaling)
undo the CGContext scaling using CGContextScaleCTM().

This patch is based on the following patches by Brion Vibber:
    https://bugzilla.gnome.org/show_bug.cgi?id=740199#c4
    https://bugs.freedesktop.org/show_bug.cgi?id=69796#c4

https://bugzilla.gnome.org/show_bug.cgi?id=763779
2016-03-23 16:27:10 +01:00
Stas Solovey 3a5848820c Updated Russian translation 2016-03-23 15:23:08 +00:00
Fran Dieguez 1355f00825 Updated Galician translation 2016-03-23 11:20:59 +00:00
Matej Urbančič 0ab7be8d57 Updated Slovenian translation 2016-03-22 22:28:03 +01:00
Stas Solovey aac8b0120f Updated Russian translation 2016-03-22 20:19:44 +00:00
Matthias Clasen d6ca66b712 Run a11y tests with csd for make check
I've made this change for installed tests a while ago. It doesn't
make sense for distcheck to do it differently.
2016-03-22 14:55:55 -04:00
Matthias Clasen 65927caf84 inspector: Look for themes in system data dirs
This matches what GTK+ does now.
2016-03-22 08:22:48 -04:00
Matthias Clasen 052e82db04 Fix an accidentally deleted line
Not sure when this went missing, just fix the formatting.
2016-03-22 08:22:48 -04:00
Daniel Mustieles f46aad3a32 Updated Spanish translation 2016-03-22 11:28:57 +00:00
Dušan Kazik 4173360bb3 Updated Slovak translation 2016-03-22 06:35:00 +00:00
Zahari Yurukov 3e375a6c81 Added Bulgarian translation 2016-03-22 07:19:04 +02:00
Matthias Clasen 7cb36aba40 Load theme settings from the right location
When loading a per-theme settings.ini file, look for it in
the same directory where we found the gtk.css file for the
theme. Previously, we were always looking in
$prefix/share/themes/THEME/gtk-3.0/, even if the css was
loaded from somewhere else.

https://bugzilla.gnome.org/show_bug.cgi?id=641354
2016-03-21 22:19:19 -04:00
Matthias Clasen 475d916eb9 Also look in system data dirs for themes
With this change, we now look in
$XDG_DATA_HOME/themes/THEME/gtk-3.x
$HOME/.themes/THEME/gtk-3.x
$XDG_DATA_DIRS/themes/THEME/gtk-3.x
GTK_DATA_PREFIX/themes/THEME/gtk-3.x

https://bugzilla.gnome.org/show_bug.cgi?id=641354
2016-03-21 22:19:19 -04:00
Christian Hergert c48bc48dda wayland: avoid dropping surfaces when possible
If the configure-event gives us the same size as we had before,
which is common for animation resizes, then try to keep the
existing buffer around. This saves us a memfd_create() syscall
on every frame.

https://bugzilla.gnome.org/show_bug.cgi?id=763350
2016-03-21 22:03:20 -04:00
Ask Hjorth Larsen 7c2f81bcd9 Updated Danish translation 2016-03-21 22:20:26 +01:00
Lapo Calamandrei ee94f9ff89 Adwaita: simplify treeview:drop(active) code 2016-03-21 19:42:54 +01:00
Matthias Clasen 73fe852be0 gtk-demo: Improve markup demo
Add squiggly underlines and background, and make the markup editable.

https://bugzilla.gnome.org/show_bug.cgi?id=763741
2016-03-21 13:32:40 -04:00
Benjamin Otte 45dfdbce3f textview: Track differences between ink and logical rects
This way, we can ensure that we queue redraws on the full ink rect. This
is particularly visible for squiggly underlines in spell checking.

https://bugzilla.gnome.org/show_bug.cgi?id=763741
2016-03-21 13:26:57 -04:00
Tom Tryfonidis 031978cb6b Updated Greek translation 2016-03-21 17:21:09 +00:00
Anders Jonsson ce822c5bd4 Updated Swedish translation 2016-03-21 16:25:41 +00:00
Carlos Garnacho 219eedd7c8 wayland: Rename internal functions with misleading naming
Now that GdkWaylandDeviceData is gone, the functions prefixed
"gdk_wayland_device_" and taking a GdkWaylandSeat as first
parameter feel out of place. Renaming those makes it more obvious
that it's seat functions.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho 1597f31eba wayland: Remove GdkWaylandDataDevice typedef
It's no longer used.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho 81f0d23744 wayland: Replace all remaining uses of GdkWaylandDeviceData
And use GdkWaylandSeat in all of those. The variable names have also
been updated.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho c9f9163544 wayland: Remove GdkWaylandDeviceData pointer in GdkWaylandDevice
It's the same than gdk_device_get_seat() nowadays. Also, rename the
usages of GdkWaylandDeviceData to GdkWaylandSeat in the functions
affected by the removal.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Matthias Clasen 08a0257893 Fix the build 2016-03-21 12:10:44 -04:00
Matthias Clasen 26617bb9b4 shortcutswindow: Make the search button square
Add the image-button style class to this button (this doesn't
work automatically here, since this is a toggle button).

https://bugzilla.gnome.org/show_bug.cgi?id=763604
2016-03-21 12:00:02 -04:00
Matthias Clasen 4ae057f07b Adwaita: Update treeview drop target styling
This reinstates the between-the-rows highlight that was lost
at some point.

https://bugzilla.gnome.org/show_bug.cgi?id=763808
2016-03-21 11:56:17 -04:00
Matthias Clasen 12c5ca5c01 treeview: Update drop target highlighting
Stop using the .dnd style class, and instead use the
:drop(active) pseudo state, together with .before and .after
classes.

https://bugzilla.gnome.org/show_bug.cgi?id=763808
2016-03-21 11:56:17 -04:00
Matthias Clasen a5a51e325d quartz: Fix up dnd code
Copy changes to drag highlight drawing from gtkdnd.c to gtkdnd-quartz.c.

https://bugzilla.gnome.org/show_bug.cgi?id=763808
2016-03-21 11:56:17 -04:00
Christian Hergert ca63330b19 stack: query preferred size for last_visible_child
When animating, we might be changing the size allocation of the previous
stack child. However, we were not querying the size in the process
meaning you would often see warnings about allocating the size without
knowing what it should be.

This simply adds an innocuous size request, since responding to last_child
sizing requests is not all that critical in the transition.

https://bugzilla.gnome.org/show_bug.cgi?id=763900
2016-03-21 11:50:27 -04:00
Carlos Garcia Campos 5107c4a75f gtk-demo: Rework foreigndrawing to use sizes from the theme
Instead of hardcoding the size of the widgets. This makes the output
closer to real widgets and fixes the blurry icons. I've also added a
scale.

https://bugzilla.gnome.org/show_bug.cgi?id=763758
2016-03-21 11:45:48 -04:00
Matthias Clasen 068d382689 dnd: Hide the drag window when we're done
We were just relying on the drag context finalize() to destroy
the window. But with garbage-collected bindings, that might
not happen as soon as we like, so explicitly hide the window
when the drag ends successfully.

https://bugzilla.gnome.org/show_bug.cgi?id=763659
2016-03-21 11:26:24 -04:00
Debarshi Ray 2407f157c7 print-operation: Be more robust in the error path
This isn't an issue at the moment. Only exporting to a file can fail
by setting by setting an error and it happens to correctly return
GTK_PRINT_OPERATION_RESULT_ERROR regardless of this code.

Still, let's make this block of code more correct to prevent future
changes from introducing broken behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=763731
2016-03-21 16:09:30 +01:00
Ask Hjorth Larsen f988f1131b Updated Danish translation 2016-03-21 13:10:54 +00:00
Matthias Clasen 06062028e2 3.20.0 2016-03-21 07:54:42 -04:00
Jiri Grönroos a449cc80de Updated Finnish translation 2016-03-21 11:28:44 +00:00
Marek Černocký 9025ceabde Updated Czech translation 2016-03-21 11:49:01 +01:00
Artur Morais 7a1b82828e Updated Brazilian Portuguese translation 2016-03-21 10:28:50 +00:00
Milo Casagrande 8f5471f1df Updated Italian translation 2016-03-21 08:55:26 +00:00
Balázs Úr 5c6979e520 Updated Hungarian translation 2016-03-21 06:30:55 +00:00
Ask Hjorth Larsen 69cb072cd6 Updated Danish translation 2016-03-21 04:42:41 +01:00
Piotr Drąg 615f55d6d1 Updated Polish translation 2016-03-21 04:04:03 +01:00
Matthias Clasen de4cb363c2 Document gdk_wayland_seat_get_wl_seat 2016-03-20 22:49:33 -04:00
Matthias Clasen 09ea0c9110 Add gk_gl_context_is_legacy to the docs 2016-03-20 22:47:22 -04:00
Matthias Clasen e4d3987b17 gdk: Add a missing Since tag
gdk_drag_context_manage_dnd was introduced this cycle.
2016-03-20 22:45:06 -04:00
Matthias Clasen 105f9acfdf Add gdk_drag_context_manage_dnd to the docs 2016-03-20 22:44:29 -04:00
Matthias Clasen 3409ec56ca Clean up gdk docs build a bit
Ignore more headers.
2016-03-20 22:44:03 -04:00
Matthias Clasen 1c692c64fe gdk: Reword some docs 2016-03-20 22:29:37 -04:00
Руслан Ижбулатов 404a7185be Improve window title context popup menu fallback
Add "Minimize", "Maximize", "Restore", "Move", "Resize" and "Always on Top"
items to the menu.
This pertially reverts commit 0ea1a526f9.

https://bugzilla.gnome.org/show_bug.cgi?id=763806
2016-03-20 22:02:23 -04:00
Matthias Clasen f732fa6883 Reword release notes 2016-03-20 21:48:05 -04:00
Matthias Clasen bee669ee66 Updates for 3.20.0 2016-03-20 21:40:05 -04:00
Matthias Clasen 5c63ab26da style context: Don't use g_warning for API misuse
We've changed our API here; what these applications are doing
used to be fine. Don't make users suffer for this by spamming their
logs in a stable release. We'll keep the warning in master.

https://bugzilla.gnome.org/show_bug.cgi?id=763796
2016-03-20 20:53:34 -04:00
Lapo Calamandrei 1dcd88961e Adwaita: more evident colorswatch drag hilight 2016-03-21 01:19:12 +01:00
Lapo Calamandrei 4973b55ad9 Adwaita: titlebutton fix
use a better selector and fix the styling on selection-mode.
2016-03-21 01:02:30 +01:00
Lapo Calamandrei 44e225e50b Adwaita: add a transition to the scale slider 2016-03-21 00:46:44 +01:00
Lapo Calamandrei eacd632e5e Adwaita: add a transition to the switch slider 2016-03-21 00:44:47 +01:00
Lapo Calamandrei 6598dca783 Adwaita: sligthly dim backdrop selected fg color 2016-03-21 00:25:44 +01:00
Lapo Calamandrei 2e2c423c78 Adwaita: clean up 2016-03-21 00:22:24 +01:00
Ask Hjorth Larsen 33247293ee Updated Danish translation 2016-03-20 23:57:57 +01:00
Lapo Calamandrei de466e7b28 Adwaita: rework places sidebar styling
set colors on rows istead of images.
2016-03-20 23:38:49 +01:00
Lapo Calamandrei 524ca3c2d5 Adwaita: fix treeview spinbutton style 2016-03-20 23:33:51 +01:00
Ask Hjorth Larsen 7da594e7b7 Updated Danish translation 2016-03-20 23:26:10 +01:00
Ask Hjorth Larsen f64612ca56 Updated Danish translation 2016-03-20 23:25:14 +01:00
Lapo Calamandrei c867b17cc8 Adwaita: fix treeview entry style
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=763955
2016-03-20 23:18:49 +01:00
Jakub Steiner 7224dd76db High Contrast: sidebar round buttons
https://bugzilla.gnome.org/show_bug.cgi?id=763774
2016-03-20 22:07:03 +01:00
Rūdolfs Mazurs 4e6f9660c0 Update Latvian translation 2016-03-20 21:16:28 +02:00
Paolo Borelli d457b4f4a5 css: use "disabled" instead of the "insensitivie"
Not only there is a typo, but it is also deprecated.
2016-03-20 17:49:15 +01:00
Benjamin Otte 710285104b styleproperties: Really don't use 'i' in inner loop
I apparently was too tired when doing
8cebc125da and forgot to replace one
instance of 'i' with 'j'.

Thanks Timm for finding that one.
2016-03-20 13:43:46 +01:00
Милош Поповић e397468964 Updated Serbian Latin translation 2016-03-20 09:00:50 +00:00
Марко Костић 5091bc9d16 Updated Serbian translation 2016-03-20 08:59:39 +00:00
Benjamin Otte 9782a2b729 broadway: Use explicit sizes for payload length
The previous greater than comparisons would never trigger the 2nd case.

http://www.viva64.com/en/b/0383/
2016-03-20 05:51:42 +01:00
Benjamin Otte 318a9c4634 x11: Use g_error_matches()
Fixes accidentally assigning values.

http://www.viva64.com/en/b/0383/
2016-03-20 05:43:02 +01:00
Benjamin Otte 8cebc125da styleproperties: Don't use the same loop variable in nested loops
http://www.viva64.com/en/b/0383/
2016-03-20 05:37:23 +01:00
Benjamin Otte d42ba8a82a tests: Add missing break statements
http://www.viva64.com/en/b/0383/
2016-03-20 05:36:17 +01:00
Benjamin Otte 07a69b7247 gtk-demo: Fix copy/paste error
http://www.viva64.com/en/b/0383/
2016-03-20 05:32:35 +01:00
Benjamin Otte 471cdee97f broadway: Remove duplicate initialization
http://www.viva64.com/en/b/0383/
2016-03-20 05:31:20 +01:00
Benjamin Otte 5db1c987ee x11: Remove duplicate variable setting
http://www.viva64.com/en/b/0383/
2016-03-20 05:30:51 +01:00
Benjamin Otte ca3607c219 menubar: Remove duplicate flags value
http://www.viva64.com/en/b/0383/
2016-03-20 05:30:43 +01:00
Benjamin Otte c76424a842 calendar: Remove duplicate flags value
http://www.viva64.com/en/b/0383/
2016-03-20 05:27:19 +01:00
Benjamin Otte 58b7512b53 cssshadowvalue: Fix copy/paste issue
http://www.viva64.com/en/b/0383/
2016-03-20 05:26:39 +01:00
Benjamin Otte 3308122c32 placesview: Simplify
http://www.viva64.com/en/b/0383/
2016-03-20 05:18:38 +01:00
Benjamin Otte c6834a002f pathbar: Order button CSS nodes right
The previous code ordered them the wrong way, so the first button (from
a CSS pov) was the last visible one.
2016-03-20 05:18:04 +01:00
Lapo Calamandrei 397bacee6e Adwaita: fix places sidebar icons style
the color wasn't changing in backdrop.
2016-03-19 20:13:06 +01:00
Lapo Calamandrei 0174803149 Adwaita: added a transition to the backdrop state to most widgets 2016-03-19 19:56:15 +01:00
Lapo Calamandrei 38211ff800 Adwaita: clean up checkbutton and radiobutton styling
some superfluous selectors there since generic label styling was
broken.
2016-03-19 18:59:29 +01:00
Lapo Calamandrei ec50042228 Revert "Adwaita: checkbutton and radiobutton backdrop color fix"
This reverts commit 43937c6aa0.
Which was needed since the label styling was broken.
2016-03-19 18:57:33 +01:00
Lapo Calamandrei e079b92a55 Adwaita: fix label styling
backdrop wasn't in the mix, added and adjusted other widgets
styling not to be overridden by it when not needed.
Spotted a typo making the backdrop base color white in the process.
2016-03-19 18:56:41 +01:00
Lapo Calamandrei 20a8ac5542 Adwaita: reset entry props on horizontal spinbuttons
the spinbutton node is where the styling is applied, the leftover
properties on the entry node make a backdrop transition bad.
2016-03-19 18:09:22 +01:00
Lapo Calamandrei 8f2213836c Adwaita: remove commented out code 2016-03-19 17:53:36 +01:00
Lapo Calamandrei 43937c6aa0 Adwaita: checkbutton and radiobutton backdrop color fix
this sets the right backdrop color to the label insider the
aformentined widgets.
2016-03-19 17:46:49 +01:00
Lapo Calamandrei 99e2f91dfe Adwaita: simplify headerbar style 2016-03-19 17:23:39 +01:00
Lapo Calamandrei 5a0aeec3f4 Adwaita: correctly order backdrop decoration node shadows
... otherwise setting a transition to the backdrop state will make
the window resize, since the shadows size gets interpolated.
2016-03-19 17:08:17 +01:00
Ask Hjorth Larsen 80732a951c Updated Danish translation by scootergrisen 2016-03-19 03:43:32 +01:00
Lapo Calamandrei 50b5820669 High Contrast: switch style fix 2016-03-18 19:25:09 +01:00
Lapo Calamandrei 48fb37f341 High Contrast: don't hardcode a font-size on the switch 2016-03-18 19:10:36 +01:00
Lapo Calamandrei a46058451e High Contrast: stronger entry focus indication 2016-03-18 19:05:20 +01:00
Lapo Calamandrei 7d27fd087e High Contrast: fix a typo 2016-03-18 19:03:19 +01:00
Lapo Calamandrei 3b1484f57c Adwaita: fix colorscale shrinking when disabled 2016-03-18 18:38:48 +01:00
Jakub Steiner ad9865126a High Contrast: fix drop states
https://bugzilla.gnome.org/show_bug.cgi?id=763823
2016-03-18 15:48:52 +01:00
Daniel Korostil fe31c5f4fd Updated Ukrainian translation 2016-03-18 16:47:10 +02:00
Jakub Steiner 3a529614e5 High Contrast: spinbutton active state
- more contrast for the active state
- osd active state
2016-03-18 15:44:27 +01:00
Jakub Steiner 4fc5832cfd High Contrast: osd spinbutton fixes
- don't jump around for :backdrop
- only shade focused widgets
2016-03-18 15:30:46 +01:00
Jakub Steiner c94afa01c4 High Contrast: osd spinbuttons
https://bugzilla.gnome.org/show_bug.cgi?id=763846
2016-03-18 15:22:16 +01:00
Jakub Steiner a076df852b Hight Contrast: scrollbars
https://bugzilla.gnome.org/show_bug.cgi?id=763797
2016-03-18 13:53:30 +01:00
Anders Jonsson b88020ec92 Updated Swedish translation 2016-03-18 10:14:33 +00:00
Anders Jonsson 71eac292bb Updated Swedish translation 2016-03-18 10:13:42 +00:00
Milo Casagrande 0e171dd45c Updated Italian translation 2016-03-18 08:28:19 +00:00
Руслан Ижбулатов 7d2a7a5626 GDK W32: Don't move iconic windows
Using UpdateLayeredWindow() on iconic windows brings them *back* from
their iconic (minimized) state. That is bad.
As a precaution, also don't use SetWindowPos() on iconic windows.
This means that iconic windows can't be moved. That is fixable
by using SetWindowPlacement(), but there is no pressing need to do so,
as there are very few cases when windows need to be moved while minimized.

https://bugzilla.gnome.org/show_bug.cgi?id=763835
2016-03-18 07:49:39 +00:00
Rafael Fontenelle 54d36efa61 Updated Brazilian Portuguese translation 2016-03-18 05:05:10 +00:00
Christian Hergert 1bd5be6b7c quartz: fix quartz build
More fallout from recent refactoring.

See also b3860e407d.
2016-03-17 21:18:58 -07:00
Olivier Fourdan 3e3d29f7b7 gtkwindow: ignore default size if there is a size request
Some applications set both a default size on their gtk window and a size
request on the corresponding gtk widget.

Until now, the default size was ignored for fixed size windows, so this
had no effect and remained unnoticed, but with the recent change for
client-side decorations, the default size is now used even for fixed size
windows, which can cause the resulting fixed size window to be much
smaller than expected with the size request.

For fixed size windows, if we have both a size request and a default
size set, prefer the size request as before.

https://bugzilla.gnome.org/show_bug.cgi?id=763749
2016-03-17 22:40:42 -04:00
Milo Casagrande 4ddd29d8c0 Updated Italian translation 2016-03-17 20:08:07 +00:00
Milo Casagrande 450704b28a Updated Italian translation 2016-03-17 20:03:44 +00:00
Jakub Steiner 1bf3f40cc5 High Contrast: disabled flat buttons
- disabled flat buttons and backdrop state
2016-03-17 14:57:09 +01:00
Jakub Steiner 09168806a2 High Contrast: fix app-notifications
- get rid of the internal frame

https://bugzilla.gnome.org/show_bug.cgi?id=763781
2016-03-17 13:07:04 +01:00
Jakub Steiner e942aee13d High Contrast: menubar separator
- set menubar apart form the window content

https://bugzilla.gnome.org/show_bug.cgi?id=763777
2016-03-17 13:00:32 +01:00
Lapo Calamandrei 52c362721c High Contrast: fix titlebuttons sizing
... simplifying the scss in the process.
2016-03-17 12:54:10 +01:00
Lapo Calamandrei b0a25b3aa9 High Contrast: add undecorated button mixin
... which is used in _common.scss, this fixes flat button not
being, well, flat.
2016-03-17 12:54:10 +01:00
Lapo Calamandrei 981985ee50 High Contrast: remove an adwaita leftover
... a missing mixin which makes no sense in HC actually.
2016-03-17 12:54:10 +01:00
Lapo Calamandrei 4a58e751fb Adwaita: fix wide separators 2016-03-17 10:32:35 +01:00
Baurzhan Muftakhidinov 4455ef1c90 Updated Kazakh translation 2016-03-17 03:33:59 +00:00
Baurzhan Muftakhidinov 9b4eff6ed9 Updated Kazakh translation 2016-03-17 03:33:32 +00:00
Matthias Clasen e9de5f1083 HighContrast: Fix actionbar borders
Make the selector more specific so that it doesn't affect contained
boxes. Copied from Adwaita.

https://bugzilla.gnome.org/show_bug.cgi?id=763775
2016-03-16 21:57:49 -04:00
Changwoo Ryu 51f34f4b90 Updated Korean translation 2016-03-16 19:49:50 +00:00
Changwoo Ryu b0b06ffbf2 Updated Korean translation 2016-03-16 19:49:22 +00:00
Lapo Calamandrei 1ae5643f59 Adwaita: shrink back big standalone osd buttons 2016-03-16 18:06:56 +01:00
Jakub Steiner 3e6eca537b High Contrast: button metrics
- sync with Adwaita for button definitions

https://bugzilla.gnome.org/show_bug.cgi?id=763706
2016-03-16 15:25:28 +01:00
Jakub Steiner 5e629bc26b High Contrast: spinbuttons
- sync with Adwaita

https://bugzilla.gnome.org/show_bug.cgi?id=763696
2016-03-16 15:15:20 +01:00
Jakub Steiner b73f428a86 High Contrast: circular buttons
- make sure they are visible on selected rows

https://bugzilla.gnome.org/show_bug.cgi?id=763612
2016-03-16 14:53:47 +01:00
Jakub Steiner e4f6c76cf8 High Contrast: fix entry and button metrics
- sync with Adwaita

https://bugzilla.gnome.org/show_bug.cgi?id=763610
2016-03-16 14:32:14 +01:00
Lapo Calamandrei 6228233a9e Adwaita: remove a nonsensical comment 2016-03-16 13:42:38 +01:00
Lapo Calamandrei 6ccaa8e3ca High Contrast: keycap styling
sync with Adwaita with some styling tweaks.
2016-03-16 13:34:00 +01:00
Lapo Calamandrei ef8ef299c4 Adwaita: simplify treeview check and radio scss 2016-03-16 13:11:46 +01:00
Jakub Steiner 286437000b High Contrast: fix metrics for popover menus
- ripped the appropriate bits from Adwaita.

https://bugzilla.gnome.org/show_bug.cgi?id=763609
2016-03-16 12:57:14 +01:00
Jakub Steiner e5e8ffa3f7 High Contrast: reimplement check and radio
Use a similar structure as Adwaita - using buttons for
radios and checkboxes.

https://bugzilla.gnome.org/show_bug.cgi?id=763707
2016-03-16 12:30:12 +01:00
Timm Bäder 985121813e scale: Fix value height calculation
if (orientation) doesn't make a lot of sense but C doesn't complain and
instead evaluates orientation to TRUE for GTK_ORIENTATION_VERTICAL
(since that's 1), thus inverting the value sizes.
2016-03-16 10:20:17 +01:00
Lapo Calamandrei 6f3a3ea7f3 Adwaita: notebook better header spacing
added some padding to the header and margins to the tabs node when
it's not the only child.
2016-03-15 19:04:21 +01:00
Jakub Steiner 3e567b4900 High Contrast: disabled scales more subtle
Make even the tough border subtle to make it distinct from
normal state.

https://bugzilla.gnome.org/show_bug.cgi?id=763613
2016-03-15 18:28:40 +01:00
Lapo Calamandrei abfdad3c3d Adwaita: fix progressbar in treeviews styling 2016-03-15 17:02:01 +01:00
Lapo Calamandrei c6dcc6ee62 Adwaita: add some comments in the GtkScale related scss 2016-03-15 16:13:49 +01:00
Jakub Steiner 87c410d420 High Contrast: checkboxes and radios inside treeviews
- fixes hover state of checkboxes and radios inside treeviews
2016-03-15 15:49:25 +01:00
Jakub Steiner e44617b351 High Contrast: reimplement gtk scale
- sync with Adwaita to the new box model

https://bugzilla.gnome.org/show_bug.cgi?id=763613
2016-03-15 14:23:56 +01:00
Matthias Clasen 7018a41ce9 Correct a deprecation note
The CSS equivalent for focus-padding is outline-offset.
2016-03-15 09:22:23 -04:00
Jakub Steiner 186ecdf0fa High Contrast: distinct insensitive button
Tone down insensitive buttons.

https://bugzilla.gnome.org/show_bug.cgi?id=746490
2016-03-15 13:25:11 +01:00
203 changed files with 42768 additions and 29627 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ ChangeLog:
uninstall-local:
rm -f $(DESTDIR)$(pkgconfigdir)/gtk+-3.0.pc
DISTCHECK_CONFIGURE_FLAGS = \
AM_DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
--disable-doc-cross-references \
--enable-man \
+83 -1
View File
@@ -1,3 +1,84 @@
Overview of Changes in GTK+ 3.20.1
==================================
* Active GtkSwitch widgets now use the :checked state, to match GtkToggleButton
* Bugs fixed:
641354 Look for themes in XDG folders
763350 drawing performance worse than X
763604 The search button of a GtkShortcutsWindow should have the image-button...
763659 DND Drop on root with Pixbuf leaves image behind
763731 Return GTK_PRINT_OPERATION_RESULT_ERROR even if error == NULL
763741 Wavy/squiggly underline not properly removed
763758 Do not use fixed values for widgets size in foreign drawing demo
763779 [PATCH] quartz: fix pixelated image surfaces in retina/hidpi mode
763802 [HighContrastInverse] the “ON” text of a GtkSwitch should be black (on...
763804 [HighContrastInverse] menuitem:hover colors
763808 .dnd styleclass still used
763859 gdkdevice-wayland.c cleanups
763900 stack: fix warnings during GtkStack size_allocate
764118 Glitches in menu scroll arrow rendering
* Translation updates:
Basque
Bulgarian
Danish
Galician
Greek
Russian
Slovak
Slovenian
Spanish
Swedish
Overview of Changes in GTK+ 3.20.0
==================================
* Themes:
- The HighContrast theme has been brought back up to par with Adwaita
- Adwaita has received detail fixes for many widgets
- Adwaita now transitions to backdrop
* Some recently publicized static analysis findings have been fixed
* Bugs fixed:
746490 [HighContrast] insensitive ToggleButtons are rendered similarly ac...
763609 [HighContrast] model-generated menu-like popovers are unthemed
763610 [HighContrast] GtkSearchEntrys “search” icon needs left&right pad...
763612 [HighContrast] “:selected .circular” should be visible
763613 [HighContrast] GtkScale is unreadable
763696 [HighContrast] spinbuttons broken
763706 [HighContrast] linked horizontal dropboxes broken
763707 [HighContrast] active and hover states for radios and checkboxes b...
763774 [HighContrast] GtkPlacesSidebar row need more top&bottom padding
763775 [HighContrast] the “enter server adress” entry in GtkPlacesView ha...
763777 [HighContrast] GtkMenuBar needs a bottom box-shadow
763781 [HighContrast] .app-notification border { border:none; }
763797 [HighContrast] scrollbars invisible (whity on white)
763823 [HighContrast] dnd on a vertical spinbutton does a weird resizing
763846 [HighContrast] spinbuttons in osd look bad
763955 treeview: inline editing shows old text as background
763796 excessive Gtk-WARNING **: State 0 for EMailShellSidebar doesn't ma...
763835 W32: Layered windows don't become minimized
763749 Nautilus desktop window is too small with gtk 3.19
* Translation updates
Brazilian Portuguese
Czech
Danish
Finnish
Hungarian
Italian
Kazakh
Korean
Latvian
Serbian
Serbian Latin
Swedish
Ukrainian
Overview of Changes in GTK+ 3.19.12
===================================
@@ -604,7 +685,8 @@ Overview of Changes in GTK+ 3.19.3
758407 Could not send the search request \ GDBus.Error:org.freedesktop.Tr...
758442 gtk_style_context_save() destroys style information
* Translation updates:
Overview of Changes in GTK+ 3.19.2
==================================
* Most widgets have been ported to CSS nodes. The element names and
+28 -28
View File
@@ -72,48 +72,48 @@ and attach the patch to that bug report.
Patches should be in unified diff form. (The -up option to GNU diff)
Even better are git-formatted patches. (Use git format-patch)
Release notes for 3.20
======================
* The way theming works in GTK+ has been reworked pretty fundamentally
in this release, to be able to implement many more CSS features and
generally give themes more power. As a result, custom CSS that is
shipped with applications and third-party themes will need adjustments.
Widgets now use element names much more than style classes; type
names are no longer used in style matching. Every widget now documents
the element names it has and the style classes it uses. The GTK+
inspector can also be helpful in finding this information.
* The way theming works in GTK+ has been reworked fundamentally, to
implement many more CSS features and make themes more expressive.
As a result, custom CSS that is shipped with applications and third-
party themes will need adjustments. Widgets now use element names much
more than style classes; type names are no longer used in style matching.
Every widget now documents the element names it has and the style classes
it uses. The GTK+ inspector can also help with finding this information.
* GTK+ now uses internal subobjects (also known as gadgets) for allocating
and drawing widget parts. Applications that subclass GTK+ widgets may
see warnings if they override size_allocate and don't chain up. The
proper way to subclass is to chain up in size_allocate. If you don't
want to do that for some reason, you have to override draw as well.
and drawing widget parts. Applications that subclass GTK+ widgets may see
warnings if they override the size_allocate vfunc and don't chain up.
The proper way to subclass is to chain up in size_allocate. If you do not
want to do that for some reason, you have to override the draw vfunc as
well.
* Several fixes for window sizing and placement with client-side
decorations may affect applications that are saving and restoring
window sizes. The recommended best practice for this which is known
to work with client-side and server-side decorations and with older
and newer versions of GTK+ is to use gtk_window_get_size() to save
and gtk_window_set_default_size() to restore the window size. See
https://wiki.gnome.org/HowDoI/SaveWindowState for a detailed example.
* Several fixes for window sizing and window placement with client-side
decorations may affect applications that are saving and restoring window
sizes. The recommended best practice for this which is known to work with
client-side and server-side decorations and with older and newer versions
of GTK+ is to use gtk_window_get_size() to save window sizes and
gtk_window_set_default_size() to restore it.
See https://wiki.gnome.org/HowDoI/SaveWindowState for a detailed example.
* GtkDrawingArea used to implicitly render the theme background before
calling the ::draw handler. This is no longer the case. If you rely
on having a theme-provided background, call gtk_render_background()
from your ::draw handler.
* The GtkFileChooser interface pre-requisite changed from GtkWidget
* The GtkFileChooser interface prerequisite changed from GtkWidget
to GObject, allowing non-widget implementations of this interface.
This is a minor change in ABI, as apps are no longer guaranteed
that a GtkFileChooser interface also supports all GtkWidget methods.
However, all previously existing objects still derive from GtkWidget,
so no existing code should break.
This is a minor change in ABI, as applications are no longer guaranteed
that a GtkFileChooser also supports all GtkWidget methods. However, all
previously existing implementations still derive from GtkWidget, so no
existing code should break.
* The way in which GtkLevelBar determines the offset to apply was
a bit inconsistent in the past; this has been fixed. Applications
that are using custom offsets should double-check that their
levels look as expected.
* The way in which GtkLevelBar determines the offset to apply was a bit
inconsistent in the past; this has been fixed. Applications that are using
custom offsets should double-check that their levels look as expected.
Release notes for 3.18
======================
+2 -2
View File
@@ -9,8 +9,8 @@
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [19])
m4_define([gtk_micro_version], [12])
m4_define([gtk_minor_version], [21])
m4_define([gtk_micro_version], [0])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
+1 -1
View File
@@ -1,4 +1,4 @@
/* CSS Theming/CSS Accordion
/* Theming/CSS Accordion
*
* A simple accordion demo written using CSS transitions and multiple backgrounds
*
+1 -1
View File
@@ -1,4 +1,4 @@
/* CSS Theming/CSS Basics
/* Theming/CSS Basics
*
* Gtk themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website.
+1 -1
View File
@@ -1,4 +1,4 @@
/* CSS Theming/Multiple Backgrounds
/* Theming/Multiple Backgrounds
*
* Gtk themes are written using CSS. Every widget is build of multiple items
* that you can style very similarly to a regular website.
+1 -1
View File
@@ -1,4 +1,4 @@
/* CSS Theming/Animated Backgrounds
/* Theming/Animated Backgrounds
*
* This demo is done in honour of the Pixbufs demo further down.
* It is done exclusively with CSS as the background of the window.
+1 -1
View File
@@ -1,4 +1,4 @@
/* CSS Theming/Shadows
/* Theming/Shadows
*
* This demo shows how to use CSS shadows.
*/
+542 -192
View File
@@ -5,9 +5,7 @@
* rest of the desktop, and follow GTK+ themes. This demo shows how to
* use GtkStyleContext and the gtk_render_ APIs to achieve this.
*
* Note that this is a very simple, non-interactive example and does
* not show how to come up with theme-compliant sizes by using CSS padding,
* margins and min-width or min-height.
* Note that this is a very simple, non-interactive example.
*/
#include <gtk/gtk.h>
@@ -110,19 +108,11 @@ append_element (GtkWidgetPath *path,
}
static GtkStyleContext *
get_style (GtkStyleContext *parent,
const char *selector)
create_context_for_path (GtkWidgetPath *path,
GtkStyleContext *parent)
{
GtkWidgetPath *path;
GtkStyleContext *context;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
append_element (path, selector);
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_set_parent (context, parent);
@@ -135,93 +125,273 @@ get_style (GtkStyleContext *parent,
return context;
}
static GtkStyleContext *
get_style (GtkStyleContext *parent,
const char *selector)
{
GtkWidgetPath *path;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
append_element (path, selector);
return create_context_for_path (path, parent);
}
static GtkStyleContext *
get_style_with_siblings (GtkStyleContext *parent,
const char *selector,
const char **siblings,
gint position)
{
GtkWidgetPath *path, *siblings_path;
guint i;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
siblings_path = gtk_widget_path_new ();
for (i = 0; siblings[i]; i++)
append_element (siblings_path, siblings[i]);
gtk_widget_path_append_with_siblings (path, siblings_path, position);
gtk_widget_path_unref (siblings_path);
return create_context_for_path (path, parent);
}
static void
draw_menu (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height)
draw_style_common (GtkStyleContext *context,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height,
gint *contents_x,
gint *contents_y,
gint *contents_width,
gint *contents_height)
{
GtkBorder margin, border, padding;
int min_width, min_height;
gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
gtk_style_context_get (context, gtk_style_context_get_state (context),
"min-width", &min_width,
"min-height", &min_height,
NULL);
x += margin.left;
y += margin.top;
width -= margin.left + margin.right;
height -= margin.top + margin.bottom;
width = MAX (width, min_width);
height = MAX (height, min_height);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
if (contents_x)
*contents_x = x + border.left + padding.left;
if (contents_y)
*contents_y = y + border.top + padding.top;
if (contents_width)
*contents_width = width - border.left - border.right - padding.left - padding.right;
if (contents_height)
*contents_height = height - border.top - border.bottom - padding.top - padding.bottom;
}
static void
query_size (GtkStyleContext *context,
gint *width,
gint *height)
{
GtkBorder margin, border, padding;
int min_width, min_height;
gtk_style_context_get_margin (context, gtk_style_context_get_state (context), &margin);
gtk_style_context_get_border (context, gtk_style_context_get_state (context), &border);
gtk_style_context_get_padding (context, gtk_style_context_get_state (context), &padding);
gtk_style_context_get (context, gtk_style_context_get_state (context),
"min-width", &min_width,
"min-height", &min_height,
NULL);
min_width += margin.left + margin.right + border.left + border.right + padding.left + padding.right;
min_height += margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
if (width)
*width = MAX (*width, min_width);
if (height)
*height = MAX (*height, min_height);
}
static void
draw_menu (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *menu_context;
GtkStyleContext *menuitem_context;
GtkStyleContext *hovermenuitem_context;
GtkStyleContext *hoveredarrowmenuitem_context;
GtkStyleContext *arrowmenuitem_context;
GtkStyleContext *checkmenuitem_context;
GtkStyleContext *disabledarrowmenuitem_context;
GtkStyleContext *disabledcheckmenuitem_context;
GtkStyleContext *radiomenuitem_context;
GtkStyleContext *disablemenuitem_context;
GtkStyleContext *disabledradiomenuitem_context;
GtkStyleContext *separatormenuitem_context;
gint menuitem1_height, menuitem2_height, menuitem3_height, menuitem4_height, menuitem5_height;
gint contents_x, contents_y, contents_width, contents_height;
gint menu_x, menu_y, menu_width, menu_height;
gint arrow_width, arrow_height, arrow_size;
gint toggle_x, toggle_y, toggle_width, toggle_height;
/* This information is taken from the GtkMenu docs, see "CSS nodes" */
menu_context = get_style (gtk_widget_get_style_context(widget), "menu");
gtk_render_background (menu_context, cr, x, y, width, height);
gtk_render_frame (menu_context, cr, x, y, width, height);
hovermenuitem_context = get_style (menu_context, "menuitem:hover");
gtk_render_background (hovermenuitem_context, cr, x, y, width, 20);
gtk_render_frame (hovermenuitem_context, cr, x, y, width, 20);
/* arrow for left to right */
arrowmenuitem_context = get_style (hovermenuitem_context, "arrow:dir(ltr)");
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2, x + width - 20, y, 20);
g_object_unref (arrowmenuitem_context);
hoveredarrowmenuitem_context = get_style (hovermenuitem_context, "arrow.right:dir(ltr)");
menuitem_context = get_style (menu_context, "menuitem");
gtk_render_background (menuitem_context, cr, x, y + 20, width, 20);
gtk_render_frame (menuitem_context, cr, x, y + 20, width, 20);
disablemenuitem_context = get_style (menu_context, "menuitem:disabled");
/* arrow for right to left, sensitive */
arrowmenuitem_context = get_style (menuitem_context, "arrow:dir(rtl)");
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2, x, y + 20, 20);
g_object_unref (arrowmenuitem_context);
/* arrow for right to left, insensitive */
arrowmenuitem_context = get_style (disablemenuitem_context, "arrow:dir(rtl)");
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2, x + width - 20, y + 20, 20);
gtk_render_background (menuitem_context, cr, x, y + 40, width, 20);
gtk_render_frame (menuitem_context, cr, x, y + 40, width, 20);
/* check enabled, sensitive */
disablemenuitem_context = get_style (menu_context, "menuitem:disabled");
disabledarrowmenuitem_context = get_style (disablemenuitem_context, "arrow:dir(rtl)");
checkmenuitem_context = get_style (menuitem_context, "check:checked");
gtk_render_frame (checkmenuitem_context, cr, x + 2, y + 40, 16, 16);
gtk_render_check (checkmenuitem_context, cr, x + 2, y + 40, 16, 16);
g_object_unref (checkmenuitem_context);
/* check unchecked, insensitive */
checkmenuitem_context = get_style (disablemenuitem_context, "check");
gtk_render_frame (checkmenuitem_context, cr, x + width - 18, y + 40, 16, 16);
gtk_render_check (checkmenuitem_context, cr, x + width - 18, y + 40, 16, 16);
/* draw separator */
separatormenuitem_context = get_style (menuitem_context, "separator:disabled");
gtk_render_line (separatormenuitem_context, cr, x + 1, y + 60, x + width - 2, y + 60);
gtk_render_background (menuitem_context, cr, x, y + 70, width, 20);
gtk_render_frame (menuitem_context, cr, x, y + 70, width, 20);
/* radio checked, sensitive */
disabledcheckmenuitem_context = get_style (disablemenuitem_context, "check");
separatormenuitem_context = get_style (menu_context, "separator:disabled");
radiomenuitem_context = get_style (menuitem_context, "radio:checked");
gtk_render_frame (radiomenuitem_context, cr, x + 2, y + 70, 16, 16);
gtk_render_option (radiomenuitem_context, cr, x + 2, y + 70, 16, 16);
g_object_unref (radiomenuitem_context);
disabledradiomenuitem_context = get_style (disablemenuitem_context, "radio");
/* radio unchecked, insensitive */
radiomenuitem_context = get_style (disablemenuitem_context, "radio");
gtk_render_frame (radiomenuitem_context, cr, x + width - 18, y + 70, 16, 16);
gtk_render_option (radiomenuitem_context, cr, x + width - 18, y + 70, 16, 16);
*height = 0;
query_size (menu_context, NULL, height);
menuitem1_height = 0;
query_size (hovermenuitem_context, NULL, &menuitem1_height);
query_size (hoveredarrowmenuitem_context, NULL, &menuitem1_height);
*height += menuitem1_height;
menuitem2_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem2_height);
query_size (arrowmenuitem_context, NULL, &menuitem2_height);
query_size (disabledarrowmenuitem_context, NULL, &menuitem2_height);
*height += menuitem2_height;
menuitem3_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem3_height);
query_size (checkmenuitem_context, NULL, &menuitem3_height);
query_size (disabledcheckmenuitem_context, NULL, &menuitem3_height);
*height += menuitem3_height;
menuitem4_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (separatormenuitem_context, NULL, &menuitem4_height);
*height += menuitem4_height;
menuitem5_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem5_height);
query_size (radiomenuitem_context, NULL, &menuitem5_height);
query_size (disabledradiomenuitem_context, NULL, &menuitem5_height);
*height += menuitem5_height;
draw_style_common (menu_context, cr, x, y, width, *height,
&menu_x, &menu_y, &menu_width, &menu_height);
/* Hovered with right arrow */
gtk_style_context_get (hoveredarrowmenuitem_context, gtk_style_context_get_state (hoveredarrowmenuitem_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (hovermenuitem_context, cr, menu_x, menu_y, menu_width, menuitem1_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_arrow (hoveredarrowmenuitem_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
/* Left arrow sensitive, and right arrow insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height, menu_width, menuitem2_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (arrowmenuitem_context, gtk_style_context_get_state (arrowmenuitem_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2,
contents_x,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
gtk_style_context_get (disabledarrowmenuitem_context, gtk_style_context_get_state (disabledarrowmenuitem_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (disabledarrowmenuitem_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height, menu_width, menuitem3_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (checkmenuitem_context, gtk_style_context_get_state (checkmenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (checkmenuitem_context, cr,
contents_x,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (checkmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
gtk_style_context_get (disabledcheckmenuitem_context, gtk_style_context_get_state (disabledcheckmenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledcheckmenuitem_context, cr,
contents_x + contents_width - toggle_width,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (disabledcheckmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
/* Separator */
draw_style_common (separatormenuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height,
menu_width, menuitem4_height,
NULL, NULL, NULL, NULL);
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height + menuitem4_height,
menu_width, menuitem5_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (radiomenuitem_context, gtk_style_context_get_state (radiomenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (radiomenuitem_context, cr,
contents_x,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (radiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
gtk_style_context_get (disabledradiomenuitem_context, gtk_style_context_get_state (disabledradiomenuitem_context),
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledradiomenuitem_context, cr,
contents_x + contents_width - toggle_width,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (disabledradiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
g_object_unref (separatormenuitem_context);
g_object_unref (disablemenuitem_context);
g_object_unref (radiomenuitem_context);
g_object_unref (checkmenuitem_context);
g_object_unref (arrowmenuitem_context);
g_object_unref (hovermenuitem_context);
g_object_unref (menuitem_context);
g_object_unref (menu_context);
g_object_unref (menuitem_context);
g_object_unref (hovermenuitem_context);
g_object_unref (hoveredarrowmenuitem_context);
g_object_unref (arrowmenuitem_context);
g_object_unref (checkmenuitem_context);
g_object_unref (disabledarrowmenuitem_context);
g_object_unref (disabledcheckmenuitem_context);
g_object_unref (radiomenuitem_context);
g_object_unref (disablemenuitem_context);
g_object_unref (disabledradiomenuitem_context);
g_object_unref (separatormenuitem_context);
}
static void
@@ -230,28 +400,49 @@ draw_menubar (GtkWidget *widget,
gint x,
gint y,
gint width,
gint height)
gint *height)
{
GtkStyleContext *frame_context;
GtkStyleContext *border_context;
GtkStyleContext *menubar_context;
GtkStyleContext *hovered_menuitem_context;
GtkStyleContext *menuitem_context;
gint item_width = width / 3;
gint contents_x, contents_y, contents_width, contents_height;
gint item_width;
/* Menubar background is the same color as our base background, so use a frame */
frame_context = get_style (NULL, "frame");
border_context = get_style (frame_context, "border");
/* This information is taken from the GtkMenuBar docs, see "CSS nodes" */
menubar_context = get_style (NULL, "menubar.background");
menubar_context = get_style (NULL, "menubar");
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
menuitem_context = get_style (menubar_context, "menuitem");
gtk_render_background (menubar_context, cr, x, y, width, height);
gtk_render_frame (menubar_context, cr, x, y, width, height);
*height = 0;
query_size (frame_context, NULL, height);
query_size (border_context, NULL, height);
query_size (menubar_context, NULL, height);
query_size (hovered_menuitem_context, NULL, height);
query_size (menuitem_context, NULL, height);
menuitem_context = get_style (menubar_context, "menuitem:hover");
gtk_render_background (menuitem_context, cr, x, y, item_width, 20);
gtk_render_frame (menuitem_context, cr, x, y, item_width, 20);
gtk_render_background (menuitem_context, cr, x + item_width * 2, y, item_width, 20);
gtk_render_frame (menuitem_context, cr, x + item_width * 2, y, item_width, 20);
draw_style_common (frame_context, cr, x, y, width, *height,
NULL, NULL, NULL, NULL);
draw_style_common (border_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (menubar_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
item_width = contents_width / 3;
draw_style_common (hovered_menuitem_context, cr, contents_x, contents_y, item_width, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (menuitem_context, cr, contents_x + item_width * 2, contents_y, item_width, contents_height,
NULL, NULL, NULL, NULL);
g_object_unref (menuitem_context);
g_object_unref (hovered_menuitem_context);
g_object_unref (menubar_context);
g_object_unref (border_context);
g_object_unref (frame_context);
}
static void
@@ -265,39 +456,40 @@ draw_notebook (GtkWidget *widget,
GtkStyleContext *notebook_context;
GtkStyleContext *header_context;
GtkStyleContext *tabs_context;
GtkStyleContext *tab_context;
GtkStyleContext *tab1_context, *tab2_context;
GtkStyleContext *stack_context;
gint header_height = 40;
gint header_height;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkNotebook docs, see "CSS nodes" */
notebook_context = get_style (NULL, "notebook.frame");
gtk_render_background (notebook_context, cr, x, y, width, height);
gtk_render_frame (notebook_context, cr, x, y, width, height);
header_context = get_style (notebook_context, "header.top");
gtk_render_background (header_context, cr, x, y, width, header_height);
gtk_render_frame (header_context, cr, x, y, width, header_height);
tabs_context = get_style (header_context, "tabs");
gtk_render_background (tabs_context, cr, x, y, width, header_height);
gtk_render_frame (tabs_context, cr, x, y, width, header_height);
tab_context = get_style (tabs_context, "tab:active");
gtk_render_background (tab_context, cr, x, y, width/2, header_height);
gtk_render_frame (tab_context, cr, x, y, width/2, header_height);
g_object_unref (tab_context);
tab_context = get_style (tabs_context, "tab");
gtk_render_background (tab_context, cr, x + width/2, y, width/2, header_height);
gtk_render_frame (tab_context, cr, x + width/2, y, width/2, header_height);
tab1_context = get_style (tabs_context, "tab:checked");
tab2_context = get_style (tabs_context, "tab:hover");
stack_context = get_style (notebook_context, "stack");
gtk_render_background (stack_context, cr, x, y + header_height, width, height - header_height);
gtk_render_frame (stack_context, cr, x, y + header_height, width, height - header_height);
header_height = 0;
query_size (notebook_context, NULL, &header_height);
query_size (header_context, NULL, &header_height);
query_size (tabs_context, NULL, &header_height);
query_size (tab1_context, NULL, &header_height);
query_size (tab2_context, NULL, &header_height);
draw_style_common (notebook_context, cr, x, y, width, height, NULL, NULL, NULL, NULL);
draw_style_common (header_context, cr, x, y, width, header_height, NULL, NULL, NULL, NULL);
draw_style_common (tabs_context, cr, x, y, width, header_height, NULL, NULL, NULL, NULL);
draw_style_common (tab1_context, cr, x, y, width / 2, header_height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (tab2_context, cr, x + width / 2, y, width / 2, header_height,
NULL, NULL, NULL, NULL);
draw_style_common (stack_context, cr, x, y + header_height, width,height - header_height,
NULL, NULL, NULL, NULL);
g_object_unref (stack_context);
g_object_unref (tab_context);
g_object_unref (tabs_context);
g_object_unref (tab1_context);
g_object_unref (tab2_context);
g_object_unref (header_context);
g_object_unref (notebook_context);
}
@@ -308,17 +500,18 @@ draw_horizontal_scrollbar (GtkWidget *widget,
gint x,
gint y,
gint width,
gint height,
gint position,
GtkStateFlags state)
GtkStateFlags state,
gint *height)
{
GtkStyleContext *scrollbar_context;
GtkStyleContext *contents_context;
GtkStyleContext *trough_context;
GtkStyleContext *slider_context;
gint slider_width;
/* This information is taken from the GtkScrollbar docs, see "CSS nodes" */
scrollbar_context = get_style (NULL, "scrollbar.horizontal");
scrollbar_context = get_style (NULL, "scrollbar.horizontal.bottom");
contents_context = get_style (scrollbar_context, "contents");
trough_context = get_style (contents_context, "trough");
slider_context = get_style (trough_context, "slider");
@@ -328,15 +521,19 @@ draw_horizontal_scrollbar (GtkWidget *widget,
gtk_style_context_set_state (trough_context, state);
gtk_style_context_set_state (slider_context, state);
gtk_render_background (scrollbar_context, cr, x, y, width, height);
gtk_render_frame (scrollbar_context, cr, x, y, width, height);
gtk_render_background (contents_context, cr, x, y, width, height);
gtk_render_frame (contents_context, cr, x, y, width, height);
gtk_render_background (trough_context, cr, x, y, width, height);
gtk_render_frame (trough_context, cr, x, y, width, height);
/* The theme uses negative margins, this is where the -1 comes from */
gtk_render_background (slider_context, cr, x + position, y - 1, 30, height + 2);
gtk_render_frame (slider_context, cr, x + position, y - 1, 30, height + 2);
*height = 0;
query_size (scrollbar_context, NULL, height);
query_size (contents_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
gtk_style_context_get (slider_context, gtk_style_context_get_state (slider_context),
"min-width", &slider_width, NULL);
draw_style_common (scrollbar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (contents_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (slider_context, cr, x + position, y, slider_width, *height, NULL, NULL, NULL, NULL);
g_object_unref (slider_context);
g_object_unref (trough_context);
@@ -387,10 +584,13 @@ draw_check (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
GtkStateFlags state)
GtkStateFlags state,
gint *width,
gint *height)
{
GtkStyleContext *button_context;
GtkStyleContext *check_context;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkCheckButton docs, see "CSS nodes" */
button_context = get_style (NULL, "checkbutton");
@@ -398,9 +598,14 @@ draw_check (GtkWidget *widget,
gtk_style_context_set_state (check_context, state);
gtk_render_background (check_context, cr, x, y, 20, 20);
gtk_render_frame (check_context, cr, x, y, 20, 20);
gtk_render_check (check_context, cr, x, y, 20, 20);
*width = *height = 0;
query_size (button_context, width, height);
query_size (check_context, width, height);
draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL);
draw_style_common (check_context, cr, x, y, *width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height);
g_object_unref (check_context);
g_object_unref (button_context);
@@ -412,10 +617,13 @@ draw_radio (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
GtkStateFlags state)
GtkStateFlags state,
gint *width,
gint *height)
{
GtkStyleContext *button_context;
GtkStyleContext *check_context;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkRadioButton docs, see "CSS nodes" */
button_context = get_style (NULL, "radiobutton");
@@ -423,9 +631,14 @@ draw_radio (GtkWidget *widget,
gtk_style_context_set_state (check_context, state);
gtk_render_background (check_context, cr, x, y, 20, 20);
gtk_render_frame (check_context, cr, x, y, 20, 20);
gtk_render_option (check_context, cr, x, y, 20, 20);
*width = *height = 0;
query_size (button_context, width, height);
query_size (check_context, width, height);
draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL);
draw_style_common (check_context, cr, x, y, *width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height);
g_object_unref (check_context);
g_object_unref (button_context);
@@ -438,69 +651,166 @@ draw_progress (GtkWidget *widget,
gint x,
gint y,
gint width,
gint height,
gint position)
gint position,
gint *height)
{
GtkStyleContext *bar_context;
GtkStyleContext *trough_context;
GtkStyleContext *progress_context;
/* This information is taken from the GtkProgressBar docs, see "CSS nodes" */
bar_context = get_style (NULL, "progressbar");
bar_context = get_style (NULL, "progressbar.horizontal");
trough_context = get_style (bar_context, "trough");
progress_context = get_style (trough_context, "progress");
progress_context = get_style (trough_context, "progress.left");
gtk_render_background (trough_context, cr, x, y, width, height);
gtk_render_frame (trough_context, cr, x, y, width, height);
gtk_render_background (progress_context, cr, x, y, position, height);
gtk_render_frame (progress_context, cr, x, y, position, height);
*height = 0;
query_size (bar_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (progress_context, NULL, height);
draw_style_common (bar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (progress_context, cr, x, y, position, *height, NULL, NULL, NULL, NULL);
g_object_unref (progress_context);
g_object_unref (trough_context);
g_object_unref (bar_context);
}
static void
draw_scale (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
gint *height)
{
GtkStyleContext *scale_context;
GtkStyleContext *contents_context;
GtkStyleContext *trough_context;
GtkStyleContext *slider_context;
GtkStyleContext *highlight_context;
gint contents_x, contents_y, contents_width, contents_height;
gint trough_height, slider_height;
scale_context = get_style (NULL, "scale.horizontal");
contents_context = get_style (scale_context, "contents");
trough_context = get_style (contents_context, "trough");
slider_context = get_style (trough_context, "slider");
highlight_context = get_style (trough_context, "highlight.top");
*height = 0;
query_size (scale_context, NULL, height);
query_size (contents_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
query_size (highlight_context, NULL, height);
draw_style_common (scale_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (contents_context, cr, contents_x, contents_y, contents_width, contents_height,
&contents_x, &contents_y, &contents_width, &contents_height);
/* Scale trough defines its size querying slider and highlight */
trough_height = 0;
query_size (trough_context, NULL, &trough_height);
slider_height = 0;
query_size (slider_context, NULL, &slider_height);
query_size (highlight_context, NULL, &slider_height);
trough_height += slider_height;
draw_style_common (trough_context, cr, contents_x, contents_y, contents_width, trough_height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (highlight_context, cr, contents_x, contents_y,
contents_width / 2, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (slider_context, cr, contents_x + position, contents_y, contents_height, contents_height,
NULL, NULL, NULL, NULL);
g_object_unref (scale_context);
g_object_unref (contents_context);
g_object_unref (trough_context);
g_object_unref (slider_context);
g_object_unref (highlight_context);
}
static void
draw_combobox (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gboolean has_entry)
gboolean has_entry,
gint *height)
{
GtkStyleContext *combo_context;
GtkStyleContext *box_context;
GtkStyleContext *button_context;
GtkStyleContext *button_box_context;
GtkStyleContext *entry_context;
GtkStyleContext *arrow_context;
gint contents_x, contents_y, contents_width, contents_height;
gint button_width;
gint arrow_width, arrow_height, arrow_size;
/* This information is taken from the GtkComboBox docs, see "CSS nodes" */
combo_context = get_style (NULL, "combobox:focus");
button_context = get_style (combo_context, "button:focus");
entry_context = get_style (combo_context, "entry:focus");
arrow_context = get_style (button_context, "arrow");
gtk_render_background (combo_context, cr, x, y, width, 30);
gtk_render_frame (combo_context, cr, x, y, width, 30);
box_context = get_style (combo_context, "box.horizontal.linked");
if (has_entry)
{
gtk_style_context_set_junction_sides (entry_context, GTK_JUNCTION_RIGHT);
gtk_render_background (entry_context, cr, x, y, width - 30, 30);
gtk_render_frame (entry_context, cr, x, y, width - 30, 30);
const char *siblings[3] = { "entry.combo:focus", "button.combo" , NULL };
gtk_render_background (button_context, cr, x + width - 30, y, 30, 30);
gtk_render_frame (button_context, cr, x + width - 30, y, 30, 30);
entry_context = get_style_with_siblings (box_context, "entry.combo:focus", siblings, 0);
button_context = get_style_with_siblings (box_context, "button.combo", siblings, 1);
}
else
{
gtk_render_background (button_context, cr, x, y, width, 30);
gtk_render_frame (button_context, cr, x, y, width, 30);
const char *siblings[2] = { "button.combo" , NULL };
button_context = get_style_with_siblings (box_context, "button.combo", siblings, 0);
}
button_box_context = get_style (button_context, "box.horizontal");
arrow_context = get_style (button_box_context, "arrow");
*height = 0;
query_size (combo_context, NULL, height);
query_size (box_context, NULL, height);
if (has_entry)
query_size (entry_context, NULL, height);
query_size (button_context, NULL, height);
query_size (button_box_context, NULL, height);
query_size (arrow_context, NULL, height);
gtk_style_context_get (arrow_context, gtk_style_context_get_state (arrow_context),
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (combo_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (box_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
if (has_entry)
{
button_width = *height;
draw_style_common (entry_context, cr, x, y, width - button_width, *height, NULL, NULL, NULL, NULL);
draw_style_common (button_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
}
else
{
button_width = width;
draw_style_common (button_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
}
gtk_render_arrow (arrow_context, cr, G_PI / 2, x + width - 25, y+5, 20);
draw_style_common (button_box_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (arrow_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
gtk_render_arrow (arrow_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
g_object_unref (arrow_context);
g_object_unref (entry_context);
if (has_entry)
g_object_unref (entry_context);
g_object_unref (button_context);
g_object_unref (combo_context);
}
@@ -510,44 +820,59 @@ draw_spinbutton (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width)
gint width,
gint *height)
{
GtkStyleContext *spin_context;
GtkStyleContext *entry_context;
GtkStyleContext *up_context;
GtkStyleContext *down_context;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GdkPixbuf *pixbuf;
gint icon_width, icon_height, icon_size;
gint button_width;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkSpinButton docs, see "CSS nodes" */
spin_context = get_style (NULL, "spinbutton:focus");
spin_context = get_style (NULL, "spinbutton.horizontal:focus");
entry_context = get_style (NULL, "entry:focus");
up_context = get_style (spin_context, "button.up:active");
down_context = get_style (spin_context, "button.down");
up_context = get_style (spin_context, "button.up:focus:active");
down_context = get_style (spin_context, "button.down:focus");
gtk_render_background (entry_context, cr, x, y, width, 30);
gtk_render_frame (entry_context, cr, x, y, width, 30);
*height = 0;
query_size (spin_context, NULL, height);
query_size (entry_context, NULL, height);
query_size (up_context, NULL, height);
query_size (down_context, NULL, height);
button_width = *height;
gtk_render_background (up_context, cr, x + width - 30, y, 30, 30);
gtk_render_frame (up_context, cr, x + width - 30, y, 30, 30);
gtk_render_background (down_context, cr, x + width - 60, y, 30, 30);
gtk_render_frame (down_context, cr, x + width - 60, y, 30, 30);
draw_style_common (spin_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (entry_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (widget));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", 20, 0);
gtk_style_context_get (up_context, gtk_style_context_get_state (up_context),
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL);
g_object_unref (icon_info);
gtk_render_icon (up_context, cr, pixbuf, x + width - 30 + 5, y + 5);
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (up_context, cr, pixbuf, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", 20, 0);
gtk_style_context_get (down_context, gtk_style_context_get_state (down_context),
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL);
g_object_unref (icon_info);
gtk_render_icon (down_context, cr, pixbuf, x + width - 60 + 5, y + 5);
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (down_context, cr, pixbuf, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
g_object_unref (down_context);
@@ -561,39 +886,64 @@ draw_cb (GtkWidget *widget,
cairo_t *cr)
{
gint panewidth, width, height;
gint x, y;
width = gtk_widget_get_allocated_width (widget);
panewidth = width / 2;
height = gtk_widget_get_allocated_height (widget);
cairo_rectangle (cr, 0, 0, width, height);
cairo_set_source_rgb (cr, 0.6, 0.6, 0.6);
cairo_set_source_rgb (cr, 0.9, 0.9, 0.9);
cairo_fill (cr);
draw_horizontal_scrollbar (widget, cr, 10, 10, panewidth - 20, 12, 30, GTK_STATE_FLAG_NORMAL);
draw_horizontal_scrollbar (widget, cr, 10, 30, panewidth - 20, 12, 40, GTK_STATE_FLAG_PRELIGHT);
draw_horizontal_scrollbar (widget, cr, 10, 50, panewidth - 20, 12, 50, GTK_STATE_FLAG_ACTIVE|GTK_STATE_FLAG_PRELIGHT);
x = y = 10;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 30, GTK_STATE_FLAG_NORMAL, &height);
y += height + 8;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 40, GTK_STATE_FLAG_PRELIGHT, &height);
y += height + 8;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 50, GTK_STATE_FLAG_ACTIVE|GTK_STATE_FLAG_PRELIGHT, &height);
draw_text (widget, cr, 10, 70, panewidth - 20, 20, "Not selected", GTK_STATE_FLAG_NORMAL);
draw_text (widget, cr, 10, 100, panewidth - 20, 20, "Selected", GTK_STATE_FLAG_SELECTED);
y += height + 8;
draw_text (widget, cr, x, y, panewidth - 20, 20, "Not selected", GTK_STATE_FLAG_NORMAL);
y += 20 + 10;
draw_text (widget, cr, x, y, panewidth - 20, 20, "Selected", GTK_STATE_FLAG_SELECTED);
draw_check (widget, cr, 10, 130, GTK_STATE_FLAG_NORMAL);
draw_check (widget, cr, 40, 130, GTK_STATE_FLAG_CHECKED);
draw_radio (widget, cr, 70, 130, GTK_STATE_FLAG_NORMAL);
draw_radio (widget, cr, 100, 130, GTK_STATE_FLAG_CHECKED);
draw_progress (widget, cr, 10, 160, panewidth - 20, 6, 50);
x = 10;
y += 20 + 10;
draw_check (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height);
x += width + 10;
draw_check (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height);
x += width + 10;
draw_radio (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height);
x += width + 10;
draw_radio (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height);
x = 10;
draw_menu (widget, cr, 10 + panewidth, 10, panewidth - 20, 90);
y += height + 10;
draw_progress (widget, cr, x, y, panewidth - 20, 50, &height);
draw_menubar (widget, cr, 10 + panewidth, 110, panewidth - 20, 20);
y += height + 10;
draw_scale (widget, cr, x, y, panewidth - 20, 75, &height);
draw_spinbutton (widget, cr, 10 + panewidth, 140, panewidth - 20);
y += height + 20;
draw_notebook (widget, cr, x, y, panewidth - 20, 160);
draw_notebook (widget, cr, 10, 200, panewidth - 20, 160);
/* Second column */
x += panewidth;
y = 10;
draw_menu (widget, cr, x, y, panewidth - 20, &height);
draw_combobox (widget, cr, 10 + panewidth, 200, panewidth - 20, FALSE);
y += height + 10;
draw_menubar (widget, cr, x, y, panewidth - 20, &height);
draw_combobox (widget, cr, 10 + panewidth, 240, panewidth - 20, TRUE);
y += height + 20;
draw_spinbutton (widget, cr, x, y, panewidth - 20, &height);
y += height + 30;
draw_combobox (widget, cr, x, y, panewidth - 20, FALSE, &height);
y += height + 10;
draw_combobox (widget, cr, 10 + panewidth, y, panewidth - 20, TRUE, &height);
return FALSE;
}
+67 -4
View File
@@ -8,6 +8,34 @@
#include <gtk/gtk.h>
static GtkWidget *stack;
static GtkWidget *view;
static GtkWidget *view2;
static void
source_toggled (GtkToggleButton *button)
{
if (gtk_toggle_button_get_active (button))
gtk_stack_set_visible_child_name (GTK_STACK (stack), "source");
else
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
gchar *markup;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
gtk_text_buffer_get_bounds (buffer, &start, &end);
markup = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_insert_markup (buffer, &start, markup, -1);
g_free (markup);
gtk_stack_set_visible_child_name (GTK_STACK (stack), "formatted");
}
}
GtkWidget *
do_markup (GtkWidget *do_widget)
{
@@ -15,12 +43,13 @@ do_markup (GtkWidget *do_widget)
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkTextIter iter;
GBytes *bytes;
const gchar *markup;
GtkWidget *header;
GtkWidget *show_source;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
@@ -29,19 +58,49 @@ do_markup (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
stack = gtk_stack_new ();
gtk_widget_show (stack);
gtk_container_add (GTK_CONTAINER (window), stack);
show_source = gtk_check_button_new_with_label ("Source");
gtk_widget_set_valign (show_source, GTK_ALIGN_CENTER);
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
header = gtk_header_bar_new ();
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
gtk_widget_show_all (header);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_title (GTK_WINDOW (window), "Markup");
view = gtk_text_view_new ();
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 10);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 10);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
gtk_widget_show_all (sw);
gtk_stack_add_named (GTK_STACK (stack), sw, "formatted");
view2 = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view2), GTK_WRAP_WORD);
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view2), 10);
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view2), 10);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view2);
gtk_widget_show_all (sw);
gtk_stack_add_named (GTK_STACK (stack), sw, "source");
bytes = g_resources_lookup_data ("/markup/markup.txt", 0, NULL);
markup = (const gchar *)g_bytes_get_data (bytes, NULL);
@@ -50,9 +109,13 @@ do_markup (GtkWidget *do_widget)
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert_markup (buffer, &iter, markup, -1);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter, markup, -1);
g_bytes_unref (bytes);
gtk_widget_show_all (sw);
gtk_widget_show (stack);
}
if (!gtk_widget_get_visible (window))
+2 -2
View File
@@ -1,9 +1,9 @@
Text sizes: <span size="xx-small">tiny</span> <span size="x-small">very small</span> <span size="small">small</span> <span size="medium">normal</span> <span size="large">large</span> <span size="x-large">very large</span> <span size="xx-large">huge</span>
Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span>
Text <span color="gray">c<span color="green">o</span>l<span color="tomato">o</span>rs</span> and <span background="pink">backgrounds</span>
Colorful <span underline="low" underline-color="blue"><span underline="double" underline-color="red">under</span>lines</span>
Colorful <span underline="low" underline-color="blue"><span underline="double" underline-color="red">under</span>lines</span> and <span background="pink"><span underline="error">mo</span><span underline="error" underline-color="green">re</span></span>
Colorful <span strikethrough="true" strikethrough-color="magenta">strikethroughs</span>
+1 -1
View File
@@ -345,7 +345,7 @@ gtk_mirror_bin_get_preferred_height (GtkWidget *widget,
gtk_mirror_bin_size_request (widget, &requisition);
*minimum = *natural = requisition.width;
*minimum = *natural = requisition.height;
}
static void
+36 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkGrid" id="grid">
<property name="row-spacing">6</property>
<property name="row-spacing">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
@@ -271,5 +271,40 @@
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">1</property>
<property name="spacing">10</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Plain</property>
<property name="halign">end</property>
</object>
<packing>
<property name="expand">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Destructive</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="visible">1</property>
<property name="label">Suggested</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
</interface>
+2 -1
View File
@@ -1,4 +1,4 @@
/* CSS Theming/Style Classes
/* Theming/Style Classes
*
* GTK+ uses CSS for theming. Style classes can be associated
* with widgets to inform the theme about intended rendering.
@@ -24,6 +24,7 @@ do_theming_style_classes (GtkWidget *do_widget)
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+18 -3
View File
@@ -26,12 +26,27 @@ IGNORE_HFILES= \
gdkkeysyms.h \
gdkinternals.h \
gdkprivate.h \
gdk*private.h \
gdk-private.h \
gdkapplaunchcontextprivate.h \
gdkcursorprivate.h \
gdkdevicemanagerprivate.h \
gdkdeviceprivate.h \
gdkdisplaymanagerprivate.h \
gdkdisplayprivate.h \
gdkdndprivate.h \
gdkframeclockprivate.h \
gdkglcontextprivate.h \
gdkkeysprivate.h \
gdkscreenprivate.h \
gdkseatdefaultprivate.h \
gdkseatprivate.h \
gdkvisualprivate.h \
keyname-table.h \
wayland/xdg-shell-client-protocol.h \
win32 \
x11 \
quartz
quartz \
broadway \
wayland
# Extra files to add when scanning
EXTRA_HFILES= \
+5 -1
View File
@@ -23,7 +23,6 @@
<xi:include href="xml/gdkdisplay.xml" />
<xi:include href="xml/gdkscreen.xml" />
<xi:include href="xml/gdkseat.xml" />
<xi:include href="xml/gdkdevicemanager.xml" />
<xi:include href="xml/gdkdevice.xml" />
<xi:include href="xml/regions.xml" />
<xi:include href="xml/pixbufs.xml" />
@@ -52,6 +51,7 @@
<reference>
<title>Deprecated</title>
<xi:include href="xml/colors.xml" />
<xi:include href="xml/gdkdevicemanager.xml" />
</reference>
<index id="api-index-full">
@@ -106,6 +106,10 @@
<title>Index of new symbols in 3.20</title>
<xi:include href="xml/api-index-3.20.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-22" role="3.22">
<title>Index of new symbols in 3.22</title>
<xi:include href="xml/api-index-3.22.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+2
View File
@@ -1005,6 +1005,7 @@ gdk_drag_context_get_dest_window
gdk_drag_context_get_protocol
gdk_drag_context_get_drag_window
gdk_drag_context_set_hotspot
gdk_drag_context_manage_dnd
<SUBSECTION Standard>
GDK_DRAG_CONTEXT
@@ -1343,6 +1344,7 @@ gdk_gl_context_set_debug_enabled
gdk_gl_context_get_debug_enabled
gdk_gl_context_set_forward_compatible
gdk_gl_context_get_forward_compatible
gdk_gl_context_is_legacy
<SUBSECTION>
GdkGLError
+21 -21
View File
@@ -44,7 +44,7 @@
<informalexample>
<para>Create a new file with the following content named <filename>example-0.c.</filename></para>
<programlisting><xi:include href="../../../../examples/window-default.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/window-default.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>
@@ -154,7 +154,7 @@
<title>Hello World in GTK+</title>
<para>Create a new file with the following content named example-1.c.</para>
<programlisting><xi:include href="../../../../examples/hello-world.c" parse="text">
<xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
@@ -233,7 +233,7 @@
<example id="gtk-getting-started-grid-packing">
<title>Packing buttons</title>
<para>Create a new file with the following content named example-2.c.</para>
<programlisting><xi:include href="../../../../examples/grid-packing.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/grid-packing.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
@@ -257,9 +257,9 @@
<example>
<title>Packing buttons with GtkBuilder</title>
<para>Create a new file with the following content named example-4.c.</para>
<programlisting><xi:include href="../../../../examples/builder.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/builder.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<para>Create a new file with the following content named builder.ui.</para>
<programlisting><xi:include href="../../../../examples/builder.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/builder.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
@@ -346,7 +346,7 @@
of our application class.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/main.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application1/main.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>All the application logic is in the application class, which
@@ -364,7 +364,7 @@
GIO <ulink url="https://developer.gnome.org/gio/2.36/GApplication.html#GApplication.description">documentation</ulink>.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Another important class that is part of the application support
@@ -373,7 +373,7 @@
window.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/exampleappwin.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application1/exampleappwin.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>As part of the initial setup of our application, we also
@@ -388,7 +388,7 @@
</informalfigure>
<informalexample>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.desktop" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application1/exampleapp.desktop" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Note that <replaceable>@<!-- -->bindir@</replaceable> needs to be replaced
@@ -420,7 +420,7 @@
</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application2/window.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application2/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To make use of this file in our application, we revisit
@@ -460,7 +460,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application2/exampleapp.gresource.xml" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application2/exampleapp.gresource.xml" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>This file has to be converted into a C source file that will be
@@ -598,7 +598,7 @@ example_app_window_open (ExampleAppWindow *win,
in a ui file, and add it as a resource to our binary.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application4/app-menu.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application4/app-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To associate the app menu with the application, we have to call
@@ -697,7 +697,7 @@ example_app_class_init (ExampleAppClass *class)
GSettings requires a schema that describes our settings:</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application5/org.gtk.exampleapp.gschema.xml" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application5/org.gtk.exampleapp.gschema.xml" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Before we can make use of this schema in our application,
@@ -749,13 +749,13 @@ example_app_window_init (ExampleAppWindow *win)
<para>Lets start with the template.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application6/prefs.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application6/prefs.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Next comes the dialog subclass.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application6/exampleappprefs.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application6/exampleappprefs.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Now we revisit the <literal>preferences_activated(<!-- -->)</literal> function in our
@@ -807,7 +807,7 @@ preferences_activated (GSimpleAction *action,
to slide out the search bar below the header bar.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application7/window.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application7/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>Implementing the search needs quite a few code changes that
@@ -887,7 +887,7 @@ example_app_window_init (ExampleAppWindow *win)
which demonstrates #GtkMenuButton, #GtkRevealer and #GtkListBox.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application8/window.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application8/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>The code to populate the sidebar with buttons for the words
@@ -898,7 +898,7 @@ example_app_window_init (ExampleAppWindow *win)
ui file.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application8/gears-menu.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application8/gears-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To connect the menuitem to the show-words setting, we use
@@ -957,7 +957,7 @@ example_app_window_init (ExampleAppWindow *win)
triggers the show-lines action:</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application9/gears-menu.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application9/gears-menu.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>To make this menu item do something, we create a property
@@ -1017,7 +1017,7 @@ example_app_window_init (ExampleAppWindow *win)
be a direct child of the window, and set its type to be titlebar.</para>
<informalexample>
<programlisting><xi:include href="../../../../examples/application10/window.ui" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/application10/window.ui" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</informalexample>
<para>A small extra bonus of using a header bar is that we get
@@ -1073,7 +1073,7 @@ example_app_window_init (ExampleAppWindow *win)
<example id="gtk-getting-started-drawing">
<title>Drawing in response to input</title>
<para>Create a new file with the following content named example-3.c.</para>
<programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
<programlisting><xi:include href="../../../../examples/drawing.c" parse="text"><xi:fallback>MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting>
</example>
<para>
You can compile the program above with GCC using:
+4
View File
@@ -488,6 +488,10 @@
<title>Index of new symbols in 3.20</title>
<xi:include href="xml/api-index-3.20.xml"><xi:fallback /></xi:include>
</index>
<index id="api-index-3-22" role="3.22">
<title>Index of new symbols in 3.22</title>
<xi:include href="xml/api-index-3.22.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
+1
View File
@@ -6625,6 +6625,7 @@ gtk_clipboard_wait_for_targets
gtk_clipboard_wait_is_target_available
gtk_clipboard_set_can_store
gtk_clipboard_store
gtk_clipboard_get_selection
<SUBSECTION Standard>
GTK_CLIPBOARD
GTK_TYPE_CLIPBOARD
+2 -2
View File
@@ -577,14 +577,14 @@ parse_input (BroadwayInput *input)
is_mask = buf[1] & 0x80;
data = buf + 2;
if (payload_len > 125)
if (payload_len == 126)
{
if (len < 4)
return;
payload_len = GUINT16_FROM_BE( *(guint16 *) data );
data += 2;
}
else if (payload_len > 126)
else if (payload_len == 127)
{
if (len < 10)
return;
-1
View File
@@ -1611,7 +1611,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
impl_class->set_decorations = gdk_broadway_window_set_decorations;
impl_class->get_decorations = gdk_broadway_window_get_decorations;
impl_class->set_functions = gdk_broadway_window_set_functions;
impl_class->set_functions = gdk_broadway_window_set_functions;
impl_class->begin_resize_drag = gdk_broadway_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_broadway_window_begin_move_drag;
impl_class->set_opacity = gdk_broadway_window_set_opacity;
+4
View File
@@ -138,6 +138,10 @@
* Devices may also have associated “keys” or
* macro buttons. Such keys can be globally set to map into normal X
* keyboard events. The mapping is set using gdk_device_set_key().
*
* In GTK+ 3.20, a new #GdkSeat object has been introduced that
* supersedes #GdkDeviceManager and should be preferred in newly
* written code.
*/
static void gdk_device_manager_set_property (GObject *object,
+3 -2
View File
@@ -686,6 +686,8 @@ gdk_drag_drop_done (GdkDragContext *context,
* cancelled through other means.
*
* Returns: #TRUE if the drag and drop operation is managed.
*
* Since: 3.20
**/
gboolean
gdk_drag_context_manage_dnd (GdkDragContext *context,
@@ -696,8 +698,7 @@ gdk_drag_context_manage_dnd (GdkDragContext *context,
g_return_val_if_fail (GDK_IS_WINDOW (ipc_window), FALSE);
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->manage_dnd)
return GDK_DRAG_CONTEXT_GET_CLASS (context)->manage_dnd (context, ipc_window,
actions);
return GDK_DRAG_CONTEXT_GET_CLASS (context)->manage_dnd (context, ipc_window, actions);
return FALSE;
}
+12 -13
View File
@@ -33,7 +33,7 @@
* @See_also: #GdkDisplay, #GdkDevice
*
* The #GdkSeat object represents a collection of input devices
* that belong to an user.
* that belong to a user.
*/
typedef struct _GdkSeatPrivate GdkSeatPrivate;
@@ -208,8 +208,9 @@ gdk_seat_get_capabilities (GdkSeat *seat)
* elsewhere.
* @event: (nullable): the event that is triggering the grab, or %NULL if none
* is available.
* @prepare_func: (nullable) (scope call) (closure prepare_func_data): function to prepare the window to be
* grabbed, it can be %NULL if @window is visible before this call.
* @prepare_func: (nullable) (scope call) (closure prepare_func_data): function to
* prepare the window to be grabbed, it can be %NULL if @window is
* visible before this call.
* @prepare_func_data: user data to pass to @prepare_func
*
* Grabs the seat so that all events corresponding to the given @capabilities
@@ -230,8 +231,8 @@ gdk_seat_get_capabilities (GdkSeat *seat)
* Note that if the event mask of a #GdkWindow has selected both button press
* and button release events, or touch begin and touch end, then a press event
* will cause an automatic grab until the button is released, equivalent to a
* grab on the window with @owner_events set to %TRUE. This performed as most
* applications expect to receive presses and releases in pairs.
* grab on the window with @owner_events set to %TRUE. This is done because most
* applications expect to receive paired press and release events.
*
* If you set up anything at the time you take the grab that needs to be
* cleaned up when the grab ends, you should handle the #GdkEventGrabBroken
@@ -291,8 +292,8 @@ gdk_seat_ungrab (GdkSeat *seat)
*
* Returns the slave devices that match the given capabilities.
*
* Returns: (transfer container) (element-type GdkDevice): A list of #GdkDevices. The list
* must be freed with g_list_free(), the elements are owned
* Returns: (transfer container) (element-type GdkDevice): A list of #GdkDevices.
* The list must be freed with g_list_free(), the elements are owned
* by GDK and must not be freed.
*
* Since: 3.20
@@ -316,8 +317,7 @@ gdk_seat_get_slaves (GdkSeat *seat,
* Returns the master device that routes pointer events.
*
* Returns: (transfer none) (nullable): a master #GdkDevice with pointer
* capabilities. This object is owned by GTK+ and must not be
* freed.
* capabilities. This object is owned by GTK+ and must not be freed.
*
* Since: 3.20
**/
@@ -339,8 +339,7 @@ gdk_seat_get_pointer (GdkSeat *seat)
* Returns the master device that routes keyboard events.
*
* Returns: (transfer none) (nullable): a master #GdkDevice with keyboard
* capabilities. This object is owned by GTK+ and must not be
* freed.
* capabilities. This object is owned by GTK+ and must not be freed.
*
* Since: 3.20
**/
@@ -377,8 +376,8 @@ gdk_seat_device_removed (GdkSeat *seat,
*
* Returns the #GdkDisplay this seat belongs to.
*
* Returns: (transfer none): a #GdkDisplay. This memory is owned by GTK+ and
* must not be freed.
* Returns: (transfer none): a #GdkDisplay. This object is owned by GTK+
* and must not be freed.
**/
GdkDisplay *
gdk_seat_get_display (GdkSeat *seat)
+24
View File
@@ -162,6 +162,16 @@
*/
#define GDK_VERSION_3_20 (G_ENCODE_VERSION (3, 20))
/**
* GDK_VERSION_3_22:
*
* A macro that evaluates to the 3.22 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 3.20
*/
#define GDK_VERSION_3_22 (G_ENCODE_VERSION (3, 22))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target
*/
@@ -388,5 +398,19 @@
# define GDK_AVAILABLE_IN_3_20 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_22
# define GDK_DEPRECATED_IN_3_22 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_3_22_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_3_22 _GDK_EXTERN
# define GDK_DEPRECATED_IN_3_22_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_3_22
# define GDK_AVAILABLE_IN_3_22 GDK_UNAVAILABLE(3, 22)
#else
# define GDK_AVAILABLE_IN_3_22 _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */
+16 -1
View File
@@ -303,9 +303,15 @@ gdk_visual_get_depth (GdkVisual *visual)
*
* Returns the byte order of this visual.
*
* The information returned by this function is only relevant
* when working with XImages, and not all backends return
* meaningful information for this.
*
* Returns: A #GdkByteOrder stating the byte order of @visual.
*
* Since: 2.22
*
* Deprecated: 3.22: This information is not useful
*/
GdkByteOrder
gdk_visual_get_byte_order (GdkVisual *visual)
@@ -321,9 +327,14 @@ gdk_visual_get_byte_order (GdkVisual *visual)
*
* Returns the size of a colormap for this visual.
*
* You have to use platform-specific APIs to manipulate colormaps.
*
* Returns: The size of a colormap that is suitable for @visual.
*
* Since: 2.22
*
* Deprecated: 3.22: This information is not useful, since GDK does not
* provide APIs to operate on colormaps.
*/
gint
gdk_visual_get_colormap_size (GdkVisual *visual)
@@ -339,9 +350,14 @@ gdk_visual_get_colormap_size (GdkVisual *visual)
*
* Returns the number of significant bits per red, green and blue value.
*
* Not all GDK backend provide a meaningful value for this function.
*
* Returns: The number of significant bits per color value for @visual.
*
* Since: 2.22
*
* Deprecated: 3.22. Use gdk_visual_get_red_pixel_details() and its variants to
* learn about the pixel layout of TrueColor and DirectColor visuals
*/
gint
gdk_visual_get_bits_per_rgb (GdkVisual *visual)
@@ -371,7 +387,6 @@ gdk_visual_get_pixel_details (GdkVisual *visual,
m >>= 1;
}
m = pixel_mask;
while (m & 0x1)
{
p++;
+3 -3
View File
@@ -115,11 +115,11 @@ GDK_AVAILABLE_IN_ALL
GdkVisualType gdk_visual_get_visual_type (GdkVisual *visual);
GDK_AVAILABLE_IN_ALL
gint gdk_visual_get_depth (GdkVisual *visual);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
GdkByteOrder gdk_visual_get_byte_order (GdkVisual *visual);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_visual_get_colormap_size (GdkVisual *visual);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_3_22
gint gdk_visual_get_bits_per_rgb (GdkVisual *visual);
GDK_AVAILABLE_IN_ALL
void gdk_visual_get_red_pixel_details (GdkVisual *visual,
+63 -29
View File
@@ -4078,44 +4078,77 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow *window,
GdkWindowChildFunc child_func,
gpointer user_data);
/* Returns true if window is a decendant of parent, but stops looking
* at the first native window. Also ensures that all parents match
* child_func if non-null..
*
* This is useful in combination with
* window->impl_window->native_children as it lets you find all native
* decendants in an efficient way (assuming few children are native).
*/
static gboolean
has_visible_ancestor_in_impl (GdkWindow *window,
GdkWindow *ancestor,
GdkWindowChildFunc child_func,
gpointer user_data)
{
GdkWindow *p;
GdkWindow *stop_at;
p = window->parent;
stop_at = p->impl_window;
while (p != NULL)
{
if (!p->viewable)
return FALSE;
if (child_func &&
!(*child_func) ((GdkWindow *)p, user_data))
return FALSE;
if (p == ancestor)
return TRUE;
if (p == stop_at)
return FALSE;
p = p->parent;
}
return FALSE;
}
static void
invalidate_impl_subwindows (GdkWindow *window,
const cairo_region_t *region,
GdkWindowChildFunc child_func,
gpointer user_data,
int dx, int dy)
gpointer user_data)
{
GList *tmp_list;
GList *l;
tmp_list = window->children;
while (tmp_list)
/* Iterate over all native children of the native window
that window is in. */
for (l = window->impl_window->native_children;
l != NULL;
l = l->next)
{
GdkWindow *child = tmp_list->data;
tmp_list = tmp_list->next;
GdkWindow *native_child = l->data;
cairo_region_t *tmp;
int dx, dy;
if (child->input_only ||
!window->viewable)
if (native_child->input_only)
continue;
if (child_func && (*child_func) ((GdkWindow *)child, user_data))
{
if (gdk_window_has_impl (child))
{
cairo_region_t *tmp = cairo_region_copy (region);
cairo_region_translate (tmp, -dx - child->x, -dy - child->y);
gdk_window_invalidate_maybe_recurse_full (child,
tmp, child_func, user_data);
cairo_region_destroy (tmp);
}
else
{
invalidate_impl_subwindows (child,
region,
child_func, user_data,
dx + child->x, dy + child->y);
}
}
/* Then skip any that does not have window as an ancestor,
* also checking that the ancestors are visible and pass child_func
* This is fast if we assume native children are rare */
if (!has_visible_ancestor_in_impl (native_child, window,
child_func, user_data))
continue;
dx = native_child->parent->abs_x + native_child->x - window->abs_x;
dy = native_child->parent->abs_y + native_child->y - window->abs_y;
tmp = cairo_region_copy (region);
cairo_region_translate (tmp, -dx, -dy);
gdk_window_invalidate_maybe_recurse_full (native_child,
tmp, child_func, user_data);
cairo_region_destroy (tmp);
}
}
@@ -4145,7 +4178,8 @@ gdk_window_invalidate_maybe_recurse_full (GdkWindow *window,
visible_region = cairo_region_copy (region);
invalidate_impl_subwindows (window, region, child_func, user_data, 0, 0);
if (child_func)
invalidate_impl_subwindows (window, region, child_func, user_data);
display = gdk_window_get_display (window);
if (gdk_display_get_debug_updates (display))
+4 -1
View File
@@ -921,6 +921,9 @@ fill_pinch_event (GdkWindow *window,
FP_STATE_IDLE,
FP_STATE_UPDATE
} last_state = FP_STATE_IDLE;
GdkQuartzDeviceManagerCore *device_manager;
device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
event->any.type = GDK_TOUCHPAD_PINCH;
event->touchpad_pinch.window = window;
@@ -933,7 +936,7 @@ fill_pinch_event (GdkWindow *window,
event->touchpad_pinch.n_fingers = 2;
event->touchpad_pinch.dx = 0.0;
event->touchpad_pinch.dy = 0.0;
gdk_event_set_device (event, _gdk_display->core_pointer);
gdk_event_set_device (event, device_manager->core_pointer);
switch ([nsevent phase])
{
+13 -2
View File
@@ -121,6 +121,7 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
gboolean antialias)
{
CGContextRef cg_context;
CGSize scale;
if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
return NULL;
@@ -141,6 +142,12 @@ gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
CGContextSaveGState (cg_context);
CGContextSetAllowsAntialiasing (cg_context, antialias);
/* Undo the default scaling transform, since we apply our own
* in gdk_quartz_ref_cairo_surface () */
scale = CGContextConvertSizeToDeviceSpace (cg_context,
CGSizeMake (1.0, 1.0));
CGContextScaleCTM (cg_context, 1.0 / scale.width, 1.0 / scale.height);
return cg_context;
}
@@ -317,10 +324,14 @@ gdk_quartz_ref_cairo_surface (GdkWindow *window)
if (!impl->cairo_surface)
{
gint scale = gdk_window_get_scale_factor (impl->wrapper);
impl->cairo_surface =
gdk_quartz_create_cairo_surface (impl,
gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
gdk_window_get_width (impl->wrapper) * scale,
gdk_window_get_height (impl->wrapper) * scale);
cairo_surface_set_device_scale (impl->cairo_surface, scale, scale);
}
else
cairo_surface_reference (impl->cairo_surface);
File diff suppressed because it is too large Load Diff
+92
View File
@@ -230,6 +230,97 @@ postpone_on_globals_closure (GdkWaylandDisplay *display_wayland,
g_list_append (display_wayland->on_has_globals_closures, closure);
}
#ifdef G_ENABLE_DEBUG
static const char *
get_format_name (enum wl_shm_format format)
{
int i;
#define FORMAT(s) { WL_SHM_FORMAT_ ## s, #s }
struct { int format; const char *name; } formats[] = {
FORMAT(ARGB8888),
FORMAT(XRGB8888),
FORMAT(C8),
FORMAT(RGB332),
FORMAT(BGR233),
FORMAT(XRGB4444),
FORMAT(XBGR4444),
FORMAT(RGBX4444),
FORMAT(BGRX4444),
FORMAT(ARGB4444),
FORMAT(ABGR4444),
FORMAT(RGBA4444),
FORMAT(BGRA4444),
FORMAT(XRGB1555),
FORMAT(XBGR1555),
FORMAT(RGBX5551),
FORMAT(BGRX5551),
FORMAT(ARGB1555),
FORMAT(ABGR1555),
FORMAT(RGBA5551),
FORMAT(BGRA5551),
FORMAT(RGB565),
FORMAT(BGR565),
FORMAT(RGB888),
FORMAT(BGR888),
FORMAT(XBGR8888),
FORMAT(RGBX8888),
FORMAT(BGRX8888),
FORMAT(ABGR8888),
FORMAT(RGBA8888),
FORMAT(BGRA8888),
FORMAT(XRGB2101010),
FORMAT(XBGR2101010),
FORMAT(RGBX1010102),
FORMAT(BGRX1010102),
FORMAT(ARGB2101010),
FORMAT(ABGR2101010),
FORMAT(RGBA1010102),
FORMAT(BGRA1010102),
FORMAT(YUYV),
FORMAT(YVYU),
FORMAT(UYVY),
FORMAT(VYUY),
FORMAT(AYUV),
FORMAT(NV12),
FORMAT(NV21),
FORMAT(NV16),
FORMAT(NV61),
FORMAT(YUV410),
FORMAT(YVU410),
FORMAT(YUV411),
FORMAT(YVU411),
FORMAT(YUV420),
FORMAT(YVU420),
FORMAT(YUV422),
FORMAT(YVU422),
FORMAT(YUV444),
FORMAT(YVU444),
{ 0xffffffff, NULL }
};
#undef FORMAT
for (i = 0; formats[i].name; i++)
{
if (formats[i].format == format)
return formats[i].name;
}
return NULL;
}
#endif
static void
wl_shm_format (void *data,
struct wl_shm *wl_shm,
uint32_t format)
{
GDK_NOTE (MISC, g_message ("supported pixel format %s", get_format_name (format)));
}
static const struct wl_shm_listener wl_shm_listener = {
wl_shm_format
};
static void
gdk_registry_handle_global (void *data,
struct wl_registry *registry,
@@ -254,6 +345,7 @@ gdk_registry_handle_global (void *data,
{
display_wayland->shm =
wl_registry_bind (display_wayland->wl_registry, id, &wl_shm_interface, 1);
wl_shm_add_listener (display_wayland->shm, &wl_shm_listener, display_wayland);
}
else if (strcmp (interface, "xdg_shell") == 0)
{
+14
View File
@@ -445,6 +445,19 @@ gdk_wayland_drag_context_cancel (GdkDragContext *context,
gdk_drag_context_set_cursor (context, NULL);
}
static void
gdk_wayland_drag_context_drop_done (GdkDragContext *context,
gboolean success)
{
GdkWaylandDragContext *context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
if (success)
{
if (context_wayland->dnd_window)
gdk_window_hide (context_wayland->dnd_window);
}
}
static void
gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
{
@@ -464,6 +477,7 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
context_class->get_selection = gdk_wayland_drag_context_get_selection;
context_class->get_drag_window = gdk_wayland_drag_context_get_drag_window;
context_class->set_hotspot = gdk_wayland_drag_context_set_hotspot;
context_class->drop_done = gdk_wayland_drag_context_drop_done;
context_class->manage_dnd = gdk_wayland_drag_context_manage_dnd;
context_class->set_cursor = gdk_wayland_drag_context_set_cursor;
context_class->action_changed = gdk_wayland_drag_context_action_changed;
+4 -1
View File
@@ -133,10 +133,13 @@ gdk_wayland_keymap_get_entries_for_keyval (GdkKeymap *keymap,
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
GArray *retval;
guint keycode;
xkb_keycode_t min_keycode, max_keycode;
retval = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
for (keycode = 8; keycode < 255; keycode++) /* FIXME: min/max keycode */
min_keycode = xkb_keymap_min_keycode (xkb_keymap);
max_keycode = xkb_keymap_max_keycode (xkb_keymap);
for (keycode = min_keycode; keycode < max_keycode; keycode++)
{
gint num_layouts, layout;
num_layouts = xkb_keymap_num_layouts_for_key (xkb_keymap, keycode);
+70 -10
View File
@@ -66,7 +66,6 @@ struct _GdkWaylandScreen
/* Xinerama/RandR 1.2 */
GPtrArray *monitors;
gint primary_monitor;
GHashTable *settings;
GsdXftSettings xft_settings;
@@ -77,8 +76,6 @@ struct _GdkWaylandScreen
struct _GdkWaylandScreenClass
{
GdkScreenClass parent_class;
void (* window_manager_changed) (GdkWaylandScreen *screen_wayland);
};
#define OUTPUT_VERSION_WITH_DONE 2
@@ -133,7 +130,6 @@ init_multihead (GdkScreen *screen)
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
screen_wayland->monitors = g_ptr_array_new_with_free_func (free_monitor);
screen_wayland->primary_monitor = 0;
}
static void
@@ -215,7 +211,7 @@ gdk_wayland_screen_get_n_monitors (GdkScreen *screen)
static gint
gdk_wayland_screen_get_primary_monitor (GdkScreen *screen)
{
return GDK_WAYLAND_SCREEN (screen)->primary_monitor;
return 0;
}
static gint
@@ -864,14 +860,20 @@ static GdkVisual*
gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
return GDK_WAYLAND_SCREEN (screen)->visual;
if (depth == 32)
return GDK_WAYLAND_SCREEN (screen)->visual;
else
return NULL;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
return GDK_WAYLAND_SCREEN (screen)->visual;
if (visual_type == GDK_VISUAL_TRUE_COLOR)
return GDK_WAYLAND_SCREEN (screen)->visual;
else
return NULL;
}
static GdkVisual*
@@ -879,7 +881,10 @@ gdk_wayland_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
return GDK_WAYLAND_SCREEN (screen)->visual;
if (depth == 32 && visual_type == GDK_VISUAL_TRUE_COLOR)
return GDK_WAYLAND_SCREEN (screen)->visual;
else
return NULL;
}
static void
@@ -921,6 +926,8 @@ gdk_wayland_screen_list_visuals (GdkScreen *screen)
#define GDK_TYPE_WAYLAND_VISUAL (_gdk_wayland_visual_get_type ())
#define GDK_WAYLAND_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_VISUAL, GdkWaylandVisual))
/* Currently, the Wayland backend only ever uses ARGB8888.
*/
static GdkVisual *
gdk_wayland_visual_new (GdkScreen *screen)
{
@@ -930,6 +937,9 @@ gdk_wayland_visual_new (GdkScreen *screen)
visual->screen = GDK_SCREEN (screen);
visual->type = GDK_VISUAL_TRUE_COLOR;
visual->depth = 32;
visual->red_mask = 0xff0000;
visual->green_mask = 0x00ff00;
visual->blue_mask = 0x0000ff;
visual->bits_per_rgb = 8;
return visual;
@@ -1061,6 +1071,56 @@ update_screen_size (GdkWaylandScreen *screen_wayland)
g_signal_emit_by_name (screen_wayland, "size-changed");
}
#ifdef G_ENABLE_DEBUG
static const char *
subpixel_to_string (int layout)
{
int i;
struct { int layout; const char *name; } layouts[] = {
{ WL_OUTPUT_SUBPIXEL_UNKNOWN, "unknown" },
{ WL_OUTPUT_SUBPIXEL_NONE, "none" },
{ WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB, "rgb" },
{ WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR, "bgr" },
{ WL_OUTPUT_SUBPIXEL_VERTICAL_RGB, "vrgb" },
{ WL_OUTPUT_SUBPIXEL_VERTICAL_BGR, "vbgr" },
{ 0xffffffff, NULL }
};
for (i = 0; layouts[i].name; i++)
{
if (layouts[i].layout == layout)
return layouts[i].name;
}
return NULL;
}
static const char *
transform_to_string (int transform)
{
int i;
struct { int transform; const char *name; } transforms[] = {
{ WL_OUTPUT_TRANSFORM_NORMAL, "normal" },
{ WL_OUTPUT_TRANSFORM_90, "90" },
{ WL_OUTPUT_TRANSFORM_180, "180" },
{ WL_OUTPUT_TRANSFORM_270, "270" },
{ WL_OUTPUT_TRANSFORM_FLIPPED, "flipped" },
{ WL_OUTPUT_TRANSFORM_FLIPPED_90, "flipped 90" },
{ WL_OUTPUT_TRANSFORM_FLIPPED_180, "flipped 180" },
{ WL_OUTPUT_TRANSFORM_FLIPPED_270, "flipped 270" },
{ 0xffffffff, NULL }
};
for (i = 0; transforms[i].name; i++)
{
if (transforms[i].transform == transform)
return transforms[i].name;
}
return NULL;
}
#endif
static void
output_handle_geometry (void *data,
struct wl_output *wl_output,
@@ -1076,8 +1136,8 @@ output_handle_geometry (void *data,
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
GDK_NOTE (MISC,
g_message ("handle geometry output %d, position %d %d, phys. size %d %d, manufacturer %s, model %s",
monitor->id, x, y, physical_width, physical_height, make, model));
g_message ("handle geometry output %d, position %d %d, phys. size %d %d, subpixel layout %s, manufacturer %s, model %s, transform %s",
monitor->id, x, y, physical_width, physical_height, subpixel_to_string (subpixel), make, model, transform_to_string (transform)));
monitor->geometry.x = x;
monitor->geometry.y = y;
-1
View File
@@ -31,7 +31,6 @@
#define GDK_IS_WAYLAND_SEAT_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_WAYLAND_SEAT))
#define GDK_WAYLAND_SEAT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_WAYLAND_SEAT, GdkWaylandSeatClass))
typedef struct _GdkWaylandSeat GdkWaylandDeviceData;
typedef struct _GdkWaylandSeat GdkWaylandSeat;
typedef struct _GdkWaylandSeatClass GdkWaylandSeatClass;
+5
View File
@@ -256,6 +256,11 @@ gdk_wayland_window_update_size (GdkWindow *window,
GdkRectangle area;
cairo_region_t *region;
if ((window->width == width) &&
(window->height == height) &&
(impl->scale == scale))
return;
drop_cairo_surfaces (window);
window->width = width;
+26 -20
View File
@@ -380,38 +380,46 @@ inner_clipboard_window_procedure (HWND hwnd,
case WM_CLIPBOARDUPDATE:
case WM_DRAWCLIPBOARD:
{
int success;
HWND hwndOwner;
#ifdef G_ENABLE_DEBUG
UINT nFormat = 0;
#endif
HWND hwnd_owner;
HWND hwnd_opener;
GdkEvent *event;
GdkWindow *owner;
success = OpenClipboard (hwnd);
if (!success)
{
g_warning ("Failed to OpenClipboard on window handle %p", hwnd);
return 0;
}
hwnd_owner = GetClipboardOwner ();
hwndOwner = GetClipboardOwner ();
owner = gdk_win32_window_lookup_for_display (_gdk_display, hwndOwner);
if (owner == NULL)
owner = gdk_win32_window_foreign_new_for_display (_gdk_display, hwndOwner);
if ((hwnd_owner == NULL) &&
(GetLastError () != ERROR_SUCCESS))
WIN32_API_FAILED ("GetClipboardOwner");
GDK_NOTE (DND, g_print (" drawclipboard owner: %p", hwndOwner));
hwnd_opener = GetOpenClipboardWindow ();
GDK_NOTE (DND, g_print (" drawclipboard owner: %p; opener %p ", hwnd_owner, hwnd_opener));
#ifdef G_ENABLE_DEBUG
if (_gdk_debug_flags & GDK_DEBUG_DND)
{
while ((nFormat = EnumClipboardFormats (nFormat)) != 0)
g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
if (OpenClipboard (hwnd))
{
UINT nFormat = 0;
while ((nFormat = EnumClipboardFormats (nFormat)) != 0)
g_print ("%s ", _gdk_win32_cf_to_string (nFormat));
CloseClipboard ();
}
else
{
WIN32_API_FAILED ("OpenClipboard");
}
}
#endif
GDK_NOTE (DND, g_print (" \n"));
owner = gdk_win32_window_lookup_for_display (_gdk_display, hwnd_owner);
if (owner == NULL)
owner = gdk_win32_window_foreign_new_for_display (_gdk_display, hwnd_owner);
event = gdk_event_new (GDK_OWNER_CHANGE);
event->owner_change.window = gdk_get_default_root_window ();
event->owner_change.owner = owner;
@@ -421,8 +429,6 @@ inner_clipboard_window_procedure (HWND hwnd,
event->owner_change.selection_time = GDK_CURRENT_TIME;
_gdk_win32_append_event (event);
CloseClipboard ();
if (_hwnd_next_viewer != NULL)
return SendMessage (_hwnd_next_viewer, message, wparam, lparam);
+148 -8
View File
@@ -278,10 +278,11 @@ _gdk_win32_window_procedure (HWND hwnd,
{
LRESULT retval;
GDK_NOTE (EVENTS, g_print ("%s%*s%s %p",
GDK_NOTE (EVENTS, g_print ("%s%*s%s %p %#x %#lx",
(debug_indent > 0 ? "\n" : ""),
debug_indent, "",
_gdk_win32_message_to_string (message), hwnd));
_gdk_win32_message_to_string (message), hwnd,
wparam, lparam));
debug_indent += 2;
retval = inner_window_procedure (hwnd, message, wparam, lparam);
debug_indent -= 2;
@@ -679,7 +680,9 @@ _gdk_win32_print_event (const GdkEvent *event)
default: g_assert_not_reached ();
}
g_print (" %p ", event->any.window ? GDK_WINDOW_HWND (event->any.window) : NULL);
g_print (" %p @ %ums ",
event->any.window ? GDK_WINDOW_HWND (event->any.window) : NULL,
gdk_event_get_time (event));
switch (event->any.type)
{
@@ -1053,17 +1056,17 @@ show_window_recurse (GdkWindow *window, gboolean hide_window)
{
if (gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED)
{
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
GtkShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
}
else
{
ShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
GtkShowWindow (GDK_WINDOW_HWND (window), SW_RESTORE);
}
}
}
else
{
ShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
GtkShowWindow (GDK_WINDOW_HWND (window), SW_MINIMIZE);
}
}
@@ -1907,6 +1910,77 @@ ensure_stacking_on_activate_app (MSG *msg,
}
}
static gboolean
handle_wm_sysmenu (GdkWindow *window, MSG *msg, gint *ret_valp)
{
GdkWindowImplWin32 *impl;
LONG_PTR style, tmp_style;
gboolean maximized, minimized;
LONG_PTR additional_styles;
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
style = GetWindowLongPtr (msg->hwnd, GWL_STYLE);
maximized = IsZoomed (msg->hwnd);
minimized = IsIconic (msg->hwnd);
additional_styles = 0;
if (!(style & WS_SYSMENU))
additional_styles |= WS_SYSMENU;
if (!maximized && !(style & WS_MAXIMIZEBOX))
additional_styles |= WS_MAXIMIZEBOX;
if (!minimized && !(style & WS_MINIMIZEBOX))
additional_styles |= WS_MINIMIZEBOX;
if (!minimized && !maximized && !(style & WS_SIZEBOX))
additional_styles |= WS_SIZEBOX;
if (additional_styles == 0)
/* The caller will eventually pass this to DefWindowProc (),
* only without the style dance, which isn't needed, as it turns out.
*/
return FALSE;
/* Note: This code will enable resizing, maximizing and minimizing windows
* via window menu even if these are non-CSD windows that were explicitly
* forbidden from doing this by removing the appropriate styles,
* or if these are CSD windows that were explicitly forbidden from doing
* this by removing appropriate decorations from the headerbar and/or
* changing hints or properties.
*
* If doing this for non-CSD windows is not desired,
* do a _gdk_win32_window_lacks_wm_decorations() check and return FALSE
* if it doesn't pass.
*
* If doing this for CSD windows with disabled decorations is not desired,
* tough luck - GDK can't know which CSD decorations are enabled, and which
* are not.
*
* If doing this for CSD windows with particular hints is not desired,
* check window hints here and return FALSE (DefWindowProc() will return
* FALSE later) or set *ret_valp to 0 and return TRUE.
*/
tmp_style = style | additional_styles;
GDK_NOTE (EVENTS, g_print (" Handling WM_SYSMENU: style 0x%lx -> 0x%lx\n", style, tmp_style));
impl->have_temp_styles = TRUE;
impl->temp_styles = additional_styles;
SetWindowLongPtr (msg->hwnd, GWL_STYLE, tmp_style);
*ret_valp = DefWindowProc (msg->hwnd, msg->message, msg->wParam, msg->lParam);
tmp_style = GetWindowLongPtr (msg->hwnd, GWL_STYLE);
style = tmp_style & ~additional_styles;
GDK_NOTE (EVENTS, g_print (" Handling WM_SYSMENU: style 0x%lx <- 0x%lx\n", style, tmp_style));
SetWindowLongPtr (msg->hwnd, GWL_STYLE, style);
impl->have_temp_styles = FALSE;
return TRUE;
}
gboolean
_gdk_win32_window_fill_min_max_info (GdkWindow *window,
MINMAXINFO *mmi)
@@ -1970,8 +2044,8 @@ _gdk_win32_window_fill_min_max_info (GdkWindow *window,
mmi->ptMaxSize.y = nearest_info.rcWork.bottom - nearest_info.rcWork.top;
}
mmi->ptMaxTrackSize.x = GetSystemMetrics (SM_CXMAXTRACK);
mmi->ptMaxTrackSize.y = GetSystemMetrics (SM_CYMAXTRACK);
mmi->ptMaxTrackSize.x = GetSystemMetrics (SM_CXVIRTUALSCREEN) + impl->margins_x;
mmi->ptMaxTrackSize.y = GetSystemMetrics (SM_CYVIRTUALSCREEN) + impl->margins_y;
}
return TRUE;
@@ -2214,6 +2288,48 @@ gdk_event_translate (MSG *msg,
if (GDK_WINDOW_DESTROYED (window))
break;
if (msg->message == WM_KEYUP &&
!GDK_WINDOW_DESTROYED (gdk_window_get_toplevel (window)) &&
_gdk_win32_window_lacks_wm_decorations (gdk_window_get_toplevel (window)) && /* For CSD only */
((GetKeyState (VK_LWIN) & 0x8000) ||
(GetKeyState (VK_RWIN) & 0x8000)))
{
GdkWin32AeroSnapCombo combo = GDK_WIN32_AEROSNAP_COMBO_NOTHING;
gboolean lshiftdown = GetKeyState (VK_LSHIFT) & 0x8000;
gboolean rshiftdown = GetKeyState (VK_RSHIFT) & 0x8000;
gboolean oneshiftdown = (lshiftdown || rshiftdown) && !(lshiftdown && rshiftdown);
switch (msg->wParam)
{
case VK_UP:
combo = GDK_WIN32_AEROSNAP_COMBO_UP;
break;
case VK_DOWN:
combo = GDK_WIN32_AEROSNAP_COMBO_DOWN;
break;
case VK_LEFT:
combo = GDK_WIN32_AEROSNAP_COMBO_LEFT;
break;
case VK_RIGHT:
combo = GDK_WIN32_AEROSNAP_COMBO_RIGHT;
break;
}
if (oneshiftdown && combo != GDK_WIN32_AEROSNAP_COMBO_NOTHING)
combo += 4;
/* These are the only combos that Windows WM does handle for us */
if (combo == GDK_WIN32_AEROSNAP_COMBO_SHIFTLEFT ||
combo == GDK_WIN32_AEROSNAP_COMBO_SHIFTRIGHT)
combo = GDK_WIN32_AEROSNAP_COMBO_NOTHING;
if (combo != GDK_WIN32_AEROSNAP_COMBO_NOTHING)
{
_gdk_win32_window_handle_aerosnap (gdk_window_get_toplevel (window), combo);
break;
}
}
event = gdk_event_new ((msg->message == WM_KEYDOWN ||
msg->message == WM_SYSKEYDOWN) ?
GDK_KEY_PRESS : GDK_KEY_RELEASE);
@@ -2856,6 +2972,30 @@ gdk_event_translate (MSG *msg,
}
break;
case WM_SYSMENU:
return_val = handle_wm_sysmenu (window, msg, ret_valp);
break;
case WM_INITMENU:
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (impl->have_temp_styles)
{
LONG_PTR window_style;
window_style = GetWindowLongPtr (GDK_WINDOW_HWND (window),
GWL_STYLE);
/* Handling WM_SYSMENU added extra styles to this window,
* remove them now.
*/
window_style &= ~impl->temp_styles;
SetWindowLongPtr (GDK_WINDOW_HWND (window),
GWL_STYLE,
window_style);
}
break;
case WM_SYSCOMMAND:
switch (msg->wParam)
{
+4 -3
View File
@@ -134,10 +134,11 @@ _gdk_win32_windowing_init (void)
void
_gdk_win32_api_failed (const gchar *where,
const gchar *api)
const gchar *api)
{
gchar *msg = g_win32_error_message (GetLastError ());
g_warning ("%s: %s failed: %s", where, api, msg);
DWORD error_code = GetLastError ();
gchar *msg = g_win32_error_message (error_code);
g_warning ("%s: %s failed with code %lu: %s", where, api, error_code, msg);
g_free (msg);
}
+18
View File
@@ -97,6 +97,18 @@
#define WM_MOUSEHWHEEL 0x20E
#endif
/* According to
* http://blog.airesoft.co.uk/2009/11/wm_messages/
* this is the actual internal name MS uses for this undocumented message.
* According to
* https://bugs.winehq.org/show_bug.cgi?id=15055
* wParam is 0
* lParam is a pair of virtual desktop coordinates for the popup
*/
#ifndef WM_SYSMENU
#define WM_SYSMENU 0x313
#endif
#ifndef CF_DIBV5
#define CF_DIBV5 17
#endif
@@ -524,6 +536,9 @@ void _gdk_win32_emit_configure_event (GdkWindow *window);
guint32 _gdk_win32_keymap_get_decimal_mark (void);
void _gdk_win32_window_handle_aerosnap (GdkWindow *window,
GdkWin32AeroSnapCombo combo);
gboolean _gdk_win32_get_window_rect (GdkWindow *window,
RECT *rect);
void _gdk_win32_do_emit_configure_event (GdkWindow *window,
@@ -537,6 +552,9 @@ gboolean _gdk_win32_window_fill_min_max_info (GdkWindow *window,
gboolean _gdk_win32_window_lacks_wm_decorations (GdkWindow *window);
BOOL WINAPI GtkShowWindow (HWND hwnd,
int cmd_show);
/* Initialization */
void _gdk_win32_windowing_init (void);
void _gdk_dnd_init (void);
+7 -6
View File
@@ -194,12 +194,6 @@ _gdk_win32_window_change_property (GdkWindow *window,
if (type == _utf8_string)
{
if (!OpenClipboard (GDK_WINDOW_HWND (window)))
{
WIN32_API_FAILED ("OpenClipboard");
return;
}
wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, &err);
if (err != NULL)
{
@@ -208,6 +202,13 @@ _gdk_win32_window_change_property (GdkWindow *window,
return;
}
if (!OpenClipboard (GDK_WINDOW_HWND (window)))
{
WIN32_API_FAILED ("OpenClipboard");
g_free (wcptr);
return;
}
wclen++; /* Terminating 0 */
size = wclen * 2;
for (i = 0; i < wclen; i++)
+2 -2
View File
@@ -492,6 +492,8 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
}
}
API_CALL (CloseClipboard, ());
GDK_NOTE (DND, {
int i;
@@ -514,8 +516,6 @@ _gdk_win32_display_convert_selection (GdkDisplay *display,
ntargets * sizeof (GdkAtom));
else
property = GDK_NONE;
API_CALL (CloseClipboard, ());
}
else if (selection == GDK_SELECTION_CLIPBOARD && target == _utf8_string)
{
File diff suppressed because it is too large Load Diff
+152
View File
@@ -46,6 +46,46 @@ typedef struct _GdkWindowImplWin32Class GdkWindowImplWin32Class;
#define GDK_IS_WINDOW_IMPL_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WINDOW_IMPL_WIN32))
#define GDK_WINDOW_IMPL_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WINDOW_IMPL_WIN32, GdkWindowImplWin32Class))
enum _GdkWin32AeroSnapCombo
{
GDK_WIN32_AEROSNAP_COMBO_NOTHING = 0,
GDK_WIN32_AEROSNAP_COMBO_UP,
GDK_WIN32_AEROSNAP_COMBO_DOWN,
GDK_WIN32_AEROSNAP_COMBO_LEFT,
GDK_WIN32_AEROSNAP_COMBO_RIGHT,
/* Same order as non-shift variants. We use it to do things like:
* AEROSNAP_UP + 4 = AEROSNAP_SHIFTUP
*/
GDK_WIN32_AEROSNAP_COMBO_SHIFTUP,
GDK_WIN32_AEROSNAP_COMBO_SHIFTDOWN,
GDK_WIN32_AEROSNAP_COMBO_SHIFTLEFT,
GDK_WIN32_AEROSNAP_COMBO_SHIFTRIGHT
};
typedef enum _GdkWin32AeroSnapCombo GdkWin32AeroSnapCombo;
enum _GdkWin32AeroSnapState
{
GDK_WIN32_AEROSNAP_STATE_UNDETERMINED = 0,
GDK_WIN32_AEROSNAP_STATE_HALFLEFT,
GDK_WIN32_AEROSNAP_STATE_HALFRIGHT,
GDK_WIN32_AEROSNAP_STATE_FULLUP,
/* Maximize state is only used by edge-snap */
GDK_WIN32_AEROSNAP_STATE_MAXIMIZE
};
typedef enum _GdkWin32AeroSnapState GdkWin32AeroSnapState;
struct _GdkRectangleDouble
{
gdouble x;
gdouble y;
gdouble width;
gdouble height;
};
typedef struct _GdkRectangleDouble GdkRectangleDouble;
enum _GdkW32WindowDragOp
{
GDK_WIN32_DRAGOP_NONE = 0,
@@ -58,6 +98,9 @@ typedef enum _GdkW32WindowDragOp GdkW32WindowDragOp;
struct _GdkW32DragMoveResizeContext
{
/* The window that is being moved/resized */
GdkWindow *window;
/* The kind of drag-operation going on. */
GdkW32WindowDragOp op;
@@ -97,6 +140,77 @@ struct _GdkW32DragMoveResizeContext
/* The cursor we should use while the operation is running. */
GdkCursor *cursor;
/* This window looks like an outline and is drawn under the window
* that is being dragged. It indicates the shape the dragged window
* will take if released at a particular point.
* Indicator window size always matches the target indicator shape,
* the the actual indicator drawn on it might not, depending on
* how much time elapsed since the animation started.
*/
HWND shape_indicator;
/* Used to draw the indicator */
cairo_surface_t *indicator_surface;
gint indicator_surface_width;
gint indicator_surface_height;
/* Size/position of shape_indicator */
GdkRectangle indicator_window_rect;
/* Indicator will animate to occupy this rectangle */
GdkRectangle indicator_target;
/* Indicator will start animating from this rectangle */
GdkRectangle indicator_start;
/* Timestamp of the animation start */
gint64 indicator_start_time;
/* Timer that drives the animation */
guint timer;
/* A special timestamp, if we want to draw not how
* the animation should look *now*, but how it should
* look at arbitrary moment of time.
* Set to 0 to tell GDK to use current time.
*/
gint64 draw_timestamp;
/* Indicates that a transformation was revealed:
*
* For drag-resize: If it's FALSE,
* then the pointer have not yet hit a trigger that triggers fullup.
* If TRUE, then the pointer did hit a trigger that triggers fullup
* at some point during this drag op.
* This is used to prevent drag-resize from triggering
* a transformation when first approaching a trigger of the work area -
* one must drag it all the way to the very trigger to trigger; afterwards
* a transformation will start triggering at some distance from the trigger
* for as long as the op is still running. This is how AeroSnap works.
*
* For drag-move: If it's FALSE,
* then the pointer have not yet hit a trigger, even if it is
* already within a edge region.
* If it's TRUE, then the pointer did hit a trigger within an
* edge region, and have not yet left an edge region
* (passing from one edge region into another doesn't count).
*/
gboolean revealed;
/* Arrays of GdkRectangle pairs, describing the areas of the virtual
* desktop that trigger various AeroSnap window transofrmations
* Coordinates are GDK screen coordinates.
*/
GArray *halfleft_regions;
GArray *halfright_regions;
GArray *maximize_regions;
GArray *fullup_regions;
/* Current pointer position will result in this kind of snapping,
* if the drag op is finished.
*/
GdkWin32AeroSnapState current_snap;
};
typedef struct _GdkW32DragMoveResizeContext GdkW32DragMoveResizeContext;
@@ -130,6 +244,17 @@ struct _GdkWindowImplWin32
gint initial_x;
gint initial_y;
/* left/right/top/bottom width of the shadow/resize-grip around the window */
RECT margins;
/* left+right and top+bottom from @margins */
gint margins_x;
gint margins_y;
/* Set to TRUE when GTK tells us that margins are 0 everywhere.
* We don't actually set margins to 0, we just set this bit.
*/
guint zero_margins : 1;
guint no_bg : 1;
guint inhibit_configure : 1;
guint override_redirect : 1;
@@ -141,6 +266,11 @@ struct _GdkWindowImplWin32
*/
guint layered : 1;
/* If TRUE, the @temp_styles is set to the styles that were temporarily
* added to this window.
*/
guint have_temp_styles : 1;
/* GDK does not keep window contents around, it just draws new
* stuff over the window where changes occurred.
* cache_surface retains old window contents, because
@@ -168,11 +298,33 @@ struct _GdkWindowImplWin32
GdkW32DragMoveResizeContext drag_move_resize_context;
/* Remembers where the window was snapped.
* Some snap operations change their meaning if
* the window is already snapped.
*/
GdkWin32AeroSnapState snap_state;
/* Remembers window position before it was snapped.
* This is used to unsnap it.
* Position and size are percentages of the workarea
* of the monitor on which the window was before it was snapped.
*/
GdkRectangleDouble *snap_stash;
/* Also remember the same position, but in absolute form. */
GdkRectangle *snap_stash_int;
/* Decorations set by gdk_window_set_decorations() or NULL if unset */
GdkWMDecoration* decorations;
/* No. of windows to force layered windows off */
guint suppress_layered;
/* Temporary styles that this window got for the purpose of
* handling WM_SYSMENU.
* They are removed at the first opportunity (usually WM_INITMENU).
*/
LONG_PTR temp_styles;
};
struct _GdkWindowImplWin32Class
+4 -1
View File
@@ -2616,7 +2616,10 @@ gdk_x11_drag_context_drop_done (GdkDragContext *context,
cairo_t *cr;
if (success)
return;
{
gdk_window_hide (x11_context->drag_window);
return;
}
win_surface = _gdk_window_ref_cairo_surface (x11_context->drag_window);
surface = gdk_window_create_similar_surface (x11_context->drag_window,
+1 -2
View File
@@ -738,8 +738,7 @@ gdk_x11_display_utf8_to_compound_text (GdkDisplay *display,
if (!locale_str)
{
if (!(error->domain = G_CONVERT_ERROR &&
error->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
if (!g_error_matches (error, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE))
{
g_warning ("Error converting from UTF-8 to '%s': %s",
charset, error->message);
+1 -2
View File
@@ -4510,7 +4510,7 @@ gdk_x11_window_get_decorations(GdkWindow *window,
static void
gdk_x11_window_set_functions (GdkWindow *window,
GdkWMFunction functions)
GdkWMFunction functions)
{
MotifWmHints hints;
@@ -5764,7 +5764,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->set_decorations = gdk_x11_window_set_decorations;
impl_class->get_decorations = gdk_x11_window_get_decorations;
impl_class->set_functions = gdk_x11_window_set_functions;
impl_class->set_functions = gdk_x11_window_set_functions;
impl_class->begin_resize_drag = gdk_x11_window_begin_resize_drag;
impl_class->begin_move_drag = gdk_x11_window_begin_move_drag;
impl_class->set_opacity = gdk_x11_window_set_opacity;
+15 -1
View File
@@ -173,6 +173,7 @@ gtk_public_h_sources = \
gtkdebug.h \
gtkdialog.h \
gtkdnd.h \
gtkdragdest.h \
gtkdragsource.h \
gtkdrawingarea.h \
gtkeditable.h \
@@ -519,6 +520,7 @@ gtk_private_h_sources = \
gtkprintutils.h \
gtkprivate.h \
gtkpixelcacheprivate.h \
gtkprogresstrackerprivate.h \
gtkquery.h \
gtkrangeprivate.h \
gtkrbtree.h \
@@ -567,6 +569,7 @@ gtk_private_h_sources = \
gtktooltipwindowprivate.h \
gtktreedatalist.h \
gtktreeprivate.h \
gtkutilsprivate.h \
gtkwidgetprivate.h \
gtkwidgetpathprivate.h \
gtkwin32drawprivate.h \
@@ -724,6 +727,7 @@ gtk_base_c_sources = \
gtkcsswidgetnode.c \
gtkcsswin32sizevalue.c \
gtkdialog.c \
gtkdragdest.c \
gtkdragsource.c \
gtkdrawingarea.c \
gtkeditable.c \
@@ -829,6 +833,7 @@ gtk_base_c_sources = \
gtkprivate.c \
gtkprivatetypebuiltins.c \
gtkprogressbar.c \
gtkprogresstracker.c \
gtkpixelcache.c \
gtkpopover.c \
gtkpopovermenu.c \
@@ -926,6 +931,7 @@ gtk_base_c_sources = \
gtktreeview.c \
gtktreeviewcolumn.c \
gtktypebuiltins.c \
gtkutils.c \
gtkvolumebutton.c \
gtkviewport.c \
gtkwidget.c \
@@ -1249,6 +1255,14 @@ gtk.gresource.xml: Makefile.am inspector/Makefile.inc
echo " <file alias='theme/HighContrastInverse/gtk.css'>theme/HighContrast/gtk-inverse.css</file>" >> $@; \
echo " <file>theme/HighContrast/gtk-contained.css</file>" >> $@; \
echo " <file>theme/HighContrast/gtk-contained-inverse.css</file>" >> $@; \
for f in $(srcdir)/theme/HighContrast/assets/*.png; do \
n=`basename $$f`; \
echo " <file preprocess='to-pixdata'>theme/HighContrast/assets/$$n</file>" >> $@; \
done; \
for f in $(srcdir)/theme/HighContrast/assets/*.svg; do \
n=`basename $$f`; \
echo " <file>theme/HighContrast/assets/$$n</file>" >> $@; \
done; \
echo " <file>theme/win32/gtk-win32-base.css</file>" >> $@; \
echo " <file>theme/win32/gtk.css</file>" >> $@; \
for f in $(srcdir)/cursor/*.png; do \
@@ -1499,7 +1513,7 @@ bin_PROGRAMS = \
gtk-query-settings \
gtk-launch
gtk_query_immodules_3_0_SOURCES = queryimmodules.c
gtk_query_immodules_3_0_SOURCES = queryimmodules.c gtkutils.c
gtk_query_immodules_3_0_LDADD = \
libgtk-3.la \
$(top_builddir)/gdk/libgdk-3.la \
+1
View File
@@ -41,6 +41,7 @@
#include "gtkcolorutils.h"
#include "gtkdnd.h"
#include "gtkdragsource.h"
#include "gtkdragdest.h"
#include "gtkdrawingarea.h"
#include "gtkframe.h"
#include "gtkgrid.h"
+3 -3
View File
@@ -881,7 +881,7 @@ gtk_style_properties_merge (GtkStyleProperties *props,
{
PropertyData *prop_to_merge = val;
PropertyData *prop;
guint i;
guint i, j;
prop = g_hash_table_lookup (priv->properties, key);
@@ -932,8 +932,8 @@ gtk_style_properties_merge (GtkStyleProperties *props,
array = g_value_get_boxed (_gtk_css_typed_value_get (value->value));
array_to_merge = g_value_get_boxed (_gtk_css_typed_value_get (data->value));
for (i = 0; i < array_to_merge->len; i++)
g_ptr_array_add (array, g_ptr_array_index (array_to_merge, i));
for (j = 0; j < array_to_merge->len; j++)
g_ptr_array_add (array, g_ptr_array_index (array_to_merge, j));
}
else if (replace || value->value == NULL)
{
+1
View File
@@ -84,6 +84,7 @@
#include <gtk/gtkdebug.h>
#include <gtk/gtkdialog.h>
#include <gtk/gtkdnd.h>
#include <gtk/gtkdragdest.h>
#include <gtk/gtkdragsource.h>
#include <gtk/gtkdrawingarea.h>
#include <gtk/gtkeditable.h>
+2 -1
View File
@@ -127,7 +127,8 @@ static const LicenseInfo gtk_license_info [] = {
{ N_("GNU General Public License, version 2 only"), "http://www.gnu.org/licenses/old-licenses/gpl-2.0.html" },
{ N_("GNU General Public License, version 3 only"), "http://www.gnu.org/licenses/gpl-3.0.html" },
{ N_("GNU Lesser General Public License, version 2.1 only"), "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" },
{ N_("GNU Lesser General Public License, version 3 only"), "http://www.gnu.org/licenses/lgpl-3.0.html" }
{ N_("GNU Lesser General Public License, version 3 only"), "http://www.gnu.org/licenses/lgpl-3.0.html" },
{ N_("GNU Affero General Public License, version 3 or later"), "http://www.gnu.org/licenses/agpl-3.0.html" }
};
typedef struct
+4 -1
View File
@@ -58,6 +58,7 @@ typedef struct _GtkAboutDialogPrivate GtkAboutDialogPrivate;
* @GTK_LICENSE_GPL_3_0_ONLY: The GNU General Public License, version 3.0 only. Since 3.12.
* @GTK_LICENSE_LGPL_2_1_ONLY: The GNU Lesser General Public License, version 2.1 only. Since 3.12.
* @GTK_LICENSE_LGPL_3_0_ONLY: The GNU Lesser General Public License, version 3.0 only. Since 3.12.
* @GTK_LICENSE_AGPL_3_0: The GNU Affero General Public License, version 3.0 or later. Since: 3.22.
*
* The type of license for an application.
*
@@ -83,7 +84,9 @@ typedef enum {
GTK_LICENSE_GPL_2_0_ONLY,
GTK_LICENSE_GPL_3_0_ONLY,
GTK_LICENSE_LGPL_2_1_ONLY,
GTK_LICENSE_LGPL_3_0_ONLY
GTK_LICENSE_LGPL_3_0_ONLY,
GTK_LICENSE_AGPL_3_0
} GtkLicense;
/**
+3 -2
View File
@@ -31,7 +31,7 @@
#include <string.h>
#include "gtkapplicationprivate.h"
#include "gtkclipboard.h"
#include "gtkclipboardprivate.h"
#include "gtkmarshalers.h"
#include "gtkmain.h"
#include "gtkrecentmanager.h"
@@ -1402,7 +1402,8 @@ gtk_application_set_app_menu (GtkApplication *application,
* Returns the menu model that has been set with
* gtk_application_set_app_menu().
*
* Returns: (transfer none): the application menu of @application
* Returns: (transfer none) (nullable): the application menu of @application
* or %NULL if no application menu has been set.
*
* Since: 3.4
*/
+2 -1
View File
@@ -73,6 +73,7 @@
#include "gtkcalendar.h"
#include "gtkdnd.h"
#include "gtkdragdest.h"
#include "gtkintl.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
@@ -397,7 +398,7 @@ gtk_calendar_class_init (GtkCalendarClass *class)
P_("Year"),
P_("The selected year"),
0, G_MAXINT >> 9, 0,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY|G_PARAM_EXPLICIT_NOTIFY));
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/**
* GtkCalendar:month:
+2
View File
@@ -739,6 +739,8 @@ gtk_cell_editable_event_box_class_init (GtkCellEditableEventBoxClass *class)
g_object_class_install_property (object_class, PROP_PATH,
g_param_spec_string ("path", NULL, NULL,
NULL, GTK_PARAM_READWRITE));
gtk_widget_class_set_css_name (widget_class, "acceleditor");
}
static void
+18
View File
@@ -2208,3 +2208,21 @@ _gtk_clipboard_store_all (void)
g_slist_free (displays);
}
/**
* gtk_clipboard_get_selection:
* @clipboard: a #GtkClipboard
*
* Gets the selection that this clipboard is for.
*
* Returns: the selection
*
* Since: 3.22
*/
GdkAtom
gtk_clipboard_get_selection (GtkClipboard *clipboard)
{
g_return_val_if_fail (GTK_IS_CLIPBOARD (clipboard), GDK_NONE);
return clipboard->selection;
}
+2 -4
View File
@@ -290,10 +290,8 @@ void gtk_clipboard_set_can_store (GtkClipboard *clipboard,
GDK_AVAILABLE_IN_ALL
void gtk_clipboard_store (GtkClipboard *clipboard);
/* private */
void _gtk_clipboard_handle_event (GdkEventOwnerChange *event);
void _gtk_clipboard_store_all (void);
GDK_AVAILABLE_IN_3_22
GdkAtom gtk_clipboard_get_selection (GtkClipboard *clipboard);
G_END_DECLS
+4
View File
@@ -83,6 +83,10 @@ struct _GtkClipboardClass
void (* owner_change) (GtkClipboard *clipboard,
GdkEventOwnerChange *event);
};
void _gtk_clipboard_handle_event (GdkEventOwnerChange *event);
void _gtk_clipboard_store_all (void);
G_END_DECLS
+1
View File
@@ -37,6 +37,7 @@
#include "gtkcolorchooserdialog.h"
#include "gtkcolorswatchprivate.h"
#include "gtkdnd.h"
#include "gtkdragdest.h"
#include "gtkdragsource.h"
#include "gtkmarshalers.h"
#include "gtkprivate.h"
+22 -17
View File
@@ -71,7 +71,7 @@ gtk_css_animated_style_is_static (GtkCssStyle *style)
for (list = animated->animations; list; list = list->next)
{
if (!_gtk_style_animation_is_static (list->data, animated->current_time))
if (!_gtk_style_animation_is_static (list->data))
return FALSE;
}
@@ -288,7 +288,10 @@ gtk_css_animated_style_create_css_transitions (GSList *animations,
{
animation = gtk_css_animated_style_find_transition (GTK_CSS_ANIMATED_STYLE (source), i);
if (animation)
animations = g_slist_prepend (animations, g_object_ref (animation));
{
animation = _gtk_style_animation_advance (animation, timestamp);
animations = g_slist_prepend (animations, animation);
}
continue;
}
@@ -301,8 +304,9 @@ gtk_css_animated_style_create_css_transitions (GSList *animations,
animation = _gtk_css_transition_new (i,
gtk_css_style_get_value (source, i),
_gtk_css_array_value_get_nth (timing_functions, i),
timestamp + delay * G_USEC_PER_SEC,
timestamp + (delay + duration) * G_USEC_PER_SEC);
timestamp,
duration * G_USEC_PER_SEC,
delay * G_USEC_PER_SEC);
animations = g_slist_prepend (animations, animation);
}
@@ -367,9 +371,9 @@ gtk_css_animated_style_create_css_animations (GSList *animation
if (animation)
{
animation = _gtk_css_animation_copy (GTK_CSS_ANIMATION (animation),
timestamp,
_gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)));
animation = _gtk_css_animation_advance_with_play_state (GTK_CSS_ANIMATION (animation),
timestamp,
_gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)));
}
else
{
@@ -400,8 +404,7 @@ gtk_css_animated_style_create_css_animations (GSList *animation
/* PUBLIC API */
static void
gtk_css_animated_style_apply_animations (GtkCssAnimatedStyle *style,
gint64 timestamp)
gtk_css_animated_style_apply_animations (GtkCssAnimatedStyle *style)
{
GSList *l;
@@ -409,9 +412,8 @@ gtk_css_animated_style_apply_animations (GtkCssAnimatedStyle *style,
{
GtkStyleAnimation *animation = l->data;
_gtk_style_animation_set_values (animation,
timestamp,
GTK_CSS_ANIMATED_STYLE (style));
_gtk_style_animation_apply_values (animation,
GTK_CSS_ANIMATED_STYLE (style));
}
}
@@ -448,7 +450,7 @@ gtk_css_animated_style_new (GtkCssStyle *base_style,
result->current_time = timestamp;
result->animations = animations;
gtk_css_animated_style_apply_animations (result, timestamp);
gtk_css_animated_style_apply_animations (result);
return GTK_CSS_STYLE (result);
}
@@ -464,18 +466,21 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
gtk_internal_return_val_if_fail (GTK_IS_CSS_ANIMATED_STYLE (source), NULL);
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (base), NULL);
if (timestamp == 0)
if (timestamp == 0 || timestamp == source->current_time)
return g_object_ref (source->style);
gtk_internal_return_val_if_fail (timestamp > source->current_time, NULL);
animations = NULL;
for (l = source->animations; l; l = l->next)
{
GtkStyleAnimation *animation = l->data;
if (_gtk_style_animation_is_finished (animation, timestamp))
if (_gtk_style_animation_is_finished (animation))
continue;
animations = g_slist_prepend (animations, g_object_ref (animation));
animation = _gtk_style_animation_advance (animation, timestamp);
animations = g_slist_prepend (animations, animation);
}
animations = g_slist_reverse (animations);
@@ -488,7 +493,7 @@ gtk_css_animated_style_new_advance (GtkCssAnimatedStyle *source,
result->current_time = timestamp;
result->animations = animations;
gtk_css_animated_style_apply_animations (result, timestamp);
gtk_css_animated_style_apply_animations (result);
return GTK_CSS_STYLE (result);
}
+64 -80
View File
@@ -22,41 +22,25 @@
#include "gtkcssanimationprivate.h"
#include "gtkcsseasevalueprivate.h"
#include "gtkprogresstrackerprivate.h"
#include <math.h>
G_DEFINE_TYPE (GtkCssAnimation, _gtk_css_animation, GTK_TYPE_STYLE_ANIMATION)
/* NB: Return value can be negative (if animation hasn't started yet) */
static gint64
gtk_css_animation_get_elapsed (GtkCssAnimation *animation,
gint64 for_time_us)
{
if (animation->play_state == GTK_CSS_PLAY_STATE_PAUSED)
return animation->timestamp;
else
return for_time_us - animation->timestamp;
}
/* NB: Return value can be negative and +-Inf */
static double
gtk_css_animation_get_iteration (GtkCssAnimation *animation,
gint64 for_time_us)
{
return (double) gtk_css_animation_get_elapsed (animation, for_time_us) / animation->duration;
}
static gboolean
gtk_css_animation_is_executing_at_iteration (GtkCssAnimation *animation,
double iteration)
gtk_css_animation_is_executing (GtkCssAnimation *animation)
{
GtkProgressState state = gtk_progress_tracker_get_state (&animation->tracker);
switch (animation->fill_mode)
{
case GTK_CSS_FILL_NONE:
return iteration >= 0 && iteration <= animation->iteration_count;
return state == GTK_PROGRESS_STATE_DURING;
case GTK_CSS_FILL_FORWARDS:
return iteration >= 0;
return state != GTK_PROGRESS_STATE_BEFORE;
case GTK_CSS_FILL_BACKWARDS:
return iteration <= animation->iteration_count;
return state != GTK_PROGRESS_STATE_AFTER;
case GTK_CSS_FILL_BOTH:
return TRUE;
default:
@@ -65,57 +49,58 @@ gtk_css_animation_is_executing_at_iteration (GtkCssAnimation *animation,
}
static double
gtk_css_animation_get_progress_from_iteration (GtkCssAnimation *animation,
double iteration)
gtk_css_animation_get_progress (GtkCssAnimation *animation)
{
gboolean reverse;
double completed;
iteration = CLAMP (iteration, 0.0, animation->iteration_count);
completed = floor (iteration);
gboolean reverse, odd_iteration;
gint cycle = gtk_progress_tracker_get_iteration_cycle (&animation->tracker);
odd_iteration = cycle % 2 > 0;
switch (animation->direction)
{
case GTK_CSS_DIRECTION_NORMAL:
reverse = completed == iteration && iteration > 0;
reverse = FALSE;
break;
case GTK_CSS_DIRECTION_REVERSE:
reverse = !(completed == iteration && iteration > 0);
reverse = TRUE;
break;
case GTK_CSS_DIRECTION_ALTERNATE:
reverse = fmod (iteration, 2) >= 1.0;
reverse = odd_iteration;
break;
case GTK_CSS_DIRECTION_ALTERNATE_REVERSE:
reverse = !(fmod (iteration, 2) >= 1.0);
reverse = !odd_iteration;
break;
default:
g_return_val_if_reached (0.0);
}
iteration -= completed;
if (reverse)
iteration = 1.0 - iteration;
return gtk_progress_tracker_get_progress (&animation->tracker, reverse);
}
return iteration;
GtkStyleAnimation *
gtk_css_animation_advance (GtkStyleAnimation *style_animation,
gint64 timestamp)
{
GtkCssAnimation *animation = GTK_CSS_ANIMATION (style_animation);
return _gtk_css_animation_advance_with_play_state (animation,
timestamp,
animation->play_state);
}
static void
gtk_css_animation_set_values (GtkStyleAnimation *style_animation,
gint64 for_time_us,
GtkCssAnimatedStyle *style)
gtk_css_animation_apply_values (GtkStyleAnimation *style_animation,
GtkCssAnimatedStyle *style)
{
GtkCssAnimation *animation = GTK_CSS_ANIMATION (style_animation);
double iteration, progress;
double progress;
guint i;
iteration = gtk_css_animation_get_iteration (animation, for_time_us);
if (!gtk_css_animation_is_executing_at_iteration (animation, iteration))
if (!gtk_css_animation_is_executing (animation))
return;
progress = gtk_css_animation_get_progress_from_iteration (animation, iteration);
progress = gtk_css_animation_get_progress (animation);
progress = _gtk_css_ease_value_transform (animation->ease, progress);
for (i = 0; i < _gtk_css_keyframes_get_n_properties (animation->keyframes); i++)
{
GtkCssValue *value;
@@ -133,25 +118,20 @@ gtk_css_animation_set_values (GtkStyleAnimation *style_animation,
}
static gboolean
gtk_css_animation_is_finished (GtkStyleAnimation *style_animation,
gint64 at_time_us)
gtk_css_animation_is_finished (GtkStyleAnimation *style_animation)
{
return FALSE;
}
static gboolean
gtk_css_animation_is_static (GtkStyleAnimation *style_animation,
gint64 at_time_us)
gtk_css_animation_is_static (GtkStyleAnimation *style_animation)
{
GtkCssAnimation *animation = GTK_CSS_ANIMATION (style_animation);
double iteration;
if (animation->play_state == GTK_CSS_PLAY_STATE_PAUSED)
return TRUE;
iteration = gtk_css_animation_get_iteration (animation, at_time_us);
return iteration >= animation->iteration_count;
return gtk_progress_tracker_get_state (&animation->tracker) == GTK_PROGRESS_STATE_AFTER;
}
static void
@@ -174,7 +154,8 @@ _gtk_css_animation_class_init (GtkCssAnimationClass *klass)
object_class->finalize = gtk_css_animation_finalize;
animation_class->set_values = gtk_css_animation_set_values;
animation_class->advance = gtk_css_animation_advance;
animation_class->apply_values = gtk_css_animation_apply_values;
animation_class->is_finished = gtk_css_animation_is_finished;
animation_class->is_static = gtk_css_animation_is_static;
}
@@ -207,17 +188,16 @@ _gtk_css_animation_new (const char *name,
animation->name = g_strdup (name);
animation->keyframes = _gtk_css_keyframes_ref (keyframes);
if (play_state == GTK_CSS_PLAY_STATE_PAUSED)
animation->timestamp = - delay_us;
else
animation->timestamp = timestamp + delay_us;
animation->duration = duration_us;
animation->ease = _gtk_css_value_ref (ease);
animation->direction = direction;
animation->play_state = play_state;
animation->fill_mode = fill_mode;
animation->iteration_count = iteration_count;
gtk_progress_tracker_start (&animation->tracker, duration_us, delay_us, iteration_count);
if (animation->play_state == GTK_CSS_PLAY_STATE_PAUSED)
gtk_progress_tracker_skip_frame (&animation->tracker, timestamp);
else
gtk_progress_tracker_advance_frame (&animation->tracker, timestamp);
return GTK_STYLE_ANIMATION (animation);
}
@@ -231,24 +211,28 @@ _gtk_css_animation_get_name (GtkCssAnimation *animation)
}
GtkStyleAnimation *
_gtk_css_animation_copy (GtkCssAnimation *animation,
gint64 at_time_us,
GtkCssPlayState play_state)
_gtk_css_animation_advance_with_play_state (GtkCssAnimation *source,
gint64 timestamp,
GtkCssPlayState play_state)
{
g_return_val_if_fail (GTK_IS_CSS_ANIMATION (animation), NULL);
GtkCssAnimation *animation;
if (animation->play_state == play_state)
return g_object_ref (animation);
g_return_val_if_fail (GTK_IS_CSS_ANIMATION (source), NULL);
return _gtk_css_animation_new (animation->name,
animation->keyframes,
at_time_us,
- gtk_css_animation_get_elapsed (animation, at_time_us),
animation->duration,
animation->ease,
animation->direction,
play_state,
animation->fill_mode,
animation->iteration_count);
animation = g_object_new (GTK_TYPE_CSS_ANIMATION, NULL);
animation->name = g_strdup (source->name);
animation->keyframes = _gtk_css_keyframes_ref (source->keyframes);
animation->ease = _gtk_css_value_ref (source->ease);
animation->direction = source->direction;
animation->play_state = play_state;
animation->fill_mode = source->fill_mode;
gtk_progress_tracker_init_copy (&source->tracker, &animation->tracker);
if (animation->play_state == GTK_CSS_PLAY_STATE_PAUSED)
gtk_progress_tracker_skip_frame (&animation->tracker, timestamp);
else
gtk_progress_tracker_advance_frame (&animation->tracker, timestamp);
return GTK_STYLE_ANIMATION (animation);
}
+5 -6
View File
@@ -23,6 +23,7 @@
#include "gtkstyleanimationprivate.h"
#include "gtkcsskeyframesprivate.h"
#include "gtkprogresstrackerprivate.h"
G_BEGIN_DECLS
@@ -43,12 +44,10 @@ struct _GtkCssAnimation
char *name;
GtkCssKeyframes *keyframes;
GtkCssValue *ease;
gint64 timestamp; /* elapsed time when paused, start time when playing (can be negative) */
gint64 duration; /* duration of 1 cycle */
double iteration_count;
GtkCssDirection direction;
GtkCssPlayState play_state;
GtkCssFillMode fill_mode;
GtkProgressTracker tracker;
};
struct _GtkCssAnimationClass
@@ -69,9 +68,9 @@ GtkStyleAnimation * _gtk_css_animation_new (const char *
GtkCssFillMode fill_mode,
double iteration_count);
GtkStyleAnimation * _gtk_css_animation_copy (GtkCssAnimation *animation,
gint64 at_time_us,
GtkCssPlayState play_state);
GtkStyleAnimation * _gtk_css_animation_advance_with_play_state (GtkCssAnimation *animation,
gint64 timestamp,
GtkCssPlayState play_state);
const char * _gtk_css_animation_get_name (GtkCssAnimation *animation);
+46 -20
View File
@@ -61,12 +61,15 @@
* gtk_style_context_add_provider_for_screen().
* In addition, certain files will be read when GTK+ is initialized. First, the
* file $XDG_CONFIG_HOME/gtk-3.0/gtk.css` is loaded if it exists. Then, GTK+ tries
* to load `$HOME/.themes/theme-name/gtk-3.0/gtk.css`, falling back to
* file $XDG_CONFIG_HOME/gtk-3.0/gtk.css` is loaded if it exists. Then, GTK+
* loads the first existing file among
* `XDG_DATA_HOME/themes/theme-name/gtk-VERSION/gtk.css`,
* `$HOME/.themes/theme-name/gtk-VERSION/gtk.css`,
* `$XDG_DATA_DIRS/themes/theme-name/gtk-VERSION/gtk.css` and
* `DATADIR/share/themes/THEME/gtk-VERSION/gtk.css`, where THEME is the name of
* the current theme (see the #GtkSettings:gtk-theme-name setting), DATADIR
* is the prefix configured when GTK+ was compiled, unless overridden by the
* `GTK_DATA_PREFIX` environment variable, and VERSION is the GTK+ version number.
* is the prefix configured when GTK+ was compiled (unless overridden by the
* `GTK_DATA_PREFIX` environment variable), and VERSION is the GTK+ version number.
* If no file is found for the current version, GTK+ tries older versions all the
* way back to 3.0.
*
@@ -127,6 +130,7 @@ struct _GtkCssProviderPrivate
GArray *rulesets;
GtkCssSelectorTree *tree;
GResource *resource;
gchar *path;
};
enum {
@@ -824,6 +828,8 @@ gtk_css_provider_finalize (GObject *object)
priv->resource = NULL;
}
g_free (priv->path);
G_OBJECT_CLASS (gtk_css_provider_parent_class)->finalize (object);
}
@@ -901,7 +907,7 @@ gtk_css_provider_invalid_token (GtkCssProvider *provider,
"expected %s", expected);
}
static void
static void
css_provider_commit (GtkCssProvider *css_provider,
GSList *selectors,
GtkCssRuleset *ruleset)
@@ -944,6 +950,12 @@ gtk_css_provider_reset (GtkCssProvider *css_provider)
priv->resource = NULL;
}
if (priv->path)
{
g_free (priv->path);
priv->path = NULL;
}
g_hash_table_remove_all (priv->symbolic_colors);
g_hash_table_remove_all (priv->keyframes);
@@ -1973,18 +1985,23 @@ gtk_css_provider_get_default (void)
}
gchar *
_gtk_css_provider_get_theme_dir (void)
_gtk_get_theme_dir (void)
{
const gchar *var;
gchar *path;
var = g_getenv ("GTK_DATA_PREFIX");
if (var)
path = g_build_filename (var, "share", "themes", NULL);
else
path = g_build_filename (_gtk_get_data_prefix (), "share", "themes", NULL);
if (var == NULL)
var = _gtk_get_data_prefix ();
return g_build_filename (var, "share", "themes", NULL);
}
return path;
/* Return the path that this providers gtk.css was loaded from,
* if it is part of a theme, otherwise NULL.
*/
const gchar *
_gtk_css_provider_get_theme_dir (GtkCssProvider *provider)
{
return provider->priv->path;
}
#if (GTK_MINOR_VERSION % 2)
@@ -2055,9 +2072,11 @@ _gtk_css_find_theme (const gchar *name,
const gchar *variant)
{
gchar *path;
const gchar *var;
const char *const *dirs;
int i;
char *dir;
/* First look in the user's config directory */
/* First look in the user's data directory */
path = _gtk_css_find_theme_dir (g_get_user_data_dir (), "themes", name, variant);
if (path)
return path;
@@ -2067,12 +2086,19 @@ _gtk_css_find_theme (const gchar *name,
if (path)
return path;
/* Finally, try in the default theme directory */
var = g_getenv ("GTK_DATA_PREFIX");
if (!var)
var = _gtk_get_data_prefix ();
/* Look in system data directories */
dirs = g_get_system_data_dirs ();
for (i = 0; dirs[i]; i++)
{
path = _gtk_css_find_theme_dir (dirs[i], "themes", name, variant);
if (path)
return path;
}
path = _gtk_css_find_theme_dir (var, "share" G_DIR_SEPARATOR_S "themes", name, variant);
/* Finally, try in the default theme directory */
dir = _gtk_get_theme_dir ();
path = _gtk_css_find_theme_dir (dir, NULL, name, variant);
g_free (dir);
return path;
}
@@ -2137,9 +2163,9 @@ _gtk_css_provider_load_named (GtkCssProvider *provider,
/* Only set this after load, as load_from_path will clear it */
provider->priv->resource = resource;
provider->priv->path = dir;
g_free (path);
g_free (dir);
}
else
{
+3 -1
View File
@@ -22,7 +22,9 @@
G_BEGIN_DECLS
gchar *_gtk_css_provider_get_theme_dir (void);
gchar *_gtk_get_theme_dir (void);
const gchar *_gtk_css_provider_get_theme_dir (GtkCssProvider *provider);
void _gtk_css_provider_load_named (GtkCssProvider *provider,
const gchar *name,
-10
View File
@@ -22,16 +22,6 @@
#include "gtkcssparserprivate.h"
#include "gtkprivate.h"
/**
* GtkCssSection:
*
* Defines a part of a CSS document. Because sections are nested into
* one another, you can use gtk_css_section_get_parent() to get the
* containing region.
*
* Since: 3.2
*/
struct _GtkCssSection
{
gint ref_count;
+5 -2
View File
@@ -69,8 +69,11 @@ typedef enum
/**
* GtkCssSection:
*
* GtkCssSection is an auxiliary object containing information about
* the results of parsing a CSS style sheet.
* Defines a part of a CSS document. Because sections are nested into
* one another, you can use gtk_css_section_get_parent() to get the
* containing region.
*
* Since: 3.2
*/
typedef struct _GtkCssSection GtkCssSection;
+2 -2
View File
@@ -682,7 +682,7 @@ draw_shadow_corner (const GtkCssValue *shadow,
x2 = ceil (box->box.x + box->corner[corner].horizontal + clip_radius);
x = x1;
sx = 1;
max_other = MAX(box->corner[GTK_CSS_TOP_RIGHT].horizontal, box->corner[GTK_CSS_TOP_RIGHT].horizontal);
max_other = MAX(box->corner[GTK_CSS_TOP_RIGHT].horizontal, box->corner[GTK_CSS_BOTTOM_RIGHT].horizontal);
x3 = floor (box->box.x + box->box.width - max_other - clip_radius);
if (x2 > x3)
overlapped = TRUE;
@@ -693,7 +693,7 @@ draw_shadow_corner (const GtkCssValue *shadow,
x2 = ceil (box->box.x + box->box.width + clip_radius);
x = x2;
sx = -1;
max_other = MAX(box->corner[GTK_CSS_TOP_LEFT].horizontal, box->corner[GTK_CSS_TOP_LEFT].horizontal);
max_other = MAX(box->corner[GTK_CSS_TOP_LEFT].horizontal, box->corner[GTK_CSS_BOTTOM_LEFT].horizontal);
x3 = ceil (box->box.x + max_other + clip_radius);
if (x3 > x1)
overlapped = TRUE;
+48 -28
View File
@@ -22,60 +22,79 @@
#include "gtkcsstransitionprivate.h"
#include "gtkcsseasevalueprivate.h"
#include "gtkprogresstrackerprivate.h"
G_DEFINE_TYPE (GtkCssTransition, _gtk_css_transition, GTK_TYPE_STYLE_ANIMATION)
static void
gtk_css_transition_set_values (GtkStyleAnimation *animation,
gint64 for_time_us,
GtkCssAnimatedStyle *style)
static GtkStyleAnimation *
gtk_css_transition_advance (GtkStyleAnimation *style_animation,
gint64 timestamp)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
GtkCssTransition *source = GTK_CSS_TRANSITION (style_animation);
GtkCssTransition *transition;
transition = g_object_new (GTK_TYPE_CSS_TRANSITION, NULL);
transition->property = source->property;
transition->start = _gtk_css_value_ref (source->start);
transition->ease = _gtk_css_value_ref (source->ease);
gtk_progress_tracker_init_copy (&source->tracker, &transition->tracker);
gtk_progress_tracker_advance_frame (&transition->tracker, timestamp);
return GTK_STYLE_ANIMATION (transition);
}
static void
gtk_css_transition_apply_values (GtkStyleAnimation *style_animation,
GtkCssAnimatedStyle *style)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (style_animation);
GtkCssValue *value, *end;
double progress;
GtkProgressState state;
end = gtk_css_animated_style_get_intrinsic_value (style, transition->property);
if (transition->start_time >= for_time_us)
state = gtk_progress_tracker_get_state (&transition->tracker);
if (state == GTK_PROGRESS_STATE_BEFORE)
value = _gtk_css_value_ref (transition->start);
else if (transition->end_time > for_time_us)
else if (state == GTK_PROGRESS_STATE_DURING)
{
progress = (double) (for_time_us - transition->start_time) / (transition->end_time - transition->start_time);
progress = gtk_progress_tracker_get_progress (&transition->tracker, FALSE);
progress = _gtk_css_ease_value_transform (transition->ease, progress);
value = _gtk_css_value_transition (transition->start,
end,
transition->property,
progress);
if (value == NULL)
value = _gtk_css_value_ref (end);
}
else
value = NULL;
return;
if (value)
{
gtk_css_animated_style_set_animated_value (style, transition->property, value);
_gtk_css_value_unref (value);
}
if (value == NULL)
value = _gtk_css_value_ref (end);
gtk_css_animated_style_set_animated_value (style, transition->property, value);
_gtk_css_value_unref (value);
}
static gboolean
gtk_css_transition_is_finished (GtkStyleAnimation *animation,
gint64 at_time_us)
gtk_css_transition_is_finished (GtkStyleAnimation *animation)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
return at_time_us >= transition->end_time;
return gtk_progress_tracker_get_state (&transition->tracker) == GTK_PROGRESS_STATE_AFTER;
}
static gboolean
gtk_css_transition_is_static (GtkStyleAnimation *animation,
gint64 at_time_us)
gtk_css_transition_is_static (GtkStyleAnimation *animation)
{
GtkCssTransition *transition = GTK_CSS_TRANSITION (animation);
return at_time_us >= transition->end_time;
return gtk_progress_tracker_get_state (&transition->tracker) == GTK_PROGRESS_STATE_AFTER;
}
static void
@@ -97,7 +116,8 @@ _gtk_css_transition_class_init (GtkCssTransitionClass *klass)
object_class->finalize = gtk_css_transition_finalize;
animation_class->set_values = gtk_css_transition_set_values;
animation_class->advance = gtk_css_transition_advance;
animation_class->apply_values = gtk_css_transition_apply_values;
animation_class->is_finished = gtk_css_transition_is_finished;
animation_class->is_static = gtk_css_transition_is_static;
}
@@ -111,22 +131,22 @@ GtkStyleAnimation *
_gtk_css_transition_new (guint property,
GtkCssValue *start,
GtkCssValue *ease,
gint64 start_time_us,
gint64 end_time_us)
gint64 timestamp,
gint64 duration_us,
gint64 delay_us)
{
GtkCssTransition *transition;
g_return_val_if_fail (start != NULL, NULL);
g_return_val_if_fail (ease != NULL, NULL);
g_return_val_if_fail (start_time_us <= end_time_us, NULL);
transition = g_object_new (GTK_TYPE_CSS_TRANSITION, NULL);
transition->property = property;
transition->start = _gtk_css_value_ref (start);
transition->ease = _gtk_css_value_ref (ease);
transition->start_time = start_time_us;
transition->end_time = end_time_us;
gtk_progress_tracker_start (&transition->tracker, duration_us, delay_us, 1.0);
gtk_progress_tracker_advance_frame (&transition->tracker, timestamp);
return GTK_STYLE_ANIMATION (transition);
}
+8 -7
View File
@@ -21,6 +21,7 @@
#define __GTK_CSS_TRANSITION_PRIVATE_H__
#include "gtkstyleanimationprivate.h"
#include "gtkprogresstrackerprivate.h"
G_BEGIN_DECLS
@@ -38,11 +39,10 @@ struct _GtkCssTransition
{
GtkStyleAnimation parent;
guint property;
GtkCssValue *start;
GtkCssValue *ease;
gint64 start_time;
gint64 end_time;
guint property;
GtkCssValue *start;
GtkCssValue *ease;
GtkProgressTracker tracker;
};
struct _GtkCssTransitionClass
@@ -55,8 +55,9 @@ GType _gtk_css_transition_get_type (void) G_GNUC_CONST;
GtkStyleAnimation * _gtk_css_transition_new (guint property,
GtkCssValue *start,
GtkCssValue *ease,
gint64 start_time_us,
gint64 end_time_us);
gint64 timestamp,
gint64 duration_us,
gint64 delay_us);
guint _gtk_css_transition_get_property (GtkCssTransition *transition);
+2 -46
View File
@@ -337,42 +337,6 @@ gtk_drag_get_source_widget (GdkDragContext *context)
return info->source_widget;
}
/*************************************************************
* gtk_drag_highlight_draw:
* Callback for expose_event for highlighted widgets.
* arguments:
* widget:
* event:
* data:
* results:
*************************************************************/
static gboolean
gtk_drag_highlight_draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
int width = gtk_widget_get_allocated_width (widget);
int height = gtk_widget_get_allocated_height (widget);
GtkStyleContext *context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
gtk_render_frame (context, cr, 0, 0, width, height);
gtk_style_context_restore (context);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr,
0.5, 0.5,
width - 1, height - 1);
cairo_stroke (cr);
return FALSE;
}
/**
* gtk_drag_highlight: (method)
* @widget: a widget to highlight
@@ -382,11 +346,7 @@ gtk_drag_highlight (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_signal_connect_after (widget, "draw",
G_CALLBACK (gtk_drag_highlight_draw),
NULL);
gtk_widget_queue_draw (widget);
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE, FALSE);
}
/**
@@ -398,11 +358,7 @@ gtk_drag_unhighlight (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_highlight_draw,
NULL);
gtk_widget_queue_draw (widget);
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE);
}
static NSWindow *
+3 -492
View File
@@ -46,6 +46,7 @@
#include <gdk/wayland/gdkwayland.h>
#endif
#include "gtkdragdest.h"
#include "gtkgesturedrag.h"
#include "gtkgesturesingle.h"
#include "gtkicontheme.h"
@@ -79,7 +80,6 @@
static GSList *source_widgets = NULL;
typedef struct _GtkDragSourceInfo GtkDragSourceInfo;
typedef struct _GtkDragDestSite GtkDragDestSite;
typedef struct _GtkDragDestInfo GtkDragDestInfo;
@@ -121,19 +121,6 @@ struct _GtkDragSourceInfo
guint have_grab : 1; /* Do we still have the pointer grab */
};
struct _GtkDragDestSite
{
GtkDestDefaults flags;
GtkTargetList *target_list;
GdkDragAction actions;
GdkWindow *proxy_window;
GdkDragProtocol proxy_protocol;
guint do_proxy : 1;
guint proxy_coords : 1;
guint have_drag : 1;
guint track_motion : 1;
};
struct _GtkDragDestInfo
{
GtkWidget *widget; /* Widget in which drag is in */
@@ -192,10 +179,6 @@ static gboolean gtk_drag_find_widget (GtkWidget *widget,
static void gtk_drag_proxy_begin (GtkWidget *widget,
GtkDragDestInfo *dest_info,
guint32 time);
static void gtk_drag_dest_realized (GtkWidget *widget);
static void gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel);
static void gtk_drag_dest_site_destroy (gpointer data);
static void gtk_drag_dest_leave (GtkWidget *widget,
GdkDragContext *context,
guint time);
@@ -1025,381 +1008,6 @@ gtk_drag_unhighlight (GtkWidget *widget)
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_DROP_ACTIVE);
}
static void
gtk_drag_dest_set_internal (GtkWidget *widget,
GtkDragDestSite *site)
{
GtkDragDestSite *old_site;
g_return_if_fail (widget != NULL);
/* HACK, do this in the destroy */
old_site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
if (old_site)
{
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_realized,
old_site);
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_hierarchy_changed,
old_site);
site->track_motion = old_site->track_motion;
}
if (gtk_widget_get_realized (widget))
gtk_drag_dest_realized (widget);
g_signal_connect (widget, "realize",
G_CALLBACK (gtk_drag_dest_realized), site);
g_signal_connect (widget, "hierarchy-changed",
G_CALLBACK (gtk_drag_dest_hierarchy_changed), site);
g_object_set_data_full (G_OBJECT (widget), I_("gtk-drag-dest"),
site, gtk_drag_dest_site_destroy);
}
/**
* gtk_drag_dest_set: (method)
* @widget: a #GtkWidget
* @flags: which types of default drag behavior to use
* @targets: (allow-none) (array length=n_targets): a pointer to an array of
* #GtkTargetEntrys indicating the drop types that this @widget will
* accept, or %NULL. Later you can access the list with
* gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target().
* @n_targets: the number of entries in @targets
* @actions: a bitmask of possible actions for a drop onto this @widget.
*
* Sets a widget as a potential drop destination, and adds default behaviors.
*
* The default behaviors listed in @flags have an effect similar
* to installing default handlers for the widgets drag-and-drop signals
* (#GtkWidget::drag-motion, #GtkWidget::drag-drop, ...). They all exist
* for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is
* sufficient to connect to the widgets #GtkWidget::drag-data-received
* signal to get primitive, but consistent drag-and-drop support.
*
* Things become more complicated when you try to preview the dragged data,
* as described in the documentation for #GtkWidget::drag-motion. The default
* behaviors described by @flags make some assumptions, that can conflict
* with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes
* invokations of gdk_drag_status() in the context of #GtkWidget::drag-motion,
* and invokations of gtk_drag_finish() in #GtkWidget::drag-data-received.
* Especially the later is dramatic, when your own #GtkWidget::drag-motion
* handler calls gtk_drag_get_data() to inspect the dragged data.
*
* Theres no way to set a default action here, you can use the
* #GtkWidget::drag-motion callback for that. Heres an example which selects
* the action to use depending on whether the control key is pressed or not:
* |[<!-- language="C" -->
* static void
* drag_motion (GtkWidget *widget,
* GdkDragContext *context,
* gint x,
* gint y,
* guint time)
* {
* GdkModifierType mask;
*
* gdk_window_get_pointer (gtk_widget_get_window (widget),
* NULL, NULL, &mask);
* if (mask & GDK_CONTROL_MASK)
* gdk_drag_status (context, GDK_ACTION_COPY, time);
* else
* gdk_drag_status (context, GDK_ACTION_MOVE, time);
* }
* ]|
*/
void
gtk_drag_dest_set (GtkWidget *widget,
GtkDestDefaults flags,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_slice_new0 (GtkDragDestSite);
site->flags = flags;
site->have_drag = FALSE;
if (targets)
site->target_list = gtk_target_list_new (targets, n_targets);
else
site->target_list = NULL;
site->actions = actions;
site->do_proxy = FALSE;
site->proxy_window = NULL;
site->track_motion = FALSE;
gtk_drag_dest_set_internal (widget, site);
}
/**
* gtk_drag_dest_set_proxy: (method)
* @widget: a #GtkWidget
* @proxy_window: the window to which to forward drag events
* @protocol: the drag protocol which the @proxy_window accepts
* (You can use gdk_drag_get_protocol() to determine this)
* @use_coordinates: If %TRUE, send the same coordinates to the
* destination, because it is an embedded
* subwindow.
*
* Sets this widget as a proxy for drops to another window.
*/
void
gtk_drag_dest_set_proxy (GtkWidget *widget,
GdkWindow *proxy_window,
GdkDragProtocol protocol,
gboolean use_coordinates)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!proxy_window || GDK_IS_WINDOW (proxy_window));
site = g_slice_new (GtkDragDestSite);
site->flags = 0;
site->have_drag = FALSE;
site->target_list = NULL;
site->actions = 0;
site->proxy_window = proxy_window;
if (proxy_window)
g_object_ref (proxy_window);
site->do_proxy = TRUE;
site->proxy_protocol = protocol;
site->proxy_coords = use_coordinates;
site->track_motion = FALSE;
gtk_drag_dest_set_internal (widget, site);
}
/**
* gtk_drag_dest_unset: (method)
* @widget: a #GtkWidget
*
* Clears information about a drop destination set with
* gtk_drag_dest_set(). The widget will no longer receive
* notification of drags.
*/
void
gtk_drag_dest_unset (GtkWidget *widget)
{
GtkDragDestSite *old_site;
g_return_if_fail (GTK_IS_WIDGET (widget));
old_site = g_object_get_data (G_OBJECT (widget),
"gtk-drag-dest");
if (old_site)
{
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_realized,
old_site);
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_hierarchy_changed,
old_site);
}
g_object_set_data (G_OBJECT (widget), I_("gtk-drag-dest"), NULL);
}
/**
* gtk_drag_dest_get_target_list: (method)
* @widget: a #GtkWidget
*
* Returns the list of targets this widget can accept from
* drag-and-drop.
*
* Returns: (nullable) (transfer none): the #GtkTargetList, or %NULL if none
*/
GtkTargetList*
gtk_drag_dest_get_target_list (GtkWidget *widget)
{
GtkDragDestSite *site;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
return site ? site->target_list : NULL;
}
/**
* gtk_drag_dest_set_target_list: (method)
* @widget: a #GtkWidget thats a drag destination
* @target_list: (allow-none): list of droppable targets, or %NULL for none
*
* Sets the target types that this widget can accept from drag-and-drop.
* The widget must first be made into a drag destination with
* gtk_drag_dest_set().
*/
void
gtk_drag_dest_set_target_list (GtkWidget *widget,
GtkTargetList *target_list)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
if (!site)
{
g_warning ("Can't set a target list on a widget until you've called gtk_drag_dest_set() "
"to make the widget into a drag destination");
return;
}
if (target_list)
gtk_target_list_ref (target_list);
if (site->target_list)
gtk_target_list_unref (site->target_list);
site->target_list = target_list;
}
/**
* gtk_drag_dest_add_text_targets: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Add the text targets supported by #GtkSelectionData to
* the target list of the drag destination. The targets
* are added with @info = 0. If you need another value,
* use gtk_target_list_add_text_targets() and
* gtk_drag_dest_set_target_list().
*
* Since: 2.6
*/
void
gtk_drag_dest_add_text_targets (GtkWidget *widget)
{
GtkTargetList *target_list;
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_ref (target_list);
else
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_text_targets (target_list, 0);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
/**
* gtk_drag_dest_add_image_targets: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Add the image targets supported by #GtkSelectionData to
* the target list of the drag destination. The targets
* are added with @info = 0. If you need another value,
* use gtk_target_list_add_image_targets() and
* gtk_drag_dest_set_target_list().
*
* Since: 2.6
*/
void
gtk_drag_dest_add_image_targets (GtkWidget *widget)
{
GtkTargetList *target_list;
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_ref (target_list);
else
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_image_targets (target_list, 0, FALSE);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
/**
* gtk_drag_dest_add_uri_targets: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Add the URI targets supported by #GtkSelectionData to
* the target list of the drag destination. The targets
* are added with @info = 0. If you need another value,
* use gtk_target_list_add_uri_targets() and
* gtk_drag_dest_set_target_list().
*
* Since: 2.6
*/
void
gtk_drag_dest_add_uri_targets (GtkWidget *widget)
{
GtkTargetList *target_list;
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_ref (target_list);
else
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_uri_targets (target_list, 0);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
/**
* gtk_drag_dest_set_track_motion: (method)
* @widget: a #GtkWidget thats a drag destination
* @track_motion: whether to accept all targets
*
* Tells the widget to emit #GtkWidget::drag-motion and
* #GtkWidget::drag-leave events regardless of the targets and the
* %GTK_DEST_DEFAULT_MOTION flag.
*
* This may be used when a widget wants to do generic
* actions regardless of the targets that the source offers.
*
* Since: 2.10
*/
void
gtk_drag_dest_set_track_motion (GtkWidget *widget,
gboolean track_motion)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
g_return_if_fail (site != NULL);
site->track_motion = track_motion != FALSE;
}
/**
* gtk_drag_dest_get_track_motion: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Returns whether the widget has been configured to always
* emit #GtkWidget::drag-motion signals.
*
* Returns: %TRUE if the widget always emits
* #GtkWidget::drag-motion events
*
* Since: 2.10
*/
gboolean
gtk_drag_dest_get_track_motion (GtkWidget *widget)
{
GtkDragDestSite *site;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
site = g_object_get_data (G_OBJECT (widget), "gtk-drag-dest");
if (site)
return site->track_motion;
return FALSE;
}
/*
* _gtk_drag_dest_handle_event:
* @toplevel: Toplevel widget that received the event
@@ -1506,70 +1114,6 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
}
}
/**
* gtk_drag_dest_find_target: (method)
* @widget: drag destination widget
* @context: drag context
* @target_list: (allow-none): list of droppable targets, or %NULL to use
* gtk_drag_dest_get_target_list (@widget).
*
* Looks for a match between the supported targets of @context and the
* @dest_target_list, returning the first matching target, otherwise
* returning %GDK_NONE. @dest_target_list should usually be the return
* value from gtk_drag_dest_get_target_list(), but some widgets may
* have different valid targets for different parts of the widget; in
* that case, they will have to implement a drag_motion handler that
* passes the correct target list to this function.
*
* Returns: (transfer none): first target that the source offers
* and the dest can accept, or %GDK_NONE
*/
GdkAtom
gtk_drag_dest_find_target (GtkWidget *widget,
GdkDragContext *context,
GtkTargetList *target_list)
{
GList *tmp_target;
GList *tmp_source = NULL;
GtkWidget *source_widget;
g_return_val_if_fail (GTK_IS_WIDGET (widget), GDK_NONE);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_NONE);
source_widget = gtk_drag_get_source_widget (context);
if (target_list == NULL)
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list == NULL)
return GDK_NONE;
tmp_target = target_list->list;
while (tmp_target)
{
GtkTargetPair *pair = tmp_target->data;
tmp_source = gdk_drag_context_list_targets (context);
while (tmp_source)
{
if (tmp_source->data == GUINT_TO_POINTER (pair->target))
{
if ((!(pair->flags & GTK_TARGET_SAME_APP) || source_widget) &&
(!(pair->flags & GTK_TARGET_SAME_WIDGET) || (source_widget == widget)) &&
(!(pair->flags & GTK_TARGET_OTHER_APP) || !source_widget) &&
(!(pair->flags & GTK_TARGET_OTHER_WIDGET) || (source_widget != widget)))
return pair->target;
else
break;
}
tmp_source = tmp_source->next;
}
tmp_target = tmp_target->next;
}
return GDK_NONE;
}
static void
gtk_drag_selection_received (GtkWidget *widget,
GtkSelectionData *selection_data,
@@ -1875,39 +1419,6 @@ gtk_drag_clear_source_info (GdkDragContext *context)
g_object_set_qdata (G_OBJECT (context), dest_info_quark, NULL);
}
static void
gtk_drag_dest_realized (GtkWidget *widget)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel))
gdk_window_register_dnd (gtk_widget_get_window (toplevel));
}
static void
gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel) && gtk_widget_get_realized (toplevel))
gdk_window_register_dnd (gtk_widget_get_window (toplevel));
}
static void
gtk_drag_dest_site_destroy (gpointer data)
{
GtkDragDestSite *site = data;
if (site->proxy_window)
g_object_unref (site->proxy_window);
if (site->target_list)
gtk_target_list_unref (site->target_list);
g_slice_free (GtkDragDestSite, site);
}
/*
* Default drag handlers
*/
@@ -2765,7 +2276,6 @@ gtk_drag_set_icon_surface (GdkDragContext *context,
rgba_visual != NULL &&
gdk_screen_is_composited (screen);
gtk_window_set_screen (GTK_WINDOW (window), screen);
if (has_rgba)
@@ -2793,7 +2303,8 @@ gtk_drag_set_icon_surface (GdkDragContext *context,
cairo_region_destroy (region);
/* Need to saturate the colors, so it doesn't look like semi-transparent
* pixels were painted on black. */
* pixels were painted on black.
*/
saturated = gdk_window_create_similar_surface (gtk_widget_get_window (window),
CAIRO_CONTENT_COLOR,
extents.width,
-88
View File
@@ -37,56 +37,6 @@
G_BEGIN_DECLS
/**
* GtkDestDefaults:
* @GTK_DEST_DEFAULT_MOTION: If set for a widget, GTK+, during a drag over this
* widget will check if the drag matches this widgets list of possible targets
* and actions.
* GTK+ will then call gdk_drag_status() as appropriate.
* @GTK_DEST_DEFAULT_HIGHLIGHT: If set for a widget, GTK+ will draw a highlight on
* this widget as long as a drag is over this widget and the widget drag format
* and action are acceptable.
* @GTK_DEST_DEFAULT_DROP: If set for a widget, when a drop occurs, GTK+ will
* will check if the drag matches this widgets list of possible targets and
* actions. If so, GTK+ will call gtk_drag_get_data() on behalf of the widget.
* Whether or not the drop is successful, GTK+ will call gtk_drag_finish(). If
* the action was a move, then if the drag was successful, then %TRUE will be
* passed for the @delete parameter to gtk_drag_finish().
* @GTK_DEST_DEFAULT_ALL: If set, specifies that all default actions should
* be taken.
*
* The #GtkDestDefaults enumeration specifies the various
* types of action that will be taken on behalf
* of the user for a drag destination site.
*/
typedef enum {
GTK_DEST_DEFAULT_MOTION = 1 << 0,
GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1,
GTK_DEST_DEFAULT_DROP = 1 << 2,
GTK_DEST_DEFAULT_ALL = 0x07
} GtkDestDefaults;
/**
* GtkTargetFlags:
* @GTK_TARGET_SAME_APP: If this is set, the target will only be selected
* for drags within a single application.
* @GTK_TARGET_SAME_WIDGET: If this is set, the target will only be selected
* for drags within a single widget.
* @GTK_TARGET_OTHER_APP: If this is set, the target will not be selected
* for drags within a single application.
* @GTK_TARGET_OTHER_WIDGET: If this is set, the target will not be selected
* for drags withing a single widget.
*
* The #GtkTargetFlags enumeration is used to specify
* constraints on a #GtkTargetEntry.
*/
typedef enum {
GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
GTK_TARGET_SAME_WIDGET = 1 << 1, /*< nick=same-widget >*/
GTK_TARGET_OTHER_APP = 1 << 2, /*< nick=other-app >*/
GTK_TARGET_OTHER_WIDGET = 1 << 3 /*< nick=other-widget >*/
} GtkTargetFlags;
/* Destination side */
GDK_AVAILABLE_IN_ALL
@@ -108,44 +58,6 @@ void gtk_drag_highlight (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_unhighlight (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set (GtkWidget *widget,
GtkDestDefaults flags,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set_proxy (GtkWidget *widget,
GdkWindow *proxy_window,
GdkDragProtocol protocol,
gboolean use_coordinates);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_unset (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
GdkDragContext *context,
GtkTargetList *target_list);
GDK_AVAILABLE_IN_ALL
GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set_target_list (GtkWidget *widget,
GtkTargetList *target_list);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_add_text_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_add_image_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set_track_motion (GtkWidget *widget,
gboolean track_motion);
GDK_AVAILABLE_IN_ALL
gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget);
/* Source side */
GDK_AVAILABLE_IN_3_10
+15
View File
@@ -22,9 +22,24 @@
#include <gtk/gtkwidget.h>
#include <gtk/gtkselection.h>
#include <gtk/gtkdragdest.h>
#include "gtkimagedefinitionprivate.h"
typedef struct _GtkDragDestSite GtkDragDestSite;
struct _GtkDragDestSite
{
GtkDestDefaults flags;
GtkTargetList *target_list;
GdkDragAction actions;
GdkWindow *proxy_window;
GdkDragProtocol proxy_protocol;
guint do_proxy : 1;
guint proxy_coords : 1;
guint have_drag : 1;
guint track_motion : 1;
};
G_BEGIN_DECLS
GdkDragContext * gtk_drag_begin_internal (GtkWidget *widget,
+500
View File
@@ -0,0 +1,500 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gtkdragdest.h"
#include "gtkdnd.h"
#include "gtkdndprivate.h"
#include "gtkselectionprivate.h"
#include "gtkintl.h"
static void
gtk_drag_dest_realized (GtkWidget *widget)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel))
gdk_window_register_dnd (gtk_widget_get_window (toplevel));
}
static void
gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
GtkWidget *previous_toplevel)
{
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (gtk_widget_is_toplevel (toplevel) && gtk_widget_get_realized (toplevel))
gdk_window_register_dnd (gtk_widget_get_window (toplevel));
}
static void
gtk_drag_dest_site_destroy (gpointer data)
{
GtkDragDestSite *site = data;
if (site->proxy_window)
g_object_unref (site->proxy_window);
if (site->target_list)
gtk_target_list_unref (site->target_list);
g_slice_free (GtkDragDestSite, site);
}
static void
gtk_drag_dest_set_internal (GtkWidget *widget,
GtkDragDestSite *site)
{
GtkDragDestSite *old_site;
old_site = g_object_get_data (G_OBJECT (widget), I_("gtk-drag-dest"));
if (old_site)
{
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_realized,
old_site);
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_hierarchy_changed,
old_site);
site->track_motion = old_site->track_motion;
}
if (gtk_widget_get_realized (widget))
gtk_drag_dest_realized (widget);
g_signal_connect (widget, "realize",
G_CALLBACK (gtk_drag_dest_realized), site);
g_signal_connect (widget, "hierarchy-changed",
G_CALLBACK (gtk_drag_dest_hierarchy_changed), site);
g_object_set_data_full (G_OBJECT (widget), I_("gtk-drag-dest"),
site, gtk_drag_dest_site_destroy);
}
/**
* gtk_drag_dest_set: (method)
* @widget: a #GtkWidget
* @flags: which types of default drag behavior to use
* @targets: (allow-none) (array length=n_targets): a pointer to an array of
* #GtkTargetEntrys indicating the drop types that this @widget will
* accept, or %NULL. Later you can access the list with
* gtk_drag_dest_get_target_list() and gtk_drag_dest_find_target().
* @n_targets: the number of entries in @targets
* @actions: a bitmask of possible actions for a drop onto this @widget.
*
* Sets a widget as a potential drop destination, and adds default behaviors.
*
* The default behaviors listed in @flags have an effect similar
* to installing default handlers for the widgets drag-and-drop signals
* (#GtkWidget::drag-motion, #GtkWidget::drag-drop, ...). They all exist
* for convenience. When passing #GTK_DEST_DEFAULT_ALL for instance it is
* sufficient to connect to the widgets #GtkWidget::drag-data-received
* signal to get primitive, but consistent drag-and-drop support.
*
* Things become more complicated when you try to preview the dragged data,
* as described in the documentation for #GtkWidget::drag-motion. The default
* behaviors described by @flags make some assumptions, that can conflict
* with your own signal handlers. For instance #GTK_DEST_DEFAULT_DROP causes
* invokations of gdk_drag_status() in the context of #GtkWidget::drag-motion,
* and invokations of gtk_drag_finish() in #GtkWidget::drag-data-received.
* Especially the later is dramatic, when your own #GtkWidget::drag-motion
* handler calls gtk_drag_get_data() to inspect the dragged data.
*
* Theres no way to set a default action here, you can use the
* #GtkWidget::drag-motion callback for that. Heres an example which selects
* the action to use depending on whether the control key is pressed or not:
* |[<!-- language="C" -->
* static void
* drag_motion (GtkWidget *widget,
* GdkDragContext *context,
* gint x,
* gint y,
* guint time)
* {
* GdkModifierType mask;
*
* gdk_window_get_pointer (gtk_widget_get_window (widget),
* NULL, NULL, &mask);
* if (mask & GDK_CONTROL_MASK)
* gdk_drag_status (context, GDK_ACTION_COPY, time);
* else
* gdk_drag_status (context, GDK_ACTION_MOVE, time);
* }
* ]|
*/
void
gtk_drag_dest_set (GtkWidget *widget,
GtkDestDefaults flags,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_slice_new0 (GtkDragDestSite);
site->flags = flags;
site->have_drag = FALSE;
if (targets)
site->target_list = gtk_target_list_new (targets, n_targets);
else
site->target_list = NULL;
site->actions = actions;
site->do_proxy = FALSE;
site->proxy_window = NULL;
site->track_motion = FALSE;
gtk_drag_dest_set_internal (widget, site);
}
/**
* gtk_drag_dest_set_proxy: (method)
* @widget: a #GtkWidget
* @proxy_window: the window to which to forward drag events
* @protocol: the drag protocol which the @proxy_window accepts
* (You can use gdk_drag_get_protocol() to determine this)
* @use_coordinates: If %TRUE, send the same coordinates to the
* destination, because it is an embedded
* subwindow.
*
* Sets this widget as a proxy for drops to another window.
*/
void
gtk_drag_dest_set_proxy (GtkWidget *widget,
GdkWindow *proxy_window,
GdkDragProtocol protocol,
gboolean use_coordinates)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!proxy_window || GDK_IS_WINDOW (proxy_window));
site = g_slice_new (GtkDragDestSite);
site->flags = 0;
site->have_drag = FALSE;
site->target_list = NULL;
site->actions = 0;
site->proxy_window = proxy_window;
if (proxy_window)
g_object_ref (proxy_window);
site->do_proxy = TRUE;
site->proxy_protocol = protocol;
site->proxy_coords = use_coordinates;
site->track_motion = FALSE;
gtk_drag_dest_set_internal (widget, site);
}
/**
* gtk_drag_dest_unset: (method)
* @widget: a #GtkWidget
*
* Clears information about a drop destination set with
* gtk_drag_dest_set(). The widget will no longer receive
* notification of drags.
*/
void
gtk_drag_dest_unset (GtkWidget *widget)
{
GtkDragDestSite *old_site;
g_return_if_fail (GTK_IS_WIDGET (widget));
old_site = g_object_get_data (G_OBJECT (widget), I_("gtk-drag-dest"));
if (old_site)
{
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_realized,
old_site);
g_signal_handlers_disconnect_by_func (widget,
gtk_drag_dest_hierarchy_changed,
old_site);
}
g_object_set_data (G_OBJECT (widget), I_("gtk-drag-dest"), NULL);
}
/**
* gtk_drag_dest_get_target_list: (method)
* @widget: a #GtkWidget
*
* Returns the list of targets this widget can accept from
* drag-and-drop.
*
* Returns: (transfer none): the #GtkTargetList, or %NULL if none
*/
GtkTargetList *
gtk_drag_dest_get_target_list (GtkWidget *widget)
{
GtkDragDestSite *site;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
site = g_object_get_data (G_OBJECT (widget), I_("gtk-drag-dest"));
return site ? site->target_list : NULL;
}
/**
* gtk_drag_dest_set_target_list: (method)
* @widget: a #GtkWidget thats a drag destination
* @target_list: (allow-none): list of droppable targets, or %NULL for none
*
* Sets the target types that this widget can accept from drag-and-drop.
* The widget must first be made into a drag destination with
* gtk_drag_dest_set().
*/
void
gtk_drag_dest_set_target_list (GtkWidget *widget,
GtkTargetList *target_list)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_object_get_data (G_OBJECT (widget), I_("gtk-drag-dest"));
if (!site)
{
g_warning ("Can't set a target list on a widget until you've called gtk_drag_dest_set() "
"to make the widget into a drag destination");
return;
}
if (target_list)
gtk_target_list_ref (target_list);
if (site->target_list)
gtk_target_list_unref (site->target_list);
site->target_list = target_list;
}
/**
* gtk_drag_dest_add_text_targets: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Add the text targets supported by #GtkSelectionData to
* the target list of the drag destination. The targets
* are added with @info = 0. If you need another value,
* use gtk_target_list_add_text_targets() and
* gtk_drag_dest_set_target_list().
*
* Since: 2.6
*/
void
gtk_drag_dest_add_text_targets (GtkWidget *widget)
{
GtkTargetList *target_list;
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_ref (target_list);
else
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_text_targets (target_list, 0);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
/**
* gtk_drag_dest_add_image_targets: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Add the image targets supported by #GtkSelectionData to
* the target list of the drag destination. The targets
* are added with @info = 0. If you need another value,
* use gtk_target_list_add_image_targets() and
* gtk_drag_dest_set_target_list().
*
* Since: 2.6
*/
void
gtk_drag_dest_add_image_targets (GtkWidget *widget)
{
GtkTargetList *target_list;
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_ref (target_list);
else
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_image_targets (target_list, 0, FALSE);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
/**
* gtk_drag_dest_add_uri_targets: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Add the URI targets supported by #GtkSelectionData to
* the target list of the drag destination. The targets
* are added with @info = 0. If you need another value,
* use gtk_target_list_add_uri_targets() and
* gtk_drag_dest_set_target_list().
*
* Since: 2.6
*/
void
gtk_drag_dest_add_uri_targets (GtkWidget *widget)
{
GtkTargetList *target_list;
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list)
gtk_target_list_ref (target_list);
else
target_list = gtk_target_list_new (NULL, 0);
gtk_target_list_add_uri_targets (target_list, 0);
gtk_drag_dest_set_target_list (widget, target_list);
gtk_target_list_unref (target_list);
}
/**
* gtk_drag_dest_set_track_motion: (method)
* @widget: a #GtkWidget thats a drag destination
* @track_motion: whether to accept all targets
*
* Tells the widget to emit #GtkWidget::drag-motion and
* #GtkWidget::drag-leave events regardless of the targets and the
* %GTK_DEST_DEFAULT_MOTION flag.
*
* This may be used when a widget wants to do generic
* actions regardless of the targets that the source offers.
*
* Since: 2.10
*/
void
gtk_drag_dest_set_track_motion (GtkWidget *widget,
gboolean track_motion)
{
GtkDragDestSite *site;
g_return_if_fail (GTK_IS_WIDGET (widget));
site = g_object_get_data (G_OBJECT (widget), I_("gtk-drag-dest"));
g_return_if_fail (site != NULL);
site->track_motion = track_motion != FALSE;
}
/**
* gtk_drag_dest_get_track_motion: (method)
* @widget: a #GtkWidget thats a drag destination
*
* Returns whether the widget has been configured to always
* emit #GtkWidget::drag-motion signals.
*
* Returns: %TRUE if the widget always emits
* #GtkWidget::drag-motion events
*
* Since: 2.10
*/
gboolean
gtk_drag_dest_get_track_motion (GtkWidget *widget)
{
GtkDragDestSite *site;
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
site = g_object_get_data (G_OBJECT (widget), I_("gtk-drag-dest"));
if (site)
return site->track_motion;
return FALSE;
}
/**
* gtk_drag_dest_find_target: (method)
* @widget: drag destination widget
* @context: drag context
* @target_list: (allow-none): list of droppable targets, or %NULL to use
* gtk_drag_dest_get_target_list (@widget).
*
* Looks for a match between the supported targets of @context and the
* @dest_target_list, returning the first matching target, otherwise
* returning %GDK_NONE. @dest_target_list should usually be the return
* value from gtk_drag_dest_get_target_list(), but some widgets may
* have different valid targets for different parts of the widget; in
* that case, they will have to implement a drag_motion handler that
* passes the correct target list to this function.
*
* Returns: (transfer none): first target that the source offers
* and the dest can accept, or %GDK_NONE
*/
GdkAtom
gtk_drag_dest_find_target (GtkWidget *widget,
GdkDragContext *context,
GtkTargetList *target_list)
{
GList *tmp_target;
GList *tmp_source = NULL;
GtkWidget *source_widget;
g_return_val_if_fail (GTK_IS_WIDGET (widget), GDK_NONE);
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_NONE);
source_widget = gtk_drag_get_source_widget (context);
if (target_list == NULL)
target_list = gtk_drag_dest_get_target_list (widget);
if (target_list == NULL)
return GDK_NONE;
tmp_target = target_list->list;
while (tmp_target)
{
GtkTargetPair *pair = tmp_target->data;
tmp_source = gdk_drag_context_list_targets (context);
while (tmp_source)
{
if (tmp_source->data == GUINT_TO_POINTER (pair->target))
{
if ((!(pair->flags & GTK_TARGET_SAME_APP) || source_widget) &&
(!(pair->flags & GTK_TARGET_SAME_WIDGET) || (source_widget == widget)) &&
(!(pair->flags & GTK_TARGET_OTHER_APP) || !source_widget) &&
(!(pair->flags & GTK_TARGET_OTHER_WIDGET) || (source_widget != widget)))
return pair->target;
else
break;
}
tmp_source = tmp_source->next;
}
tmp_target = tmp_target->next;
}
return GDK_NONE;
}
+110
View File
@@ -0,0 +1,110 @@
/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GTK_DRAG_DEST_H__
#define __GTK_DRAG_DEST_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <gtk/gtkselection.h>
#include <gtk/gtkwidget.h>
G_BEGIN_DECLS
/**
* GtkDestDefaults:
* @GTK_DEST_DEFAULT_MOTION: If set for a widget, GTK+, during a drag over this
* widget will check if the drag matches this widgets list of possible targets
* and actions.
* GTK+ will then call gdk_drag_status() as appropriate.
* @GTK_DEST_DEFAULT_HIGHLIGHT: If set for a widget, GTK+ will draw a highlight on
* this widget as long as a drag is over this widget and the widget drag format
* and action are acceptable.
* @GTK_DEST_DEFAULT_DROP: If set for a widget, when a drop occurs, GTK+ will
* will check if the drag matches this widgets list of possible targets and
* actions. If so, GTK+ will call gtk_drag_get_data() on behalf of the widget.
* Whether or not the drop is successful, GTK+ will call gtk_drag_finish(). If
* the action was a move, then if the drag was successful, then %TRUE will be
* passed for the @delete parameter to gtk_drag_finish().
* @GTK_DEST_DEFAULT_ALL: If set, specifies that all default actions should
* be taken.
*
* The #GtkDestDefaults enumeration specifies the various
* types of action that will be taken on behalf
* of the user for a drag destination site.
*/
typedef enum {
GTK_DEST_DEFAULT_MOTION = 1 << 0,
GTK_DEST_DEFAULT_HIGHLIGHT = 1 << 1,
GTK_DEST_DEFAULT_DROP = 1 << 2,
GTK_DEST_DEFAULT_ALL = 0x07
} GtkDestDefaults;
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set (GtkWidget *widget,
GtkDestDefaults flags,
const GtkTargetEntry *targets,
gint n_targets,
GdkDragAction actions);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set_proxy (GtkWidget *widget,
GdkWindow *proxy_window,
GdkDragProtocol protocol,
gboolean use_coordinates);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_unset (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
GdkAtom gtk_drag_dest_find_target (GtkWidget *widget,
GdkDragContext *context,
GtkTargetList *target_list);
GDK_AVAILABLE_IN_ALL
GtkTargetList* gtk_drag_dest_get_target_list (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set_target_list (GtkWidget *widget,
GtkTargetList *target_list);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_add_text_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_add_image_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_add_uri_targets (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_drag_dest_set_track_motion (GtkWidget *widget,
gboolean track_motion);
GDK_AVAILABLE_IN_ALL
gboolean gtk_drag_dest_get_track_motion (GtkWidget *widget);
G_END_DECLS
#endif /* __GTK_DRAG_DEST_H__ */
+29 -21
View File
@@ -70,6 +70,7 @@
#include "gtkmagnifierprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcsscustomgadgetprivate.h"
#include "gtkprogresstrackerprivate.h"
#include "a11y/gtkentryaccessible.h"
@@ -196,10 +197,11 @@ struct _GtkEntryPrivate
gdouble progress_pulse_fraction;
gdouble progress_pulse_current;
guint tick_id;
gint64 pulse1;
gint64 pulse2;
gint64 frame1;
guint tick_id;
GtkProgressTracker tracker;
gint64 pulse1;
gint64 pulse2;
gdouble last_iteration;
gchar *placeholder_text;
@@ -10394,31 +10396,30 @@ tick_cb (GtkWidget *widget,
{
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
gint64 frame2;
gdouble fraction;
gint64 frame_time;
gdouble iteration, pulse_iterations, current_iterations, fraction;
frame2 = gdk_frame_clock_get_frame_time (frame_clock);
if (priv->frame1 == 0)
priv->frame1 = frame2 - 16667;
if (priv->pulse1 == 0)
priv->pulse1 = priv->pulse2 - 250 * 1000000;
if (priv->pulse2 == 0 && priv->pulse1 == 0)
return G_SOURCE_CONTINUE;
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
gtk_progress_tracker_advance_frame (&priv->tracker, frame_time);
g_assert (priv->pulse2 > priv->pulse1);
g_assert (frame2 > priv->frame1);
if (frame2 - priv->pulse2 > 3 * (priv->pulse2 - priv->pulse1))
{
priv->pulse1 = 0;
return G_SOURCE_CONTINUE;
}
pulse_iterations = (priv->pulse2 - priv->pulse1) / (gdouble) G_USEC_PER_SEC;
current_iterations = (frame_time - priv->pulse1) / (gdouble) G_USEC_PER_SEC;
iteration = gtk_progress_tracker_get_iteration (&priv->tracker);
/* Determine the fraction to move the block from one frame
* to the next when pulse_fraction is how far the block should
* move between two calls to gtk_entry_progress_pulse().
*/
fraction = priv->progress_pulse_fraction * (frame2 - priv->frame1) / MAX (frame2 - priv->pulse2, priv->pulse2 - priv->pulse1);
fraction = priv->progress_pulse_fraction * (iteration - priv->last_iteration) / MAX (pulse_iterations, current_iterations);
priv->last_iteration = iteration;
priv->frame1 = frame2;
if (current_iterations > 3 * pulse_iterations)
return G_SOURCE_CONTINUE;
/* advance the block */
if (priv->progress_pulse_way_back)
@@ -10483,6 +10484,9 @@ gtk_entry_start_pulse_mode (GtkEntry *entry)
gtk_css_gadget_add_class (priv->progress_gadget, GTK_STYLE_CLASS_PULSE);
priv->progress_pulse_mode = TRUE;
/* How long each pulse should last depends on calls to gtk_entry_progress_pulse.
* Just start the tracker to repeat forever with iterations every second. */
gtk_progress_tracker_start (&priv->tracker, G_USEC_PER_SEC, 0, INFINITY);
priv->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (entry), tick_cb, NULL, NULL);
priv->progress_fraction = 0.0;
@@ -10491,7 +10495,7 @@ gtk_entry_start_pulse_mode (GtkEntry *entry)
priv->pulse2 = 0;
priv->pulse1 = 0;
priv->frame1 = 0;
priv->last_iteration = 0;
}
static void
@@ -10514,9 +10518,13 @@ static void
gtk_entry_update_pulse (GtkEntry *entry)
{
GtkEntryPrivate *priv = entry->priv;
gint64 pulse_time = g_get_monotonic_time ();
if (priv->pulse2 == pulse_time)
return;
priv->pulse1 = priv->pulse2;
priv->pulse2 = g_get_monotonic_time ();
priv->pulse2 = pulse_time;
}
/**
+1
View File
@@ -36,6 +36,7 @@
#include "gtkcombobox.h"
#include "gtkcssiconthemevalueprivate.h"
#include "gtkdnd.h"
#include "gtkdragdest.h"
#include "gtkicontheme.h"
#include "deprecated/gtkiconfactory.h"
#include "gtkimage.h"
-36
View File
@@ -352,25 +352,6 @@ file_chooser_widget_file_activated (GtkFileChooser *chooser,
gtk_widget_activate (widget);
}
#if 0
/* FIXME: to see why this function is ifdef-ed out, see the comment below in
* file_chooser_widget_default_size_changed().
*/
static void
load_position (int *out_xpos, int *out_ypos)
{
GtkFileChooserSettings *settings;
int x, y, width, height;
settings = _gtk_file_chooser_settings_new ();
_gtk_file_chooser_settings_get_geometry (settings, &x, &y, &width, &height);
g_object_unref (settings);
*out_xpos = x;
*out_ypos = y;
}
#endif
static void
file_chooser_widget_default_size_changed (GtkWidget *widget,
GtkFileChooserDialog *dialog)
@@ -397,23 +378,6 @@ file_chooser_widget_default_size_changed (GtkWidget *widget,
&default_width, &default_height);
gtk_window_resize (GTK_WINDOW (dialog), default_width, default_height);
if (!gtk_widget_get_mapped (GTK_WIDGET (dialog)))
{
#if 0
/* FIXME: the code to restore the position does not work yet. It is not
* clear whether it is actually desirable --- if enabled, applications
* would not be able to say "center the file chooser on top of my toplevel
* window". So, we don't use this code at all.
*/
load_position (&xpos, &ypos);
if (xpos >= 0 && ypos >= 0)
{
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_NONE);
gtk_window_move (GTK_WINDOW (dialog), xpos, ypos);
}
#endif
}
}
static void
+1
View File
@@ -31,6 +31,7 @@
#include "gtkclipboard.h"
#include "gtkcomboboxtext.h"
#include "gtkdragsource.h"
#include "gtkdragdest.h"
#include "gtkentry.h"
#include "gtkexpander.h"
#include "gtkfilechooserprivate.h"
+6 -1
View File
@@ -646,7 +646,12 @@ gtk_header_bar_get_size (GtkWidget *widget,
center_min = center_nat = 0;
if (priv->label_box != NULL)
{
if (add_child_size (priv->label_sizing_box, orientation, &center_min, &center_nat))
if (orientation == GTK_ORIENTATION_HORIZONTAL)
add_child_size (priv->label_box, orientation, &center_min, &center_nat);
else
add_child_size (priv->label_sizing_box, orientation, &center_min, &center_nat);
if (_gtk_widget_get_visible (priv->label_sizing_box))
nvis_children += 1;
}
+16 -1
View File
@@ -1091,18 +1091,33 @@ static const gchar builtin_hicolor_index[] =
"[Icon Theme]\n"
"Name=Hicolor\n"
"Hidden=True\n"
"Directories=16x16/actions,22x22/actions,24x24/actions,32x32/actions\n"
"Directories=16x16/actions,16x16/status,22x22/actions,24x24/actions,24x24/status,32x32/actions,32x32/status,48x48/status,64x64/actions\n"
"[16x16/actions]\n"
"Size=16\n"
"Type=Threshold\n"
"[16x16/status]\n"
"Size=16\n"
"Type=Threshold\n"
"[22x22/actions]\n"
"Size=22\n"
"Type=Threshold\n"
"[24x24/actions]\n"
"Size=24\n"
"Type=Threshold\n"
"[24x24/status]\n"
"Size=24\n"
"Type=Threshold\n"
"[32x32/actions]\n"
"Size=32\n"
"Type=Threshold\n"
"[32x32/status]\n"
"Size=32\n"
"Type=Threshold\n"
"[48x48/status]\n"
"Size=48\n"
"Type=Threshold\n"
"[64x64/actions]\n"
"Size=64\n"
"Type=Threshold\n";
static void
+10 -150
View File
@@ -35,6 +35,7 @@
#include "gtkimcontextsimple.h"
#include "gtksettings.h"
#include "gtkprivate.h"
#include "gtkutilsprivate.h"
#include "gtkintl.h"
#ifdef GDK_WINDOWING_X11
@@ -331,147 +332,6 @@ add_builtin_module (const gchar *module_name,
return module;
}
static gboolean
scan_string (const char **pos, GString *out)
{
const char *p = *pos, *q = *pos;
char *tmp, *tmp2;
gboolean quoted;
while (g_ascii_isspace (*p))
p++;
if (!*p)
return FALSE;
else if (*p == '"')
{
p++;
quoted = FALSE;
for (q = p; (*q != '"') || quoted; q++)
{
if (!*q)
return FALSE;
quoted = (*q == '\\') && !quoted;
}
tmp = g_strndup (p, q - p);
tmp2 = g_strcompress (tmp);
g_string_truncate (out, 0);
g_string_append (out, tmp2);
g_free (tmp);
g_free (tmp2);
}
q++;
*pos = q;
return TRUE;
}
static gboolean
skip_space (const char **pos)
{
const char *p = *pos;
while (g_ascii_isspace (*p))
p++;
*pos = p;
return !(*p == '\0');
}
static gint
read_line (FILE *stream, GString *str)
{
gboolean quoted = FALSE;
gboolean comment = FALSE;
int n_read = 0;
int lines = 1;
flockfile (stream);
g_string_truncate (str, 0);
while (1)
{
int c;
c = getc_unlocked (stream);
if (c == EOF)
{
if (quoted)
g_string_append_c (str, '\\');
goto done;
}
else
n_read++;
if (quoted)
{
quoted = FALSE;
switch (c)
{
case '#':
g_string_append_c (str, '#');
break;
case '\r':
case '\n':
{
int next_c = getc_unlocked (stream);
if (!(next_c == EOF ||
(c == '\r' && next_c == '\n') ||
(c == '\n' && next_c == '\r')))
ungetc (next_c, stream);
lines++;
break;
}
default:
g_string_append_c (str, '\\');
g_string_append_c (str, c);
}
}
else
{
switch (c)
{
case '#':
comment = TRUE;
break;
case '\\':
if (!comment)
quoted = TRUE;
break;
case '\n':
{
int next_c = getc_unlocked (stream);
if (!(c == EOF ||
(c == '\r' && next_c == '\n') ||
(c == '\n' && next_c == '\r')))
ungetc (next_c, stream);
goto done;
}
default:
if (!comment)
g_string_append_c (str, c);
}
}
}
done:
funlockfile (stream);
return (n_read > 0) ? lines : 0;
}
static void
gtk_im_module_initialize (void)
{
@@ -558,13 +418,13 @@ gtk_im_module_initialize (void)
return;
}
while (!have_error && read_line (file, line_buf))
while (!have_error && gtk_read_line (file, line_buf))
{
const char *p;
p = line_buf->str;
if (!skip_space (&p))
if (!gtk_skip_space (&p))
{
/* Blank line marking the end of a module
*/
@@ -584,7 +444,7 @@ gtk_im_module_initialize (void)
*/
module = g_object_new (GTK_TYPE_IM_MODULE, NULL);
if (!scan_string (&p, tmp_buf) || skip_space (&p))
if (!gtk_scan_string (&p, tmp_buf) || gtk_skip_space (&p))
{
g_warning ("Error parsing context info in '%s'\n %s", filename, line_buf->str);
have_error = TRUE;
@@ -602,19 +462,19 @@ gtk_im_module_initialize (void)
/* Read information about a context type
*/
if (!scan_string (&p, tmp_buf))
if (!gtk_scan_string (&p, tmp_buf))
goto context_error;
info->context_id = g_strdup (tmp_buf->str);
if (!scan_string (&p, tmp_buf))
if (!gtk_scan_string (&p, tmp_buf))
goto context_error;
info->context_name = g_strdup (tmp_buf->str);
if (!scan_string (&p, tmp_buf))
if (!gtk_scan_string (&p, tmp_buf))
goto context_error;
info->domain = g_strdup (tmp_buf->str);
if (!scan_string (&p, tmp_buf))
if (!gtk_scan_string (&p, tmp_buf))
goto context_error;
info->domain_dirname = g_strdup (tmp_buf->str);
@@ -622,11 +482,11 @@ gtk_im_module_initialize (void)
correct_localedir_prefix ((char **) &info->domain_dirname);
#endif
if (!scan_string (&p, tmp_buf))
if (!gtk_scan_string (&p, tmp_buf))
goto context_error;
info->default_locales = g_strdup (tmp_buf->str);
if (skip_space (&p))
if (gtk_skip_space (&p))
goto context_error;
infos = g_slist_prepend (infos, info);
+9 -1
View File
@@ -113,7 +113,7 @@
#include "gtkaccelmapprivate.h"
#include "gtkbox.h"
#include "gtkclipboard.h"
#include "gtkclipboardprivate.h"
#include "gtkdebug.h"
#include "gtkdndprivate.h"
#include "gtkmain.h"
@@ -636,6 +636,7 @@ do_pre_parse_initialization (int *argc,
char ***argv)
{
const gchar *env_string;
double slowdown;
if (pre_initialized)
return;
@@ -673,6 +674,13 @@ do_pre_parse_initialization (int *argc,
g_string_append (gtk_modules_string, env_string);
}
env_string = g_getenv ("GTK_SLOWDOWN");
if (env_string)
{
slowdown = g_ascii_strtod (env_string, NULL);
_gtk_set_slowdown (slowdown);
}
}
static void
+13 -1
View File
@@ -3011,7 +3011,19 @@ gtk_menu_draw (GtkWidget *widget,
gtk_css_gadget_draw (priv->bottom_arrow_gadget, cr);
}
GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
if (gtk_cairo_should_draw_window (cr, priv->bin_window))
{
int x, y;
gdk_window_get_position (priv->view_window, &x, &y);
cairo_rectangle (cr,
x, y,
gdk_window_get_width (priv->view_window),
gdk_window_get_height (priv->view_window));
cairo_clip (cr);
GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
}
return FALSE;
}
+1 -2
View File
@@ -272,8 +272,7 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
0,
G_MAXINT,
0,
GTK_PARAM_READABLE |
G_PARAM_DEPRECATED|G_PARAM_DEPRECATED));
GTK_PARAM_READABLE|G_PARAM_DEPRECATED));
gtk_container_class_handle_border_width (container_class);
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_MENU_BAR);
+4 -7
View File
@@ -26,6 +26,7 @@
#include "gtkprivate.h"
#include "gtkmodulesprivate.h"
#include "gtkintl.h"
#include "gtkutilsprivate.h"
#include <gmodule.h>
@@ -77,9 +78,7 @@ get_module_path (void)
g_free (default_dir);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
result = pango_split_file_list (module_path);
G_GNUC_END_IGNORE_DEPRECATIONS
result = gtk_split_file_list (module_path);
g_free (module_path);
return result;
@@ -419,10 +418,8 @@ load_modules (const char *module_str)
GTK_NOTE (MODULES, g_message ("Loading module list: %s", module_str));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
module_names = pango_split_file_list (module_str);
G_GNUC_END_IGNORE_DEPRECATIONS
for (i = 0; module_names[i]; i++)
module_names = gtk_split_file_list (module_str);
for (i = 0; module_names[i]; i++)
module_list = load_module (module_list, module_names[i]);
module_list = g_slist_reverse (module_list);
+4 -4
View File
@@ -1618,16 +1618,16 @@ gtk_path_bar_set_file_finish (struct SetFileInfo *info,
gtk_path_bar_clear_buttons (info->path_bar);
info->path_bar->priv->button_list = g_list_reverse (info->new_buttons);
info->path_bar->priv->fake_root = info->fake_root;
prev = gtk_widget_get_css_node (info->path_bar->priv->up_slider_button);
prev = gtk_widget_get_css_node (info->path_bar->priv->down_slider_button);
for (l = info->path_bar->priv->button_list; l; l = l->next)
{
GtkWidget *button = BUTTON_DATA (l->data)->button;
GtkCssNode *node = gtk_widget_get_css_node (button);
gtk_css_node_insert_after (gtk_widget_get_css_node (GTK_WIDGET (info->path_bar)),
node,
prev);
gtk_css_node_insert_before (gtk_widget_get_css_node (GTK_WIDGET (info->path_bar)),
node,
prev);
gtk_container_add (GTK_CONTAINER (info->path_bar), button);
prev = node;
}
+8 -2
View File
@@ -52,6 +52,7 @@
#include "gtkbutton.h"
#include "gtklistbox.h"
#include "gtkselection.h"
#include "gtkdragdest.h"
#include "gtkdnd.h"
#include "gtkseparator.h"
#include "gtkentry.h"
@@ -893,8 +894,13 @@ static void
update_trash_icon (GtkPlacesSidebar *sidebar)
{
if (sidebar->trash_row)
gtk_sidebar_row_set_icon (GTK_SIDEBAR_ROW (sidebar->trash_row),
_gtk_trash_monitor_get_icon (sidebar->trash_monitor));
{
GIcon *icon;
icon = _gtk_trash_monitor_get_icon (sidebar->trash_monitor);
gtk_sidebar_row_set_icon (GTK_SIDEBAR_ROW (sidebar->trash_row), icon);
g_object_unref (icon);
}
}
static void
+1 -2
View File
@@ -705,8 +705,7 @@ add_volume (GtkPlacesView *view,
name = g_volume_get_name (volume);
path = !is_network ? g_volume_get_identifier (volume, G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE) : NULL;
if (!mount ||
(mount && !g_mount_is_shadowed (mount)))
if (!mount || !g_mount_is_shadowed (mount))
{
GtkWidget *row;
+1 -1
View File
@@ -129,7 +129,7 @@ measure_available_space_finished (GObject *object,
* should be based on the free space available.
* i.e. 1 GB / 24 GB available.
*/
label = g_strdup_printf (ngettext ("%s / %s available", "%s / %s available", plural_form),
label = g_strdup_printf (dngettext (GETTEXT_PACKAGE, "%s / %s available", "%s / %s available", plural_form),
formatted_free_size, formatted_total_size);
gtk_label_set_label (row->available_space_label, label);
+7 -23
View File
@@ -110,6 +110,7 @@
#include "gtkmenusectionbox.h"
#include "gtkroundedboxprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkprogresstrackerprivate.h"
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
@@ -156,6 +157,7 @@ struct _GtkPopoverPrivate
GtkAdjustment *hadj;
GdkRectangle pointing_to;
GtkPopoverConstraint constraint;
GtkProgressTracker tracker;
guint prev_focus_unmap_id;
guint hierarchy_changed_id;
guint size_allocate_id;
@@ -173,7 +175,6 @@ struct _GtkPopoverPrivate
guint transitions_enabled : 1;
guint state : 2;
guint visible : 1;
gint64 start_time;
gint transition_diff;
guint tick_id;
@@ -510,17 +511,6 @@ gtk_popover_apply_modality (GtkPopover *popover,
}
}
/* From clutter-easing.c, based on Robert Penner's
* infamous easing equations, MIT license.
*/
static double
ease_out_cubic (double t)
{
double p = t - 1;
return p * p * p + 1;
}
static gboolean
show_animate_cb (GtkWidget *widget,
GdkFrameClock *frame_clock,
@@ -528,15 +518,11 @@ show_animate_cb (GtkWidget *widget,
{
GtkPopover *popover = GTK_POPOVER (widget);
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
gint64 now = gdk_frame_clock_get_frame_time (frame_clock);
gdouble t;
if (now < (priv->start_time + TRANSITION_DURATION))
t = (now - priv->start_time) / (gdouble) (TRANSITION_DURATION);
else
t = 1.0;
t = ease_out_cubic (t);
gtk_progress_tracker_advance_frame (&priv->tracker,
gdk_frame_clock_get_frame_time (frame_clock));
t = gtk_progress_tracker_get_ease_out_cubic (&priv->tracker, FALSE);
if (priv->state == STATE_SHOWING)
{
@@ -551,7 +537,7 @@ show_animate_cb (GtkWidget *widget,
gtk_popover_update_position (popover);
if (t >= 1.0)
if (gtk_progress_tracker_get_state (&priv->tracker) == GTK_PROGRESS_STATE_AFTER)
{
if (priv->state == STATE_SHOWING)
{
@@ -573,13 +559,11 @@ static void
gtk_popover_start_transition (GtkPopover *popover)
{
GtkPopoverPrivate *priv = popover->priv;
GdkFrameClock *clock;
if (priv->tick_id != 0)
return;
clock = gtk_widget_get_frame_clock (GTK_WIDGET (popover));
priv->start_time = gdk_frame_clock_get_frame_time (clock);
gtk_progress_tracker_start (&priv->tracker, TRANSITION_DURATION, 0, 1.0);
priv->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (popover),
show_animate_cb,
popover, NULL);
+3 -2
View File
@@ -3283,9 +3283,10 @@ gtk_print_operation_run (GtkPrintOperation *op,
if (run_print_pages)
print_pages (op, parent, do_print, result);
if (priv->error && error)
if (priv->error)
{
*error = g_error_copy (priv->error);
if (error)
*error = g_error_copy (priv->error);
result = GTK_PRINT_OPERATION_RESULT_ERROR;
}
else if (priv->cancelled)
+4
View File
@@ -91,6 +91,10 @@ gboolean _gtk_propagate_captured_event (GtkWidget *widget,
GdkEvent *event,
GtkWidget *topmost);
gdouble _gtk_get_slowdown ();
void _gtk_set_slowdown (gdouble slowdown_factor);
#ifdef G_OS_WIN32
void _gtk_load_dll_with_libgtk3_manifest (const char *dllname);
#endif
+30 -21
View File
@@ -38,6 +38,7 @@
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsscustomgadgetprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkprogresstrackerprivate.h"
#include "a11y/gtkprogressbaraccessible.h"
@@ -92,6 +93,7 @@
#define MIN_VERTICAL_BAR_WIDTH 7
#define MIN_VERTICAL_BAR_HEIGHT 80
#define DEFAULT_PULSE_DURATION 250000000
struct _GtkProgressBarPrivate
{
@@ -110,10 +112,11 @@ struct _GtkProgressBarPrivate
GtkOrientation orientation;
guint tick_id;
gint64 pulse1;
gint64 pulse2;
gint64 frame1;
guint tick_id;
GtkProgressTracker tracker;
gint64 pulse1;
gint64 pulse2;
gdouble last_iteration;
guint activity_dir : 1;
guint activity_mode : 1;
@@ -1142,31 +1145,30 @@ tick_cb (GtkWidget *widget,
{
GtkProgressBar *pbar = GTK_PROGRESS_BAR (widget);
GtkProgressBarPrivate *priv = pbar->priv;
gint64 frame2;
gdouble fraction;
gint64 frame_time;
gdouble iteration, pulse_iterations, current_iterations, fraction;
frame2 = gdk_frame_clock_get_frame_time (frame_clock);
if (priv->frame1 == 0)
priv->frame1 = frame2 - 16667;
if (priv->pulse1 == 0)
priv->pulse1 = priv->pulse2 - 250 * 1000000;
if (priv->pulse2 == 0 && priv->pulse1 == 0)
return G_SOURCE_CONTINUE;
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
gtk_progress_tracker_advance_frame (&priv->tracker, frame_time);
g_assert (priv->pulse2 > priv->pulse1);
g_assert (frame2 > priv->frame1);
if (frame2 - priv->pulse2 > 3 * (priv->pulse2 - priv->pulse1))
{
priv->pulse1 = 0;
return G_SOURCE_CONTINUE;
}
pulse_iterations = (priv->pulse2 - priv->pulse1) / (gdouble) G_USEC_PER_SEC;
current_iterations = (frame_time - priv->pulse1) / (gdouble) G_USEC_PER_SEC;
iteration = gtk_progress_tracker_get_iteration (&priv->tracker);
/* Determine the fraction to move the block from one frame
* to the next when pulse_fraction is how far the block should
* move between two calls to gtk_progress_bar_pulse().
*/
fraction = priv->pulse_fraction * (frame2 - priv->frame1) / MAX (frame2 - priv->pulse2, priv->pulse2 - priv->pulse1);
fraction = priv->pulse_fraction * (iteration - priv->last_iteration) / MAX (pulse_iterations, current_iterations);
priv->last_iteration = iteration;
priv->frame1 = frame2;
if (current_iterations > 3 * pulse_iterations)
return G_SOURCE_CONTINUE;
/* advance the block */
if (priv->activity_dir == 0)
@@ -1243,10 +1245,13 @@ gtk_progress_bar_act_mode_enter (GtkProgressBar *pbar)
}
update_node_classes (pbar);
/* No fixed schedule for pulses, will adapt after calls to update_pulse. Just
* start the tracker to repeat forever with iterations every second.*/
gtk_progress_tracker_start (&priv->tracker, G_USEC_PER_SEC, 0, INFINITY);
priv->tick_id = gtk_widget_add_tick_callback (widget, tick_cb, NULL, NULL);
priv->pulse2 = 0;
priv->pulse1 = 0;
priv->frame1 = 0;
priv->last_iteration = 0;
}
static void
@@ -1406,9 +1411,13 @@ static void
gtk_progress_bar_update_pulse (GtkProgressBar *pbar)
{
GtkProgressBarPrivate *priv = pbar->priv;
gint64 pulse_time = g_get_monotonic_time ();
if (priv->pulse2 == pulse_time)
return;
priv->pulse1 = priv->pulse2;
priv->pulse2 = g_get_monotonic_time ();
priv->pulse2 = pulse_time;
}
/**
+268
View File
@@ -0,0 +1,268 @@
/*
* Copyright © 2016 Endless Mobile Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthew Watson <mattdangerw@gmail.com>
*/
#include "gtkprogresstrackerprivate.h"
#include "gtkprivate.h"
#include "gtkcsseasevalueprivate.h"
#include <math.h>
#include <string.h>
/*
* Progress tracker is small helper for tracking progress through gtk
* animations. It's a simple zero-initable struct, meant to be thrown in a
* widget's private data without the need for setup or teardown.
*
* Progress tracker will handle translating frame clock timestamps to a
* fractional progress value for interpolating between animation targets.
*
* Progress tracker will use the GTK_SLOWDOWN environment variable to control
* the speed of animations. This can be useful for debugging.
*/
static gdouble gtk_slowdown = 1.0;
void
_gtk_set_slowdown (gdouble factor)
{
gtk_slowdown = factor;
}
gdouble
_gtk_get_slowdown (gdouble factor)
{
return gtk_slowdown;
}
/**
* gtk_progress_tracker_init_copy:
* @source: The source progress tracker
* @dest: The destination progress tracker
*
* Copy all progress tracker state from the source tracker to dest tracker.
**/
void
gtk_progress_tracker_init_copy (GtkProgressTracker *source,
GtkProgressTracker *dest)
{
memcpy (dest, source, sizeof (GtkProgressTracker));
}
/**
* gtk_progress_tracker_start:
* @tracker: The progress tracker
* @duration: Animation duration in us
* @delay: Animation delay in us
* @iteration_count: Number of iterations to run the animation, must be >= 0
*
* Begins tracking progress for a new animation. Clears all previous state.
**/
void
gtk_progress_tracker_start (GtkProgressTracker *tracker,
guint64 duration,
gint64 delay,
gdouble iteration_count)
{
tracker->is_running = TRUE;
tracker->last_frame_time = 0;
tracker->duration = duration;
tracker->iteration = - delay / (gdouble) duration;
tracker->iteration_count = iteration_count;
}
/**
* gtk_progress_tracker_finish:
* @tracker: The progress tracker
*
* Stops running the current animation.
**/
void
gtk_progress_tracker_finish (GtkProgressTracker *tracker)
{
tracker->is_running = FALSE;
}
/**
* gtk_progress_tracker_advance_frame:
* @tracker: The progress tracker
* @frame_time: The current frame time, usually from the frame clock.
*
* Increments the progress of the animation forward a frame. If no animation has
* been started, does nothing.
**/
void
gtk_progress_tracker_advance_frame (GtkProgressTracker *tracker,
guint64 frame_time)
{
gdouble delta;
if (!tracker->is_running)
return;
if (tracker->last_frame_time == 0)
{
tracker->last_frame_time = frame_time;
return;
}
if (frame_time < tracker->last_frame_time)
{
g_warning ("Progress tracker frame set backwards, ignoring.");
return;
}
delta = (frame_time - tracker->last_frame_time) / gtk_slowdown / tracker->duration;
tracker->last_frame_time = frame_time;
tracker->iteration += delta;
}
/**
* gtk_progress_tracker_skip_frame:
* @tracker: The progress tracker
* @frame_time: The current frame time, usually from the frame clock.
*
* Does not update the progress of the animation forward, but records the frame
* to calculate future deltas. Calling this each frame will effectively pause
* the animation.
**/
void
gtk_progress_tracker_skip_frame (GtkProgressTracker *tracker,
guint64 frame_time)
{
if (!tracker->is_running)
return;
tracker->last_frame_time = frame_time;
}
/**
* gtk_progress_tracker_get_state:
* @tracker: The progress tracker
*
* Returns whether the tracker is before, during or after the currently started
* animation. The tracker will only ever be in the before state if the animation
* was started with a delay. If no animation has been started, returns
* %GTK_PROGRESS_STATE_AFTER.
*
* Returns: A GtkProgressState
**/
GtkProgressState
gtk_progress_tracker_get_state (GtkProgressTracker *tracker)
{
if (!tracker->is_running || tracker->iteration > tracker->iteration_count)
return GTK_PROGRESS_STATE_AFTER;
if (tracker->iteration < 0)
return GTK_PROGRESS_STATE_BEFORE;
return GTK_PROGRESS_STATE_DURING;
}
/**
* gtk_progress_tracker_get_iteration:
* @tracker: The progress tracker
*
* Returns the fractional number of cycles the animation has completed. For
* example, it you started an animation with iteration-count of 2 and are half
* way through the second animation, this returns 1.5.
*
* Returns: The current iteration.
**/
gdouble
gtk_progress_tracker_get_iteration (GtkProgressTracker *tracker)
{
return tracker->is_running ? CLAMP (tracker->iteration, 0.0, tracker->iteration_count) : 1.0;
}
/**
* gtk_progress_tracker_get_iteration_cycle:
* @tracker: The progress tracker
*
* Returns an integer index of the current iteration cycle tracker is
* progressing through. Handles edge cases, such as an iteration value of 2.0
* which could be considered the end of the second iteration of the beginning of
* the third, in the same way as gtk_progress_tracker_get_progress().
*
* Returns: The integer count of the current animation cycle.
**/
guint64
gtk_progress_tracker_get_iteration_cycle (GtkProgressTracker *tracker)
{
gdouble iteration = gtk_progress_tracker_get_iteration (tracker);
/* Some complexity here. We want an iteration of 0.0 to always map to 0 (start
* of the first iteration), but an iteration of 1.0 to also map to 0 (end of
* first iteration) and 2.0 to 1 (end of the second iteration).
*/
if (iteration == 0.0)
return 0;
return (guint64) ceil (iteration) - 1;
}
/**
* gtk_progress_tracker_get_progress:
* @tracker: The progress tracker
* @reversed: If progress should be reversed.
*
* Gets the progress through the current animation iteration, from [0, 1]. Use
* to interpolate between animation targets. If reverse is true each iteration
* will begin at 1 and end at 0.
*
* Returns: The progress value.
**/
gdouble
gtk_progress_tracker_get_progress (GtkProgressTracker *tracker,
gboolean reversed)
{
gdouble progress, iteration;
guint64 iteration_cycle;
iteration = gtk_progress_tracker_get_iteration (tracker);
iteration_cycle = gtk_progress_tracker_get_iteration_cycle (tracker);
progress = iteration - iteration_cycle;
return reversed ? 1.0 - progress : progress;
}
/* From clutter-easing.c, based on Robert Penner's
* infamous easing equations, MIT license.
*/
static gdouble
ease_out_cubic (gdouble t)
{
gdouble p = t - 1;
return p * p * p + 1;
}
/**
* gtk_progress_tracker_get_ease_out_cubic:
* @tracker: The progress tracker
* @reversed: If progress should be reversed before applying the ease function.
*
* Applies a simple ease out cubic function to the result of
* gtk_progress_tracker_get_progress().
*
* Returns: The eased progress value.
**/
gdouble
gtk_progress_tracker_get_ease_out_cubic (GtkProgressTracker *tracker,
gboolean reversed)
{
gdouble progress = gtk_progress_tracker_get_progress (tracker, reversed);
return ease_out_cubic (progress);
}
+75
View File
@@ -0,0 +1,75 @@
/*
* Copyright © 2016 Endless Mobile Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthew Watson <mattdangerw@gmail.com>
*/
#ifndef __GTK_PROGRESS_TRACKER_PRIVATE_H__
#define __GTK_PROGRESS_TRACKER_PRIVATE_H__
#include <glib-object.h>
#include "gtkcsseasevalueprivate.h"
G_BEGIN_DECLS
typedef enum {
GTK_PROGRESS_STATE_BEFORE,
GTK_PROGRESS_STATE_DURING,
GTK_PROGRESS_STATE_AFTER,
} GtkProgressState;
typedef struct _GtkProgressTracker GtkProgressTracker;
struct _GtkProgressTracker
{
gboolean is_running;
guint64 last_frame_time;
guint64 duration;
gdouble iteration;
gdouble iteration_count;
};
void gtk_progress_tracker_init_copy (GtkProgressTracker *source,
GtkProgressTracker *dest);
void gtk_progress_tracker_start (GtkProgressTracker *tracker,
guint64 duration,
gint64 delay,
gdouble iteration_count);
void gtk_progress_tracker_finish (GtkProgressTracker *tracker);
void gtk_progress_tracker_advance_frame (GtkProgressTracker *tracker,
guint64 frame_time);
void gtk_progress_tracker_skip_frame (GtkProgressTracker *tracker,
guint64 frame_time);
GtkProgressState gtk_progress_tracker_get_state (GtkProgressTracker *tracker);
gdouble gtk_progress_tracker_get_iteration (GtkProgressTracker *tracker);
guint64 gtk_progress_tracker_get_iteration_cycle (GtkProgressTracker *tracker);
gdouble gtk_progress_tracker_get_progress (GtkProgressTracker *tracker,
gboolean reverse);
gdouble gtk_progress_tracker_get_ease_out_cubic (GtkProgressTracker *tracker,
gboolean reverse);
G_END_DECLS
#endif /* __GTK_PROGRESS_TRACKER_PRIVATE_H__ */

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