Compare commits

..

113 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
250 changed files with 26688 additions and 28404 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 \
-194
View File
@@ -1,197 +1,3 @@
Overview of Changes in GTK+ 3.20.9
==================================
* Bug fixes:
769287 GtkMenuToolButton:show-menu is emitted twice and breaks dynamic m...
769603 gtk+-3.20.8: underlink issue with ld.gold - build fails: ./.libs/...
Fix headerbar size allocation
Use g_snprintf instead of snprintf
* Translation updates
Brazilian Portuguese
Czech
German
Hungarian
Indonesian
Lithuanian
Polish
Portuguese
Swedish
Overview of Changes in GTK+ 3.20.8
==================================
* Revert an unintentional bump of the GLib requirement in 3.20.7
Overview of Changes in GTK+ 3.20.7
==================================
* Bugs fixed:
118959 GtkScale value '-0'
674215 regression with updating tooltips
708148 gtk_tree_view_get_path_at_pos mistakenly identifies column of ini...
745622 Selected text not highlighted in GtkInfoBar
747206 gtktextview: note on how to get line spacing between two paragraphs
764060 opening a second nautilus while a delete operation is in progress...
764203 Default background color for the 'textview border' node
765924 Improve external drives detection
766120 Scale draw_value() align changed from centre/right (H/V) to lefti...
766122 Re-used filechooser displays $pwd half of the time when shown
766341 Do not rely on memfd as it requires a fairly recent kernel
766643 Frozen windows when unmapped with pending configure event
766782 OpenGL in broadway leads to segmentation fault
767058 GtkInfoBar: right-click/context menu all white
767468 Popover over a treeview cellrenderer is hidden immediately after ...
767705 GtkActionHelper: Change a message to a warning
767766 CUPS 2.X detected incorrectly by configure
767795 Warning when the "accelerator" property of GtkShortcutsShortcut ...
767848 crash in the window test
767851 Adwaita: popover arrows broken in some orientations
768016 [Wayland] Submenus often get closed after ~2 seconds
768025 entry.warning & entry.error broken
768082 wayland: copying from Wayland to NEdit (Xwayland/Motif) doesn't work
768142 Incorrect order of $(LIBS) and $(OBJS) in Makefile.example caused...
768177 CLIPBOARD target request after PRIMARY request times out. GDK_SEL...
768485 Change the priority of the window-close idle to G_PRIORITY_DEFAULT
768657 places-view: fix open action for locations without a mount or volume
768930 reftests: override GSETTINGS_SCHEMA_DIR when running tests
769003 Adwaita: GtkCalendar uses a confusing style for week of year
769047 GtkWidget <-> GtkStyleContext API not clear
* Translation updates:
Indonesian
Norwegian bokmål
Overview of Changes in GTK+ 3.20.6
==================================
* Bugs fixed:
766694 crash on save as in any gtk3 application starting 3.20.5...
766323 GTKPopover gives warnings if visible when reparented
766336 Crash when selecting rows with rubberbanding
766737 stack: Only map children when necessary
* Translation updates:
Arabic
Overview of Changes in GTK+ 3.20.5
==================================
* Bugs fixed:
763852 gdk/wayland: event source is not multi-thread aware
765973 GtkRevealer need to always send "child-revealed" signal...
766175 Translation of quotes may misinterpreted by GTK sidebar
766233 Crash when server does not support XI2
766440 Scale slider button has stopped discerning & rendering...
766442 Broken drag & drop between windows
* Translation updates:
Kazakh
Portuguese
Overview of Changes in GTK+ 3.20.4
==================================
* Bugs fixed:
573380 gtk_tree_model_iter_parent() fails if the same iterator is used for...
620065 Several problems related to recent files
693077 GtkRecentManager doesn't send "changed" when file is deleted
749405 GtkMenuSectionBox doesn't remove submenus when parent item is removed
761651 [Wayland] glade previewer is resizing windows until it crashes gnom...
762756 keyboard focus problem on dismiss of menus under wayland
763768 Wrong margin used for the sidebar separator
764395 nautilus crashed on double clicking 'other locations'
764424 `Super` keybindings trigger without Super, on Wayland
764585 Fix "format not a string literal" errors
764825 [WAYLAND] Fn key resets scrolling
764846 Code improvements in GtkApplication
765038 Adwaita & decorations
765065 Wayland: Hover state stuck after mouse leaving the toplevel
765066 GtkColorChooser looks like it can select multiple colors
765122 Duplicate/missing string in gtkprintbackendcups
765213 info bars nearly unreadable in backdrop state because of gray font ...
765238 gtktexthandle should avoid connecting to GtkWidget::draw
765261 listbox: Page up/Down don't do anything with large rows
765270 wayland: Leave existing mods on map_virtual_modifiers
765284 debug: reduce runtime overhead in debug builds
765471 CellRendererText shows edit entry in a wrong position for small cells
765474 Wayland: Dialogs without transient parent crash the inspector
765486 builtinicon: avoid calculating font-metrics in vast majority of cases
765493 kineticscrolling: avoid stutter at tail of kinetic deceleration
765496 Clean up gtklabel.c a bit
765565 Wayland: Inspector GtkLabel drag'n'drop crashes client
765567 wayland: avoid jitter in keyboard repeat
765592 frametimings: reuse previous frame timing in common case
765640 pixelcache: reuse existing timeout source when possible
765644 Widget sizing problems with GtkProgressBar
765742 GtkRedioButton and GtkCheckButton doesn't aligned right to left lan...
765790 W32: configure does not tell which cairo version to use
765907 [Wayland] Reversed scrolling GDK_SCROLL_UP/GDK_SCROLL_DOWN in Wayland
765922 GtkScale labels extend past edge of widget and overlap neighboring ...
765981 fts warning from tracker when searching for files with "-" in name
766166 key bindings in gtk.css are ignored
* Translation uypdates:
Brazilian Portuguese
Latvian
Polish
Traditional Chinese
Overview of Changes in GTK+ 3.20.3
==================================
* Bugs fixed:
764174 Configuration dialog is too small
764203 Default background color for the 'textview border' node
764204 Primary and secondary carets/cursors not distinguishable by default
764261 gtkplacesviewrow: untranslated "%s / %s available"
764374 Busy loop while "Displays" page is active
764378 gtk3-demo won't run without hicolor-icon-theme
764540 gtk_scrollable_get_border is missing annotations
764585 Fix "format not a string literal" errors
764686 build failure after "make distclean"
764710 GtkListBox row CSS nodes do not reflect visual order
764835 broadway: fix documentation, correct display port details
764664 Segfault when initializing WINTAB pressure-sensitive tablets
* Translation updates:
Bulgarian
Esperanto
Greek
Norwegian bokmål
Persian
Overview of Changes in GTK+ 3.20.2
==================================
* Fix blue background in Emacs windows
* Fix a performance issue with excessive redraws
* Bugs fixed:
763627 menu-traditional puts popover beneath the text editor widget
763783 GDK W32: Erase hidden layered windows before showing them
763851 GDK W32: show_window_menu() is not implemented
764022 Negative content width -200 (allocation -200, extents 0x0) while...
764170 [HighContrastInverse] “suqqested-action” is white on lightgrey
764210 Strange Background Color on Emacs
764321 window: Fix gtk_window_set_geometry_hints documentation
764376 UI glitch when entering keyboard shortcut
* Translation updates:
Dutch
German
Italian
Lithuanian
Serbian
Thai
Overview of Changes in GTK+ 3.20.1
==================================
-5
View File
@@ -99,11 +99,6 @@ Release notes for 3.20
gtk_window_set_default_size() to restore it.
See https://wiki.gnome.org/HowDoI/SaveWindowState for a detailed example.
* Geometry handling in GtkWindow has been removed. If you are using the
functions gtk_window_resize_to_geometry, gtk_window_set_default_geometry,
gtk_window_parse_geometry or gtk_window_set_geometry_hints, you may need
to make some changes to your code.
* 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()
+18 -10
View File
@@ -5,6 +5,9 @@
</ImportGroup>
<PropertyGroup Label="UserMacros">
<BinDir>$(SolutionDir)$(Configuration)\$(Platform)\bin</BinDir>
<InstalledDlls>$(BinDir)\$(GtkDllPrefix)gdk(GtkDllSuffix).dll;$(BinDir)\$(GtkDllPrefix)gtk(GtkDllSuffix).dll;$(BinDir)\$(GtkDllPrefix)gailutil(GtkDllSuffix).dll</InstalledDlls>
<InstalledBins>$(BinDir)\gtk3-demo.exe;$(BinDir)\gtk3-demo-application.exe;$(BinDir)\gtk3-icon-browser.exe;$(BinDir)\gtk-encode-symbolic-svg.exe</InstalledBins>
<InstalledBroadwayBins>$(BinDir)\broadwayd.exe</InstalledBroadwayBins>
<GtkDoInstallBin>
mkdir $(CopyDir)\bin
mkdir $(CopyDir)\lib
@@ -123,19 +126,18 @@ copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\gtk\org.gtk.Settings.Debug.gschema.xml $(CopyDir)\share\glib-2.0\schemas
copy ..\..\..\demos\gtk-demo\org.gtk.Demo.gschema.xml $(CopyDir)\share\glib-2.0\schemas
echo "Compiling gsettings XML Files..."
$(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
echo "Generating icon cache......"
$(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir)\share\icons\hicolor"
</GtkDoInstall>
<GtkDoInstallBroadwayHeaders>
copy ..\..\..\gdk\broadway\gdkbroadway.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway
#include "gdk3-broadway.vs10.headers"
</GtkDoInstallBroadwayHeaders>
<GtkPostInstall>
echo "Compiling gsettings XML Files..."
$(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas
echo "Generating icon cache......"
$(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir)\share\icons\hicolor"
</GtkPostInstall>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>gtk3installsprops</_PropertySheetDisplayName>
@@ -144,6 +146,15 @@ $(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir
<BuildMacro Include="BinDir">
<Value>$(BinDir)</Value>
</BuildMacro>
<BuildMacro Include="InstalledDlls">
<Value>$(InstalledDlls)</Value>
</BuildMacro>
<BuildMacro Include="InstalledBins">
<Value>$(InstalledBins)</Value>
</BuildMacro>
<BuildMacro Include="InstalledBroadwayBins">
<Value>$(InstalledBroadwayBins)</Value>
</BuildMacro>
<BuildMacro Include="GtkDoInstallBin">
<Value>$(GtkDoInstallBin)</Value>
</BuildMacro>
@@ -153,8 +164,5 @@ $(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force "$(CopyDir
<BuildMacro Include="GtkDoInstallBroadwayHeaders">
<Value>$(GtkDoInstallBroadwayHeaders)</Value>
</BuildMacro>
<BuildMacro Include="GtkPostInstall">
<Value>$(GtkPostInstall)</Value>
</BuildMacro>
</ItemGroup>
</Project>
+16 -16
View File
@@ -157,29 +157,29 @@
<ItemGroup>
<CustomBuild Include="..\..\..\config.h.win32">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(GtkDoInstallBin)$(GtkDoInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(InstalledDlls);$(InstalledBins);%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">Installing Build Results...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">blah;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(InstalledDlls);$(InstalledBins);$(InstalledBroadwayBins);%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
+8 -8
View File
@@ -29,7 +29,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -42,7 +42,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -56,7 +56,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
<Configuration
@@ -69,7 +69,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
<Configuration
@@ -84,7 +84,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -98,7 +98,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)"
/>
</Configuration>
<Configuration
@@ -113,7 +113,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
<Configuration
@@ -127,7 +127,7 @@
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)$(GtkPostInstall)"
CommandLine="$(GtkDoInstallBin)$(GtkDoInstall)$(GtkDoInstallBroadwayHeaders)"
/>
</Configuration>
</Configurations>
+8 -12
View File
@@ -128,24 +128,20 @@ copy ..\..\..\gtk\org.gtk.Settings.FileChooser.gschema.xml $(CopyDir)\share\glib
copy ..\..\..\gtk\org.gtk.Settings.ColorChooser.gschema.xml $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
copy ..\..\..\gtk\org.gtk.Settings.Debug.gschema.xml $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
copy ..\..\..\demos\gtk-demo\org.gtk.Demo.gschema.xml $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
"
/>
<UserMacro
Name="GtkPostInstall"
Value="
echo &quot;Compiling gsettings XML Files...&quot;&#x0D;&#x0A;
$(GlibEtcInstallRoot)\bin\glib-compile-schemas.exe $(CopyDir)\share\glib-2.0\schemas&#x0D;&#x0A;
echo &quot;Generating icon cache...&quot;&#x0D;&#x0A;
$(CopyDir)\bin\gtk-update-icon-cache.exe --ignore-theme-index --force &quot;$(CopyDir)\share\icons\hicolor&quot;
"
/>
<UserMacro
Name="GtkDoInstallBroadwayHeaders"
Value="
"
/>
<UserMacro
Name="GtkDoInstallBroadwayHeaders"
Value="
copy ..\..\..\gdk\broadway\gdkbroadway.h $(CopyDir)\include\gtk-$(ApiVersion)\gdk&#x0D;&#x0A;
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gdk\broadway&#x0D;&#x0A;
#include "gdk3-broadway.headers"
"
/>
"
/>
</VisualStudioPropertySheet>
+6 -9
View File
@@ -9,9 +9,9 @@
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [20])
m4_define([gtk_micro_version], [9])
m4_define([gtk_interface_age], [9])
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)])
m4_define([gtk_version],
@@ -580,7 +580,7 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
# Remove this check once cairo_required_version reaches at least 1.16.0
# Remove this check once cairo_required_version reaches at least 1.14.4
case $host_os in
mingw*)
PKG_CHECK_MODULES(CAIRO, [cairo >= cairo_required_version])
@@ -588,7 +588,7 @@ case $host_os in
[AC_MSG_RESULT([found])],
[AC_MSG_ERROR(
[cairo_win32_surface_create_with_format is not found in cairo library
You need a cairo snapshot 1.15.x or 1.16.x release or newer])])
You need cairo version newer than 2015-04-14])])
;;
*)
;;
@@ -794,9 +794,6 @@ LIBS="$LIBS $GLIB_LIBS"
AC_CHECK_FUNCS(bind_textdomain_codeset)
LIBS=$gtk_save_LIBS
AC_CHECK_HEADERS(linux/memfd.h,
AC_DEFINE(HAVE_LINUX_MEMFD_H, 1,
[Define to 1 if memfd.h is available]))
AC_CHECK_HEADERS(sys/mman.h,
AC_DEFINE(HAVE_SYS_MMAN_H, 1,
[Define to 1 if mman.h is available]))
@@ -1475,7 +1472,7 @@ else
CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $1}'`
CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $2}'`
if test $CUPS_API_MAJOR -lt 1 -o \
if test $CUPS_API_MAJOR -gt 1 -o \
$CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -lt 2; then
AC_MSG_ERROR([CUPS >= 1.2 not found])
fi
+1 -3
View File
@@ -28,8 +28,7 @@ source_toggled (GtkToggleButton *button)
markup = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_delete (buffer, &start, &end);
gtk_text_buffer_get_start_iter (buffer, &start);
gtk_text_buffer_insert_markup (buffer, &start, markup, -1);
g_free (markup);
@@ -68,7 +67,6 @@ do_markup (GtkWidget *do_widget)
g_signal_connect (show_source, "toggled", G_CALLBACK (source_toggled), stack);
header = gtk_header_bar_new ();
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), show_source);
gtk_widget_show_all (header);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
+3 -6
View File
@@ -12,13 +12,10 @@ static guint timeout = 0;
static void
change_direction (GtkRevealer *revealer)
{
if (gtk_widget_get_mapped (GTK_WIDGET (revealer)))
{
gboolean revealed;
gboolean revealed;
revealed = gtk_revealer_get_child_revealed (revealer);
gtk_revealer_set_reveal_child (revealer, !revealed);
}
revealed = gtk_revealer_get_child_revealed (revealer);
gtk_revealer_set_reveal_child (revealer, !revealed);
}
static gboolean
+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>
+4 -4
View File
@@ -43,10 +43,10 @@ To use broadwayd, start it like this:
<programlisting>
broadwayd :5
</programlisting>
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
Then point your web browser at <literal>http://127.0.0.1:8084</literal>.
Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo
BROADWAY_DISPLAY=:5 gtk3-demo
</programlisting>
</para>
@@ -58,11 +58,11 @@ GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo
<title><envar>BROADWAY_DISPLAY</envar></title>
<para>
Specifies the Broadway display number. The default display is 0.
Specifies the Broadway display number. The default display is 1.
The display number determines the port to use when connecting
to a Broadway application via the following formula:
<programlisting>
<replaceable>port</replaceable> = 8080 + <replaceable>display</replaceable>
<replaceable>port</replaceable> = 8080 + (<replaceable>display</replaceable> - 1)
</programlisting>
</para>
</formalpara>
+3 -3
View File
@@ -45,14 +45,14 @@ windows in the same web browser, by connecting to broadwayd.
</para>
<para>
When using broadwayd, specify the display number to use, prefixed
with a colon, similar to X. The default display number is 0.
with a colon, similar to X. The default display number is 1.
<programlisting>
broadwayd :5
</programlisting>
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
Then point your web browser at <literal>http://127.0.0.1:8084</literal>.
Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk3-demo
BROADWAY_DISPLAY=:5 gtk3-demo
</programlisting>
You can add password protection for your session by creating a file in
+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
+1 -7
View File
@@ -1133,7 +1133,7 @@ gtk_arrow_draw (GtkWidget *widget,
The default values for the #GtkScrolledWindow:hscrollbar-policy and
#GtkScrolledWindow:vscrollbar-policy properties have been changed from
'never' to 'automatic'. If your application was relying on the default
value, you will have to set it explicitly.
value, you will have explicitly set it explicitly.
</para>
<para>
@@ -1205,12 +1205,6 @@ gtk_arrow_draw (GtkWidget *widget,
have disappeared, and instead there are now
gtk_window_set_has_resize_grip() and gtk_window_get_has_resize_grip().
</para>
<para>
In more recent versions of GTK+ 3, the resize grip functionality has
been removed entirely, in favor of invisible resize borders around the
window. When updating to newer versions of GTK+ 3, you should simply
remove all code dealing with resize grips.
</para>
</section>
<section>
+1 -1
View File
@@ -13,7 +13,7 @@ all: exampleapp
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(OBJS)
+1 -1
View File
@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid
+1 -1
View File
@@ -18,7 +18,7 @@ resources.c: exampleapp.gresource.xml window.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(BUILT_SRC)
+1 -1
View File
@@ -18,7 +18,7 @@ resources.c: exampleapp.gresource.xml window.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(BUILT_SRC)
+1 -1
View File
@@ -18,7 +18,7 @@ resources.c: exampleapp.gresource.xml window.ui app-menu.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS)
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f $(BUILT_SRC)
+1 -1
View File
@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml window.ui app-menu.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid
+1 -1
View File
@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml window.ui app-menu.ui
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid
+1 -1
View File
@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid
+1 -1
View File
@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid
+1 -1
View File
@@ -25,7 +25,7 @@ resources.c: exampleapp.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --source
$(CC) -c -o $(@F) $(CFLAGS) $<
exampleapp: $(OBJS) gschemas.compiled
$(CC) -o $(@F) $(OBJS) $(LIBS)
$(CC) -o $(@F) $(LIBS) $(OBJS)
clean:
rm -f org.gtk.exampleapp.gschema.valid
+1 -1
View File
@@ -187,7 +187,7 @@ common_sources = \
libgdk_3_la_SOURCES = $(common_sources)
libgdk_3_la_CFLAGS = $(AM_CFLAGS) $(GDK_HIDDEN_VISIBILITY_CFLAGS)
libgdk_3_la_LIBADD = $(GDK_DEP_LIBS) $(SHM_LIBS)
libgdk_3_la_LIBADD = $(GDK_DEP_LIBS)
libgdk_3_la_LDFLAGS = $(LDADD)
if USE_X11
-1
View File
@@ -98,7 +98,6 @@ _gdk_broadway_window_drag_begin (GdkWindow *window,
new_context = g_object_new (GDK_TYPE_BROADWAY_DRAG_CONTEXT,
NULL);
new_context->display = gdk_window_get_display (window);
return new_context;
}
+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,
+2 -3
View File
@@ -752,8 +752,7 @@ gdk_drag_context_handle_source_event (GdkEvent *event)
}
GdkCursor *
gdk_drag_get_cursor (GdkDragContext *context,
GdkDragAction action)
gdk_drag_get_cursor (GdkDragAction action)
{
gint i;
@@ -762,7 +761,7 @@ gdk_drag_get_cursor (GdkDragContext *context,
break;
if (drag_cursors[i].cursor == NULL)
drag_cursors[i].cursor = gdk_cursor_new_from_name (context->display,
drag_cursors[i].cursor = gdk_cursor_new_from_name (gdk_display_get_default (),
drag_cursors[i].name);
return drag_cursors[i].cursor;
}
+1 -4
View File
@@ -94,8 +94,6 @@ struct _GdkDragContext {
/*< private >*/
GdkDragProtocol protocol;
GdkDisplay *display;
gboolean is_source;
GdkWindow *source_window;
GdkWindow *dest_window;
@@ -121,8 +119,7 @@ void gdk_drag_context_cancel (GdkDragContext *context,
GdkDragCancelReason reason);
gboolean gdk_drag_context_handle_source_event (GdkEvent *event);
gboolean gdk_drag_context_handle_dest_event (GdkEvent *event);
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
GdkDragAction action);
GdkCursor * gdk_drag_get_cursor (GdkDragAction action);
G_END_DECLS
+6 -1
View File
@@ -295,7 +295,6 @@ _gdk_event_queue_handle_motion_compression (GdkDisplay *display)
while (pending_motions && pending_motions->next != NULL)
{
GList *next = pending_motions->next;
gdk_event_free (pending_motions->data);
display->queued_events = g_list_delete_link (display->queued_events,
pending_motions);
pending_motions = next;
@@ -2067,6 +2066,12 @@ gdk_get_show_events (void)
return (_gdk_debug_flags & GDK_DEBUG_EVENTS) != 0;
}
/* What do we do with G_IO_NVAL?
*/
#define READ_CONDITION (G_IO_IN | G_IO_HUP | G_IO_ERR)
#define WRITE_CONDITION (G_IO_OUT | G_IO_ERR)
#define EXCEPTION_CONDITION (G_IO_PRI)
static void
gdk_synthesize_click (GdkDisplay *display,
GdkEvent *event,
+3 -51
View File
@@ -416,18 +416,12 @@ _gdk_frame_clock_begin_frame (GdkFrameClock *frame_clock)
priv->frame_counter++;
priv->current = (priv->current + 1) % FRAME_HISTORY_MAX_LENGTH;
/* Try to steal the previous frame timing instead of discarding
* and allocating a new one.
*/
if G_LIKELY (priv->n_timings == FRAME_HISTORY_MAX_LENGTH &&
_gdk_frame_timings_steal (priv->timings[priv->current],
priv->frame_counter))
return;
if (priv->n_timings < FRAME_HISTORY_MAX_LENGTH)
priv->n_timings++;
else
gdk_frame_timings_unref(priv->timings[priv->current]);
{
gdk_frame_timings_unref(priv->timings[priv->current]);
}
priv->timings[priv->current] = _gdk_frame_timings_new (priv->frame_counter);
}
@@ -609,45 +603,3 @@ gdk_frame_clock_get_refresh_info (GdkFrameClock *frame_clock,
frame_counter--;
}
}
void
_gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[FLUSH_EVENTS], 0);
}
void
_gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[BEFORE_PAINT], 0);
}
void
_gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[UPDATE], 0);
}
void
_gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[LAYOUT], 0);
}
void
_gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[PAINT], 0);
}
void
_gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[AFTER_PAINT], 0);
}
void
_gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock)
{
g_signal_emit (frame_clock, signals[RESUME_EVENTS], 0);
}
+7 -7
View File
@@ -307,7 +307,7 @@ gdk_frame_clock_flush_idle (void *data)
priv->phase = GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS;
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS;
_gdk_frame_clock_emit_flush_events (clock);
g_signal_emit_by_name (G_OBJECT (clock), "flush-events");
if ((priv->requested & ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0 ||
priv->updating_count > 0)
@@ -366,7 +366,7 @@ gdk_frame_clock_paint_idle (void *data)
* in them.
*/
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT;
_gdk_frame_clock_emit_before_paint (clock);
g_signal_emit_by_name (G_OBJECT (clock), "before-paint");
priv->phase = GDK_FRAME_CLOCK_PHASE_UPDATE;
}
/* fallthrough */
@@ -377,7 +377,7 @@ gdk_frame_clock_paint_idle (void *data)
priv->updating_count > 0)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_UPDATE;
_gdk_frame_clock_emit_update (clock);
g_signal_emit_by_name (G_OBJECT (clock), "update");
}
}
/* fallthrough */
@@ -405,7 +405,7 @@ gdk_frame_clock_paint_idle (void *data)
priv->freeze_count == 0 && iter++ < 4)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
_gdk_frame_clock_emit_layout (clock);
g_signal_emit_by_name (G_OBJECT (clock), "layout");
}
if (iter == 5)
g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
@@ -427,7 +427,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->requested & GDK_FRAME_CLOCK_PHASE_PAINT)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_PAINT;
_gdk_frame_clock_emit_paint (clock);
g_signal_emit_by_name (G_OBJECT (clock), "paint");
}
}
/* fallthrough */
@@ -435,7 +435,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->freeze_count == 0)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_AFTER_PAINT;
_gdk_frame_clock_emit_after_paint (clock);
g_signal_emit_by_name (G_OBJECT (clock), "after-paint");
/* the ::after-paint phase doesn't get repeated on freeze/thaw,
*/
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
@@ -462,7 +462,7 @@ gdk_frame_clock_paint_idle (void *data)
if (priv->requested & GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS;
_gdk_frame_clock_emit_resume_events (clock);
g_signal_emit_by_name (G_OBJECT (clock), "resume-events");
}
if (priv->freeze_count == 0)
+1 -11
View File
@@ -111,17 +111,7 @@ void _gdk_frame_clock_begin_frame (GdkFrameClock *clock);
void _gdk_frame_clock_debug_print_timings (GdkFrameClock *clock,
GdkFrameTimings *timings);
GdkFrameTimings *_gdk_frame_timings_new (gint64 frame_counter);
gboolean _gdk_frame_timings_steal (GdkFrameTimings *timings,
gint64 frame_counter);
void _gdk_frame_clock_emit_flush_events (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_before_paint (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_after_paint (GdkFrameClock *frame_clock);
void _gdk_frame_clock_emit_resume_events (GdkFrameClock *frame_clock);
GdkFrameTimings *_gdk_frame_timings_new (gint64 frame_counter);
G_END_DECLS
-17
View File
@@ -17,8 +17,6 @@
#include "config.h"
#include <string.h>
#include "gdkframeclockprivate.h"
/**
@@ -50,21 +48,6 @@ _gdk_frame_timings_new (gint64 frame_counter)
return timings;
}
gboolean
_gdk_frame_timings_steal (GdkFrameTimings *timings,
gint64 frame_counter)
{
if (timings->ref_count == 1)
{
memset (timings, 0, sizeof *timings);
timings->ref_count = 1;
timings->frame_counter = frame_counter;
return TRUE;
}
return FALSE;
}
/**
* gdk_frame_timings_ref:
* @timings: a #GdkFrameTimings
-12
View File
@@ -248,23 +248,11 @@ gdk_gl_context_upload_texture (GdkGLContext *context,
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
}
static gboolean
gdk_gl_context_real_realize (GdkGLContext *self,
GError **error)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
"The current backend does not support OpenGL");
return FALSE;
}
static void
gdk_gl_context_class_init (GdkGLContextClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
klass->realize = gdk_gl_context_real_realize;
/**
* GdkGLContext:display:
*
+1 -1
View File
@@ -613,7 +613,7 @@ gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
* This function is useful when matching key events against
* accelerators.
*
* Returns: %FALSE if two virtual modifiers were mapped to the
* Returns: %TRUE if no virtual modifiers were mapped to the
* same non-virtual modifier. Note that %FALSE is also returned
* if a virtual modifier is mapped to a non-virtual modifier that
* was already set in @state.
+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
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)
+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,
+68 -64
View File
@@ -2769,20 +2769,11 @@ gdk_window_get_paint_gl_context (GdkWindow *window,
if (window->impl_window->gl_paint_context == NULL)
{
GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (impl_class->create_gl_context == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("The current backend does not support OpenGL"));
return NULL;
}
window->impl_window->gl_paint_context =
impl_class->create_gl_context (window->impl_window,
TRUE,
NULL,
&internal_error);
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->create_gl_context (window->impl_window,
TRUE,
NULL,
&internal_error);
}
if (internal_error != NULL)
@@ -4087,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);
}
}
@@ -4154,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))
@@ -7672,7 +7697,6 @@ is_button_type (GdkEventType type)
type == GDK_BUTTON_RELEASE ||
type == GDK_TOUCH_BEGIN ||
type == GDK_TOUCH_END ||
type == GDK_TOUCH_CANCEL ||
type == GDK_SCROLL;
}
@@ -9296,7 +9320,6 @@ proxy_button_event (GdkEvent *source_event,
case GDK_TOUCH_BEGIN:
case GDK_TOUCH_END:
case GDK_TOUCH_CANCEL:
convert_toplevel_coords_to_window (event_win,
toplevel_x, toplevel_y,
&event->button.x, &event->button.y);
@@ -9312,7 +9335,7 @@ proxy_button_event (GdkEvent *source_event,
gdk_event_set_source_device (event, source_device);
if (((type == GDK_TOUCH_END || type == GDK_TOUCH_CANCEL) &&
if ((type == GDK_TOUCH_END &&
_gdk_event_get_pointer_emulated (source_event)) &&
pointer_window == pointer_info->window_under_pointer &&
gdk_device_get_source (source_device) == GDK_SOURCE_TOUCHSCREEN)
@@ -9821,25 +9844,6 @@ gdk_window_create_similar_surface (GdkWindow * window,
* Initially the surface contents are all 0 (transparent if contents
* have transparency, black otherwise.)
*
* The @width and @height of the new surface are not affected by
* the scaling factor of the @window, or by the @scale argument; they
* are the size of the surface in device pixels. If you wish to create
* an image surface capable of holding the contents of @window you can
* use:
*
* |[<!-- language="C" -->
* int scale = gdk_window_get_scale_factor (window);
* int width = gdk_window_get_width (window) * scale;
* int height = gdk_window_get_height (window) * scale;
*
* // format is set elsewhere
* cairo_surface_t *surface =
* gdk_window_create_similar_image_surface (window,
* format,
* width, height,
* scale);
* ]|
*
* Returns: a pointer to the newly allocated surface. The caller
* owns the surface and should call cairo_surface_destroy() when done
* with it.
-2
View File
@@ -587,8 +587,6 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
window = [[self contentView] gdkWindow];
current_context->display = gdk_window_get_display (window);
device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
gdk_drag_context_set_device (current_context,
gdk_device_manager_get_client_pointer (device_manager));
-1
View File
@@ -44,7 +44,6 @@ _gdk_quartz_window_drag_begin (GdkWindow *window,
/* Create fake context */
_gdk_quartz_drag_source_context = g_object_new (GDK_TYPE_QUARTZ_DRAG_CONTEXT,
NULL);
_gdk_quartz_drag_source_context->display = gdk_window_get_display (window);
_gdk_quartz_drag_source_context->is_source = TRUE;
_gdk_quartz_drag_source_context->source_window = window;
+4 -5
View File
@@ -906,7 +906,7 @@ fill_crossing_event (GdkWindow *toplevel,
such that PINCH(STARTED), PINCH(UPDATE).... will not show a second
PINCH(STARTED) event.
*/
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
static void
fill_pinch_event (GdkWindow *window,
GdkEvent *event,
@@ -1002,7 +1002,7 @@ fill_pinch_event (GdkWindow *window,
}
event->touchpad_pinch.scale = last_scale;
}
#endif /* OSX Version >= 10.8 */
#endif /* OSX Version >= 10.7 */
static void
fill_button_event (GdkWindow *window,
@@ -1647,12 +1647,11 @@ gdk_event_translate (GdkEvent *event,
}
}
break;
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
case NSEventTypeMagnify:
case NSEventTypeRotate:
/* Event handling requires [NSEvent phase] which was introduced in 10.7 */
/* However - Tests on 10.7 showed that phase property does not work */
if (gdk_quartz_osx_version () >= GDK_OSX_MOUNTAIN_LION)
if (gdk_quartz_osx_version () >= GDK_OSX_LION)
fill_pinch_event (window, event, nsevent, x, y, x_root, y_root);
else
return_val = FALSE;
+1 -1
View File
@@ -14,7 +14,7 @@ AM_CPPFLAGS = \
$(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
LDADDS = $(GDK_DEP_LIBS) $(SHM_LIBS)
LDADDS = $(GDK_DEP_LIBS)
noinst_LTLIBRARIES = \
libgdk-wayland.la
+32 -58
View File
@@ -110,7 +110,6 @@ struct _GdkWaylandSeat
guint32 repeat_timer;
guint32 repeat_key;
guint32 repeat_count;
gint64 repeat_deadline;
GSettings *keyboard_settings;
guint cursor_timeout_id;
@@ -405,8 +404,7 @@ gdk_wayland_device_query_state (GdkDevice *device,
if (root_window)
*root_window = gdk_screen_get_root_window (default_screen);
if (child_window)
/* Set child only if actually a child of the given window, as XIQueryPointer() does */
*child_window = g_list_find (window->children, seat->pointer_focus) ? seat->pointer_focus : NULL;
*child_window = seat->pointer_focus;
if (mask)
*mask = seat->button_modifiers | seat->key_modifiers;
@@ -967,9 +965,6 @@ primary_selection_selection (void *data,
GdkWaylandSeat *seat = data;
GdkAtom selection;
if (!seat->keyboard_focus)
return;
GDK_NOTE (EVENTS,
g_message ("primary selection selection, device %p, data offer %p",
gtk_primary_selection_device, gtk_primary_offer));
@@ -1054,36 +1049,31 @@ flush_scroll_event (GdkWaylandSeat *seat,
else if (pointer_frame->discrete_x < 0)
direction = GDK_SCROLL_RIGHT;
else if (pointer_frame->discrete_y > 0)
direction = GDK_SCROLL_DOWN;
else
direction = GDK_SCROLL_UP;
else
direction = GDK_SCROLL_DOWN;
flush_discrete_scroll_event (seat, direction);
pointer_frame->discrete_x = 0;
pointer_frame->discrete_y = 0;
}
if (pointer_frame->is_scroll_stop ||
pointer_frame->delta_x != 0 ||
pointer_frame->delta_y != 0)
{
/* Axes can stop independently, if we stop on one axis but have a
* delta on the other, we don't count it as a stop event.
*/
if (pointer_frame->is_scroll_stop &&
pointer_frame->delta_x == 0 &&
pointer_frame->delta_y == 0)
is_stop = TRUE;
/* Axes can stop independently, if we stop on one axis but have a
* delta on the other, we don't count it as a stop event.
*/
if (pointer_frame->is_scroll_stop &&
pointer_frame->delta_x == 0 &&
pointer_frame->delta_y == 0)
is_stop = TRUE;
flush_smooth_scroll_event (seat,
pointer_frame->delta_x,
pointer_frame->delta_y,
is_stop);
flush_smooth_scroll_event (seat,
pointer_frame->delta_x,
pointer_frame->delta_y,
is_stop);
pointer_frame->delta_x = 0;
pointer_frame->delta_y = 0;
pointer_frame->is_scroll_stop = FALSE;
}
pointer_frame->delta_x = 0;
pointer_frame->delta_y = 0;
pointer_frame->discrete_x = 0;
pointer_frame->discrete_y = 0;
pointer_frame->is_scroll_stop = FALSE;
}
static void
@@ -1388,6 +1378,9 @@ pointer_handle_frame (void *data,
{
GdkWaylandSeat *seat = data;
if (!seat->pointer_focus)
return;
GDK_NOTE (EVENTS,
g_message ("frame, seat %p", seat));
@@ -1731,9 +1724,6 @@ deliver_key_event (GdkWaylandSeat *seat,
GdkKeymap *keymap;
xkb_keysym_t sym;
guint delay, interval, timeout;
gint64 begin_time, now;
begin_time = g_get_monotonic_time ();
stop_key_repeat (seat);
@@ -1742,11 +1732,6 @@ deliver_key_event (GdkWaylandSeat *seat,
xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (keymap);
sym = xkb_state_key_get_one_sym (xkb_state, key);
if (sym == XKB_KEY_NoSymbol)
return;
if (sym == XKB_KEY_NoSymbol)
return;
seat->time = time_;
seat->key_modifiers = gdk_keymap_get_modifier_state (keymap);
@@ -1785,20 +1770,10 @@ deliver_key_event (GdkWaylandSeat *seat,
seat->repeat_count++;
seat->repeat_key = key;
interval *= 1000L;
delay *= 1000L;
now = g_get_monotonic_time ();
if (seat->repeat_count == 1)
seat->repeat_deadline = begin_time + delay;
else if (seat->repeat_deadline + interval > now)
seat->repeat_deadline += interval;
timeout = delay;
else
/* frame delay caused us to miss repeat deadline */
seat->repeat_deadline = now;
timeout = (seat->repeat_deadline - now) / 1000L;
timeout = interval;
seat->repeat_timer =
gdk_threads_add_timeout (timeout, keyboard_repeat, seat);
@@ -2761,7 +2736,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
if (native == NULL || GDK_WINDOW_DESTROYED (native))
return GDK_GRAB_NOT_VIEWABLE;
gdk_wayland_seat_set_grab_window (wayland_seat, native);
gdk_wayland_seat_set_grab_window (wayland_seat, window);
wayland_seat->pointer_grab_time = evtime;
if (prepare_func)
@@ -2780,9 +2755,9 @@ gdk_wayland_seat_grab (GdkSeat *seat,
{
GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_pointer);
if (prev_focus != native)
if (prev_focus != window)
device_emit_grab_crossing (wayland_seat->master_pointer, prev_focus,
native, GDK_CROSSING_GRAB, evtime);
window, GDK_CROSSING_GRAB, evtime);
_gdk_display_add_device_grab (display,
wayland_seat->master_pointer,
@@ -2805,9 +2780,9 @@ gdk_wayland_seat_grab (GdkSeat *seat,
{
GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->touch_master);
if (prev_focus != native)
if (prev_focus != window)
device_emit_grab_crossing (wayland_seat->touch_master, prev_focus,
native, GDK_CROSSING_GRAB, evtime);
window, GDK_CROSSING_GRAB, evtime);
_gdk_display_add_device_grab (display,
wayland_seat->touch_master,
@@ -2826,9 +2801,9 @@ gdk_wayland_seat_grab (GdkSeat *seat,
{
GdkWindow *prev_focus = gdk_wayland_device_get_focus (wayland_seat->master_keyboard);
if (prev_focus != native)
if (prev_focus != window)
device_emit_grab_crossing (wayland_seat->master_keyboard, prev_focus,
native, GDK_CROSSING_GRAB, evtime);
window, GDK_CROSSING_GRAB, evtime);
_gdk_display_add_device_grab (display,
wayland_seat->master_keyboard,
@@ -2989,8 +2964,7 @@ _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
seat->data_device =
wl_data_device_manager_get_data_device (display_wayland->data_device_manager,
seat->wl_seat);
seat->drop_context = _gdk_wayland_drop_context_new (display,
seat->data_device);
seat->drop_context = _gdk_wayland_drop_context_new (seat->data_device);
wl_data_device_add_listener (seat->data_device,
&data_device_listener, seat);
+103 -63
View File
@@ -22,11 +22,7 @@
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef HAVE_LINUX_MEMFD_H
#include <linux/memfd.h>
#endif
#include <sys/mman.h>
#include <sys/syscall.h>
@@ -234,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,
@@ -258,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)
{
@@ -509,13 +597,7 @@ gdk_wayland_display_finalize (GObject *object)
static const gchar *
gdk_wayland_display_get_name (GdkDisplay *display)
{
const gchar *name;
name = g_getenv ("WAYLAND_DISPLAY");
if (name == NULL)
name = "wayland-0";
return name;
return "Wayland";
}
static GdkScreen *
@@ -955,54 +1037,6 @@ typedef struct _GdkWaylandCairoSurfaceData {
uint32_t scale;
} GdkWaylandCairoSurfaceData;
static int
open_shared_memory (void)
{
static gboolean force_shm_open = FALSE;
int ret = -1;
#if !defined (__NR_memfd_create)
force_shm_open = TRUE;
#endif
do
{
#if defined (__NR_memfd_create)
if (!force_shm_open)
{
ret = syscall (__NR_memfd_create, "gdk-wayland", MFD_CLOEXEC);
/* fall back to shm_open until debian stops shipping 3.16 kernel
* See bug 766341
*/
if (ret < 0 && errno == ENOSYS)
force_shm_open = TRUE;
}
#endif
if (force_shm_open)
{
char name[NAME_MAX - 1] = "";
sprintf (name, "/gdk-wayland-%x", g_random_int ());
ret = shm_open (name, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0600);
if (ret >= 0)
shm_unlink (name);
else if (errno == EEXIST)
continue;
}
}
while (ret < 0 && errno == EINTR);
if (ret < 0)
g_critical (G_STRLOC ": creating shared memory file (using %s) failed: %m",
force_shm_open? "shm_open" : "memfd_create");
return ret;
}
static struct wl_shm_pool *
create_shm_pool (struct wl_shm *shm,
int size,
@@ -1010,13 +1044,19 @@ create_shm_pool (struct wl_shm *shm,
void **data_out)
{
struct wl_shm_pool *pool;
int fd;
int ret, fd;
void *data;
fd = open_shared_memory ();
ret = syscall (__NR_memfd_create, "gdk-wayland", MFD_CLOEXEC);
if (fd < 0)
return NULL;
if (ret < 0)
{
g_critical (G_STRLOC ": creating shared memory file failed: %s",
g_strerror (-ret));
return NULL;
}
fd = ret;
if (ftruncate (fd, size) < 0)
{
-3
View File
@@ -82,9 +82,6 @@ struct _GdkWaylandDisplay
GHashTable *known_globals;
GList *on_has_globals_closures;
/* Keep a list of orphaned dialogs (i.e. without parent) */
GList *orphan_dialogs;
struct wl_cursor_theme *scaled_cursor_themes[GDK_WAYLAND_THEME_SCALES_COUNT];
gchar *cursor_theme_name;
int cursor_theme_size;
+2 -5
View File
@@ -427,7 +427,7 @@ gdk_wayland_drag_context_action_changed (GdkDragContext *context,
{
GdkCursor *cursor;
cursor = gdk_drag_get_cursor (context, action);
cursor = gdk_drag_get_cursor (action);
gdk_drag_context_set_cursor (context, cursor);
}
@@ -528,7 +528,6 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT, NULL);
context = GDK_DRAG_CONTEXT (context_wayland);
context->display = gdk_window_get_display (window);
context->source_window = g_object_ref (window);
context->is_source = TRUE;
context->targets = g_list_copy (targets);
@@ -553,15 +552,13 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
}
GdkDragContext *
_gdk_wayland_drop_context_new (GdkDisplay *display,
struct wl_data_device *data_device)
_gdk_wayland_drop_context_new (struct wl_data_device *data_device)
{
GdkWaylandDragContext *context_wayland;
GdkDragContext *context;
context_wayland = g_object_new (GDK_TYPE_WAYLAND_DRAG_CONTEXT, NULL);
context = GDK_DRAG_CONTEXT (context_wayland);
context->display = display;
context->is_source = FALSE;
return context;
+19 -48
View File
@@ -28,9 +28,10 @@ typedef struct _GdkWaylandEventSource {
GPollFD pfd;
uint32_t mask;
GdkDisplay *display;
gboolean reading;
} GdkWaylandEventSource;
static GList *event_sources = NULL;
static gboolean
gdk_event_source_prepare (GSource *base,
gint *timeout)
@@ -45,26 +46,17 @@ gdk_event_source_prepare (GSource *base,
/* We have to add/remove the GPollFD if we want to update our
* poll event mask dynamically. Instead, let's just flush all
* write on idle instead, which is what this amounts to.
*/
* write on idle instead, which is what this amounts to. */
if (_gdk_event_queue_find_first (source->display) != NULL)
return TRUE;
/* wl_display_prepare_read() needs to be balanced with either
* wl_display_read_events() or wl_display_cancel_read()
* (in gdk_event_source_check() */
if (source->reading)
return FALSE;
/* if prepare_read() returns non-zero, there are events to be dispatched */
if (wl_display_prepare_read (display->wl_display) != 0)
return TRUE;
source->reading = TRUE;
if (wl_display_flush (display->wl_display) < 0)
g_error ("Error flushing display: %s", g_strerror (errno));
if (wl_display_dispatch_pending (display->wl_display) < 0)
g_error ("Error dispatching display: %s", g_strerror (errno));
return FALSE;
}
@@ -72,29 +64,9 @@ static gboolean
gdk_event_source_check (GSource *base)
{
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
GdkWaylandDisplay *display_wayland = (GdkWaylandDisplay *) source->display;
if (source->display->event_pause_count > 0)
{
if (source->reading)
wl_display_cancel_read (display_wayland->wl_display);
source->reading = FALSE;
return _gdk_event_queue_find_first (source->display) != NULL;
}
/* read the events from the wayland fd into their respective queues if we have data */
if (source->reading)
{
if (source->pfd.revents & G_IO_IN)
{
if (wl_display_read_events (display_wayland->wl_display) < 0)
g_error ("Error reading events from display: %s", g_strerror (errno));
}
else
wl_display_cancel_read (display_wayland->wl_display);
source->reading = FALSE;
}
return _gdk_event_queue_find_first (source->display) != NULL;
return _gdk_event_queue_find_first (source->display) != NULL ||
source->pfd.revents;
@@ -126,14 +98,9 @@ gdk_event_source_dispatch (GSource *base,
}
static void
gdk_event_source_finalize (GSource *base)
gdk_event_source_finalize (GSource *source)
{
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
GdkWaylandDisplay *display = (GdkWaylandDisplay *) source->display;
if (source->reading)
wl_display_cancel_read (display->wl_display);
source->reading = FALSE;
event_sources = g_list_remove (event_sources, source);
}
static GSourceFuncs wl_glib_source_funcs = {
@@ -164,8 +131,7 @@ _gdk_wayland_display_event_source_new (GdkDisplay *display)
source = g_source_new (&wl_glib_source_funcs,
sizeof (GdkWaylandEventSource));
name = g_strdup_printf ("GDK Wayland Event source (%s)",
gdk_display_get_name (display));
name = g_strdup_printf ("GDK Wayland Event source (%s)", "display name");
g_source_set_name (source, name);
g_free (name);
wl_source = (GdkWaylandEventSource *) source;
@@ -180,6 +146,8 @@ _gdk_wayland_display_event_source_new (GdkDisplay *display)
g_source_set_can_recurse (source, TRUE);
g_source_attach (source, NULL);
event_sources = g_list_prepend (event_sources, source);
return source;
}
@@ -192,11 +160,14 @@ _gdk_wayland_display_queue_events (GdkDisplay *display)
display_wayland = GDK_WAYLAND_DISPLAY (display);
source = (GdkWaylandEventSource *) display_wayland->event_source;
if (wl_display_dispatch_pending (display_wayland->wl_display) < 0)
if (source->pfd.revents & G_IO_IN)
{
g_warning ("Error %d (%s) dispatching to Wayland display.",
errno, g_strerror (errno));
exit (1);
if (wl_display_dispatch (display_wayland->wl_display) < 0)
{
g_warning ("Error %d (%s) dispatching to Wayland display.",
errno, g_strerror (errno));
exit (1);
}
}
if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
+7 -52
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);
@@ -351,7 +354,7 @@ gdk_wayland_keymap_translate_keyboard_state (GdkKeymap *keymap,
if (consumed_modifiers)
*consumed_modifiers = get_gdk_modifiers (xkb_keymap, consumed);
return (sym != XKB_KEY_NoSymbol);
return TRUE;
}
static guint
@@ -370,62 +373,14 @@ static void
gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
xkb_mod_index_t idx;
uint32_t mods, real;
struct { const char *name; GdkModifierType mask; } vmods[] = {
{ "Super", GDK_SUPER_MASK },
{ "Hyper", GDK_HYPER_MASK },
{ "Meta", GDK_META_MASK },
{ NULL, 0 }
};
int i;
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
mods = get_xkb_modifiers (xkb_keymap, *state);
xkb_state = xkb_state_new (xkb_keymap);
for (i = 0; vmods[i].name; i++)
{
idx = xkb_keymap_mod_get_index (xkb_keymap, vmods[i].name);
if (idx == XKB_MOD_INVALID)
continue;
xkb_state_update_mask (xkb_state, 1 << idx, 0, 0, 0, 0, 0);
real = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
real &= 0xf0; /* ignore mapping to Lock, Shift, Control, Mod1 */
if (mods & real)
*state |= vmods[i].mask;
xkb_state_update_mask (xkb_state, 0, 0, 0, 0, 0, 0);
}
xkb_state_unref (xkb_state);
return;
}
static gboolean
gdk_wayland_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
uint32_t mods, mapped;
gboolean ret = TRUE;
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
mods = get_xkb_modifiers (xkb_keymap, *state);
xkb_state = xkb_state_new (xkb_keymap);
xkb_state_update_mask (xkb_state, mods & ~0xff, 0, 0, 0, 0, 0);
mapped = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
if ((mapped & mods & 0xff) != 0)
ret = FALSE;
*state |= get_gdk_modifiers (xkb_keymap, mapped);
xkb_state_unref (xkb_state);
return ret;
return TRUE;
}
static void
+1 -2
View File
@@ -109,8 +109,7 @@ GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window,
void _gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window,
int x,
int y);
GdkDragContext * _gdk_wayland_drop_context_new (GdkDisplay *display,
struct wl_data_device *data_device);
GdkDragContext * _gdk_wayland_drop_context_new (struct wl_data_device *data_device);
void _gdk_wayland_drag_context_set_source_window (GdkDragContext *context,
GdkWindow *window);
void _gdk_wayland_drag_context_set_dest_window (GdkDragContext *context,
+72 -13
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
@@ -301,7 +297,13 @@ gdk_wayland_screen_is_composited (GdkScreen *screen)
static gchar *
gdk_wayland_screen_make_display_name (GdkScreen *screen)
{
return g_strdup (gdk_display_get_name (GDK_WAYLAND_SCREEN (screen)->display));
const gchar *name;
name = g_getenv ("WAYLAND_DISPLAY");
if (name == NULL)
name = "wayland-0";
return g_strdup (name);
}
static GdkWindow *
@@ -620,8 +622,6 @@ init_settings (GdkScreen *screen)
screen_wayland->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
source = g_settings_schema_source_get_default ();
if (source == NULL)
return;
for (i = 0; i < G_N_ELEMENTS (translations); i++)
{
@@ -860,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*
@@ -875,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
@@ -1062,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,
@@ -1077,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;
+39 -119
View File
@@ -35,7 +35,6 @@
#include <string.h>
typedef struct _SelectionBuffer SelectionBuffer;
typedef struct _SelectionData SelectionData;
typedef struct _StoredSelection StoredSelection;
typedef struct _AsyncWriteData AsyncWriteData;
typedef struct _DataOfferData DataOfferData;
@@ -81,26 +80,22 @@ struct _AsyncWriteData
gsize index;
};
struct _SelectionData
{
DataOfferData *offer;
GHashTable *buffers; /* Hashtable of target_atom->SelectionBuffer */
};
enum {
ATOM_PRIMARY,
ATOM_CLIPBOARD,
ATOM_DND,
N_ATOMS
ATOM_DND
};
static GdkAtom atoms[N_ATOMS] = { 0 };
static GdkAtom atoms[3] = { 0 };
struct _GdkWaylandSelection
{
/* Destination-side data */
SelectionData selections[N_ATOMS];
DataOfferData *dnd_offer;
DataOfferData *clipboard_offer;
DataOfferData *primary_offer;
GHashTable *offers; /* Currently alive offers, Hashtable of wl_data_offer->DataOfferData */
GHashTable *selection_buffers; /* Hashtable of target_atom->SelectionBuffer */
/* Source-side data */
StoredSelection stored_selection;
@@ -312,7 +307,6 @@ GdkWaylandSelection *
gdk_wayland_selection_new (void)
{
GdkWaylandSelection *selection;
gint i;
/* init atoms */
atoms[ATOM_PRIMARY] = gdk_atom_intern_static_string ("PRIMARY");
@@ -320,13 +314,9 @@ gdk_wayland_selection_new (void)
atoms[ATOM_DND] = gdk_atom_intern_static_string ("GdkWaylandSelection");
selection = g_new0 (GdkWaylandSelection, 1);
for (i = 0; i < G_N_ELEMENTS (selection->selections); i++)
{
selection->selections[i].buffers =
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) selection_buffer_cancel_and_unref);
}
selection->selection_buffers =
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) selection_buffer_cancel_and_unref);
selection->offers =
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) data_offer_data_free);
@@ -338,11 +328,7 @@ gdk_wayland_selection_new (void)
void
gdk_wayland_selection_free (GdkWaylandSelection *selection)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (selection->selections); i++)
g_hash_table_destroy (selection->selections[i].buffers);
g_hash_table_destroy (selection->selection_buffers);
g_array_unref (selection->source_targets);
g_hash_table_destroy (selection->offers);
@@ -470,16 +456,16 @@ static const struct gtk_primary_selection_offer_listener primary_offer_listener
primary_offer_offer,
};
SelectionData *
DataOfferData *
selection_lookup_offer_by_atom (GdkWaylandSelection *selection,
GdkAtom selection_atom)
{
if (selection_atom == atoms[ATOM_PRIMARY])
return &selection->selections[ATOM_PRIMARY];
return selection->primary_offer;
else if (selection_atom == atoms[ATOM_CLIPBOARD])
return &selection->selections[ATOM_CLIPBOARD];
return selection->clipboard_offer;
else if (selection_atom == atoms[ATOM_DND])
return &selection->selections[ATOM_DND];
return selection->dnd_offer;
else
return NULL;
}
@@ -531,7 +517,6 @@ gdk_wayland_selection_set_offer (GdkDisplay *display,
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
struct wl_data_offer *prev_offer;
SelectionData *selection_data;
DataOfferData *info;
info = g_hash_table_lookup (selection->offers, wl_offer);
@@ -541,14 +526,15 @@ gdk_wayland_selection_set_offer (GdkDisplay *display,
if (prev_offer)
g_hash_table_remove (selection->offers, prev_offer);
selection_data = selection_lookup_offer_by_atom (selection, selection_atom);
if (selection_atom == atoms[ATOM_PRIMARY])
selection->primary_offer = info;
else if (selection_atom == atoms[ATOM_CLIPBOARD])
selection->clipboard_offer = info;
else if (selection_atom == atoms[ATOM_DND])
selection->dnd_offer = info;
if (selection_data)
{
selection_data->offer = info;
/* Clear all buffers */
g_hash_table_remove_all (selection_data->buffers);
}
/* Clear all buffers */
g_hash_table_remove_all (selection->selection_buffers);
}
gpointer
@@ -556,12 +542,12 @@ gdk_wayland_selection_get_offer (GdkDisplay *display,
GdkAtom selection_atom)
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
const SelectionData *data;
const DataOfferData *info;
data = selection_lookup_offer_by_atom (selection, selection_atom);
info = selection_lookup_offer_by_atom (selection, selection_atom);
if (data && data->offer)
return data->offer->offer_data;
if (info)
return info->offer_data;
return NULL;
}
@@ -571,12 +557,12 @@ gdk_wayland_selection_get_targets (GdkDisplay *display,
GdkAtom selection_atom)
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
const SelectionData *data;
const DataOfferData *info;
data = selection_lookup_offer_by_atom (selection, selection_atom);
info = selection_lookup_offer_by_atom (selection, selection_atom);
if (data && data->offer)
return data->offer->targets;
if (info)
return info->targets;
return NULL;
}
@@ -763,17 +749,13 @@ gdk_wayland_selection_lookup_requestor_buffer (GdkWindow *requestor)
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
SelectionBuffer *buffer_data;
GHashTableIter iter;
gint i;
for (i = 0; i < G_N_ELEMENTS (selection->selections); i++)
g_hash_table_iter_init (&iter, selection->selection_buffers);
while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &buffer_data))
{
g_hash_table_iter_init (&iter, selection->selections[i].buffers);
while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &buffer_data))
{
if (g_list_find (buffer_data->requestors, requestor))
return buffer_data;
}
if (g_list_find (buffer_data->requestors, requestor))
return buffer_data;
}
return NULL;
@@ -1273,16 +1255,11 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
guint32 time)
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
const SelectionData *selection_data;
SelectionBuffer *buffer_data;
gpointer offer;
gchar *mimetype;
GList *target_list;
selection_data = selection_lookup_offer_by_atom (wayland_selection, selection);
if (!selection_data)
return;
offer = gdk_wayland_selection_get_offer (display, selection);
target_list = gdk_wayland_selection_get_targets (display, selection);
@@ -1308,7 +1285,8 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
mimetype);
}
buffer_data = g_hash_table_lookup (selection_data->buffers, target);
buffer_data = g_hash_table_lookup (wayland_selection->selection_buffers,
target);
if (buffer_data)
selection_buffer_add_requestor (buffer_data, requestor);
@@ -1355,7 +1333,7 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
g_free (targets);
}
g_hash_table_insert (selection_data->buffers,
g_hash_table_insert (wayland_selection->selection_buffers,
GDK_ATOM_TO_POINTER (target),
buffer_data);
}
@@ -1407,69 +1385,11 @@ _gdk_wayland_display_text_property_to_utf8_list (GdkDisplay *display,
return nitems;
}
/* This function has been copied straight from the x11 backend */
static gchar *
sanitize_utf8 (const gchar *src,
gboolean return_latin1)
{
gint len = strlen (src);
GString *result = g_string_sized_new (len);
const gchar *p = src;
while (*p)
{
if (*p == '\r')
{
p++;
if (*p == '\n')
p++;
g_string_append_c (result, '\n');
}
else
{
gunichar ch = g_utf8_get_char (p);
if (!((ch < 0x20 && ch != '\t' && ch != '\n') || (ch >= 0x7f && ch < 0xa0)))
{
if (return_latin1)
{
if (ch <= 0xff)
g_string_append_c (result, ch);
else
g_string_append_printf (result,
ch < 0x10000 ? "\\u%04x" : "\\U%08x",
ch);
}
else
{
char buf[7];
gint buflen;
buflen = g_unichar_to_utf8 (ch, buf);
g_string_append_len (result, buf, buflen);
}
}
p = g_utf8_next_char (p);
}
}
return g_string_free (result, FALSE);
}
gchar *
_gdk_wayland_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str)
{
/* This is mainly needed when interfacing with old clients through
* Xwayland, the STRING target could be used, and passed as-is
* by the compositor.
*
* There's already some handling of this atom (aka "mimetype" in
* this backend) in common code, so we end up in this vfunc.
*/
return sanitize_utf8 (str, TRUE);
return NULL;
}
void
+16 -45
View File
@@ -168,10 +168,10 @@ struct _GdkWindowImplWaylandClass
GdkWindowImplClass parent_class;
};
static void gdk_wayland_window_maybe_configure (GdkWindow *window,
int width,
int height,
int scale);
static void gdk_wayland_window_configure (GdkWindow *window,
int width,
int height,
int scale);
static void maybe_set_gtk_surface_dbus_properties (GdkWindow *window);
static void maybe_set_gtk_surface_modal (GdkWindow *window);
@@ -191,15 +191,14 @@ _gdk_window_impl_wayland_init (GdkWindowImplWayland *impl)
impl->saved_height = -1;
}
/* Keep a list of orphaned dialogs (i.e. without parent) */
static GList *orphan_dialogs;
static void
_gdk_wayland_screen_add_orphan_dialog (GdkWindow *window)
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
if (!g_list_find (display_wayland->orphan_dialogs, window))
display_wayland->orphan_dialogs =
g_list_prepend (display_wayland->orphan_dialogs, window);
if (!g_list_find (orphan_dialogs, window))
orphan_dialogs = g_list_prepend (orphan_dialogs, window);
}
static void
@@ -572,7 +571,7 @@ window_update_scale (GdkWindow *window)
}
/* Notify app that scale changed */
gdk_wayland_window_maybe_configure (window, window->width, window->height, scale);
gdk_wayland_window_configure (window, window->width, window->height, scale);
}
static void
@@ -927,22 +926,6 @@ gdk_wayland_window_configure (GdkWindow *window,
_gdk_wayland_display_deliver_event (display, event);
}
static void
gdk_wayland_window_maybe_configure (GdkWindow *window,
int width,
int height,
int scale)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (window->width == width &&
window->height == height &&
impl->scale == scale)
return;
gdk_wayland_window_configure (window, width, height, scale);
}
static void
gdk_wayland_window_sync_parent (GdkWindow *window,
GdkWindow *parent)
@@ -951,9 +934,6 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
GdkWindowImplWayland *impl_parent = NULL;
struct xdg_surface *parent_surface;
g_assert (parent == NULL ||
gdk_window_get_display (window) == gdk_window_get_display (parent));
if (!impl->display_server.xdg_surface)
return;
@@ -979,14 +959,12 @@ gdk_wayland_window_sync_parent (GdkWindow *window,
static void
gdk_wayland_window_update_dialogs (GdkWindow *window)
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GList *l;
if (!display_wayland->orphan_dialogs)
if (!orphan_dialogs)
return;
for (l = display_wayland->orphan_dialogs; l; l = l->next)
for (l = orphan_dialogs; l; l = l->next)
{
GdkWindow *w = l->data;
GdkWindowImplWayland *impl;
@@ -1833,8 +1811,7 @@ gdk_wayland_window_hide_surface (GdkWindow *window)
impl->display_server.outputs = NULL;
if (impl->hint == GDK_WINDOW_TYPE_HINT_DIALOG && !impl->transient_for)
display_wayland->orphan_dialogs =
g_list_remove (display_wayland->orphan_dialogs, window);
orphan_dialogs = g_list_remove (orphan_dialogs, window);
}
_gdk_wayland_window_clear_saved_size (window);
@@ -1959,7 +1936,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
* just move the window - don't update its size
*/
if (width > 0 && height > 0)
gdk_wayland_window_maybe_configure (window, width, height, impl->scale);
gdk_wayland_window_configure (window, width, height, impl->scale);
}
static void
@@ -2295,13 +2272,8 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindow *previous_parent;
g_assert (parent == NULL ||
gdk_window_get_display (window) == gdk_window_get_display (parent));
if (check_transient_for_loop (window, parent))
{
g_warning ("Setting %p transient for %p would create a loop", window, parent);
@@ -2319,8 +2291,7 @@ gdk_wayland_window_set_transient_for (GdkWindow *window,
if (!parent)
_gdk_wayland_screen_add_orphan_dialog (window);
else if (!previous_parent)
display_wayland->orphan_dialogs =
g_list_remove (display_wayland->orphan_dialogs, window);
orphan_dialogs = g_list_remove (orphan_dialogs, window);
}
gdk_wayland_window_sync_parent (window, NULL);
if (should_map_as_subsurface (window) &&
@@ -2773,7 +2744,7 @@ gdk_wayland_window_set_shadow_width (GdkWindow *window,
(impl->margin_left + impl->margin_right) + (left + right);
new_height = window->height -
(impl->margin_top + impl->margin_bottom) + (top + bottom);
gdk_wayland_window_maybe_configure (window, new_width, new_height, impl->scale);
gdk_wayland_window_configure (window, new_width, new_height, impl->scale);
impl->margin_left = left;
impl->margin_right = right;
+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);
-1
View File
@@ -182,7 +182,6 @@ gdk_drag_context_new (GdkDisplay *display)
context_win32 = g_object_new (GDK_TYPE_WIN32_DRAG_CONTEXT, NULL);
context = GDK_DRAG_CONTEXT(context_win32);
context->display = display;
gdk_drag_context_set_device (context, gdk_seat_get_pointer (gdk_display_get_default_seat (display)));
+50 -5
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)
{
@@ -2041,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;
@@ -2285,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);
+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);
}
+3
View File
@@ -536,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,
+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
+141
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;
@@ -173,6 +298,22 @@ 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;
+3 -7
View File
@@ -2878,14 +2878,10 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
{
GList *seats, *l;
int device_id;
gboolean result = FALSE;
seats = gdk_display_list_seats (display);
gdk_x11_display_error_trap_push (display);
result = XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display),
None, &device_id);
gdk_x11_display_error_trap_pop_ignored (display);
XIGetClientPointer (GDK_DISPLAY_XDISPLAY (display),
None, &device_id);
for (l = seats; l; l = l->next)
{
@@ -2893,7 +2889,7 @@ gdk_x11_display_get_default_seat (GdkDisplay *display)
pointer = gdk_seat_get_pointer (l->data);
if (gdk_x11_device_get_id (pointer) == device_id || !result)
if (gdk_x11_device_get_id (pointer) == device_id)
{
GdkSeat *seat = l->data;
g_list_free (seats);
+2 -16
View File
@@ -1705,7 +1705,6 @@ xdnd_enter_filter (GdkXEvent *xev,
context_x11 = (GdkX11DragContext *)g_object_new (GDK_TYPE_X11_DRAG_CONTEXT, NULL);
context = (GdkDragContext *)context_x11;
context->display = display;
context->protocol = GDK_DRAG_PROTO_XDND;
context_x11->version = version;
@@ -2021,7 +2020,6 @@ _gdk_x11_window_drag_begin (GdkWindow *window,
context = (GdkDragContext *) g_object_new (GDK_TYPE_X11_DRAG_CONTEXT, NULL);
context->display = gdk_window_get_display (window);
context->is_source = TRUE;
context->source_window = window;
g_object_ref (window);
@@ -2656,7 +2654,6 @@ drag_context_grab (GdkDragContext *context)
{
GdkX11DragContext *x11_context = GDK_X11_DRAG_CONTEXT (context);
GdkDevice *device = gdk_drag_context_get_device (context);
GdkSeatCapabilities capabilities;
GdkWindow *root;
GdkSeat *seat;
gint keycode, i;
@@ -2667,15 +2664,8 @@ drag_context_grab (GdkDragContext *context)
root = gdk_screen_get_root_window (gdk_window_get_screen (x11_context->ipc_window));
seat = gdk_device_get_seat (gdk_drag_context_get_device (context));
#ifdef XINPUT_2
if (GDK_IS_X11_DEVICE_XI2 (device))
capabilities = GDK_SEAT_CAPABILITY_ALL_POINTING;
else
#endif
capabilities = GDK_SEAT_CAPABILITY_ALL;
if (gdk_seat_grab (seat, x11_context->ipc_window,
capabilities, FALSE,
GDK_SEAT_CAPABILITY_ALL, FALSE,
x11_context->cursor, NULL, NULL, NULL) != GDK_GRAB_SUCCESS)
return FALSE;
@@ -3042,10 +3032,6 @@ gdk_dnd_handle_grab_broken_event (GdkDragContext *context,
event->grab_window == x11_context->ipc_window)
return FALSE;
if (gdk_event_get_device ((GdkEvent *) event) !=
gdk_drag_context_get_device (context))
return FALSE;
gdk_drag_context_cancel (context, GDK_DRAG_CANCEL_ERROR);
return TRUE;
}
@@ -3146,6 +3132,6 @@ gdk_x11_drag_context_action_changed (GdkDragContext *context,
{
GdkCursor *cursor;
cursor = gdk_drag_get_cursor (context, action);
cursor = gdk_drag_get_cursor (action);
gdk_drag_context_set_cursor (context, cursor);
}
+6
View File
@@ -51,6 +51,8 @@ static GSourceFuncs event_funcs = {
gdk_event_source_finalize
};
static GList *event_sources = NULL;
static gint
gdk_event_apply_filters (XEvent *xevent,
GdkEvent *event,
@@ -381,6 +383,8 @@ gdk_event_source_finalize (GSource *source)
g_list_free (event_source->translators);
event_source->translators = NULL;
event_sources = g_list_remove (event_sources, source);
}
GSource *
@@ -411,6 +415,8 @@ gdk_x11_event_source_new (GdkDisplay *display)
g_source_set_can_recurse (source, TRUE);
g_source_attach (source, NULL);
event_sources = g_list_prepend (event_sources, source);
return source;
}
+7 -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 \
@@ -1507,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
@@ -464,7 +464,7 @@ set_recent_manager (GtkRecentAction *action,
GtkRecentActionPrivate *priv = action->priv;
if (manager)
priv->manager = manager;
priv->manager = NULL;
else
priv->manager = gtk_recent_manager_get_default ();
}
@@ -475,6 +475,8 @@ gtk_recent_action_finalize (GObject *gobject)
GtkRecentAction *action = GTK_RECENT_ACTION (gobject);
GtkRecentActionPrivate *priv = action->priv;
priv->manager = NULL;
if (priv->data_destroy)
{
priv->data_destroy (priv->sort_data);
@@ -501,8 +503,6 @@ gtk_recent_action_dispose (GObject *gobject)
priv->current_filter = NULL;
}
priv->manager = NULL;
G_OBJECT_CLASS (gtk_recent_action_parent_class)->dispose (gobject);
}
+47 -82
View File
@@ -3199,6 +3199,44 @@ mark_node_dirty (GNode *node)
NODE_INFO (p)->dirty = TRUE;
}
static const gchar *
open_tag_format (NodeType type)
{
switch (type)
{
case NODE_TYPE_UNDECIDED: return "%*s<UNDECIDED";
case NODE_TYPE_ROOT: return "%*s<ui";
case NODE_TYPE_MENUBAR: return "%*s<menubar";
case NODE_TYPE_MENU: return "%*s<menu";
case NODE_TYPE_TOOLBAR: return "%*s<toolbar";
case NODE_TYPE_MENU_PLACEHOLDER:
case NODE_TYPE_TOOLBAR_PLACEHOLDER: return "%*s<placeholder";
case NODE_TYPE_POPUP: return "%*s<popup";
case NODE_TYPE_MENUITEM: return "%*s<menuitem";
case NODE_TYPE_TOOLITEM: return "%*s<toolitem";
case NODE_TYPE_SEPARATOR: return "%*s<separator";
case NODE_TYPE_ACCELERATOR: return "%*s<accelerator";
default: return NULL;
}
}
static const gchar *
close_tag_format (NodeType type)
{
switch (type)
{
case NODE_TYPE_UNDECIDED: return "%*s</UNDECIDED>\n";
case NODE_TYPE_ROOT: return "%*s</ui>\n";
case NODE_TYPE_MENUBAR: return "%*s</menubar>\n";
case NODE_TYPE_MENU: return "%*s</menu>\n";
case NODE_TYPE_TOOLBAR: return "%*s</toolbar>\n";
case NODE_TYPE_MENU_PLACEHOLDER:
case NODE_TYPE_TOOLBAR_PLACEHOLDER: return "%*s</placeholder>\n";
case NODE_TYPE_POPUP: return "%*s</popup>\n";
default: return NULL;
}
}
static void
print_node (GtkUIManager *manager,
GNode *node,
@@ -3207,48 +3245,15 @@ print_node (GtkUIManager *manager,
{
Node *mnode;
GNode *child;
const gchar *open_fmt;
const gchar *close_fmt;
mnode = node->data;
switch (mnode->type)
{
case NODE_TYPE_UNDECIDED:
g_string_append_printf (buffer, "%*s<UNDECIDED", indent_level, "");
break;
case NODE_TYPE_ROOT:
g_string_append_printf (buffer, "%*s<ui", indent_level, "");
break;
case NODE_TYPE_MENUBAR:
g_string_append_printf (buffer, "%*s<menubar", indent_level, "");
break;
case NODE_TYPE_MENU:
g_string_append_printf (buffer, "%*s<menu", indent_level, "");
break;
case NODE_TYPE_TOOLBAR:
g_string_append_printf (buffer, "%*s<toolbar", indent_level, "");
break;
case NODE_TYPE_MENU_PLACEHOLDER:
case NODE_TYPE_TOOLBAR_PLACEHOLDER:
g_string_append_printf (buffer, "%*s<placeholder", indent_level, "");
break;
case NODE_TYPE_POPUP:
g_string_append_printf (buffer, "%*s<popup", indent_level, "");
break;
case NODE_TYPE_MENUITEM:
g_string_append_printf (buffer, "%*s<menuitem", indent_level, "");
break;
case NODE_TYPE_TOOLITEM:
g_string_append_printf (buffer, "%*s<toolitem", indent_level, "");
break;
case NODE_TYPE_SEPARATOR:
g_string_append_printf (buffer, "%*s<separator", indent_level, "");
break;
case NODE_TYPE_ACCELERATOR:
g_string_append_printf (buffer, "%*s<accelerator", indent_level, "");
break;
default:
;; /* Nothing */
}
open_fmt = open_tag_format (mnode->type);
close_fmt = close_tag_format (mnode->type);
g_string_append_printf (buffer, open_fmt, indent_level, "");
if (mnode->type != NODE_TYPE_ROOT)
{
@@ -3260,53 +3265,13 @@ print_node (GtkUIManager *manager,
g_quark_to_string (mnode->action_name));
}
switch (mnode->type)
{
case NODE_TYPE_UNDECIDED:
case NODE_TYPE_ROOT:
case NODE_TYPE_MENUBAR:
case NODE_TYPE_MENU:
case NODE_TYPE_TOOLBAR:
case NODE_TYPE_MENU_PLACEHOLDER:
case NODE_TYPE_TOOLBAR_PLACEHOLDER:
case NODE_TYPE_POPUP:
g_string_append (buffer, ">\n");
break;
default:
g_string_append (buffer, "/>\n");
break;
}
g_string_append (buffer, close_fmt ? ">\n" : "/>\n");
for (child = node->children; child != NULL; child = child->next)
print_node (manager, child, indent_level + 2, buffer);
switch (mnode->type)
{
case NODE_TYPE_UNDECIDED:
g_string_append_printf (buffer, "%*s</UNDECIDED>\n", indent_level, "");
break;
case NODE_TYPE_ROOT:
g_string_append_printf (buffer, "%*s</ui>\n", indent_level, "");
break;
case NODE_TYPE_MENUBAR:
g_string_append_printf (buffer, "%*s</menubar>\n", indent_level, "");
break;
case NODE_TYPE_MENU:
g_string_append_printf (buffer, "%*s</menu>\n", indent_level, "");
break;
case NODE_TYPE_TOOLBAR:
g_string_append_printf (buffer, "%*s</toolbar>\n", indent_level, "");
break;
case NODE_TYPE_MENU_PLACEHOLDER:
case NODE_TYPE_TOOLBAR_PLACEHOLDER:
g_string_append_printf (buffer, "%*s</placeholder>\n", indent_level, "");
break;
case NODE_TYPE_POPUP:
g_string_append_printf (buffer, "%*s</popup>\n", indent_level, "");
break;
default:
;; /* Nothing */
}
if (close_fmt)
g_string_append_printf (buffer, close_fmt, indent_level, "");
}
static gboolean
-1
View File
@@ -164,7 +164,6 @@ needs_explicit_setting (MyParserData *data,
{ "GtkCalendar", "year", 0 },
{ "GtkCalendar", "month", 0 },
{ "GtkCalendar", "day", 0 },
{ "GtkDialog", "border-width", 0 },
{ "GtkPlacesSidebar", "show-desktop", 0 },
{ "GtkRadioButton", "draw-indicator", 0 },
{ "GtkGrid", "left-attach", 1 },
+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>
+8 -5
View File
@@ -108,6 +108,11 @@ typedef struct
const gchar *url;
} LicenseInfo;
/* Translators: this is the license preamble; the string at the end
* contains the name of the license as link text.
*/
static const gchar *gtk_license_preamble = N_("This program comes with absolutely no warranty.\nSee the <a href=\"%s\">%s</a> for details.");
/* LicenseInfo for each GtkLicense type; keep in the same order as the enumeration */
static const LicenseInfo gtk_license_info [] = {
{ N_("License"), NULL },
@@ -122,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
@@ -2483,10 +2489,7 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about,
url = priv->website_url;
str = g_string_sized_new (256);
/* Translators: this is the license preamble; the string at the end
* contains the name of the license as link text.
*/
g_string_append_printf (str, _("This program comes with absolutely no warranty.\nSee the <a href=\"%s\">%s</a> for details."), url, name);
g_string_append_printf (str, _(gtk_license_preamble), url, name);
g_free (priv->license);
priv->license = g_string_free (str, FALSE);
+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;
/**
+1 -1
View File
@@ -40,7 +40,7 @@
* The action will be looked up in action groups that are found among
* the widgets ancestors. Most commonly, these will be the actions with
* the win. or app. prefix that are associated with the #GtkApplicationWindow
* or #GtkApplication, but other action groups that are added with
* or "GtkApplication, but other action groups that are added with
* gtk_widget_insert_action_group() will be consulted as well.
*
* Since: 3.4
+6 -6
View File
@@ -147,12 +147,12 @@ gtk_action_helper_action_added (GtkActionHelper *helper,
if (!helper->can_activate)
{
g_warning ("%s: action %s can't be activated due to parameter type mismatch "
"(parameter type %s, target type %s)",
"actionhelper",
helper->action_name,
parameter_type ? g_variant_type_peek_string (parameter_type) : "NULL",
helper->target ? g_variant_get_type_string (helper->target) : "NULL");
GTK_NOTE(ACTIONS, g_message ("%s: action %s can't be activated due to parameter type mismatch "
"(parameter type %s, target type %s)",
"actionhelper",
helper->action_name,
parameter_type ? g_variant_type_peek_string (parameter_type) : "NULL",
helper->target ? g_variant_get_type_string (helper->target) : "NULL"));
return;
}
+54 -47
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"
@@ -103,8 +103,8 @@
* defines a #GtkShortcutsWindow with ID "help_overlay" then GtkApplication
* associates an instance of this shortcuts window with each
* #GtkApplicationWindow and sets up keyboard accelerators (Control-F1
* and Control-?) to open it. To create a menu item that displays the
* shortcuts window, associate the item with the action win.show-help-overlay.
* and Control-?) to open it. To create an menu item that displays the
* shortcuts window associate the item with the action win.show-help-overlay.
*
* ## A simple application ## {#gtkapplication}
*
@@ -525,7 +525,7 @@ gtk_application_focus_in_event_cb (GtkWindow *window,
g_object_notify_by_pspec (G_OBJECT (application), gtk_application_props[PROP_ACTIVE_WINDOW]);
return GDK_EVENT_PROPAGATE;
return FALSE;
}
static void
@@ -607,16 +607,14 @@ gtk_application_load_resources (GtkApplication *application)
path = g_strconcat (base_path, "/gtk/help-overlay.ui", NULL);
if (g_resources_get_info (path, G_RESOURCE_LOOKUP_FLAGS_NONE, NULL, NULL, NULL))
{
const gchar * const accels[] = { "<Primary>F1", "<Primary>question", NULL };
{
const gchar * const accels[] = { "<Primary>F1", "<Primary>question", NULL };
application->priv->help_overlay_path = path;
gtk_application_set_accels_for_action (application, "win.show-help-overlay", accels);
}
else
{
g_free (path);
}
application->priv->help_overlay_path = path;
gtk_application_set_accels_for_action (application, "win.show-help-overlay", accels);
}
else
g_free (path);
}
}
@@ -630,7 +628,7 @@ gtk_application_startup (GApplication *g_application)
gtk_action_muxer_insert (application->priv->muxer, "app", G_ACTION_GROUP (application));
gtk_init (NULL, NULL);
gtk_init (0, 0);
application->priv->impl = gtk_application_impl_new (application, gdk_display_get_default ());
gtk_application_impl_startup (application->priv->impl, application->priv->register_session);
@@ -810,15 +808,10 @@ extract_accel_from_menu_item (GMenuModel *model,
}
g_object_unref (iter);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (accel && action)
{
const gchar *accels[2] = { accel, NULL };
gchar *detailed_action_name;
detailed_action_name = g_action_print_detailed_name (action, target);
gtk_application_set_accels_for_action (app, detailed_action_name, accels);
g_free (detailed_action_name);
}
gtk_application_add_accelerator (app, accel, action, target);
G_GNUC_END_IGNORE_DEPRECATIONS
if (target)
g_variant_unref (target);
@@ -829,19 +822,19 @@ extract_accels_from_menu (GMenuModel *model,
GtkApplication *app)
{
gint i;
GMenuLinkIter *iter;
const gchar *key;
GMenuModel *m;
for (i = 0; i < g_menu_model_get_n_items (model); i++)
{
GMenuLinkIter *iter;
GMenuModel *sub_model;
extract_accel_from_menu_item (model, i, app);
iter = g_menu_model_iterate_item_links (model, i);
while (g_menu_link_iter_get_next (iter, NULL, &sub_model))
while (g_menu_link_iter_get_next (iter, &key, &m))
{
extract_accels_from_menu (sub_model, app);
g_object_unref (sub_model);
extract_accels_from_menu (m, app);
g_object_unref (m);
}
g_object_unref (iter);
}
@@ -1164,9 +1157,6 @@ gtk_application_get_windows (GtkApplication *application)
*
* Returns the #GtkApplicationWindow with the given ID.
*
* The ID of a #GtkApplicationWindow can be retrieved with
* gtk_application_window_get_id().
*
* Returns: (nullable) (transfer none): the window with ID @id, or
* %NULL if there is no window with this ID
*
@@ -1258,15 +1248,17 @@ gtk_application_add_accelerator (GtkApplication *application,
GVariant *parameter)
{
const gchar *accelerators[2] = { accelerator, NULL };
gchar *detailed_action_name;
gchar *action_and_target;
g_return_if_fail (GTK_IS_APPLICATION (application));
g_return_if_fail (action_name != NULL);
g_return_if_fail (accelerator != NULL);
detailed_action_name = g_action_print_detailed_name (action_name, parameter);
gtk_application_set_accels_for_action (application, detailed_action_name, accelerators);
g_free (detailed_action_name);
action_and_target = gtk_print_action_and_target (NULL, action_name, parameter);
accels_set_accels_for_action (&application->priv->accels, action_and_target, accelerators);
gtk_action_muxer_set_primary_accel (application->priv->muxer, action_and_target, accelerator);
gtk_application_update_accels (application);
g_free (action_and_target);
}
/**
@@ -1288,15 +1280,16 @@ gtk_application_remove_accelerator (GtkApplication *application,
const gchar *action_name,
GVariant *parameter)
{
const gchar *accelerators[1] = { NULL };
gchar *detailed_action_name;
gchar *action_and_target;
g_return_if_fail (GTK_IS_APPLICATION (application));
g_return_if_fail (action_name != NULL);
detailed_action_name = g_action_print_detailed_name (action_name, parameter);
gtk_application_set_accels_for_action (application, detailed_action_name, accelerators);
g_free (detailed_action_name);
action_and_target = gtk_print_action_and_target (NULL, action_name, parameter);
accels_set_accels_for_action (&application->priv->accels, action_and_target, NULL);
gtk_action_muxer_set_primary_accel (application->priv->muxer, action_and_target, NULL);
gtk_application_update_accels (application);
g_free (action_and_target);
}
/**
@@ -1383,8 +1376,16 @@ gtk_application_set_app_menu (GtkApplication *application,
g_return_if_fail (g_application_get_is_registered (G_APPLICATION (application)));
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
if (g_set_object (&application->priv->app_menu, app_menu))
if (app_menu != application->priv->app_menu)
{
if (application->priv->app_menu != NULL)
g_object_unref (application->priv->app_menu);
application->priv->app_menu = app_menu;
if (application->priv->app_menu != NULL)
g_object_ref (application->priv->app_menu);
if (app_menu)
extract_accels_from_menu (app_menu, application);
@@ -1401,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
*/
@@ -1447,8 +1449,16 @@ gtk_application_set_menubar (GtkApplication *application,
g_return_if_fail (g_application_get_is_registered (G_APPLICATION (application)));
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
if (g_set_object (&application->priv->menubar, menubar))
if (menubar != application->priv->menubar)
{
if (application->priv->menubar != NULL)
g_object_unref (application->priv->menubar);
application->priv->menubar = menubar;
if (application->priv->menubar != NULL)
g_object_ref (application->priv->menubar);
if (menubar)
extract_accels_from_menu (menubar, application);
@@ -1509,7 +1519,7 @@ gtk_application_get_menubar (GtkApplication *application)
* types of actions that may be blocked are specified by the @flags
* parameter. When the application completes the operation it should
* call gtk_application_uninhibit() to remove the inhibitor. Note that
* an application can have multiple inhibitors, and all of them must
* an application can have multiple inhibitors, and all of the must
* be individually removed. Inhibitors are also cleared when the
* application exits.
*
@@ -1693,9 +1703,6 @@ normalise_detailed_name (const gchar *detailed_action_name)
* To remove all accelerators for an action, use an empty, zero-terminated
* array for @accels.
*
* For the @detailed_action_name, see g_action_parse_detailed_name() and
* g_action_print_detailed_name().
*
* Since: 3.12
*/
void
+3 -3
View File
@@ -38,7 +38,7 @@
* @title: GtkApplicationWindow
* @short_description: GtkWindow subclass with GtkApplication support
*
* #GtkApplicationWindow is a #GtkWindow subclass that offers some
* GtkApplicationWindow is a #GtkWindow subclass that offers some
* extra functionality for better integration with #GtkApplication
* features. Notably, it can handle both the application menu as well
* as the menubar. See gtk_application_set_app_menu() and
@@ -52,9 +52,9 @@
* prefix. Actions must be addressed with the prefixed name when
* referring to them from a #GMenuModel.
*
* Note that widgets that are placed inside a #GtkApplicationWindow
* Note that widgets that are placed inside a GtkApplicationWindow
* can also activate these actions, if they implement the
* #GtkActionable interface.
* GtkActionable interface.
*
* As with #GtkApplication, the GDK lock will be acquired when
* processing actions arriving from other processes and should therefore
+6 -9
View File
@@ -69,14 +69,13 @@
* movement occurs in 3-character steps), the following binding can be
* used:
*
* |[ <!-- language="CSS" -->
* |[
* @binding-set MoveCursor3
* {
* bind "<Control>Right" { "move-cursor" (visual-positions, 3, 0) };
* bind "<Control>Left" { "move-cursor" (visual-positions, -3, 0) };
* }
*
* entry
* GtkEntry
* {
* -gtk-key-bindings: MoveCursor3;
* }
@@ -92,14 +91,13 @@
* works as expected. The same mechanism can not be used to unbind
* existing bindings, however.
*
* |[ <!-- language="CSS" -->
* |[
* @binding-set MoveCursor3
* {
* bind "<Control>Right" { };
* bind "<Control>Left" { };
* }
*
* entry
* GtkEntry
* {
* -gtk-key-bindings: MoveCursor3;
* }
@@ -116,14 +114,13 @@
* from activating its default bindings, the unbind keyword can be used
* like this:
*
* |[ <!-- language="CSS" -->
* |[
* @binding-set MoveCursor3
* {
* unbind "<Control>Right";
* unbind "<Control>Left";
* }
*
* entry
* GtkEntry
* {
* -gtk-key-bindings: MoveCursor3;
* }
+69 -71
View File
@@ -38,10 +38,9 @@ struct _GtkBoxGadgetPrivate {
GtkOrientation orientation;
GArray *children;
guint draw_focus : 1;
guint draw_reverse : 1;
guint draw_focus : 1;
guint draw_reverse : 1;
guint allocate_reverse : 1;
guint align_reverse : 1;
};
typedef gboolean (* ComputeExpandFunc) (GObject *object, GtkOrientation orientation);
@@ -49,7 +48,7 @@ typedef gboolean (* ComputeExpandFunc) (GObject *object, GtkOrientation orientat
typedef struct _GtkBoxGadgetChild GtkBoxGadgetChild;
struct _GtkBoxGadgetChild {
GObject *object;
gboolean expand;
ComputeExpandFunc compute_expand;
GtkAlign align;
};
@@ -65,21 +64,6 @@ gtk_box_gadget_child_is_visible (GObject *child)
return gtk_css_gadget_get_visible (GTK_CSS_GADGET (child));
}
static gboolean
gtk_box_gadget_child_compute_expand (GtkBoxGadget *gadget,
GtkBoxGadgetChild *child)
{
GtkBoxGadgetPrivate *priv = gtk_box_gadget_get_instance_private (GTK_BOX_GADGET (gadget));
if (child->expand)
return TRUE;
if (GTK_IS_WIDGET (child->object))
return gtk_widget_compute_expand (GTK_WIDGET (child->object), priv->orientation);
return FALSE;
}
static GtkAlign
gtk_box_gadget_child_get_align (GtkBoxGadget *gadget,
GtkBoxGadgetChild *child)
@@ -100,21 +84,6 @@ gtk_box_gadget_child_get_align (GtkBoxGadget *gadget,
return align;
}
static GtkAlign
effective_align (GtkAlign align,
gboolean reverse)
{
switch (align)
{
case GTK_ALIGN_START:
return reverse ? GTK_ALIGN_END : GTK_ALIGN_START;
case GTK_ALIGN_END:
return reverse ? GTK_ALIGN_START : GTK_ALIGN_END;
default:
return align;
}
}
static void
gtk_box_gadget_measure_child (GObject *child,
GtkOrientation orientation,
@@ -163,7 +132,7 @@ gtk_box_gadget_distribute (GtkBoxGadget *gadget,
&sizes[i].minimum_size, &sizes[i].natural_size,
NULL, NULL);
if (gtk_box_gadget_child_is_visible (child->object) &&
gtk_box_gadget_child_compute_expand (gadget, child))
child->compute_expand (child->object, priv->orientation))
n_expand++;
size -= sizes[i].minimum_size;
}
@@ -184,7 +153,7 @@ gtk_box_gadget_distribute (GtkBoxGadget *gadget,
GtkBoxGadgetChild *child = &g_array_index (priv->children, GtkBoxGadgetChild, i);
if (!gtk_box_gadget_child_is_visible (child->object) ||
!gtk_box_gadget_child_compute_expand (gadget, child))
!child->compute_expand (child->object, priv->orientation))
continue;
sizes[i].minimum_size += size / n_expand;
@@ -335,7 +304,6 @@ gtk_box_gadget_allocate_child (GObject *child,
allocation->width,
&minimum, &natural,
&minimum_baseline, &natural_baseline);
switch (child_align)
{
case GTK_ALIGN_FILL:
@@ -439,7 +407,7 @@ gtk_box_gadget_allocate (GtkCssGadget *gadget,
child_align = gtk_box_gadget_child_get_align (GTK_BOX_GADGET (gadget), child);
gtk_box_gadget_allocate_child (child->object,
priv->orientation,
effective_align (child_align, priv->align_reverse),
child_align,
&child_allocation,
baseline,
&child_clip);
@@ -473,7 +441,7 @@ gtk_box_gadget_allocate (GtkCssGadget *gadget,
child_align = gtk_box_gadget_child_get_align (GTK_BOX_GADGET (gadget), child);
gtk_box_gadget_allocate_child (child->object,
priv->orientation,
effective_align (child_align, priv->align_reverse),
child_align,
&child_allocation,
-1,
&child_clip);
@@ -627,15 +595,6 @@ gtk_box_gadget_set_allocate_reverse (GtkBoxGadget *gadget,
priv->allocate_reverse = allocate_reverse;
}
void
gtk_box_gadget_set_align_reverse (GtkBoxGadget *gadget,
gboolean align_reverse)
{
GtkBoxGadgetPrivate *priv = gtk_box_gadget_get_instance_private (gadget);
priv->align_reverse = align_reverse;
}
static GtkCssNode *
get_css_node (GObject *child)
{
@@ -646,17 +605,17 @@ get_css_node (GObject *child)
}
static void
gtk_box_gadget_insert_object (GtkBoxGadget *gadget,
int pos,
GObject *object,
gboolean expand,
GtkAlign align)
gtk_box_gadget_insert_object (GtkBoxGadget *gadget,
int pos,
GObject *object,
ComputeExpandFunc compute_expand_func,
GtkAlign align)
{
GtkBoxGadgetPrivate *priv = gtk_box_gadget_get_instance_private (gadget);
GtkBoxGadgetChild child;
child.object = g_object_ref (object);
child.expand = expand;
child.compute_expand = compute_expand_func;
child.align = align;
if (pos < 0 || pos >= priv->children->len)
@@ -676,11 +635,15 @@ gtk_box_gadget_insert_object (GtkBoxGadget *gadget,
}
void
gtk_box_gadget_insert_widget (GtkBoxGadget *gadget,
int pos,
GtkWidget *widget)
gtk_box_gadget_insert_widget (GtkBoxGadget *gadget,
int pos,
GtkWidget *widget)
{
gtk_box_gadget_insert_object (gadget, pos, G_OBJECT (widget), FALSE, GTK_ALIGN_FILL);
gtk_box_gadget_insert_object (gadget,
pos,
G_OBJECT (widget),
(ComputeExpandFunc) gtk_widget_compute_expand,
GTK_ALIGN_FILL);
}
static GtkBoxGadgetChild *
@@ -729,11 +692,34 @@ gtk_box_gadget_remove_widget (GtkBoxGadget *gadget,
gtk_box_gadget_remove_object (gadget, G_OBJECT (widget));
}
static gboolean
only_horizontal (GObject *object,
GtkOrientation orientation)
{
return orientation == GTK_ORIENTATION_HORIZONTAL;
}
static gboolean
only_vertical (GObject *object,
GtkOrientation orientation)
{
return orientation == GTK_ORIENTATION_VERTICAL;
}
static ComputeExpandFunc
expand_func_from_flags (gboolean hexpand,
gboolean vexpand)
{
return hexpand ? (vexpand ? (ComputeExpandFunc) gtk_true : only_horizontal)
: (vexpand ? only_vertical : (ComputeExpandFunc) gtk_false);
}
void
gtk_box_gadget_insert_gadget_before (GtkBoxGadget *gadget,
GtkCssGadget *sibling,
GtkCssGadget *cssgadget,
gboolean expand,
gboolean hexpand,
gboolean vexpand,
GtkAlign align)
{
/* Insert at the end if no sibling specified */
@@ -742,14 +728,15 @@ gtk_box_gadget_insert_gadget_before (GtkBoxGadget *gadget,
if (sibling)
gtk_box_gadget_find_object (gadget, G_OBJECT (sibling), &pos);
gtk_box_gadget_insert_gadget (gadget, pos, cssgadget, expand, align);
gtk_box_gadget_insert_gadget (gadget, pos, cssgadget, hexpand, vexpand, align);
}
void
gtk_box_gadget_insert_gadget_after (GtkBoxGadget *gadget,
GtkCssGadget *sibling,
GtkCssGadget *cssgadget,
gboolean expand,
gboolean hexpand,
gboolean vexpand,
GtkAlign align)
{
/* Insert at the beginning if no sibling specified */
@@ -758,17 +745,25 @@ gtk_box_gadget_insert_gadget_after (GtkBoxGadget *gadget,
if (sibling && gtk_box_gadget_find_object (gadget, G_OBJECT (sibling), &pos))
pos++;
gtk_box_gadget_insert_gadget (gadget, pos, cssgadget, expand, align);
gtk_box_gadget_insert_gadget (gadget, pos, cssgadget, hexpand, vexpand, align);
}
void
gtk_box_gadget_insert_gadget (GtkBoxGadget *gadget,
int pos,
GtkCssGadget *cssgadget,
gboolean expand,
gboolean hexpand,
gboolean vexpand,
GtkAlign align)
{
gtk_box_gadget_insert_object (gadget, pos, G_OBJECT (cssgadget), expand, align);
ComputeExpandFunc func;
func = expand_func_from_flags (hexpand, vexpand);
gtk_box_gadget_insert_object (gadget,
pos,
G_OBJECT (cssgadget),
func,
align);
}
void
@@ -800,31 +795,34 @@ gtk_box_gadget_reverse_children (GtkBoxGadget *gadget)
void
gtk_box_gadget_set_gadget_expand (GtkBoxGadget *gadget,
GObject *object,
gboolean expand)
GtkCssGadget *cssgadget,
gboolean hexpand,
gboolean vexpand)
{
GtkBoxGadgetChild *child;
ComputeExpandFunc func;
child = gtk_box_gadget_find_object (gadget, object, NULL);
child = gtk_box_gadget_find_object (gadget, G_OBJECT (cssgadget), NULL);
if (!child)
return;
if (child->expand == expand)
func = expand_func_from_flags (hexpand, vexpand);
if (child->compute_expand == func)
return;
child->expand = expand;
child->compute_expand = func;
gtk_css_gadget_queue_resize (GTK_CSS_GADGET (gadget));
}
void
gtk_box_gadget_set_gadget_align (GtkBoxGadget *gadget,
GObject *object,
GtkCssGadget *cssgadget,
GtkAlign align)
{
GtkBoxGadgetChild *child;
child = gtk_box_gadget_find_object (gadget, object, NULL);
child = gtk_box_gadget_find_object (gadget, G_OBJECT (cssgadget), NULL);
if (!child)
return;
+10 -8
View File
@@ -63,8 +63,6 @@ void gtk_box_gadget_set_draw_reverse (GtkBoxGadget
void gtk_box_gadget_set_allocate_reverse (GtkBoxGadget *gadget,
gboolean allocate_reverse);
void gtk_box_gadget_set_align_reverse (GtkBoxGadget *gadget,
gboolean align_reverse);
void gtk_box_gadget_insert_widget (GtkBoxGadget *gadget,
int pos,
GtkWidget *widget);
@@ -73,17 +71,20 @@ void gtk_box_gadget_remove_widget (GtkBoxGadget
void gtk_box_gadget_insert_gadget (GtkBoxGadget *gadget,
int pos,
GtkCssGadget *cssgadget,
gboolean expand,
gboolean hexpand,
gboolean vexpand,
GtkAlign align);
void gtk_box_gadget_insert_gadget_before (GtkBoxGadget *gadget,
GtkCssGadget *sibling,
GtkCssGadget *cssgadget,
gboolean expand,
gboolean hexpand,
gboolean vexpand,
GtkAlign align);
void gtk_box_gadget_insert_gadget_after (GtkBoxGadget *gadget,
GtkCssGadget *sibling,
GtkCssGadget *cssgadget,
gboolean expand,
gboolean hexpand,
gboolean vexpand,
GtkAlign align);
void gtk_box_gadget_remove_gadget (GtkBoxGadget *gadget,
@@ -91,10 +92,11 @@ void gtk_box_gadget_remove_gadget (GtkBoxGadget
void gtk_box_gadget_reverse_children (GtkBoxGadget *gadget);
void gtk_box_gadget_set_gadget_expand (GtkBoxGadget *gadget,
GObject *object,
gboolean expand);
GtkCssGadget *cssgadget,
gboolean hexpand,
gboolean vexpand);
void gtk_box_gadget_set_gadget_align (GtkBoxGadget *gadget,
GObject *object,
GtkCssGadget *cssgadget,
GtkAlign align);
G_END_DECLS
+16 -39
View File
@@ -47,8 +47,6 @@ typedef struct _GtkBuiltinIconPrivate GtkBuiltinIconPrivate;
struct _GtkBuiltinIconPrivate {
GtkCssImageBuiltinType image_type;
int default_size;
int strikethrough;
gboolean strikethrough_valid;
char * default_size_property;
};
@@ -65,6 +63,10 @@ gtk_builtin_icon_get_preferred_size (GtkCssGadget *gadget,
gint *natural_baseline)
{
GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
GtkWidget *widget;
PangoContext *pango_context;
PangoFontMetrics *metrics;
int strikethrough;
double min_size;
guint property;
@@ -96,33 +98,21 @@ gtk_builtin_icon_get_preferred_size (GtkCssGadget *gadget,
*minimum = *natural = priv->default_size;
}
widget = gtk_css_gadget_get_owner (gadget);
pango_context = gtk_widget_get_pango_context (widget);
metrics = pango_context_get_metrics (pango_context,
pango_context_get_font_description (pango_context),
pango_context_get_language (pango_context));
strikethrough = pango_font_metrics_get_strikethrough_position (metrics);
if (minimum_baseline)
{
if (!priv->strikethrough_valid)
{
GtkWidget *widget;
PangoContext *pango_context;
const PangoFontDescription *font_desc;
PangoFontMetrics *metrics;
widget = gtk_css_gadget_get_owner (gadget);
pango_context = gtk_widget_get_pango_context (widget);
font_desc = pango_context_get_font_description (pango_context);
metrics = pango_context_get_metrics (pango_context,
font_desc,
pango_context_get_language (pango_context));
priv->strikethrough = pango_font_metrics_get_strikethrough_position (metrics);
priv->strikethrough_valid = TRUE;
pango_font_metrics_unref (metrics);
}
*minimum_baseline = *minimum * 0.5 + PANGO_PIXELS (priv->strikethrough);
}
*minimum_baseline = *minimum * 0.5 + PANGO_PIXELS (strikethrough);
if (natural_baseline)
*natural_baseline = *minimum_baseline;
pango_font_metrics_unref (metrics);
}
static void
@@ -161,18 +151,6 @@ gtk_builtin_icon_draw (GtkCssGadget *gadget,
return FALSE;
}
static void
gtk_builtin_icon_style_changed (GtkCssGadget *gadget,
GtkCssStyleChange *change)
{
GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
priv->strikethrough_valid = FALSE;
GTK_CSS_GADGET_CLASS (gtk_builtin_icon_parent_class)->style_changed (gadget, change);
}
static void
gtk_builtin_icon_finalize (GObject *object)
{
@@ -194,7 +172,6 @@ gtk_builtin_icon_class_init (GtkBuiltinIconClass *klass)
gadget_class->get_preferred_size = gtk_builtin_icon_get_preferred_size;
gadget_class->allocate = gtk_builtin_icon_allocate;
gadget_class->draw = gtk_builtin_icon_draw;
gadget_class->style_changed = gtk_builtin_icon_style_changed;
}
static void
+5 -5
View File
@@ -115,7 +115,7 @@ enum {
};
static void gtk_button_finalize (GObject *object);
static void gtk_button_destroy (GtkWidget *widget);
static void gtk_button_dispose (GObject *object);
static void gtk_button_set_property (GObject *object,
guint prop_id,
@@ -241,7 +241,6 @@ gtk_button_class_init (GtkButtonClass *klass)
gobject_class->constructed = gtk_button_constructed;
gobject_class->dispose = gtk_button_dispose;
gobject_class->finalize = gtk_button_finalize;
gobject_class->set_property = gtk_button_set_property;
gobject_class->get_property = gtk_button_get_property;
@@ -250,6 +249,7 @@ gtk_button_class_init (GtkButtonClass *klass)
widget_class->get_preferred_width_for_height = gtk_button_get_preferred_width_for_height;
widget_class->get_preferred_height_for_width = gtk_button_get_preferred_height_for_width;
widget_class->get_preferred_height_and_baseline_for_width = gtk_button_get_preferred_height_and_baseline_for_width;
widget_class->destroy = gtk_button_destroy;
widget_class->screen_changed = gtk_button_screen_changed;
widget_class->realize = gtk_button_realize;
widget_class->unrealize = gtk_button_unrealize;
@@ -755,16 +755,16 @@ gtk_button_init (GtkButton *button)
}
static void
gtk_button_finalize (GObject *object)
gtk_button_destroy (GtkWidget *widget)
{
GtkButton *button = GTK_BUTTON (object);
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
g_clear_pointer (&priv->label_text, g_free);
g_clear_object (&priv->gesture);
g_clear_object (&priv->gadget);
G_OBJECT_CLASS (gtk_button_parent_class)->finalize (object);
GTK_WIDGET_CLASS (gtk_button_parent_class)->destroy (widget);
}
static void
+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"
+3 -6
View File
@@ -127,11 +127,11 @@ gtk_check_button_update_node_state (GtkWidget *widget)
* way to update the icon
*/
if (state & GTK_STATE_FLAG_CHECKED)
image_type = GTK_IS_RADIO_BUTTON (widget) ? GTK_CSS_IMAGE_BUILTIN_OPTION : GTK_CSS_IMAGE_BUILTIN_CHECK;
image_type = GTK_IS_RADIO_BUTTON (widget) ? GTK_CSS_IMAGE_BUILTIN_OPTION_CHECKED : GTK_CSS_IMAGE_BUILTIN_CHECK_CHECKED;
else if (state & GTK_STATE_FLAG_INCONSISTENT)
image_type = GTK_IS_RADIO_BUTTON (widget) ? GTK_CSS_IMAGE_BUILTIN_OPTION_INCONSISTENT : GTK_CSS_IMAGE_BUILTIN_CHECK_INCONSISTENT;
else
image_type = GTK_CSS_IMAGE_BUILTIN_NONE;
image_type = GTK_IS_RADIO_BUTTON (widget) ? GTK_CSS_IMAGE_BUILTIN_OPTION : GTK_CSS_IMAGE_BUILTIN_CHECK;
gtk_builtin_icon_set_image (GTK_BUILTIN_ICON (priv->indicator_gadget), image_type);
gtk_css_gadget_set_state (priv->indicator_gadget, state);
@@ -156,8 +156,6 @@ gtk_check_button_direction_changed (GtkWidget *widget,
gtk_box_gadget_reverse_children (GTK_BOX_GADGET (priv->gadget));
gtk_box_gadget_set_allocate_reverse (GTK_BOX_GADGET (priv->gadget),
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
gtk_box_gadget_set_align_reverse (GTK_BOX_GADGET (priv->gadget),
gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
GTK_WIDGET_CLASS (gtk_check_button_parent_class)->direction_changed (widget, previous_direction);
}
@@ -184,7 +182,6 @@ gtk_check_button_add (GtkContainer *container,
pos = gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL ? 0 : 1;
gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget), pos, widget);
gtk_box_gadget_set_gadget_expand (GTK_BOX_GADGET (priv->gadget), G_OBJECT (widget), TRUE);
}
static void
@@ -325,7 +322,7 @@ gtk_check_button_init (GtkCheckButton *check_button)
priv->gadget,
NULL);
gtk_builtin_icon_set_default_size_property (GTK_BUILTIN_ICON (priv->indicator_gadget), "indicator-size");
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), 0, priv->indicator_gadget, FALSE, GTK_ALIGN_BASELINE);
gtk_box_gadget_insert_gadget (GTK_BOX_GADGET (priv->gadget), 0, priv->indicator_gadget, FALSE, FALSE, GTK_ALIGN_BASELINE);
gtk_check_button_update_node_state (GTK_WIDGET (check_button));
}
+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"
+2 -2
View File
@@ -373,10 +373,10 @@ gtk_color_editor_init (GtkColorEditor *editor)
if (gtk_widget_get_direction (editor->priv->h_slider) == GTK_TEXT_DIR_RTL)
gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
"marks-before");
GTK_STYLE_CLASS_SCALE_HAS_MARKS_ABOVE);
else
gtk_style_context_add_class (gtk_widget_get_style_context (editor->priv->h_slider),
"marks-after");
GTK_STYLE_CLASS_SCALE_HAS_MARKS_BELOW);
/* Create the scaled popup adjustments manually here because connecting user data is not
* supported by template GtkBuilder xml (it would be possible to set this up in the xml
+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);
-10
View File
@@ -60,16 +60,6 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
if (value->y)
y = _gtk_css_value_compute (value->y, property_id, provider, style, parent_style);
if (x == value->x && y == value->y)
{
if (x)
_gtk_css_value_unref (x);
if (y)
_gtk_css_value_unref (y);
return _gtk_css_value_ref (value);
}
return _gtk_css_bg_size_value_new (value->x ? x : NULL,
value->y ? y : NULL);
}
+6 -11
View File
@@ -48,33 +48,28 @@ gtk_css_value_border_compute (GtkCssValue *value,
GtkCssStyle *style,
GtkCssStyle *parent_style)
{
GtkCssValue *values[4];
GtkCssValue *computed;
gboolean changed = FALSE;
guint i;
computed = _gtk_css_border_value_new (NULL, NULL, NULL, NULL);
computed->fill = value->fill;
for (i = 0; i < 4; i++)
{
if (value->values[i])
{
values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
changed |= (values[i] != value->values[i]);
computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, style, parent_style);
changed |= (computed->values[i] != value->values[i]);
}
}
if (!changed)
{
for (i = 0; i < 4; i++)
{
if (values[i] != NULL)
_gtk_css_value_unref (values[i]);
}
_gtk_css_value_unref (computed);
return _gtk_css_value_ref (value);
}
computed = _gtk_css_border_value_new (values[0], values[1], values[2], values[3]);
computed->fill = value->fill;
return computed;
}
+3 -4
View File
@@ -890,8 +890,7 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
#if G_ENABLE_DEBUG
{
GdkDisplay *display = gtk_widget_get_display (gtk_css_gadget_get_owner (gadget));
GtkDebugFlag flags = gtk_get_display_debug_flags (display);
if G_UNLIKELY (flags & GTK_DEBUG_LAYOUT)
if (GTK_DISPLAY_DEBUG_CHECK (display, LAYOUT))
{
cairo_save (cr);
cairo_new_path (cr);
@@ -913,7 +912,7 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
cairo_stroke (cr);
cairo_restore (cr);
}
if G_UNLIKELY (flags & GTK_DEBUG_BASELINES)
if (GTK_DISPLAY_DEBUG_CHECK (display, BASELINES))
{
int baseline = priv->allocated_baseline;
@@ -927,7 +926,7 @@ gtk_css_gadget_draw (GtkCssGadget *gadget,
}
cairo_save (cr);
cairo_new_path (cr);
cairo_move_to (cr, x + margin.left, baseline + 0.5);
cairo_move_to (cr, x + margin.left, priv->allocated_baseline + 0.5);
cairo_rel_line_to (cr, width - margin.left - margin.right, 0);
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgba (cr, 1.0, 0, 0.25, 0.25);
+87 -16
View File
@@ -45,22 +45,39 @@ gtk_css_image_builtin_draw_check (GtkCssImage *image,
gboolean inconsistent)
{
GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
gint x, y, exterior_size, interior_size, pad;
gint x, y, exterior_size, interior_size, thickness, pad;
exterior_size = MIN (width, height);
if (exterior_size % 2 == 0) /* Ensure odd */
exterior_size -= 1;
pad = 1 + MAX (1, (exterior_size - 2) / 9);
/* FIXME: thickness */
thickness = 1;
pad = thickness + MAX (1, (exterior_size - 2 * thickness) / 9);
interior_size = MAX (1, exterior_size - 2 * pad);
if (interior_size < 7)
pad = MAX (0, (exterior_size - interior_size) / 2);
{
interior_size = 7;
pad = MAX (0, (exterior_size - interior_size) / 2);
}
x = - (1 + exterior_size - (gint) width) / 2;
y = - (1 + exterior_size - (gint) height) / 2;
if (builtin->border_width > 0)
{
cairo_set_line_width (cr, builtin->border_width);
cairo_rectangle (cr, x + 0.5, y + 0.5, exterior_size - 1, exterior_size - 1);
gdk_cairo_set_source_rgba (cr, &builtin->bg_color);
cairo_fill_preserve (cr);
gdk_cairo_set_source_rgba (cr, &builtin->border_color);
cairo_stroke (cr);
}
gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
if (inconsistent)
@@ -78,7 +95,6 @@ gtk_css_image_builtin_draw_check (GtkCssImage *image,
{
if (checked)
{
cairo_save (cr);
cairo_translate (cr,
x + pad, y + pad);
@@ -107,7 +123,6 @@ gtk_css_image_builtin_draw_check (GtkCssImage *image,
7.0, 0.0);
cairo_fill (cr);
cairo_restore (cr);
}
}
}
@@ -121,7 +136,7 @@ gtk_css_image_builtin_draw_option (GtkCssImage *image,
gboolean inconsistent)
{
GtkCssImageBuiltin *builtin = GTK_CSS_IMAGE_BUILTIN (image);
gint x, y, exterior_size, interior_size, pad;
gint x, y, exterior_size, interior_size, thickness, pad;
exterior_size = MIN (width, height);
@@ -131,18 +146,42 @@ gtk_css_image_builtin_draw_option (GtkCssImage *image,
x = - (1 + exterior_size - width) / 2;
y = - (1 + exterior_size - height) / 2;
if (builtin->border_width > 0)
{
cairo_set_line_width (cr, builtin->border_width);
cairo_new_sub_path (cr);
cairo_arc (cr,
x + exterior_size / 2.,
y + exterior_size / 2.,
(exterior_size - 1) / 2.,
0, 2 * G_PI);
gdk_cairo_set_source_rgba (cr, &builtin->bg_color);
cairo_fill_preserve (cr);
gdk_cairo_set_source_rgba (cr, &builtin->border_color);
cairo_stroke (cr);
}
gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
pad = 1 + MAX (1, 2 * (exterior_size - 2) / 9);
interior_size = MAX (1, exterior_size - 2 * pad);
if (interior_size < 7)
pad = MAX (0, (exterior_size - interior_size) / 2);
/* FIXME: thickness */
thickness = 1;
if (inconsistent)
{
gint line_thickness;
pad = thickness + MAX (1, (exterior_size - 2 * thickness) / 9);
interior_size = MAX (1, exterior_size - 2 * pad);
if (interior_size < 7)
{
interior_size = 7;
pad = MAX (0, (exterior_size - interior_size) / 2);
}
line_thickness = MAX (1, (3 + interior_size * 2) / 7);
cairo_rectangle (cr,
@@ -152,8 +191,17 @@ gtk_css_image_builtin_draw_option (GtkCssImage *image,
line_thickness);
cairo_fill (cr);
}
else if (checked)
if (checked)
{
pad = thickness + MAX (1, 2 * (exterior_size - 2 * thickness) / 9);
interior_size = MAX (1, exterior_size - 2 * pad);
if (interior_size < 5)
{
interior_size = 7;
pad = MAX (0, (exterior_size - interior_size) / 2);
}
cairo_new_sub_path (cr);
cairo_arc (cr,
x + pad + interior_size / 2.,
@@ -305,7 +353,10 @@ gtk_css_image_builtin_draw_expander (GtkCssImage *image,
gdk_cairo_set_source_rgba (cr, &builtin->fg_color);
cairo_fill (cr);
cairo_fill_preserve (cr);
gdk_cairo_set_source_rgba (cr, &builtin->border_color);
cairo_stroke (cr);
}
static void
@@ -758,11 +809,27 @@ gtk_css_image_builtin_compute (GtkCssImage *image,
GtkCssStyle *parent_style)
{
GtkCssImageBuiltin *result;
GtkBorderStyle border_style;
result = g_object_new (GTK_TYPE_CSS_IMAGE_BUILTIN, NULL);
border_style = _gtk_css_border_style_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_STYLE));
if (border_style == GTK_BORDER_STYLE_SOLID)
{
GtkBorder border;
border.top = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_WIDTH), 100);
border.right = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_RIGHT_WIDTH), 100);
border.bottom = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_BOTTOM_WIDTH), 100);
border.left = _gtk_css_number_value_get (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100);
result->border_width = MIN (MIN (border.top, border.bottom),
MIN (border.left, border.right));
}
result->fg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR));
result->bg_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
result->border_color = *_gtk_css_rgba_value_get_rgba (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
return GTK_CSS_IMAGE (result);
}
@@ -775,7 +842,9 @@ gtk_css_image_builtin_equal (GtkCssImage *image1,
GtkCssImageBuiltin *builtin2 = GTK_CSS_IMAGE_BUILTIN (image2);
return gdk_rgba_equal (&builtin1->fg_color, &builtin2->fg_color)
&& gdk_rgba_equal (&builtin1->bg_color, &builtin2->bg_color);
&& gdk_rgba_equal (&builtin1->bg_color, &builtin2->bg_color)
&& gdk_rgba_equal (&builtin1->border_color, &builtin2->border_color)
&& builtin1->border_width == builtin2->border_width;
}
static void
@@ -843,17 +912,19 @@ gtk_css_image_builtin_draw (GtkCssImage *image,
case GTK_CSS_IMAGE_BUILTIN_NONE:
break;
case GTK_CSS_IMAGE_BUILTIN_CHECK:
case GTK_CSS_IMAGE_BUILTIN_CHECK_CHECKED:
case GTK_CSS_IMAGE_BUILTIN_CHECK_INCONSISTENT:
gtk_css_image_builtin_draw_check (image, cr,
width, height,
image_type == GTK_CSS_IMAGE_BUILTIN_CHECK,
image_type == GTK_CSS_IMAGE_BUILTIN_CHECK_CHECKED,
image_type == GTK_CSS_IMAGE_BUILTIN_CHECK_INCONSISTENT);
break;
case GTK_CSS_IMAGE_BUILTIN_OPTION:
case GTK_CSS_IMAGE_BUILTIN_OPTION_CHECKED:
case GTK_CSS_IMAGE_BUILTIN_OPTION_INCONSISTENT:
gtk_css_image_builtin_draw_option (image, cr,
width, height,
image_type == GTK_CSS_IMAGE_BUILTIN_OPTION,
image_type == GTK_CSS_IMAGE_BUILTIN_OPTION_CHECKED,
image_type == GTK_CSS_IMAGE_BUILTIN_OPTION_INCONSISTENT);
break;
case GTK_CSS_IMAGE_BUILTIN_ARROW_UP:

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