Compare commits

...

328 Commits

Author SHA1 Message Date
Benjamin Otte 34a2a57895 inspector: Handle icon rendering in snapshots 2015-07-01 06:39:10 +02:00
Benjamin Otte fe26e863ea render: Move function
The extents computation belongs in the icon code, not in the style
context code.
2015-07-01 06:38:00 +02:00
Benjamin Otte 2f90e1a7d9 inspector: Handle outline rendering in snapshots 2015-07-01 06:07:02 +02:00
Benjamin Otte 84144393bc inspector: Handle border rendering in snapshots 2015-07-01 06:00:49 +02:00
Benjamin Otte b8accdcd0a inspector: Handle background rendering in snapshots 2015-06-30 06:07:00 +02:00
Benjamin Otte 5da78ac0c5 inspector: Add a description vfunc for render operations 2015-06-30 06:06:59 +02:00
Benjamin Otte 3fc2dc9a5c inspector: Add a way to snapshot rendering operations
This shows the rendering broken into components for easier debugging.
2015-06-30 06:06:59 +02:00
Benjamin Otte 8105d45fe1 render: Add renderops trampolines for CSS functions 2015-06-30 06:06:59 +02:00
Benjamin Otte fc9b67a739 renderops: Add a simple functionality to track rendering operations 2015-06-27 19:17:13 +02:00
Benjamin Otte cd3f24d579 cssvalue: Change color transitions to run premultiplied
Previously, the unpremultiplied values from the GdkRGBA were taken. Now
we premultiply the color values as specified by the CSS specs.
This is only relevant when transitioning with translucent colors.

An example is the halfway transition between transparent (0, 0, 0, 0)
and white (1, 1, 1, 1). Previously, all 4 values where transitioned
separately and the result was semi-transparent gray (0.5, 0.5, 0.5,
0.5).
By depending on the alpha value, the result is now semi-transparent
white (1, 1, 1, 0.5) which is what one would naively expect.

New reftest: color-transition
2015-06-26 21:12:50 +02:00
Benjamin Otte 142abce46a cssvalue: Special case resulting color for transparency
Again, preparation for using premultiplied color transitions.
2015-06-26 20:54:57 +02:00
Benjamin Otte e3d8f03b3a cssvalue: Restructure RGBA transitions
Split out a function to make the code clearer for the changes ahead.
2015-06-26 19:06:02 +02:00
Carlos Garnacho 8509a07a08 wayland: Set the master device on the drop-side GdkDragContext
And force the ungrab on it, instead of the slave, in the case of
local DnD drop. This avoids confusions on the pointer events spawn
from DnD, as GDK doesn't think anymore those are from a slave device.
Most namely, it fixes the stuck grab when finishing DnD on the
same app it was started from.
2015-06-26 14:35:41 +02:00
Carlos Garnacho 1178a0ac8b wayland: Split handling of clipboard/DnD data offers
We currently only hold the last offer received, which is wrong, as both
are independent and have different life cycles.

This means we have to store per-selection wl_data_offer and targets, and
maintain these as appropriate from the clipboard/DnD specific entry points.
2015-06-26 14:29:42 +02:00
Alexander Larsson da395606a2 broadway: Handle shm_open failing by falling back on tmp files
This is required if /dev/shm is not mounted on your system, which can
happen for instance in certain container configurations.
2015-06-26 00:21:27 +02:00
Lapo Calamandrei 029800c426 Adwaita: entry linking fixes
Set the right border color on the linked entry after the focused
one.
2015-06-25 20:04:32 +02:00
Lapo Calamandrei 56a3fd888a Adwaita: rubberbands!
Darken the rubberband a bit to make it visible on the selected
color background, fix treeview rubberband border issue.
2015-06-25 19:57:07 +02:00
Carlos Garnacho 350d555893 wayland: Fix compile warning in DnD/selection code
Introduced in my recent commits
2015-06-25 18:44:49 +02:00
Carlos Garnacho 0606b525b4 gtkdnd: Plug a leak
We create a cairo_t in order to find out the surface extents, but it
was being leaked, dragging the whole drag surface with it through
extra refs.
2015-06-25 15:09:56 +02:00
Carlos Garnacho 33f9cbafcd gtkmodelbutton: Plug a leak
The private struct had some data that needed freeing, but this widget
didn't have any destroy/dispose/finalize handlers.
2015-06-25 15:09:56 +02:00
Carlos Garnacho 6de82c9be3 gtkmenusectionbox: plug a leak
The list returned by gtk_container_get_children() wasn't being freed.
2015-06-25 15:09:56 +02:00
Carlos Garnacho 6cc9b17429 wayland: Plug some memleaks in DnD/clipboard code
gdk_atom_name() return value must be freed, this code was consistently
not doing so...
2015-06-25 15:09:56 +02:00
Matthias Clasen f8b7623b3c builder-tool: Don't strip h/vexpand
Setting these properties has the side-effect of setting the
corresponding -set properties, which makes GTK+ behave subtly
different. So don't mess with these.
2015-06-25 07:01:26 -04:00
Matthias Clasen e9e9dfade6 GtkSearchBar: Don't vexpand
It turns out that setting vexpand to its default value has
side-effects that we need.

https://bugzilla.gnome.org/show_bug.cgi?id=751447
2015-06-25 07:00:13 -04:00
cedlemo d31e1fbef0 GtkImage: Make resource property work properly
gtk_image_set_from_resource was setting the resource_path,
only to have it overwritten again before returning. That
is not as it should be, so change things to set the resource
path late.

https://bugzilla.gnome.org/show_bug.cgi?id=751443
2015-06-25 06:50:44 -04:00
Carlos Garnacho 342db27278 wayland: protect against unknown mimetype requests
This oddly can be reproduced with weston+weston-dnd, when dragging
anything from GTK+ into weston-dnd, it will insist on picking its
custom application/x-wayland-dnd-flower mimetype, and this request
forwarded by the compositor, even if GTK+ didn't announce it on
its wl_data_source mimetype list. (What should probably happen here
is that the request is silenced, and/or weston-dnd picks (null))

This should be harmless, we are leaking though the fd in that case,
because the emission of GdkEventSelection on an unhandled mimetype
results in NOP. In order to avoid this, we should check whether the
mimetype is supported at all on the backend code and possibly close
the fd, this involves storing these in the first place.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho fb266a8876 wayland: Ensure we close the fd on all error paths in data_source.send
https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho 3bd7b2a6fb wayland: close() the selection fd if we didn't start writing yet
If the other peer requests data too fast (too rare/unlikely though),
we might receive multiple gdk_wayland_selection_request_target() calls
with no ending gdk_wayland_selection_check_write(), in which case the
fd is leaked as no GOutputStream was created to take over it.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho 5e7159413d wayland: Ensure we cancel previous selection writes before starting one
We weren't catching all the places where the AsyncWriteData operation
should be cancelled, which could happen if we repeatedly request the
same target on different fds.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Carlos Garnacho 69b5955108 wayland: Do not close the descriptor on async_write_data_free()
At the moment we create the AsyncWriteData, the ownership of the
fd is granted to the GOutputStream, and the fd set to -1, so at
this moment we're just silently getting EBADFD.

This partially reverts 25885ca600, the initialization of .fd
to -1 is valid and stays though.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 23:52:50 +02:00
Balázs Úr d3212c9b46 Updated Hungarian translation 2015-06-24 17:45:33 +00:00
Carlos Garnacho de2268000d wayland: Ensure device grabs generate crossing/focus events
On X11 this is something the windowing system does for us, which the
wayland backend should emulate, being grabs completely client-side.

So, if the grab and current focus windows differ, make sure we emit
focus/crossing events as it corresponds to the grab device.
2015-06-24 18:15:46 +02:00
Carlos Garnacho de260ae2ea wayland: Update grab serial when ungrabbing keyboards
This was being done so only on pointers. Internally, a GdkDeviceGrabInfo
is kept for each of the master pointer/keyboard, failing to do this for
keyboards results in a stuck keyboard grab.

https://bugzilla.gnome.org/show_bug.cgi?id=748892
2015-06-24 16:42:07 +02:00
Carlos Garnacho 25885ca600 wayland: Properly initialize/finalize where we store the data_source.send fd
The fd must be closed on async_write_data_free(), but we should also
initialize it to -1 so gdk_wayland_selection_check_write() doesn't wrongly
pick the stdin fd.

https://bugzilla.gnome.org/show_bug.cgi?id=751414
2015-06-24 16:42:06 +02:00
Christoph Reiter 48ea0cbe4b GtkWindow: some min/nat size corrections.
Don't add the container border to the title request size; it
is only used for the child widget.

Don't call gtk_widget_get_preferred_width_for_height() for
the title bar with an unrelated height and subtract the title
bar height before querying the child widget width.

Guard against negative size requests after substracting the
borders/shadows and the title bar.

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-06-24 10:58:30 +02:00
Matthias Clasen f9422ab223 3.17.4 2015-06-23 17:27:43 -04:00
Matthias Clasen 23ce2562bf Fix up doc comments 2015-06-23 17:27:42 -04:00
Matthias Clasen 68aa48cc44 Fix up expected results of a11y tests
These changed due to th extra box that GtkAssistant now
inserts for each page.
2015-06-23 17:08:14 -04:00
Matthias Clasen 3b97a0b940 Fix an oversight 2015-06-23 16:46:26 -04:00
Matthias Clasen 7f0606509d GtkPlacesSidebar: Simplify sidebar code
Make this code follow GTK+ styles and conventions better.
2015-06-23 16:35:17 -04:00
Matthias Clasen ae8c07c67c GktPlacesSidebar: Plug a ton of leaks
If you don't keep in mind that g_object_get() returns references to
objects and copies fo strings, things leak all over the place.
2015-06-23 16:35:17 -04:00
Matthias Clasen f2a8ddfecf sidebarrow: Avoid object-valued properties
They tend to leak...as these do.
2015-06-23 16:35:17 -04:00
Benjamin Otte 9f27ee7f5a render: Fix ridge/groove border rendering
The typo strikes again!
2015-06-23 22:33:40 +02:00
Christoph Reiter 335c070f9b GtkHeaderBar: reduce minimum title width
The minimum title width affects the minimum window width
for CSD windows. To allow smaller windows like without
CSD reduce it a bit (276px vs 156px min width)

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-06-23 21:16:37 +02:00
Christoph Reiter 84e99b20ac GtkWindow: fix default empty window size with CSD
In the non-CSD case we checked for 0x0 window size requisition
and replaced it with 200x200 so the window was still visible.
This no longer works in case of CSD as the shadow and title bar
are always added to the requisition resulting in a titlebar/shadow
only window in case there is no child widget (this is currently
visible under wayland or when setting GTK_CSD=1).

Instead of special casing the final window size, special case
the child requisition paths instead. This gives us the same
requisition in both, CSD and non-CSD cases (the header bar
has a too large minimum width atm so the resulting window is
still not the same)

https://bugzilla.gnome.org/show_bug.cgi?id=751341
2015-06-23 21:16:14 +02:00
William Hua da14dbe4e5 mir: fix toggling between maximized and restored 2015-06-23 13:17:28 -04:00
William Hua e083eb42e9 mir: fix wheel scrolling in both directions 2015-06-23 13:17:28 -04:00
William Hua 8fac1f688e mir: emit GDK_ENTER_NOTIFY on pointer enter 2015-06-23 13:17:28 -04:00
William Hua 2374a1b50b mir: remove non-useful logging 2015-06-23 13:17:28 -04:00
William Hua 19f66c781f mir: don't need dummy egl surface 2015-06-23 13:17:28 -04:00
William Hua be068607f6 mir: emit configure event on window move/resize
Without this, some windows don't restart the paint clock needed to
actually render the contents.
2015-06-23 13:17:27 -04:00
William Hua 9800d83a72 mir: fix build due to missing api 2015-06-23 13:17:27 -04:00
Lapo Calamandrei ec9a39977a Adwaita: scale marks visible on the dark variant 2015-06-23 19:11:15 +02:00
Balázs Úr aa052c6d29 Updated Hungarian translation 2015-06-23 13:59:34 +00:00
Matthias Clasen 1ed21ad3d4 GtkScale: More work on mark spacing
Try harder not to push the scale out of balance by marks. With
this change, the remaining difference in the drawing is down
to asymmetric assets and margins coming out of the theme.
To fully support such asymmetric rendering, we need implement
baseline alignment for scales.

https://bugzilla.gnome.org/show_bug.cgi?id=749650
2015-06-23 09:36:14 -04:00
Marek Kasik 4e4a2fe17e printing: Get output bin via IPP
Request "output-bin-supported" and "output-bin-default" attributes through
IPP if there is no PPD for selected printer.
Pass "output-bin" option with other options in printer_get_options().
Translate standard IPP values of "output-bin" option.

https://bugzilla.gnome.org/show_bug.cgi?id=725441
2015-06-23 13:36:57 +02:00
Matthias Clasen 7ce96cb6ac GtkStack: Avoid some unnecessary complication
We already have an in-destruction flag, so use it.
2015-06-23 06:45:07 -04:00
Christoph Reiter 3c9cca596f Fix calculation of edge input window size in case the real window is too small.
This error resulted in warnings like
"pixman_region32_init_rect: Invalid rectangle passed"

In case the window is smaller than handle_size * 2 the resulting
edge window got a negative size. Prevent that by limiting the
handle size to half the respective edge length. This also
prevents the corner windows from overlapping in case the window
is too small.
2015-06-22 14:22:50 +01:00
Emmanuele Bassi 97e728580c Revert "window: Check if we can use CSD before enabling them"
This reverts commit c5e5ee6749.

It turns out that this commit breaks the default sizing of GtkWindow,
which in turn causes the window to be smaller than the handle size,
which ends up sending invalid rectangles to Cairo.

We'll have to find another way to fix the CSD issue.

See also: https://bugzilla.gnome.org/show_bug.cgi?id=751140

https://bugzilla.gnome.org/show_bug.cgi?id=750343
2015-06-22 14:21:47 +01:00
Paolo Borelli 4e155d784d Avoid spurious operations on destroy
When the stack is destroyed we do not want to waste time running
animations and notifying listeners about which is our current
visible child.

This is not only an optimization, but it is important for the stack
switcher widgets: since they are in another branch of the hieratchy
we do not want to get notifications while the stack is being destroyed.

Based on a patch by Paolo Borelli
https://bugzilla.gnome.org/show_bug.cgi?id=724506
2015-06-21 11:32:31 -04:00
Matthias Clasen 3b43951ba4 Pacify gobject-introspection
gobject-introspection complains about the parameter names of
vfuncs. Why, you ask ? No idea.
2015-06-20 20:29:18 -04:00
Matthias Clasen 93f9a81ac5 GtkRange: Improve zoom handling a bit
The calculation to update the initial slider position on zoom
changes was not working correctly when using keys to toggle
zoom on and off for scales. Avoid it by updating the position
beforehand.
2015-06-20 20:26:42 -04:00
Matthias Clasen 27dabaefa6 GtkRange: Make drag gesture less agressive
Moving the mouse while pressing one of the steppers was making
the slider jump to the end, unexpectedly. This was caused by the
drag gesture kicking in when it shouldn't. Fix this by making
all drag gesture signal handlers only do something if we are in
a drag thats started on the slider.

https://bugzilla.gnome.org/show_bug.cgi?id=751050
2015-06-20 18:37:15 -04:00
Caolán McNamara b4a88c7287 file chooser: Avoid tall combos
The filter combo box in the file chooser was stretching to match
the height of the extra widgets next to it. Since, stretched combo
boxes are not a pretty sight, make it stick to the top instead.

Patch by Caolán McNamara,

https://bugzilla.gnome.org/show_bug.cgi?id=751227
2015-06-20 10:55:02 -04:00
Matthias Clasen b684e70dd5 GtkOverlay: Sync up parameter names
gtk-doc gets confused if the parameter names between header,
source and doc comment don't match up.
2015-06-20 10:52:44 -04:00
Matthias Clasen 3c711cc98a Fix a typo
gtk-doc complained about a multi-line Since: tag, but the
real culprit was a typo in the Deprecated: tag.
2015-06-20 10:52:01 -04:00
Matthias Clasen 8bd9604fe6 Tell gtk-doc to ignore private headers
Tell gtk-doc to ignore new private headers as well, otherwise
it complains about undocumented symbols in them.
2015-06-20 10:47:18 -04:00
Matthias Clasen d642ae78fc GtkWindow: Small documentation addition 2015-06-20 10:36:09 -04:00
Matthias Clasen 5981e15115 GtkTextView: Small documentation addition 2015-06-20 10:33:56 -04:00
Matthias Clasen 2caa1deb5b Fix up index for some 3.14 symbols
Marking these as "Since: 3.14.1" may be more accurate, but
it causes gtk-doc to not put these symbols in any versioned
index at all (it generates an unused index for 3.14.1). So,
lets lie a little, and say these symbols were added in 3.14.
2015-06-20 10:28:03 -04:00
Matthias Clasen eab0df12a8 gtk-demo: Add forgotten source file
The font_features.c file was not added as a resource, so that
gtk3-demo could not display it.
2015-06-19 22:03:19 -04:00
Matthias Clasen 0a601b093c gtk-demo: Many cosmetic fixes
Mostly update window titles, and some addition to descriptions.
2015-06-19 21:59:15 -04:00
Matthias Clasen 2f8e4f2685 GtkAssistant: Fix criticals on dispose
After the recent change thta introduced boxes between the pages
and the notebook, we were no longer careful enough when disposing
the assistant. Fix that up.
2015-06-19 21:56:29 -04:00
Matthias Clasen d6a52218d1 gtk3-demo: Improve the overlay demo
Add some more information to the description.
2015-06-19 20:09:55 -04:00
Matthias Clasen afd75070a2 gtk-demo: A better overlay demo
This shows the new passthrough feature.
2015-06-19 18:16:19 -04:00
Christian Kirbach d4b0694c02 Updated German translation 2015-06-19 20:58:12 +00:00
Piotr Drąg 5ac6b82b82 Updated POTFILES.skip 2015-06-19 22:20:08 +02:00
Chun-wei Fan 28b8541847 gtk-demo: Don't Distribute demos.h
Since demos.h is now generated according to the platform for which GTK+ is
built, don't distribute it. Generate a Windows-specific demos.h.win32 and
distribute that instead, in which the Visual Studio build files will copy
it to demos.h, so that the build will proceed normally.

https://bugzilla.gnome.org/show_bug.cgi?id=749622
2015-06-19 23:46:05 +08:00
Matthias Clasen c207b8d363 Bump Pango requirement
The font features demo that was just added uses bleeding-edge
pango features.
2015-06-19 09:33:39 -04:00
Matthias Clasen 010a120351 Add a font features demo
This started life as a standalone tool, but it is nicer
to have it integrated in gtk3-demo.
2015-06-19 09:32:10 -04:00
Matthias Clasen a4dcc6bc52 file chooser: Small cleanup
Ask the search model if it is empty, instead of maintaining this
information manually in the file chooser widget.
2015-06-19 01:04:42 -04:00
Matthias Clasen 66b5d2e523 GtkSearchEngineTracker: Fix SPARQL syntax
The function is called tracker:uri-is-descendant, not
tracker-uri-is-descendant.
2015-06-19 01:04:18 -04:00
Matthias Clasen 489b48d0b5 Forgotten file 2015-06-19 01:03:28 -04:00
Matthias Clasen 9426fb08ce GtkSearchEngineSimple: Avoid a private struct
We can just make this type final, and avoid the private struct.
2015-06-19 00:48:29 -04:00
Matthias Clasen ca31662630 GtkSearchEngineTracker: Avoid a private struct
We can just make this type final, and avoid the private struct.
2015-06-19 00:41:10 -04:00
Matthias Clasen d9a22e7e30 Avoid an unnecessary check
We create the indexed_locations array unconditionally.
2015-06-19 00:34:28 -04:00
Matthias Clasen ed50772b41 GtkSearchEngine: Avoid a crash
Add a destroy notify for the data of the callback, so we don't
end up leaving a dangling pointer behind for a short while if
the native engine is finalized before the simple one. This
was showing up as crash when typing and backspacing in the
search entry of the file chooser.
2015-06-19 00:32:49 -04:00
Matthias Clasen d12c7186b6 GtkSearchEngine: Avoid crawling indexed locations
Implement the IsIndexed callback for tracker. This requires
reading settings of the tracker file miner. We are careful
to avoid a hard dependency on the tracker schemas.
2015-06-19 00:12:46 -04:00
Matthias Clasen c7d86ef4e4 GtkSearchEngine: Avoid crawling indexed locations
Add a framework to the simple engine that allows to skip
locations which are indexed by the native engine.
2015-06-19 00:11:01 -04:00
Matthias Clasen 33e2d12e90 GtkSearchEngine: Initialize recursive flag
Otherwise all our searches become non-recursive, which was not
the intention.
2015-06-19 00:06:51 -04:00
Matthias Clasen a3a58fa7d9 GtkSearchEngine: Add recursive flag
Add a flag for recursive search, and implement non-recursive
search in both the tracker and simple search engines.

This is not currently used in the file chooser.
2015-06-18 22:59:44 -04:00
Matthias Clasen 15a41e0bf5 Remove an unused field 2015-06-18 22:40:49 -04:00
Matthias Clasen d260d2c466 GtkSearchEngine: Remove unused code
Nothing ever uses or emits the hits-subtracted signal.
Nautilus dropped it a few years ago. Time to follow suit.
2015-06-18 17:08:09 -04:00
Matthias Clasen 1d63335c8e Use infos from search engine instead of getting them again
When the search engine provides hits with GFileInfo, use that
to add the hits to the model directly, without going through
another round of async get_info calls.

To do this, we add a batched variant of the
_gtk_file_system_model_update_file call that takes lists of
GFiles and GFileInfos. Again, we can avoid repeated resorting
that happens when the files are updated individually.
2015-06-18 15:20:06 -04:00
Matthias Clasen 1b755c546e Fix an oversight in the previous commit
We lost the line marking the search model as non-empty, causing
us to show the 'no results' page despite there being results.
2015-06-18 15:14:54 -04:00
Matthias Clasen 56c05c429f Request the right attributes in the simple search engine
This change makes it so that the file info passed along
from the simple search engine has all the attributes that
the file system model wants.
2015-06-18 14:37:23 -04:00
Matthias Clasen abe4829e36 search engine: Pass file infos along for hits 2015-06-18 14:33:13 -04:00
Matthias Clasen 4b8df8c546 file chooser: Use batched insertion for search results
This helps avoiding excess work when procesing many search
results, as typically happens with short search strings
and recursive search.

https://bugzilla.gnome.org/show_bug.cgi?id=751169
2015-06-18 13:11:30 -04:00
Matthias Clasen b2ceadb057 file system model: Add batched insertion
Add a batched version of gtk_file_system_model_add_and_query_file
that takes a list of files and avoids resorting the model for each
individual insertion. The querying is still done one-file-at-a-time,
so more optimization is certainly possible.
2015-06-18 13:11:30 -04:00
Emmanuele Bassi 9590879e2f Revert "window: Reinstate logic for should_use_csd()"
This reverts commit f043fd532d.

The whole point of having can_use_csd() return TRUE when GTK_CSD is
unset is to use it inside enable_csd().

https://bugzilla.gnome.org/show_bug.cgi?id=751140
2015-06-18 16:10:36 +01:00
Emmanuele Bassi f043fd532d window: Reinstate logic for should_use_csd()
The old should_use_csd() function would return FALSE if the GTK_CSD
environment variable is unset; the change in commit c5e5ee6749
made it return TRUE if GTK_CSD is unset. This has a cascade effect
on the window size, which causes invalid rectangles to bubble down
to Pixman.

https://bugzilla.gnome.org/show_bug.cgi?id=751140
2015-06-18 14:52:17 +01:00
Timm Bäder c82ce07d80 gtkdialog: Remove 2px border 2015-06-18 15:41:29 +02:00
Timm Bäder b61d79e354 messagedialog: remove 2px border 2015-06-18 15:41:28 +02:00
Timm Bäder a97a3d6a5b filechooserdialog: Remove space between window and content
Was removed in 232d6f84f0.
2015-06-18 15:41:28 +02:00
Jakub Steiner dc8cc6291b Adwaita: indentation
- lapo was shouting at me.
2015-06-18 13:09:22 +02:00
Lapo Calamandrei 3a462b174d Adwaita: volume button and scale button padding
I was assuming that GtkVolumeButton and GtkScaleButton could only
contain a icon, now they get the image-button padding by default,
but if the text-button class is applied it is not overridden.
2015-06-18 12:46:00 +02:00
Lapo Calamandrei 5e616e0298 Adwaita: scale popup quick fix 2015-06-18 12:33:59 +02:00
Jakub Steiner 58813a0db1 Adwaita: markup cleanup
- move touch selection selectors to its own section
- use scss style markup for .button common elsewhere
  (more compact and legible)
2015-06-18 12:01:12 +02:00
Jakub Steiner ff20abda8e HC: touch text selection styling
- sync with Adwaita
- try to avoid using image assets

https://bugzilla.gnome.org/show_bug.cgi?id=750883
2015-06-18 11:56:20 +02:00
Ting-Wei Lan f85db624eb Fix return value error in _gtk_window_get_popover_parent 2015-06-18 12:14:44 +08:00
Matthias Clasen 00616bc199 Cosmetic change 2015-06-17 20:24:29 -04:00
Matthias Clasen 0f7857f66a GtkPlacesSidebar: Fix rtl appearance
Apply the necessary directional variants for asymmetric
css padding.

https://bugzilla.gnome.org/show_bug.cgi?id=751084
2015-06-17 20:14:54 -04:00
Cosimo Cecchi 9c7b0f0491 overlay: remove gtk_overlay_add_pass_through_overlay()
The API to access this functionality will be the setter we just added in
the previous commit.

https://bugzilla.gnome.org/show_bug.cgi?id=750568
2015-06-17 11:48:37 -07:00
Cosimo Cecchi 3b1b171be5 overlay: add setters and getters for pass-through child property
This will make the API easier to use from bindings too.

https://bugzilla.gnome.org/show_bug.cgi?id=750568
2015-06-17 11:48:37 -07:00
Cosimo Cecchi 1e6ccf5c86 docs: add new GtkOverlay methods to gtk3-sections.txt
https://bugzilla.gnome.org/show_bug.cgi?id=750568
2015-06-17 11:48:37 -07:00
Alexander Larsson 94a149c8ea configure: test have_docbook_style != yes, not have_docbook_dtd 2015-06-17 17:35:32 +02:00
Matthias Clasen 8612942fe2 file chooser: Drop unused variables 2015-06-17 10:01:04 -04:00
Matthias Clasen 916cf8f61e file chooser: Use a revealer
Use a revealer to manage the visibility of the header area where
we show the pathbar, the location entry or search. This is a bit
smoother, and makes search more similar to a search bar.
2015-06-17 10:01:04 -04:00
Carlos Garnacho 15bb9acc8a texthandle: Avoid double rendering of background/frame
gtk_render_handle() already renders background/frame itself, avoid
doing this twice.
2015-06-17 15:58:55 +02:00
Carlos Garnacho 77d429bc4d gtkmain: Ignore grab for events in child popovers
Popovers may be spawn when there's GTK+ grabs somewhere else (eg.
text selection popover/handles in an entry in a modal popover). When
this happens, events go to the grab widget (in this case the modal
popover) and are effectively ignored by the event widget, even though
it's can be conceptually a child of the grab widget.

To get away with this, tweak a bit gtk_main_do_event(), so events going
to popovers that are related to grab_widget or a child of it are received,
as it would happen with regular children of grab_widget.

https://bugzilla.gnome.org/show_bug.cgi?id=750993
2015-06-17 15:56:42 +02:00
Carlos Garnacho 76dc8aced5 window: Add concept of popover "parent"
This will be the widget that the popover relates to (::pointing-to in
GtkPopover, ::parent in GtkTextHandle).

Additional API to check the popover/parent relationship between widgets
has been added, which will be useful wherever this is necessary in a
generic manner.

https://bugzilla.gnome.org/show_bug.cgi?id=750993
2015-06-17 15:56:42 +02:00
Ting-Wei Lan 3955d93e9d Fix return value error in gdk_window_set_pass_through
https://bugzilla.gnome.org/show_bug.cgi?id=751099
2015-06-17 21:36:35 +08:00
Jonas Ådahl 0dab37c78f wayland: Always request transient commit when mapping subsurface
A subsurface positioning operation only takes effect when the parent
surfaces state is applied. If a subsurface is mapped and positioned, but
the parent surface state is not immediately committed, the relative
position of the subsurface is undefined and may be placed incorrectly.

To avoid this undefined state, always request that the parent surface
should be committed after mapping a subsurface so that the position
operation will take effect.

https://bugzilla.gnome.org/show_bug.cgi?id=751098
2015-06-17 17:41:31 +08:00
Christian Hergert fb06b6e4b8 treeview: always pixelcache widget contents
GtkTreeView has a particularly expensive drawing path. This can cause
issues when part of animated widget sequences. Caching the content while
a model is attached helps reduce the number of full redraws during
exposure greatly.

https://bugzilla.gnome.org/show_bug.cgi?id=751082
2015-06-16 18:08:22 -07:00
Christian Hergert 6a2143ab31 pixelcache: allow widgets to always require cached content
Some widgets have very expensive drawing paths. So caching the content
can be useful even when not scrolling.

This can help speed up widgets that are part of animation sequences and
thereby go through spurious expose events.

https://bugzilla.gnome.org/show_bug.cgi?id=751082
2015-06-16 18:08:22 -07:00
Yosef Or Boczko 3665a17102 Updated Hebrew translation 2015-06-17 03:24:12 +03:00
Christian Hergert 213b92e644 gdkwindow: avoid updating background pattern if it matches previous
Background patterns are often updated when style changes. In many cases,
the new pattern will match the previous. We can optimize out the
invalidation that will occur upon resetting the same pattern.
2015-06-16 14:40:09 -07:00
Carlos Soriano 569e59b2c5 gtkplacessidebar: improve variable name 2015-06-16 16:54:24 +02:00
Carlos Soriano 0bb82bf1de gtkplacessidebar: Remove some old comments
We didn't made up our minds until now from some of them, and for
the others no progress has been made or bugs reported, so probably
they are fine.
2015-06-16 16:25:33 +02:00
Carlos Soriano fbbad5deec gtkplacesidebar: use GtkListBox
We were using GTkTreeView in a simple list. Also, as we know,
GtkCellRenderers are not the best way to theme and manipulate
widgets.

So instead use a GtkListBox to modernize the GtkPlacesSidebar,
and in the way clean up some parts of the code (like headings)
which were not used anymore.
Also we don't use a model anymore, since the data is simple
enough to manage it in a subclass of the row itself.
2015-06-16 16:19:37 +02:00
Carlos Soriano d881b15349 theme: decrease list row transition
It was somewhat annoying given the "trace" of it. Decrease
the time to avoid too much "trace"
2015-06-16 16:19:37 +02:00
Carlos Soriano 43a4843b9c gtkfilechooserwidget: show drop hints on gtkplacessidebar
Now with the API addition on gtkplacessidebar, we can show some
hints for the drop targets.

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Carlos Soriano 4499174e32 gtkplacessidebar: make insensitive invalid drop targets
https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Carlos Soriano fb034f38b3 gtkplacessidebar: add new bookmark icon
Following design mockups

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Carlos Soriano a9b698b265 gtkplacesidebar: remove obsolete drop state
We didn't use those for some time now.
2015-06-16 16:19:37 +02:00
Carlos Soriano 91e1e80862 gtkplacessidebar: add API for show drop hints
It is convenient to allow applications to show all the drop
targets at once. This improves the user experience with drag
an drop.

The new API allows the application to set the gtkplacessidebar
in a mode where invalid drop targets are insensitive and it
adds a "new bookmark" row. This mode is intended to be set
when the application is aware of a dnd operation and needs to
be stopped kwhen the application is aware that dnd operation
was cancelled or ended in a different part than gtkplacesisdebar.

The context parameter is unused in this patch, but will be
used in next patches when the sidebar will use a GtkListBox.
The reason of being unused now is just convenience.

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:37 +02:00
Carlos Soriano 4371cc8f01 gtkplacessidebar: new bookmark row only at first position
Following the new mockups, put the new bookmark row always
in the first position, so it's easier to drop an item.

https://bugzilla.gnome.org/show_bug.cgi?id=747793
2015-06-16 16:19:36 +02:00
Matthias Clasen e367c4baa0 Deal with events from wrong display
GtkInspector is opening a separate display connection, which makes
it more likely that gtk_get_current_event() returns an event from
the "wrong" display.
2015-06-15 19:50:02 -04:00
Matthias Clasen 002699402d GtkMenuButton: Make programmatic toggling work again
This was broken in 0796d7b6ff.

https://bugzilla.gnome.org/show_bug.cgi?id=751018
2015-06-15 19:49:49 -04:00
Matthias Clasen f99375f91e GtkMenuButton: Avoid direct button access
We were getting ourselves in trouble by casting touch events
to GdkEventButton and poking directly at their internals. Instead,
use GdkEvent API to get what we need.

This fixes a crash when using the gear menu in epiphany with
touch. The same crash also occurred in testmenubutton.
2015-06-15 18:54:13 -04:00
Alexander Larsson 9fc19b5a26 gtkoverlay: Fix issues with remove
The iteration now progresses past a delete, so make sure we iterate
safely. Also, don't chain up if we removed a child.
2015-06-15 16:32:50 +02:00
Alexander Larsson 5cf2896308 testoverlay: Fix indentation 2015-06-15 11:00:40 +02:00
Alexander Larsson 1a44a85847 testoverlay: Add test for overlay z ordering
https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:46 +02:00
Alexander Larsson a9bf6532b4 testoverlay: Fix test by using add_pass_through_overlay
https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:46 +02:00
Alexander Larsson 4dd66b0c53 GtkOverlay: Add support for input pass-through overlays
For these widgets we set pass-through on the child window so that
input over these widgets (that are not on a child input window) goes
to the window below the overlay.

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:46 +02:00
Alexander Larsson 76ba5a03b9 overlay: Add reorder_overlay()
This allows you to control the z-ordering of overlay children

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:45 +02:00
Alexander Larsson 4c3eece663 gdk: Add gdk_window_set_pass_through
An pass_through window is something you can draw in but does not
affect event handling. Normally if a window has with no event mask set
for a particular event then input events in it go to its parent window
(X11 semantics), whereas if pass_through is enabled the window below
the window will get the event. The later mode is useful when the
window is partially transparent. Note that an pass-through windows can
have child windows that are not pass-through so they can still get events
on some parts.

Semantically, this behaves the same as an regular window with
gdk_window_set_child_input_shapes() called on it (and re-called any
time a child is changed), but its far more efficient and easy to use.

This allows us to fix the testoverlay input stacking test.

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:45 +02:00
Alexander Larsson ccc4b192ec testoverlay: Add new input stacking test
In this case we have a bunch of interactive main children
of the overlay, and then a centered overlay that contains both
non-interactive (labels) and interactive (entry) widgets.

This shows off a problem where the non-interactive parts (the labels)
steals input from the overlay main children (breaks button click and
hover effects).

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:45 +02:00
Daniel Mustieles 3271eb2141 Updated Spanish translation 2015-06-15 08:55:00 +00:00
Dimitris Spingos da4e83e707 Updated Greek translation 2015-06-15 11:14:00 +03:00
Benjamin Otte fe51ac273c stylecontext: Change fallback behavior on state mismatch
For functions that take state flags as an argument we need to special
case the situation where the passed in flags don't match the current
state.

Previously we would create a copy of the style info, change its state
and do the lookup from there.

Now that GtkCssNode has replaced style infos, this doesn't work as well
anymore as copying a GtkCssNode is not possible.
However, unike style infos, GtkCssNodes are instant-apply, so we don't
need to copy anymore, we can just change the state of the node.

This causes some invalidations to be queued, but we can take that
performance hit as this is fallback code.

https://bugzilla.redhat.com/show_bug.cgi?id=1228852
2015-06-15 04:36:47 +02:00
Matthias Clasen fa29a01c26 widget-factory: Make the circular button do something 2015-06-14 21:37:58 -04:00
Matthias Clasen 675467063e testassistant: Remove padding from the filechooser page
This tests the new assistant api to remove padding from
pages.
2015-06-14 21:30:01 -04:00
Matthias Clasen c3a0880cd6 GtkAssistant: Add a way to have pages without padding
This can be useful when embedding complex widgets like
a file chooser as a page.

https://bugzilla.gnome.org/show_bug.cgi?id=750631
2015-06-14 21:29:09 -04:00
Matthias Clasen 43fcae91f1 Add a filechooser-in-assistant example
This is one of the cases where one wants a page without
any padding.
2015-06-14 21:05:49 -04:00
Matthias Clasen 6cc65260f4 GtkAssistant: Redo page margins
Instead of having padding outside the notebook containing
all pages, put each page in an extra box and add the padding
there. This is in preparation for allowing pages without
padding.
2015-06-14 21:04:15 -04:00
Matthias Clasen cfd85dee03 assistant: Drop hardcoded padding
This means the pages themselves will be responsible for setting
suitable padding.

https://bugzilla.gnome.org/show_bug.cgi?id=750631
2015-06-14 20:54:47 -04:00
Jordi Mas ef8ad1c734 Fixes to Catalan translation 2015-06-14 08:32:03 +02:00
Matthias Clasen 9fbd71394c Only build testfontchooserdialog on linux
We are using this to test pango functionality that
uses fontconfig apis, so this doesn't build on OS X
or Windows anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=750892
2015-06-13 23:00:41 -04:00
Matthias Clasen d1f2e5896b color editor: make popups toggleable
The popups on the color editor are somewhat hard to get rid of.
Arrange things so that clicking the same control again dismisses
the current popup.
2015-06-13 22:32:05 -04:00
Matthias Clasen 822886edbc Don't show a menu on the color editor swatch
There's nothing to customize here, so no need to show a menu.
2015-06-13 21:57:07 -04:00
Matthias Clasen 98a3fac6ab Add a way to avoid menu on color swatches 2015-06-13 21:56:41 -04:00
Matthias Clasen 1bba3b0a38 Avoid uninitialized variables
clang complains that these may be used uninitialized.
2015-06-13 21:10:26 -04:00
Matthias Clasen 8cbed0b04a entry: Drop an unused variable 2015-06-13 21:10:26 -04:00
Matthias Clasen 047ad11353 Drop an unused variable 2015-06-13 21:10:26 -04:00
Matthias Clasen 7aec96b95f Remove unused variables 2015-06-13 21:10:26 -04:00
Matthias Clasen 5a446284b7 Ensure a variable is initialized
clang complained about transient_for being used uninitialized.
2015-06-13 21:10:25 -04:00
Matthias Clasen 577e9a33bb Remove an unused variable 2015-06-13 21:10:25 -04:00
Matthias Clasen 85a6cafd81 broadway: Avoid compiler warnings
clang doesn't like self-assignment.
2015-06-13 21:10:25 -04:00
Matthias Clasen 5b162fa44a GtkColorEditor: Remove old todo
Most of this is done, and the rest will not happen because
of this note.
2015-06-13 21:10:25 -04:00
Matthias Clasen 2af2189347 widget-factory: More popover examples
Add an example for text input in a popover. This leads to nested
popovers with touch selection, and does not currently work.
2015-06-13 21:10:25 -04:00
Matthias Clasen 94fc9f5211 widget-factory: Add horizontally linked entries
It happens in some places, so artists need an example to
make it look good.
2015-06-13 21:10:25 -04:00
Ting-Wei Lan 41b6993a66 Fix 'void function should not return void expression' warning for clang
https://bugzilla.gnome.org/show_bug.cgi?id=750888
2015-06-13 23:00:23 +08:00
Ting-Wei Lan d8657a8156 Fix return value error in _gtk_text_handle_set_direction
https://bugzilla.gnome.org/show_bug.cgi?id=750888
2015-06-13 23:00:21 +08:00
Matthias Clasen 6f955a7df6 Redo font map support in GtkFontChooser
We can't add properties to the interface, since it breaks
3rd party implementations of the GtkFontChooser interface.
These exist, for example in gnumeric.

So, instead of a new property, add getter/setter vfuncs.
2015-06-13 00:00:51 -04:00
Benjamin Otte 8c6130e68a fontchooser: Don't cause "row-changed" signal in cell data func
The font chooser delays creating the font description from the font face
as long as possible (it's slow). Because we use fixed height mode, we
only have to create font descriptions for rows we are actually going to
show.

This was achieved by looking at the font description column and if it
was NULL, we created a font description and gtk_list_stiore_set() it.
Unfortunately this caused a "row-changed" signal to be emitted and this
emission could happen during the cell data func.
And that caused infinite loops with accessibility when you were unlucky.

This change replaces the NULL font description with an empty one and
instead of setting the correct font description, we
pango_font_description_merge() it in. This way, the list store doesn't
change and no signals are emitted.

https://bugzilla.redhat.com/show_bug.cgi?id=1197267
2015-06-12 22:04:17 +02:00
Carlos Garnacho a01fe14056 popover: Avoid hiding modal popovers if another popover is taking focus
Due to popover modality itself, there's quite high chances the popover
stealing focus has been triggered from within, so stay friendly to it.
Hiding the popover here will only hide the grabbing popover too if this
happens.

https://bugzilla.gnome.org/show_bug.cgi?id=750741
2015-06-12 21:00:45 +02:00
Carlos Garnacho a0ff35f032 window: Avoid rising the window of already shown popovers
This breaks stacking, as popovers are repositioned sort of frequently
(even more after show/hide animations).

https://bugzilla.gnome.org/show_bug.cgi?id=750741
2015-06-12 21:00:45 +02:00
Cosimo Cecchi 131abe28a4 reftests: fix style class syntax in CSS file
Fixes reftests.

https://bugzilla.gnome.org/show_bug.cgi?id=750605
2015-06-12 08:55:23 -07:00
Cosimo Cecchi 0093b156d7 testsuite: add a test for non-square symbolic icons
To verify the previous fix.

https://bugzilla.gnome.org/show_bug.cgi?id=750605
2015-06-12 08:55:23 -07:00
Cosimo Cecchi 06df94ff7b icontheme: don't modify symbolic SVG dimensions when recoloring
When recoloring symbolic SVG, do not modify the original width and
height of the passed-in file; the function later will scale the image
through gdk_pixbuf_new_from_stream_at_scale(), but we should still
use the original size to create the proxy SVG, or the image will
possibly be doubly-resized or blurry.

https://bugzilla.gnome.org/show_bug.cgi?id=750605
2015-06-12 08:55:23 -07:00
Matthias Clasen e847c27aac recent chooser: Make it expand
It is expected that the list fills the available space.

https://bugzilla.gnome.org/show_bug.cgi?id=750690
2015-06-12 08:27:27 -04:00
Carlos Garnacho a2d1d5244b entry: Ensure we unset the magnifier widget on ::destroy
Otherwise there's dangling signal handlers which cause warnings
at the time we attempt to disconnect these.
2015-06-12 13:33:13 +02:00
Carlos Garnacho 5c38991367 textview: Set handles' mode to "none" if showing the bubble
show_or_hide_handles() tries to disable visibility when the popover is
shown, although it triggers a bit late, and lets the handles flash briefly
if both popover and handles try to show at the same time (eg. when
pressing on the selection of a previously unfocused textview, the handles
were previously hidden, so they try to show again on focus in).
2015-06-12 13:04:45 +02:00
Carlos Garnacho c11906fcdb textview: Perform tougher handle visibility checks after hiding the popover
The handles might fall outside the visible area, and shouldn't be shown
then. Just call gtk_text_view_update_handles() which will perform these
checks, and keep the handle conveniently hidden.

This was leading to unexpectedly visible handles (and in the
wrong/previous position, the handle code doesn't relocate the widget
it's about to hide) when "select all" was selected in the popover on
a textview needing scrollbars.
and extending the selection beyond the view above and/or below.
2015-06-12 12:45:03 +02:00
Carlos Garnacho 2be6d09c9e popover: Be lenient wrt visibility of popovers too close to widget borders
The check used to hide the popover if the pointed area fell partly out of
the widget allocation, textviews now can trigger that with text selections
too close to the visible edge, as a small extra area around is now reserved.

The check has been changed to only hide the popover if the pointed area
falls completely outside the widget allocation.
2015-06-12 12:07:30 +02:00
Carlos Garnacho 5a499ef3e1 texthandle: Remove knowledge about window borders
We need to expand beyond these if necessary, so don't artificially
limit things here.
2015-06-11 17:14:23 +02:00
Carlos Garnacho 551931c1c6 window: Allow more space at edges for popovers
We're clamping to the visible window edge, which misplaces text handles.
2015-06-11 17:14:23 +02:00
Carlos Garnacho 10cb7f90e4 entry: Set text direction information on text handles
This way the handles point to the right side on the presence of rtl/ltr
text.
2015-06-11 17:14:23 +02:00
Carlos Garnacho 8d56346f9b textview: set text direction information on text handles
This makes them point to the correct place, given the theme supports
this.
2015-06-11 17:14:23 +02:00
Carlos Garnacho 3a7689bae0 texthandle: Handle ltr/rtl positioning
This setting is per handle, as is dependent on the selected text, rather
than the locale.
2015-06-11 17:14:23 +02:00
Carlos Garnacho cd5f70357c Adwaita: support rtl on text handles
Just use the opposite variant for the opposite LTR side.
2015-06-11 17:14:23 +02:00
Carlos Garnacho fc6871b43b texthandles: Move start handle to bottom
The asset is going to change to point upwards, so physically place
the handle below the text position.

https://bugzilla.gnome.org/show_bug.cgi?id=750692
2015-06-11 17:12:06 +02:00
Jakub Steiner c8d70c8d8c Adwaita: update text selection handles
- we'll put both handles to teh bottom
- renamed top, bottom to start and end. will be easier
  for rtl too.

https://bugzilla.gnome.org/show_bug.cgi?id=750692
2015-06-11 17:12:06 +02:00
Piotr Drąg 1600d54012 docs: Fix some minor typos in comments in GtkWidget 2015-06-11 15:50:15 +02:00
Emmanuele Bassi 8b06900362 settings: Fix the type annotation for color-hash
The (element-type) annotation cannot be used with properties that return
container types like GHashTable; we need to use the (type) annotation.

https://bugzilla.gnome.org/show_bug.cgi?id=750489
2015-06-11 11:45:03 +01:00
Emmanuele Bassi b2cbe7ba79 builder: Skip introspecting lookup_callback_symbol()
Opaque function pointers as return values are not really usable in high
level languages, even via introspection.
2015-06-11 11:45:03 +01:00
Emmanuele Bassi 7410a4a994 docs: Fix annotation for GtkGLArea::resize signal
We need to document all arguments for the signal, for both gtk-doc and
introspection.
2015-06-11 11:45:03 +01:00
Emmanuele Bassi d11e81257e docs: Improve deprecation notices for GtkSettings
The button and menu item icons settings are deprecated; application
developers should control whether or not a widget should show an icon,
using the existing API.

https://bugzilla.gnome.org/show_bug.cgi?id=750718
2015-06-11 11:45:03 +01:00
Emmanuele Bassi b493bf091a docs: Improve deprecation notices for GtkMisc
Point to the replacement properties and functions.

https://bugzilla.gnome.org/show_bug.cgi?id=750718
2015-06-11 11:45:03 +01:00
Emmanuele Bassi 56faf49b8e docs: Improve deprecation notice for rules-hint property
Specify that the theme is wholly in control.

https://bugzilla.gnome.org/show_bug.cgi?id=750718
2015-06-11 11:45:03 +01:00
Emmanuele Bassi 5a61246946 docs: Improve deprecation notices for GtkImageMenuItem properties
Should help porting code away from the deprecated GtkImageMenuItem
class.

https://bugzilla.gnome.org/show_bug.cgi?id=750718
2015-06-11 11:45:03 +01:00
Emmanuele Bassi 715777154b docs: Add deprecation notices for GtkAlignment properties
We want people to port their code away from deprecated classes, and this
helps finding a replacement.

https://bugzilla.gnome.org/show_bug.cgi?id=750718
2015-06-11 11:45:03 +01:00
Carlos Soriano e74d2b7564 gtklistboxrow: propagate in the draw vfunc
So objects connected by g_signal_connect_after actually get
the signal.
This was causing an issue in the dnd highlight, since there
a cairo rectangle is draw using g_signal_connect_after on the draw
signal.
2015-06-10 17:47:23 +02:00
Matthias Clasen 90a331c84a entry: Select word on double tap
The same approach as taken for GtkTextView in the previous commit.
2015-06-10 06:20:18 -04:00
Matthias Clasen ac5fcc6b72 text view: Select word on double tap
This is an initial attempt at implementing double-tap selection.
2015-06-09 23:31:00 -04:00
Matthias Clasen 06726b4d4b gtk-demo: Make hypertext demo work with touch
Make tapping on the links work.
2015-06-09 23:31:00 -04:00
Jonas Ådahl 85635457bc wayland: Improve guessing of popup placement for detached popup menus
If a menu was not attached to any widget, we try to calculate its
position given where the grabbed pointer is and what window has its
focus. Previously we failed to do so if a "transfer window" was used
for the grab, and this patch adds a code path that, if the menu window
itself didn't have the grab, look for the transfer window and get the
grab device from there.

https://bugzilla.gnome.org/show_bug.cgi?id=748951
2015-06-10 11:28:32 +08:00
Jonas Ådahl 9e464252c0 wayland: Don't try to guess the popup menu placement when it was set
If a position was already explicitly set, don't try to guess the
position of popup menus by looking at the pointer position, just use
the set coordinates.

https://bugzilla.gnome.org/show_bug.cgi?id=748951
2015-06-10 11:28:32 +08:00
Jonas Ådahl 0f47d1bac4 wayland: Position popups relative to the parent surface
According to the xdg-shell protocol specification the (x, y) coordinates
passed when creating a popup surface is relative to top left corner of
the parent surface, but prior to this patch, if the parent surface
was an xdg_surface, we'd position it relative to top left corner of the
window geometry of that xdg_surface.

https://bugzilla.gnome.org/show_bug.cgi?id=749717
2015-06-10 10:50:12 +08:00
Matthias Clasen ecebdfc58c GtkTextHandle: Improve handle positioning
When we are close the window edge, we need to shrink the 'invisible
border' around the handle to avoid mispositioning it. A fiddly
calculation, but it works.
2015-06-09 21:19:17 -04:00
Matthias Clasen df5a2e7152 GtkTextHandle: drop non-implemented functions 2015-06-09 19:07:34 -04:00
Matthias Clasen 0b3835a93f GtkTextHandle: position handles properly
Move the handles so that the asymmetric assets align with the
start/end of the selection.
2015-06-09 17:06:27 -04:00
Matthias Clasen fe219a25b7 widget-factory: Improve touch selection example
Make the check buttons not take focus on click, so the popover
stays open.
2015-06-09 15:50:50 -04:00
Matthias Clasen 70f1e2306d entry: Make touch selection work with mouse
The buttons on the popover where stealing the focus from the text
view on click, causing the popover to be dismissed before the action
was taken. Fix this by making the buttons not take focus on click.
2015-06-09 15:50:30 -04:00
Matthias Clasen 8ad0ef27a1 text view: Make touch selection work with mouse
The buttons on the popover where stealing the focus from the text
view on click, causing the popover to be dismissed before the action
was taken. Fix this by making the buttons not take focus on click.
2015-06-09 15:49:10 -04:00
Jakub Steiner ac798dc307 adwaita: style tweaks to touch selections
- use dark theme assets for the checkboxes and radios
- darken the popover for legibility (white bg/black text is
  really the most problematic background to have).

unfortunatley in terms of SCSS structure this is further digging us into the
hole of specificity. It would be much nicer to set the .osd class on the popover
and have everything just work. I'm sure we'll end up using OSD styled popovers
outside the touch context.

https://bugzilla.gnome.org/show_bug.cgi?id=750396
2015-06-09 15:36:25 -04:00
Jordi Mas 41453ffed1 Update Catalan translation 2015-06-09 08:07:05 +02:00
Matthias Clasen ca077a085c entry: Avoid criticals
After the recent changes, we could end up calling
gtk_entry_update_handles in cases where the text_handle
has not be created (e.g. when dragging text from an entry).
Avoid that.
2015-06-08 19:04:06 -04:00
Benjamin Otte 1cc8de2412 widget: Clarify docs on gtk_widget_set_double_buffered()
Also make them more scary so people really really don't use it as a
random knob when trying to make things go fast.

//bugzilla.gnome.org/show_bug.cgi?id=750505
2015-06-08 20:29:24 +02:00
Rui Matos ef93257db7 main: Push the current event on the stack before we start needing it
The changes in commit 13e22e2030 made
_gtk_window_check_handle_wm_event() indirectly depend on
gtk_get_current_event_time() which relies on the current event being
available on the current_events stack.

Since the current event is only pushed on the stack afterwards we get
an invalid timestamp which breaks ewmh window moving.

This fixes the issue by pushing the current event before we start
relying on it being there in gtk_main_do_event() and, as a byproduct,
also fixes a potential memory leak when we have a rewritten event and
return early due to _gtk_window_check_handle_wm_event() being TRUE.

https://bugzilla.gnome.org/show_bug.cgi?id=750384
2015-06-08 14:23:19 +02:00
Matthias Clasen 3c1a2c8d24 entry: Always clear handles for mouse interaction
There were some cases where we left a handle visible
during mouse interaction, which is a little weird.
2015-06-08 06:56:12 -04:00
Matthias Clasen d055f8e64c entry: Move touch selection a little further away
Otherwise, it looks cramped, and we end up under the finger.
2015-06-08 06:56:12 -04:00
Matthias Clasen 3e386e0abb entry: Hide popover when touching elsewhere
Otherwise, the popover becomes 'sticky' and hard-to-dismiss.
2015-06-08 06:56:12 -04:00
Matthias Clasen bd65c14813 entry: Use the drag-started signal
Use the drag-started signal to differentiate between drags that
move a handle and taps on a handle. Show the touch selection popup
for the latter, but not the former.
2015-06-08 06:56:12 -04:00
Matthias Clasen 79b09cccce entry: Make handles come back reliably
We were setting the text handle mode to NONE too aggressively.
2015-06-08 06:56:12 -04:00
Matthias Clasen a219e6b4cd entry: Never show handles and popover at the same time
Hide the handles when the popover appears, and brind them back
when it disappears. This will need revisiting if we start using
the popover for mouse interaction as well, where we may not
want handles to show up.
2015-06-08 06:56:12 -04:00
Matthias Clasen 1bd10f2a7b entry: Shorten touch selection timeout
We don't want the popup to appear spontaneously, so eventually
the timeout may go away altogether. For now, shorten it to 50ms,
to avoid rewriting all the places where the timeout is set or
unset.
2015-06-08 06:56:12 -04:00
Matthias Clasen 0a2b1b68fa text view: Always clear handles for mouse interaction
There were some cases where we left a handle visible
during mouse interaction, which is a little weird.
2015-06-08 06:56:12 -04:00
Matthias Clasen 76836dcd81 text view: Move touch selection a little further away
Otherwise, it looks cramped, and we end up under the finger.
2015-06-08 06:55:21 -04:00
Matthias Clasen 4511ff76fa text view: Use the drag-started signal
Use the drag-started signal to differentiate between drags that
move a handle and taps on a handle. Show the touch selection popup
for the latter, but not the former.
2015-06-08 06:55:21 -04:00
Matthias Clasen 805fa78221 GtkTextHandle: add a drag-started signal
This will be used to discriminate drags from taps.
2015-06-08 06:55:21 -04:00
Matthias Clasen 32be35010f text view: Don't popup after drag selection
Don't show the touch selection popover after a selection drag
ends. Instead, the popover will be triggered by an explicit
touch on the selection.
2015-06-08 06:55:21 -04:00
Matthias Clasen aff47da950 text view: Never show handles and popover at the same time
Hide the handles when the popover appears, and brind them back
when it disappears. This will need revisiting if we start using
the popover for mouse interaction as well, where we may not
want handles to show up.
2015-06-08 06:55:21 -04:00
Matthias Clasen 0c6205d538 text view: Shorten touch selection timeout
We don't want the popover to appear spontaneously, so eventually
the timeout may go away altogether. For now, shorten it to 50ms,
to avoid rewriting all the places where the timeout is set or
unset.
2015-06-08 06:51:08 -04:00
Daniel Mustieles a82a686149 Updated Spanish translation 2015-06-08 07:56:59 +00:00
Daniel Mustieles 0dbac86407 Updated Spanish translation 2015-06-08 07:56:26 +00:00
Matthias Clasen 359d1951bc widget-factory: Improve context menu example
Show the text formatting in the menu / popover.
2015-06-07 01:24:13 -04:00
Matthias Clasen e1942a8bb9 widget-factory: Demonstrate custom context menu items
Add bold/italics/underline styling to the context menu of
the 'Lorem ipsum...' text view in page 1. The point is not
to show good UI for this kind of styling, but to demonstrate
custom actions in the context menu / touch selection.
2015-06-07 01:12:18 -04:00
Matthias Clasen 1ff1040c20 Adwaita: Some touch selection updates
Make touch selection popovers use osd style.
2015-06-07 01:11:32 -04:00
Matthias Clasen 6bbaa70c4c Update touch selection style
Update style for touch selection in GtkEntry and GtkTextView
according to https://wiki.gnome.org/Design/OS/Selections

Add 'Select All' to the default actions, change actions
to use icons and move the popover to the bottom. If there is
no selection, just offer to paste.
2015-06-07 01:08:33 -04:00
Timm Bäder 6bbe48ad3d gtkfilechooserbutton: Align the label to the left
Using GtkLabel's xalign property so the label doesn't jump around when
the button gets resized.

https://bugzilla.gnome.org/show_bug.cgi?id=750477
2015-06-06 22:32:07 -04:00
Matthias Clasen a8191e7113 places sidebar: Make 'recent' work on other platforms
Since nautilus merge, we were not showing 'Recent' in the sidebar
if GIO did not support the recent: scheme. But the file chooser
can show recent files independent of gvfs - it loads the recent
files manually. This is relevant on Windows and OS X, where gvfs
is typically not used.

This commit adds a show-recent property which can be used to override
the recent: scheme check. We use it in the file chooser.

https://bugzilla.gnome.org/show_bug.cgi?id=750068
2015-06-06 17:13:22 -04:00
Carlos Garnacho 1e8be1c446 texthandle: Set prelight state on the pointer-interacted handle
This will be useful with the theming changes to come.

https://bugzilla.gnome.org/show_bug.cgi?id=750396
2015-06-05 08:57:43 -04:00
Carlos Garnacho 88d88591d2 texthandle: Allow setting individual states, and separately to handles
Now each handle gets its individual current state, and we can accumulate
more than one state on these.

https://bugzilla.gnome.org/show_bug.cgi?id=750396
2015-06-05 08:57:43 -04:00
Jakub Steiner 9c53f76cbd Adwaita: updates style for text selection
- use consistent widget style. unfortunately using assets
- light/dark variant
- new assets for text selestions, using existing slider asset for
  insertion point

https://bugzilla.gnome.org/show_bug.cgi?id=750396
2015-06-05 08:57:43 -04:00
Matthias Clasen dee0da30b6 Add a tree dnd testcase
This shows a minimal setup for enabling non-row DND from a treeview.
2015-06-05 08:33:59 -04:00
Alberts Muktupāvels 245daa415e gtkplug: set decorated to FALSE by default
The change in c5e5ee6749 introduced
a regression - all GtkPlug windows has unexpected extra space. Fix
this by setting decorated to FALSE for GtkPlug window.

https://bugzilla.gnome.org/show_bug.cgi?id=750424
2015-06-04 23:41:19 -04:00
Carlos Soriano c37f569ae8 gtkrevealer: add css padding support
Add css padding support to GtkRevealer.

As a future work, GtkRevealer still needs to support the border
property.

https://bugzilla.gnome.org/show_bug.cgi?id=750338
2015-06-04 23:18:17 -04:00
Matthias Clasen 3d82fc6d7e GtkScale: Move marks inward
We don't want scale marks to affect scale sizing and positioning,
so draw them inside the range recangle. This avoids size changes
for marks that don't have labels, at least.

https://bugzilla.gnome.org/show_bug.cgi?id=749650
2015-06-04 19:58:40 -04:00
Balázs Úr 99e6796dd3 Updated Hungarian translation 2015-06-04 20:54:38 +00:00
Matthias Clasen 557f96c0fe Trivial: remove outdated comment 2015-06-04 15:14:43 -04:00
Lapo Calamandrei 6d4d2766e0 Adwaita: entry linking logic change.
Use the same linking logic of buttons for entries, this avoids
specialcasing rtl.
2015-06-04 16:19:05 +02:00
Victor Ibragimov a32a1fa9e4 Updated Tajik translation 2015-06-04 05:43:19 +00:00
Emmanuele Bassi c5e5ee6749 window: Check if we can use CSD before enabling them
The change in 03213b9509 changed the rules
as to when CSD can be enabled, but it also unconditionally enables CSD
with the implicit assumption that client-side shadows were the real
issue, and that we could work around that by drawing our own borders.
This also means that setting a titlebar for a GtkWindow will enable CSD
unconditionally.

In reality, some window managers (like Matchbox) *only* support
server-side decorations, and will ignore all hints to the contrary, to
the point of drawing decorations at random locations on top of the
window.

Since CSD are enabled unconditionally, the GTK_CSD environment variable
is also not a suitable escape hatch.

In the grand tradition of asking ourselves if we should do something
just because we can, we should split the environment checks from the
checks on what the user requested; by doing that, we can also check
when enabling client-side decorations, and ideally bail out if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=750343
2015-06-03 16:06:10 +01:00
William Hua d37f94a524 mir: keep reference on queued events 2015-06-02 15:14:27 -04:00
William Hua f1c11740c1 mir: gdk_mir_window_impl_set_surface_type 2015-06-02 15:14:27 -04:00
William Hua e1c958e70d mir: Create the correct surface 2015-06-02 15:14:27 -04:00
William Hua a57636f057 mir: Remove redundant calls 2015-06-02 15:14:27 -04:00
William Hua aebac40d38 mir: log input events properly 2015-06-02 15:14:27 -04:00
William Hua e6b3bae787 mir: Resolve warnings 2015-06-02 15:14:27 -04:00
William Hua a43efc6655 mir: Update cursor position 2015-06-02 15:14:26 -04:00
William Hua d43f5258ff mir: Remove child window rendering hack 2015-06-02 15:14:26 -04:00
Carlos Garnacho b84d9ea7ff wayland: Move DnD grab breaking function into gdkdevice-wayland.c
This has little to do with GdkDragContext, and a lot to do with
the GdkDevice that triggered it, seems to make more sense in
gdkdevice-wayland.c.
2015-06-02 18:09:49 +02:00
Carlos Garnacho d34b1225eb wayland: Split keyboard/button modifiers internally
On wl_keyboard.key/modifiers, we're just forgetting about currently
pressed mouse buttons. Fix this by storing button and key modifiers
separately, and put these together when creating the GdkEvents.
2015-06-02 17:31:38 +02:00
Carlos Garnacho 243cfd21a2 textview: Update handles after flushing scroll changes
Text insertion/pasting might trigger scroll, so we'd have to wait
until the text was revalidated and the scrolling truly happened
before we can check the new handle(s) position.
2015-06-02 17:30:09 +02:00
Carlos Garnacho a0e8056848 dnd: Remove emission of fake button release event
Nowadays (and for quite some years now) we rely on GdkEventGrabBroken
events to be received. This fake button event seems a remnant of
the early Gtk 2.x days, and is currently even inconsistent with our
event delivery model, so just remove it.

https://bugzilla.gnome.org/show_bug.cgi?id=749737
2015-06-02 17:27:05 +02:00
Rico Tzschichholz ab72da0c41 build: Fix make dist
Revert 2 hunks introduced by 36c65c1aca
2015-06-02 17:12:18 +02:00
Rico Tzschichholz 291af4e359 configure: Require pango >= 1.37.0
Needed since 049cbc8b74
2015-06-02 17:11:08 +02:00
Matthias Clasen cb6615b557 updateiconcache: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen e96d258495 queryimmodules: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen cd8a50ef11 xembed: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen b9919153b2 widget path: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen 165861323a widget: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen 121c195521 tree view: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen 3dd7f12f78 tree model sort: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen bed26edfd1 tree model filter: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen 555663c686 tool palette: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Matthias Clasen 5dc440295e text buffer: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen a111f6ee23 print operation: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 9bb121c55d paned: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen a0dddbbafa menu: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 9545c01764 kinetic scrolling: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 6ee9281a24 im context: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 138e958614 icon view: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 85b4eef004 icon theme: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 359d3669ff file chooser: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen d71c5bf983 entry: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 2a0d5c39d9 dnd: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 29ab70b801 css: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen f16fc99391 combo box: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 1f525e263e builder: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 75f0146c69 application: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 7c03f62206 accel map: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:15 -04:00
Matthias Clasen 94825c1777 about dialog: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Matthias Clasen 00236c0d21 Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Matthias Clasen 23032587db printing: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Matthias Clasen fdb9a8e142 x11: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Matthias Clasen 393df9f7e1 wayland: Avoid compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:14 -04:00
Victor Ibragimov 73693381b2 Updated Tajik translation 2015-06-02 05:20:50 +00:00
John Ralls 13c303fec5 Bug 745957 - GTK+/Quartz >= 3.14.8: Symbol not found: _gtk_drag_cancel
Implement gtk_drag_cancel, made public in c160ba069 and 62616a71, in
gtkdnd-quartz.c.
2015-05-31 11:59:34 -07:00
Matthias Clasen f5b245ff04 GtkStack: Don't mix code and declarations 2015-05-30 09:43:56 -04:00
Matthias Clasen 833dbd65cd Trivial: Use a convenience macro
g_strstrip is less obscure than the two individual functions,
so lets use it here.
2015-05-30 09:36:51 -04:00
Matthias Clasen 4c971c6f5e file chooser: Respect recent settings
When recent files are not supported in gvfs, or turned off by
settings, we should not try to load them even if the startup
mode says so. This prevents inconsistency with the places
sidebar where 'Recent' will not appear in this case.
2015-05-30 09:21:16 -04:00
Matthias Clasen 4de444ca61 placessidebar: Simplify some code
Use existing functions, instead of open-coding manipulation
of string arrays.
2015-05-30 09:20:27 -04:00
Benjamin Otte 5984bc78ee flowbox: Fix compiler warnings
Introduced in e59e38b581
2015-05-30 06:00:14 +02:00
Benjamin Otte 91fac8b5aa cssnode: Fix position invalidation
The previous code was overly complicated and wrong.
2015-05-30 05:50:31 +02:00
Matthias Clasen e59e38b581 GtkFlowBox: support positional css selectors
As in the previous commit for GtkListBox, support :first-child,
:last-child, :nth-child() and :last-nth-child() selectors here.
2015-05-29 23:37:42 -04:00
Christian Hergert aa07c40748 listbox: add support for :first-child, :last-child and others
This applies the proper CSS child ordering semantics using GtkCssNode to
GtkListBox. You can now use :first-child, :last-child, :nth-child(), and
:last-nth-child() selectors.

For example, this allows styling row separators using CSS while ignoring
the separator on the last row.

 GtkListBoxRow {
   border-bottom: 1px solid @borders;
 }
 GtkListBoxRow:last-child {
   border-bottom: none;
 }

When the sort ordering of the listbox changes, we also update the CSS
node ordering.
2015-05-29 20:03:11 -07:00
Cédric Valmary bb93c1cecd Updated Occitan translation 2015-05-29 21:50:59 +00:00
John Ralls 205db2013c Fix DnD Introspection on Quartz Backend.
Don't exclude the -quartz.c files from introspection_files.
2015-05-29 13:27:39 -07:00
Timm Bäder 4d75d62033 GtkStack: Interpolate between size changes 2015-05-29 17:37:04 +02:00
Timm Bäder 0eddfcedb9 GtkStack: Remove some useless function calls
We will call gtk_widget_queue_resize anyway later when finishing the
(maybe non-running) transition, which will also cause the stack to be
repainted.
2015-05-29 17:37:04 +02:00
Timm Bäder 24193a38f0 GtkStack: Keep the last_visible_child around during transitions
We need it later.
2015-05-29 17:37:04 +02:00
Timm Bäder dc55a895ed GtkStack: Misc indentation fixes 2015-05-29 17:37:04 +02:00
Timm Bäder 6d25e52a4d GtkStack: Remove useless cast 2015-05-29 17:37:04 +02:00
Timm Bäder c0d535a718 GtkStack: Remove useless function calls
These both just use the default values anyway.
2015-05-29 17:37:04 +02:00
Timm Bäder bdabea3ae3 GtkStack: Save last visible widget size
When interpolating the stack size, we compute the current size by using
the prefered/minimum current size and the last size. We can't use the
last_visible_surface_allocation because that is not available until the
first _draw call and it doesn't include the child's margins.
2015-05-29 17:37:04 +02:00
Timm Bäder b3bbe99001 GtkStack: Remove gtk_widget_set_opacity call
The corresponding call with 0.999 opacity is gone, so we don't need to
reset the opacity anymore.
2015-05-29 17:37:04 +02:00
Timm Bäder d3a18de97e gtkpopover: Update the menu's alignment
... when the popover position changes.
2015-05-29 17:37:04 +02:00
Chun-wei Fan 36c65c1aca Fix GDK MSVC Projects
We need to link to dwmapi.lib for all configs, not just the Broadway
ones, so fix the build.
2015-05-29 18:10:59 +08:00
Matthias Clasen 02e2f7dc56 Fix a cornercase crash
If gtk_text_layout_move_cursor_visually is called with a
count of 0, we were passing NULL to a free function that
can't handle it. Don't do that.

https://bugzilla.gnome.org/show_bug.cgi?id=750058
2015-05-28 23:42:14 -04:00
Benjamin Otte 03312371da cssmatcher: Speed up common matching
first-child and last-child are the most common usages of the nth-child
machinery, so special-casing them makes sense.
2015-05-28 17:41:47 +02:00
Benjamin Otte 59a7739fce cssmatcher: Rewrite nth-child matcher
Instead of trying to be smart, be stupid but correct.

Fixes nth-child reftest.
2015-05-28 17:12:57 +02:00
Benjamin Otte 4847eff6c4 cssmatcher: Simplify code
Instead of copy/paste, pass the only difference as an argument

The code still doesn't work right, but at least it's easier to fix now.
2015-05-28 17:07:25 +02:00
Benjamin Otte 9df707da22 gtk: Add deprecation guards for newest pango deprecations 2015-05-28 16:54:03 +02:00
Benjamin Otte d921a4fe84 testsuite: Add deprecation guards 2015-05-28 16:53:53 +02:00
Daniel Mustieles d8885777a1 Updated Spanish translation 2015-05-28 06:42:39 +00:00
290 changed files with 38896 additions and 30638 deletions
+66
View File
@@ -1,3 +1,69 @@
Overview of Changes in GTK+ 3.17.4
==================================
* GtkStack animates size changes
* GtkListBox and GtkFlowBox support positional css selectors
like :first-child, :last-child and :nth-child
* GtkPlacesSidebar has been rewritten to use GtkListBox
* Touch selection in GtkTextView and GtkEntry has been greatly
improved
* There's now a way to have output-only windows, and this is
used by GtkOverlay for pass-through overlays
* Bug fixes:
724506 Do not animate and notify during destroy
725441 Print Dialog: Add support for PPD-less printing on IPP printers...
745957 GTK+/Quartz >= 3.14.8: Symbol not found: _gtk_drag_cancel (MyPa...
747793 Implement part of bookmarks mockups
748951 popup menus are being displayed at wrong position
749650 Slider tick marks affect vertical positioning
749717 wayland: Position popups relative to the parent surface
749737 DnD breaks button-released events. (Setting a widget as DnD sou...
750058 bad options for the keybindings in css instructions generate a ...
750068 "Recent" shortcut is missing from the left pane in the file cho...
750338 gtkrevealer: add css padding support
750343 CSD enabled unconditionally for windows with titlebar
750384 GtkDialog can not be moved when gtk_dialog_run from GtkListBox ...
750396 make text selection widgets feel more interactive
750424 GtkPlug has extra space around window
750477 GtkFileChooserButton's label isn't xalign=0'ed
750489 gtk settings c910 warning unexpected annotation element type co...
750505 Main grid overlaps GtkPopover
750568 Add support for windows that are transparent wrt input
750605 icontheme: don't modify symbolic SVG dimensions when recoloring
750631 GtkAssistant: Allow to set a page with no padding
750690 Recent Chooser Widget doesn't expand
750692 Touch text selection: magnifier can't be seen, obscures drag ha...
750718 Improve documentation for deprecated properties
750741 Popover spawned from within another popover gets stacked behind...
750883 HighContrast: add suitable touch selection handle assets
750888 Fix return value error in _gtk_text_handle_set_direction
750892 testfontchooserdialog.c requires pangoft2
750993 non-modal popovers within modal popovers are non interactive
751018 Widget: GtkMenuButton+GtkPopover gtk_toggle_button_set_active()...
751050 Moving the mouse while a stepper is activated causes the scroll...
751082 GtkTreeView draw performance is bad when contents are not large...
751084 Wrong padding/spacing in the new bookmark sidebar in RTL
751098 wayland: Always request transient commit when mapping subsurface
751099 Fix return value error in gdk_window_set_pass_through
751169 Improve search performance
751341 GtkWindow: fix default empty window size with CSD
* Translation updates:
Catalan
German
Greek
Hebrew
Hungarian
Occitan
Spanish
Tajik
Overview of Changes in GTK+ 3.17.3
==================================
+4 -4
View File
@@ -144,7 +144,7 @@
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
@@ -187,7 +187,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
@@ -234,7 +234,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
@@ -277,7 +277,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalDependencies>imm32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>imm32.lib;winmm.lib;dwmapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>$(OutDir)$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).pdb</ProgramDatabaseFile>
+4
View File
@@ -65,6 +65,7 @@ $(PythonPath)\python $(GlibEtcInstallRoot)\bin\gdbus-codegen --interface-prefix
cd $(SolutionDir)
</GenerateGtkDbusBuiltSources>
<GenerateGtkWin32RC>$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest</GenerateGtkWin32RC>
<CopyDemosH>copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h</CopyDemosH>
</PropertyGroup>
<PropertyGroup>
<_PropertySheetDisplayName>gtkgensrcsprops</_PropertySheetDisplayName>
@@ -85,5 +86,8 @@ cd $(SolutionDir)
<BuildMacro Include="GenerateGtkWin32RC">
<Value>$(GenerateGtkWin32RC)</Value>
</BuildMacro>
<BuildMacro Include="CopyDemosH">
<Value>$(CopyDemosH)</Value>
</BuildMacro>
</ItemGroup>
</Project>
+26
View File
@@ -209,6 +209,32 @@
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(GenGdkConfigHBroadway)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">..\..\..\gdk\gdkconfig.h;..\..\..\GDK_BROADWAY_BUILD;..\..\..\MSVC_$(Configuration)_Broadway;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\..\..\demos\gtk-demo\demos.h.win32">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug_Broadway|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|Win32'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
<Message Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">Copying demos.h from demos.h.win32...</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">$(CopyDemosH)</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release_Broadway|x64'">..\..\..\demos\gtk-demo\demos.h;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
</ItemGroup>
+4 -4
View File
@@ -42,7 +42,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="imm32.lib winmm.lib"
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
@@ -104,7 +104,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="imm32.lib winmm.lib"
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
@@ -170,7 +170,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="imm32.lib winmm.lib"
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
@@ -232,7 +232,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="imm32.lib winmm.lib"
AdditionalDependencies="imm32.lib winmm.lib dwmapi.lib"
OutputFile="$(OutDir)\$(GtkDllPrefix)$(ProjectName)$(GtkDllSuffix).dll"
LinkIncremental="1"
GenerateDebugInformation="true"
+4
View File
@@ -66,4 +66,8 @@ cd $(SolutionDir)&#x0D;&#x0A;
Name="GenerateGtkWin32RC"
Value="$(PythonPath)\python ..\process-in-win32.py --gtkwin32rc --gtk3manifest"
/>
<UserMacro
Name="CopyDemosH"
Value="copy ..\..\..\demos\gtk-demo\demos.h.win32 ..\..\..\demos\gtk-demo\demos.h"
/>
</VisualStudioPropertySheet>
+58
View File
@@ -217,6 +217,64 @@
/>
</FileConfiguration>
</File>
<File RelativePath="..\..\..\demos\gtk-demo\demos.h.win32">
<FileConfiguration Name="Debug|Win32">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Debug_Broadway|Win32">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Release|Win32">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Release_Broadway|Win32">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Debug|x64">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Debug_Broadway|x64">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Release|x64">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
<FileConfiguration Name="Release_Broadway|x64">
<Tool Name="VCCustomBuildTool"
Description="Copying demos.h from demos.h.win32..."
CommandLine="$(CopyDemosH)"
Outputs="..\..\..\demos\gtk-demo\demos.h"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
+3 -3
View File
@@ -10,7 +10,7 @@
m4_define([gtk_major_version], [3])
m4_define([gtk_minor_version], [17])
m4_define([gtk_micro_version], [3])
m4_define([gtk_micro_version], [4])
m4_define([gtk_interface_age], [0])
m4_define([gtk_binary_age],
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
@@ -42,7 +42,7 @@ m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.43.4])
m4_define([pango_required_version], [1.36.7])
m4_define([pango_required_version], [1.37.1])
m4_define([atk_required_version], [2.15.1])
m4_define([cairo_required_version], [1.14.0])
m4_define([gdk_pixbuf_required_version], [2.30.0])
@@ -1738,7 +1738,7 @@ if test "$enable_man" != no; then
dnl check for DocBook XSL stylesheets in the local catalog
JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
[DocBook XSL Stylesheets], [have_docbook_style=yes],[have_docbook_style=no])
if test "$have_docbook_dtd" != yes; then
if test "$have_docbook_style" != yes; then
if test "$enable_man" = yes ; then
AC_MSG_ERROR([DocBook XSL Stylesheets are required for --enable-man])
fi
+14 -6
View File
@@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.decl
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos = \
demos_base = \
application.c \
assistant.c \
builder.c \
@@ -25,6 +25,7 @@ demos = \
entry_completion.c \
event_axes.c \
expander.c \
font_features.c \
gestures.c \
glarea.c \
headerbar.c \
@@ -62,7 +63,9 @@ demos = \
tree_store.c
if OS_UNIX
demos += pagesetup.c
demos = $(demos_base) pagesetup.c
else
demos = $(demos_base)
endif
AM_CPPFLAGS = \
@@ -95,7 +98,8 @@ EXTRA_DIST += \
data/symbolic-source.svg \
demo.gresource.xml \
$(RESOURCES) \
org.gtk.Demo.gschema.xml
org.gtk.Demo.gschema.xml \
demos.h.win32
gsettings_SCHEMAS = \
org.gtk.Demo.gschema.xml
@@ -105,11 +109,15 @@ gsettings_SCHEMAS = \
demos.h: $(demos) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
demos.h.win32: $(demos_base) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos_base)) > demos.h.win32
nodist_gtk3_demo_SOURCES = demos.h
gtk3_demo_SOURCES = \
$(demos) \
demo_resources.c \
main.c \
demos.h
main.c
gtk3_demo_DEPENDENCIES = $(DEPS)
gtk3_demo_LDADD = $(LDADDS)
@@ -227,6 +235,6 @@ uninstall-update-icon-cache:
$(AM_V_at)$(POST_UNINSTALL)
test -n "$(DESTDIR)" || $(update_icon_cache) "$(iconthemedir)"
DISTCLEANFILES = demos.h
DISTCLEANFILES = demos.h demos.h.win32
-include $(top_srcdir)/git.mk
+2 -8
View File
@@ -48,7 +48,6 @@ GtkWidget *
do_builder (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GError *err = NULL;
GtkWidget *toolbar;
GActionGroup *actions;
GtkAccelGroup *accel_group;
@@ -56,13 +55,8 @@ do_builder (GtkWidget *do_widget)
if (!window)
{
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/builder/demo.ui", &err);
if (err)
{
g_error ("ERROR: %s\n", err->message);
return NULL;
}
builder = gtk_builder_new_from_resource ("/builder/demo.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_screen (GTK_WINDOW (window),
+1 -1
View File
@@ -56,7 +56,7 @@ do_button_box (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes");
gtk_window_set_title (GTK_WINDOW (window), "Button Boxes demo");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
+7 -7
View File
@@ -242,7 +242,7 @@ open_display_cb (GtkWidget *button,
if (!result)
{
gchar *error_msg =
g_strdup_printf ("Can't open display :\n\t%s\nplease try another one\n",
g_strdup_printf ("Can't open display:\n\t%s\nplease try another one\n",
new_screen_name);
gtk_label_set_text (GTK_LABEL (dialog_label), error_msg);
g_free (error_msg);
@@ -523,12 +523,12 @@ do_changedisplay (GtkWidget *do_widget)
info = g_new0 (ChangeDisplayInfo, 1);
info->window = gtk_dialog_new_with_buttons ("Change Screen or display",
GTK_WINDOW (do_widget),
0,
_("_Close"), GTK_RESPONSE_CLOSE,
"Change", GTK_RESPONSE_OK,
NULL);
info->window = gtk_dialog_new_with_buttons ("Change Display",
GTK_WINDOW (do_widget),
0,
"Close", GTK_RESPONSE_CLOSE,
"Change", GTK_RESPONSE_OK,
NULL);
gtk_window_set_default_size (GTK_WINDOW (info->window), 300, 400);
+1 -1
View File
@@ -213,7 +213,7 @@ do_clipboard (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Clipboard demo");
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+1 -1
View File
@@ -318,7 +318,7 @@ do_combobox (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Combo boxes");
gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed),
+3 -9
View File
@@ -23,16 +23,14 @@ do_css_accordion (GtkWidget *do_widget)
{
GtkWidget *container, *child;
GtkStyleProvider *provider;
GBytes *bytes;
gsize data_size;
const guint8 *data;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
@@ -57,11 +55,7 @@ do_css_accordion (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (container), child);
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
bytes = g_resources_lookup_data ("/css_accordion/css_accordion.css", 0, NULL);
data = g_bytes_get_data (bytes, &data_size);
gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider), (gchar *)data, data_size, NULL);
g_bytes_unref (bytes);
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
apply_css (window, provider);
}
+6 -7
View File
@@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider,
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
}
static void
css_text_changed (GtkTextBuffer *buffer,
GtkCssProvider *provider)
@@ -70,8 +70,9 @@ do_css_basics (GtkWidget *do_widget)
GtkStyleProvider *provider;
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "CSS Basics");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
@@ -88,15 +89,13 @@ do_css_basics (GtkWidget *do_widget)
NULL);
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
container = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), container);
child = gtk_text_view_new_with_buffer (text);
gtk_container_add (GTK_CONTAINER (container), child);
g_signal_connect (text,
"changed",
G_CALLBACK (css_text_changed),
provider);
g_signal_connect (text, "changed",
G_CALLBACK (css_text_changed), provider);
bytes = g_resources_lookup_data ("/css_basics/css_basics.css", 0, NULL);
gtk_text_buffer_set_text (text, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
+2 -1
View File
@@ -34,7 +34,7 @@ show_parsing_error (GtkCssProvider *provider,
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
}
static void
css_text_changed (GtkTextBuffer *buffer,
GtkCssProvider *provider)
@@ -90,6 +90,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
+3 -2
View File
@@ -33,7 +33,7 @@ show_parsing_error (GtkCssProvider *provider,
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
}
static void
css_text_changed (GtkTextBuffer *buffer,
GtkCssProvider *provider)
@@ -69,8 +69,9 @@ do_css_pixbufs (GtkWidget *do_widget)
GtkStyleProvider *provider;
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
+3 -2
View File
@@ -32,7 +32,7 @@ show_parsing_error (GtkCssProvider *provider,
gtk_text_buffer_apply_tag_by_name (buffer, tag_name, &start, &end);
}
static void
css_text_changed (GtkTextBuffer *buffer,
GtkCssProvider *provider)
@@ -92,8 +92,9 @@ do_css_shadows (GtkWidget *do_widget)
GtkStyleProvider *provider;
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Shadows");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
g_signal_connect (window, "destroy",
+4
View File
@@ -132,6 +132,7 @@
<file>event_axes.c</file>
<file>expander.c</file>
<file>flowbox.c</file>
<file>font_features.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
<file>headerbar.c</file>
@@ -183,4 +184,7 @@
<file>glarea-fragment.glsl</file>
<file>glarea-vertex.glsl</file>
</gresource>
<gresource prefix="/font-features">
<file>font-features.ui</file>
</gresource>
</gresources>
+2 -2
View File
@@ -24,7 +24,7 @@
</data>
</object>
<object class="GtkAboutDialog" id="aboutdialog1">
<property name="program-name" translatable="yes">GtkBuilder demo</property>
<property name="program-name" translatable="yes">Builder demo</property>
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
<accessibility>
<relation target="window1" type="subwindow-of"/>
@@ -33,7 +33,7 @@
<object class="GtkWindow" id="window1">
<property name="default_height">250</property>
<property name="default_width">440</property>
<property name="title">GtkBuilder demo</property>
<property name="title" translatable="yes">Builder</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
+2 -2
View File
@@ -1,4 +1,4 @@
/* Dialog and Message Boxes
/* Dialogs and Message Boxes
*
* Dialog widgets are used to pop up a transient window for user feedback.
*/
@@ -109,7 +109,7 @@ do_dialog (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Dialogs");
gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
+1 -1
View File
@@ -349,7 +349,7 @@ do_editable_cells (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Shopping list");
gtk_window_set_title (GTK_WINDOW (window), "Editable Cells");
gtk_container_set_border_width (GTK_CONTAINER (window), 5);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+3 -2
View File
@@ -1,7 +1,8 @@
/* Entry/Entry Buffer
*
* GtkEntryBuffer provides the text content in a GtkEntry.
*
* Applications can provide their own buffer implementation,
* e.g. to provide secure handling for passwords in memory.
*/
#include <glib/gi18n.h>
@@ -20,7 +21,7 @@ do_entry_buffer (GtkWidget *do_widget)
if (!window)
{
window = gtk_dialog_new_with_buttons ("GtkEntryBuffer",
window = gtk_dialog_new_with_buttons ("Entry Buffer",
GTK_WINDOW (do_widget),
0,
_("_Close"),
+1 -1
View File
@@ -47,7 +47,7 @@ do_entry_completion (GtkWidget *do_widget)
if (!window)
{
window = gtk_dialog_new_with_buttons ("GtkEntryCompletion",
window = gtk_dialog_new_with_buttons ("Entry Completion",
GTK_WINDOW (do_widget),
0,
_("_Close"),
+1
View File
@@ -384,6 +384,7 @@ do_event_axes (GtkWidget *toplevel)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Event Axes");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
g_signal_connect (window, "destroy",
+68 -28
View File
@@ -10,45 +10,85 @@
static GtkWidget *window = NULL;
static void
response_cb (GtkDialog *dialog, gint response_id)
{
gtk_widget_destroy (window);
window = NULL;
}
static void
expander_cb (GtkExpander *expander, GParamSpec *pspec, GtkWindow *dialog)
{
gtk_window_set_resizable (dialog, gtk_expander_get_expanded (expander));
}
static void
do_not_expand (GtkWidget *child, gpointer data)
{
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (child)), child,
"expand", FALSE, "fill", FALSE, NULL);
}
GtkWidget *
do_expander (GtkWidget *do_widget)
{
GtkWidget *content_area;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *toplevel;
GtkWidget *area;
GtkWidget *box;
GtkWidget *expander;
GtkWidget *sw;
GtkWidget *tv;
GtkTextBuffer *buffer;
if (!window)
{
window = gtk_dialog_new_with_buttons ("GtkExpander",
GTK_WINDOW (do_widget),
0,
_("_Close"),
GTK_RESPONSE_NONE,
NULL);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
{
toplevel = gtk_widget_get_toplevel (do_widget);
window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel),
0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"<big><b>%s</b></big>",
"Something went wrong");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (window),
"Here are some more details "
"but not the full story.");
g_signal_connect (window, "response",
G_CALLBACK (gtk_widget_destroy), NULL);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
box = gtk_widget_get_parent (area);
gtk_container_child_set (GTK_CONTAINER (gtk_widget_get_parent (box)), box,
"expand", TRUE, "fill", TRUE, NULL);
gtk_container_foreach (GTK_CONTAINER (area), do_not_expand, NULL);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
expander = gtk_expander_new ("Details:");
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
tv = gtk_text_view_new ();
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
gtk_text_view_set_editable (GTK_TEXT_VIEW (tv), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (tv), GTK_WRAP_WORD);
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (buffer),
"Finally, the full story with all details. "
"And all the inside information, including "
"error codes, etc etc. Pages of information, "
"you might have to scroll down to read it all, "
"or even resize the window - it works !\n"
"A second paragraph will contain even more "
"innuendo, just to make you scroll down or "
"resize the window. Do it already !", -1);
gtk_container_add (GTK_CONTAINER (sw), tv);
gtk_container_add (GTK_CONTAINER (expander), sw);
gtk_box_pack_end (GTK_BOX (area), expander, TRUE, TRUE, 0);
gtk_widget_show_all (expander);
g_signal_connect (expander, "notify::expanded",
G_CALLBACK (expander_cb), window);
label = gtk_label_new ("Expander demo. Click on the triangle for details.");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
/* Create the expander */
expander = gtk_expander_new ("Details");
gtk_box_pack_start (GTK_BOX (vbox), expander, FALSE, FALSE, 0);
label = gtk_label_new ("Details can be shown or hidden.");
gtk_container_add (GTK_CONTAINER (expander), label);
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
}
if (!gtk_widget_get_visible (window))
File diff suppressed because it is too large Load Diff
+205
View File
@@ -0,0 +1,205 @@
/* Font Features
*
* This demonstrates support for OpenType font features with
* Pango attributes. The attributes can be used manually or
* via Pango markup.
*/
#include <gtk/gtk.h>
static GtkWidget *label;
static GtkWidget *settings;
static GtkWidget *font;
static GtkWidget *resetbutton;
static GtkWidget *numcasedefault;
static GtkWidget *numspacedefault;
static GtkWidget *fractiondefault;
static GtkWidget *stack;
static GtkWidget *entry;
static GtkWidget *toggle[24];
static void
update (void)
{
GString *s;
char *font_desc;
char *font_settings;
const char *text;
gboolean has_feature;
int i;
text = gtk_entry_get_text (GTK_ENTRY (entry));
font_desc = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font));
s = g_string_new ("");
has_feature = FALSE;
for (i = 0; i < 24; i++)
{
if (!gtk_widget_is_sensitive (toggle[i]))
continue;
if (GTK_IS_RADIO_BUTTON (toggle[i]))
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
{
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
g_string_append (s, " 1");
has_feature = TRUE;
}
}
else
{
if (has_feature)
g_string_append (s, ", ");
g_string_append (s, gtk_buildable_get_name (GTK_BUILDABLE (toggle[i])));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle[i])))
g_string_append (s, " 1");
else
g_string_append (s, " 0");
has_feature = TRUE;
}
}
font_settings = g_string_free (s, FALSE);
gtk_label_set_text (GTK_LABEL (settings), font_settings);
s = g_string_new ("");
g_string_append_printf (s, "<span font_desc='%s' font_features='%s'>%s</span>", font_desc, font_settings, text);
gtk_label_set_markup (GTK_LABEL (label), s->str);
g_string_free (s, TRUE);
g_free (font_desc);
g_free (font_settings);
}
static void
reset (void)
{
int i;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numcasedefault), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (numspacedefault), TRUE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (fractiondefault), TRUE);
for (i = 0; i < 24; i++)
{
if (!GTK_IS_RADIO_BUTTON (toggle[i]))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle[i]), FALSE);
gtk_widget_set_sensitive (toggle[i], FALSE);
}
}
}
static char *text;
static void
switch_to_entry (void)
{
text = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
gtk_stack_set_visible_child_name (GTK_STACK (stack), "entry");
}
static void
switch_to_label (void)
{
g_free (text);
text = NULL;
gtk_stack_set_visible_child_name (GTK_STACK (stack), "label");
update ();
}
static gboolean
entry_key_press (GtkEntry *entry, GdkEventKey *event)
{
if (event->keyval == GDK_KEY_Escape)
{
gtk_entry_set_text (GTK_ENTRY (entry), text);
switch_to_label ();
return GDK_EVENT_STOP;
}
return GDK_EVENT_PROPAGATE;
}
GtkWidget *
do_font_features (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
int i;
builder = gtk_builder_new_from_resource ("/font-features/font-features.ui");
gtk_builder_add_callback_symbol (builder, "update", update);
gtk_builder_add_callback_symbol (builder, "reset", reset);
gtk_builder_add_callback_symbol (builder, "switch_to_entry", switch_to_entry);
gtk_builder_add_callback_symbol (builder, "switch_to_label", switch_to_label);
gtk_builder_add_callback_symbol (builder, "entry_key_press", G_CALLBACK (entry_key_press));
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
settings = GTK_WIDGET (gtk_builder_get_object (builder, "settings"));
resetbutton = GTK_WIDGET (gtk_builder_get_object (builder, "reset"));
font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
numcasedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numcasedefault"));
numspacedefault = GTK_WIDGET (gtk_builder_get_object (builder, "numspacedefault"));
fractiondefault = GTK_WIDGET (gtk_builder_get_object (builder, "fractiondefault"));
stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
i = 0;
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "kern"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "liga"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "dlig"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hlig"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "clig"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "smcp"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "c2sc"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "lnum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "onum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "pnum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "tnum"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "frac"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "afrc"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "zero"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "nalt"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "swsh"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "calt"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "hist"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "salt"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss01"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss02"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss03"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss04"));
toggle[i++] = GTK_WIDGET (gtk_builder_get_object (builder, "ss05"));
update ();
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
}
if (!gtk_widget_get_visible (window))
{
gtk_window_present (GTK_WINDOW (window));
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}
+1 -1
View File
@@ -139,7 +139,7 @@ do_gestures (GtkWidget *do_widget)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
gtk_window_set_title (GTK_WINDOW (window), "Gestures demo");
gtk_window_set_title (GTK_WINDOW (window), "Gestures");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+1 -1
View File
@@ -373,7 +373,7 @@ create_glarea_window (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "GtkGLArea - Golden Triangle");
gtk_window_set_title (GTK_WINDOW (window), "OpenGL Area");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);
gtk_container_set_border_width (GTK_CONTAINER (window), 12);
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
+23 -8
View File
@@ -128,7 +128,7 @@ key_press_event (GtkWidget *text_view,
return FALSE;
}
/* Links can also be activated by clicking.
/* Links can also be activated by clicking or tapping.
*/
static gboolean
event_after (GtkWidget *text_view,
@@ -136,15 +136,30 @@ event_after (GtkWidget *text_view,
{
GtkTextIter start, end, iter;
GtkTextBuffer *buffer;
GdkEventButton *event;
gdouble ex, ey;
gint x, y;
if (ev->type != GDK_BUTTON_RELEASE)
return FALSE;
if (ev->type == GDK_BUTTON_RELEASE)
{
GdkEventButton *event;
event = (GdkEventButton *)ev;
event = (GdkEventButton *)ev;
if (event->button != GDK_BUTTON_PRIMARY)
return FALSE;
if (event->button != GDK_BUTTON_PRIMARY)
ex = event->x;
ey = event->y;
}
else if (ev->type == GDK_TOUCH_END)
{
GdkEventTouch *event;
event = (GdkEventTouch *)ev;
ex = event->x;
ey = event->y;
}
else
return FALSE;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
@@ -156,13 +171,13 @@ event_after (GtkWidget *text_view,
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
GTK_TEXT_WINDOW_WIDGET,
event->x, event->y, &x, &y);
ex, ey, &x, &y);
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
follow_if_link (text_view, &iter);
return FALSE;
return TRUE;
}
static gboolean hovering_over_link = FALSE;
+1 -1
View File
@@ -255,7 +255,7 @@ do_iconview (GtkWidget *do_widget)
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "GtkIconView demo");
gtk_window_set_title (GTK_WINDOW (window), "Icon View Basics");
g_signal_connect (window, "destroy",
G_CALLBACK (close_window), NULL);
+1 -1
View File
@@ -1,4 +1,4 @@
/* Info bar
/* Info Bars
*
* Info bar widgets are used to report important messages to the user.
*/
+1 -1
View File
@@ -258,7 +258,7 @@ do_list_store (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "GtkListStore demo");
gtk_window_set_title (GTK_WINDOW (window), "List Store");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+2 -5
View File
@@ -18,10 +18,6 @@
* A GtkMenuItem can have a submenu, which is simply a GtkMenu to pop
* up when the menu item is selected. Typically, all menu items in a menu bar
* have submenus.
*
* GtkUIManager provides a higher-level interface for creating menu bars
* and menus; while you can construct menus manually, most people don't
* do that. There's a separate demo for GtkUIManager.
*/
#include <gtk/gtk.h>
@@ -30,7 +26,7 @@
#include <stdio.h>
static GtkWidget *
create_menu (gint depth)
create_menu (gint depth)
{
GtkWidget *menu;
GtkRadioMenuItem *last_item;
@@ -120,6 +116,7 @@ do_menus (GtkWidget *do_widget)
gtk_widget_show (box1);
menubar = gtk_menu_bar_new ();
gtk_widget_set_hexpand (menubar, TRUE);
gtk_box_pack_start (GTK_BOX (box1), menubar, FALSE, TRUE, 0);
gtk_widget_show (menubar);
+1 -1
View File
@@ -577,7 +577,7 @@ do_offscreen_window (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Rotated widget");
gtk_window_set_title (GTK_WINDOW (window), "Rotated Button");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+54 -145
View File
@@ -1,10 +1,20 @@
/* Overlay
*
* Stack widgets in static positions over a main widget
* Shows widgets in static positions over a main widget.
*
* The overlayed widgets can be interactive controls such
* as the entry in this example, or just decorative, like
* the big blue label.
*/
#include <gtk/gtk.h>
static void
do_number (GtkButton *button, GtkEntry *entry)
{
gtk_entry_set_text (entry, gtk_button_get_label (button));
}
GtkWidget *
do_overlay (GtkWidget *do_widget)
{
@@ -12,158 +22,57 @@ do_overlay (GtkWidget *do_widget)
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkWidget *overlay;
GtkWidget *entry;
GtkWidget *grid;
GtkWidget *button;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *entry;
int i, j;
char *text;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
gtk_window_set_default_size (GTK_WINDOW (window), 500, 510);
gtk_window_set_title (GTK_WINDOW (window), "Overlay");
overlay = gtk_overlay_new ();
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (overlay), grid);
entry = gtk_entry_new ();
for (j = 0; j < 5; j++)
{
for (i = 0; i < 5; i++)
{
text = g_strdup_printf ("%d", 5*j + i);
button = gtk_button_new_with_label (text);
g_free (text);
gtk_widget_set_hexpand (button, TRUE);
gtk_widget_set_vexpand (button, TRUE);
g_signal_connect (button, "clicked", G_CALLBACK (do_number), entry);
gtk_grid_attach (GTK_GRID (grid), button, i, j, 1, 1);
}
}
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
gtk_overlay_set_overlay_pass_through (GTK_OVERLAY (overlay), vbox, TRUE);
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
label = gtk_label_new ("<span foreground='blue' weight='ultrabold' font='40'>Numbers</span>");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 8);
gtk_entry_set_placeholder_text (GTK_ENTRY (entry), "Your Lucky Number");
gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 8);
gtk_container_add (GTK_CONTAINER (window), overlay);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "Overlay");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
view = gtk_text_view_new ();
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (sw), view);
overlay = gtk_overlay_new ();
gtk_container_add (GTK_CONTAINER (overlay), sw);
gtk_container_add (GTK_CONTAINER (window), overlay);
entry = gtk_entry_new ();
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
gtk_widget_set_halign (entry, GTK_ALIGN_END);
gtk_widget_set_valign (entry, GTK_ALIGN_END);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_widget_set_valign (label, GTK_ALIGN_END);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_START);
gtk_widget_set_valign (entry, GTK_ALIGN_END);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_END);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_END);
gtk_widget_set_valign (entry, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_widget_set_valign (label, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_START);
gtk_widget_set_valign (entry, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_END);
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_END);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_START);
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
gtk_widget_set_valign (entry, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (label, GTK_ALIGN_START);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 20);
gtk_widget_set_margin_end (label, 20);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
gtk_widget_set_valign (entry, GTK_ALIGN_END);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (label, GTK_ALIGN_END);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_set_margin_start (label, 10);
gtk_widget_set_margin_end (label, 10);
gtk_widget_set_margin_top (label, 5);
gtk_widget_set_margin_bottom (label, 5);
entry = gtk_entry_new ();
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
label = gtk_label_new ("Hello world");
gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), label);
gtk_widget_show_all (overlay);
}
+8 -8
View File
@@ -1,14 +1,14 @@
/* Paned Widgets
*
* The GtkHPaned and GtkVPaned Widgets divide their content
* area into two panes with a divider in between that the
* user can adjust. A separate child is placed into each
* pane.
* The GtkPaned Widget divides its content area into two panes
* with a divider in between that the user can adjust. A separate
* child is placed into each pane. GtkPaned widgets can be split
* horizontally or vertially.
*
* There are a number of options that can be set for each pane.
* This test contains both a horizontal (HPaned) and a vertical
* (VPaned) widget, and allows you to adjust the options for
* each side of each widget.
* This test contains both a horizontal and a vertical GtkPaned
* widget, and allows you to adjust the options for each side of
* each widget.
*/
#include <gtk/gtk.h>
@@ -141,7 +141,7 @@ do_panes (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "Panes");
gtk_window_set_title (GTK_WINDOW (window), "Paned Widgets");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+1 -1
View File
@@ -84,7 +84,7 @@ do_search_entry2 (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Search Entry #2");
gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_widget_set_size_request (window, 200, -1);
+1 -1
View File
@@ -43,7 +43,7 @@ do_sidebar (GtkWidget *do_widget)
header = gtk_header_bar_new ();
gtk_header_bar_set_show_close_button (GTK_HEADER_BAR(header), TRUE);
gtk_window_set_titlebar (GTK_WINDOW(window), header);
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar demo");
gtk_window_set_title (GTK_WINDOW(window), "Stack Sidebar");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+1 -1
View File
@@ -100,7 +100,7 @@ do_sizegroup (GtkWidget *do_widget)
if (!window)
{
window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
window = gtk_dialog_new_with_buttons ("Size Groups",
GTK_WINDOW (do_widget),
0,
_("_Close"),
+1 -1
View File
@@ -36,7 +36,7 @@ do_spinner (GtkWidget *do_widget)
if (!window)
{
window = gtk_dialog_new_with_buttons ("GtkSpinner",
window = gtk_dialog_new_with_buttons ("Spinner",
GTK_WINDOW (do_widget),
0,
_("_Close"),
+1 -8
View File
@@ -14,17 +14,10 @@ GtkWidget *
do_stack (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GError *err = NULL;
if (!window)
{
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/stack/stack.ui", &err);
if (err)
{
g_error ("ERROR: %s\n", err->message);
return NULL;
}
builder = gtk_builder_new_from_resource ("/stack/stack.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_screen (GTK_WINDOW (window),
+1 -1
View File
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="title" translatable="yes">GtkStack</property>
<property name="title" translatable="yes">Stack</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
+1
View File
@@ -181,6 +181,7 @@ do_textscroll (GtkWidget *do_widget)
GtkWidget *hbox;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
+1 -1
View File
@@ -480,7 +480,7 @@ do_textview (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "TextView");
gtk_window_set_title (GTK_WINDOW (window), "Multiple Views");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
vpaned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
+54 -55
View File
@@ -11,9 +11,9 @@
static void
draw_shadow_box (cairo_t *cr,
GdkRectangle rect,
double radius,
double transparency)
GdkRectangle rect,
double radius,
double transparency)
{
cairo_pattern_t *pattern;
double x0, x1, x2, x3;
@@ -23,140 +23,140 @@ draw_shadow_box (cairo_t *cr,
x1 = rect.x + radius;
x2 = rect.x + rect.width - radius;
x3 = rect.x + rect.width;
y0 = rect.y;
y1 = rect.y + radius;
y2 = rect.y + rect.height - radius;
y3 = rect.y + rect.height;
/* Fill non-border part */
cairo_set_source_rgba (cr, 0, 0, 0, transparency);
cairo_rectangle (cr,
x1, y1, x2 - x1, y2 - y1);
x1, y1, x2 - x1, y2 - y1);
cairo_fill (cr);
/* Upper border */
pattern = cairo_pattern_create_linear (0, y0, 0, y1);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x1, y0,
x2 - x1, y1 - y0);
x1, y0,
x2 - x1, y1 - y0);
cairo_fill (cr);
/* Bottom border */
pattern = cairo_pattern_create_linear (0, y2, 0, y3);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x1, y2,
x2 - x1, y3 - y2);
x1, y2,
x2 - x1, y3 - y2);
cairo_fill (cr);
/* Left border */
pattern = cairo_pattern_create_linear (x0, 0, x1, 0);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, 0.0);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, transparency);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y1,
x1 - x0, y2 - y1);
x0, y1,
x1 - x0, y2 - y1);
cairo_fill (cr);
/* Right border */
pattern = cairo_pattern_create_linear (x2, 0, x3, 0);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y1,
x3 - x2, y2 - y1);
x2, y1,
x3 - x2, y2 - y1);
cairo_fill (cr);
/* NW corner */
pattern = cairo_pattern_create_radial (x1, y1, 0,
x1, y1, radius);
x1, y1, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y0,
x1 - x0, y1 - y0);
x0, y0,
x1 - x0, y1 - y0);
cairo_fill (cr);
/* NE corner */
pattern = cairo_pattern_create_radial (x2, y1, 0,
x2, y1, radius);
x2, y1, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y0,
x3 - x2, y1 - y0);
x2, y0,
x3 - x2, y1 - y0);
cairo_fill (cr);
/* SW corner */
pattern = cairo_pattern_create_radial (x1, y2, 0,
x1, y2, radius);
x1, y2, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x0, y2,
x1 - x0, y3 - y2);
x0, y2,
x1 - x0, y3 - y2);
cairo_fill (cr);
/* SE corner */
pattern = cairo_pattern_create_radial (x2, y2, 0,
x2, y2, radius);
x2, y2, radius);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, 0.0, 0, 0, transparency);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, 0.0, 0, 0, 0.0);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr,
x2, y2,
x3 - x2, y3 - y2);
x2, y2,
x3 - x2, y3 - y2);
cairo_fill (cr);
}
@@ -174,8 +174,8 @@ draw_callback (GtkWidget *widget,
rect.height -= SHADOW_OFFSET_Y;
draw_shadow_box (cr,
rect, SHADOW_RADIUS, 0.4);
rect, SHADOW_RADIUS, 0.4);
return FALSE;
}
@@ -202,7 +202,7 @@ do_transparent (GtkWidget *do_widget)
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "Transparent");
gtk_window_set_title (GTK_WINDOW (window), "Transparency");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
view = gtk_text_view_new ();
@@ -230,7 +230,6 @@ do_transparent (GtkWidget *do_widget)
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), entry);
gtk_widget_set_halign (entry, GTK_ALIGN_CENTER);
gtk_widget_set_valign (entry, GTK_ALIGN_START);
gtk_widget_show_all (overlay);
}
+1 -1
View File
@@ -398,7 +398,7 @@ do_tree_store (GtkWidget *do_widget)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Card planning sheet");
gtk_window_set_title (GTK_WINDOW (window), "Tree Store");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
+115
View File
@@ -1124,6 +1124,108 @@ page_combo_separator_func (GtkTreeModel *model,
return res;
}
static void
activate_item (GtkWidget *item, GtkTextView *tv)
{
const gchar *tag;
GtkTextIter start, end;
gboolean active;
g_object_get (item, "active", &active, NULL);
tag = (const gchar *)g_object_get_data (G_OBJECT (item), "tag");
gtk_text_buffer_get_selection_bounds (gtk_text_view_get_buffer (tv), &start, &end);
if (active)
gtk_text_buffer_apply_tag_by_name (gtk_text_view_get_buffer (tv), tag, &start, &end);
else
gtk_text_buffer_remove_tag_by_name (gtk_text_view_get_buffer (tv), tag, &start, &end);
}
static void
add_item (GtkTextView *tv,
GtkWidget *popup,
const gchar *text,
const gchar *tag,
gboolean set)
{
GtkWidget *item, *label;
if (GTK_IS_MENU (popup))
{
item = gtk_check_menu_item_new ();
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), set);
g_signal_connect (item, "toggled", G_CALLBACK (activate_item), tv);
}
else
{
item = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (item), set);
gtk_button_set_focus_on_click (GTK_BUTTON (item), FALSE);
g_signal_connect (item, "clicked", G_CALLBACK (activate_item), tv);
}
label = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_label_set_markup (GTK_LABEL (label), text);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (item), label);
g_object_set_data (G_OBJECT (item), "tag", (gpointer)tag);
gtk_widget_show (item);
gtk_container_add (GTK_CONTAINER (popup), item);
}
static void
populate_popup (GtkTextView *tv,
GtkWidget *popup)
{
gboolean has_selection;
GtkWidget *item;
GtkTextIter start, end, iter;
GtkTextTagTable *tags;
GtkTextTag *bold, *italic, *underline;
gboolean all_bold, all_italic, all_underline;
has_selection = gtk_text_buffer_get_selection_bounds (gtk_text_view_get_buffer (tv), &start, &end);
if (!has_selection)
return;
tags = gtk_text_buffer_get_tag_table (gtk_text_view_get_buffer (tv));
bold = gtk_text_tag_table_lookup (tags, "bold");
italic = gtk_text_tag_table_lookup (tags, "italic");
underline = gtk_text_tag_table_lookup (tags, "underline");
all_bold = TRUE;
all_italic = TRUE;
all_underline = TRUE;
gtk_text_iter_assign (&iter, &start);
while (!gtk_text_iter_equal (&iter, &end))
{
all_bold &= gtk_text_iter_has_tag (&iter, bold);
all_italic &= gtk_text_iter_has_tag (&iter, italic);
all_underline &= gtk_text_iter_has_tag (&iter, underline);
gtk_text_iter_forward_char (&iter);
}
if (GTK_IS_MENU (popup))
{
item = gtk_separator_menu_item_new ();
gtk_widget_show (item);
gtk_container_add (GTK_CONTAINER (popup), item);
}
add_item (tv, popup, "<b>Bold</b>", "bold", all_bold);
add_item (tv, popup, "<i>Italics</i>", "italic", all_italic);
add_item (tv, popup, "<u>Underline</u>", "underline", all_underline);
}
static void
open_popover_text_changed (GtkEntry *entry, GParamSpec *pspec, GtkWidget *button)
{
const gchar *text;
text = gtk_entry_get_text (entry);
gtk_widget_set_sensitive (button, strlen (text) > 0);
}
static void
activate (GApplication *app)
{
@@ -1262,6 +1364,8 @@ activate (GApplication *app)
g_signal_connect (dialog, "response", G_CALLBACK (close_dialog), NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "preference_dialog_button");
g_signal_connect (widget, "clicked", G_CALLBACK (show_dialog), dialog);
widget = (GtkWidget *)gtk_builder_get_object (builder, "circular_button");
g_signal_connect (widget, "clicked", G_CALLBACK (show_dialog), dialog);
dialog = (GtkWidget *)gtk_builder_get_object (builder, "selection_dialog");
widget = (GtkWidget *)gtk_builder_get_object (builder, "text3");
@@ -1327,6 +1431,17 @@ activate (GApplication *app)
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "totem_like_osd");
g_object_set_data (G_OBJECT (widget), "osd", widget2);
widget = (GtkWidget *)gtk_builder_get_object (builder, "textview1");
g_signal_connect (widget, "populate-popup",
G_CALLBACK (populate_popup), NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "open_popover");
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "open_popover_entry");
widget3 = (GtkWidget *)gtk_builder_get_object (builder, "open_popover_button");
gtk_popover_set_default_widget (GTK_POPOVER (widget), widget3);
g_signal_connect (widget2, "notify::text", G_CALLBACK (open_popover_text_changed), widget3);
g_signal_connect_swapped (widget3, "clicked", G_CALLBACK (gtk_widget_hide), widget);
gtk_widget_show_all (GTK_WIDGET (window));
g_object_unref (builder);
+154 -5
View File
@@ -162,7 +162,28 @@
</row>
</data>
</object>
<object class="GtkTextTagTable" id="tags">
<child type="tag">
<object class="GtkTextTag">
<property name="name">bold</property>
<property name="weight">800</property>
</object>
</child>
<child type="tag">
<object class="GtkTextTag">
<property name="name">italic</property>
<property name="style">italic</property>
</object>
</child>
<child type="tag">
<object class="GtkTextTag">
<property name="name">underline</property>
<property name="underline">single</property>
</object>
</child>
</object>
<object class="GtkTextBuffer" id="textbuffer1">
<property name="tag-table">tags</property>
<property name="text">Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nullam fringilla, est ut feugiat ultrices, elit lacus ultricies nibh, id commodo tortor nisi id elit.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
@@ -1408,6 +1429,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="wrap_mode">2</property>
<property name="left_margin">10</property>
<property name="right_margin">10</property>
<property name="populate_all">True</property>
</object>
</child>
</object>
@@ -2871,9 +2893,10 @@ microphone-sensitivity-medium-symbolic</property>
<property name="halign">start</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton">
<object class="GtkMenuButton">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="popover">open_popover</property>
<style>
<class name="text-button"/>
<class name="image-button"/>
@@ -2976,7 +2999,7 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton">
<object class="GtkButton" id="circular_button">
<property name="visible">True</property>
<style>
<class name="image-button"/>
@@ -3561,10 +3584,56 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkSpinner">
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="active">True</property>
<property name="expand">True</property>
<property name="orientation">vertical</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="halign">center</property>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="placeholder_text" translatable="yes">Name…</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="placeholder_text" translatable="yes">Age…</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="linked"/>
</style>
</object>
</child>
<child>
<object class="GtkSpinner">
<property name="visible">True</property>
<property name="active">True</property>
<property name="expand">True</property>
</object>
</child>
</object>
</child>
</object>
@@ -3816,6 +3885,86 @@ bad things might happen.</property>
<action-widget response="ok" default="true">select_selection_dialog</action-widget>
</action-widgets>
</object>
<object class="GtkPopover" id="open_popover">
<property name="visible">True</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="margin">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label">Title:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="valign">start</property>
<property name="visible">True</property>
<property name="label">Description:</property>
<property name="xalign">1</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="valign">start</property>
<property name="visible">True</property>
<property name="shadow-type">in</property>
<property name="hscrollbar-policy">never</property>
<property name="vscrollbar-policy">automatic</property>
<property name="min-content-height">70</property>
<child>
<object class="GtkTextView" id="open_popover_textview">
<property name="visible">True</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="open_popover_entry">
<property name="visible">True</property>
<property name="activates-default">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="open_popover_button">
<property name="halign">end</property>
<property name="visible">True</property>
<property name="label">_Open</property>
<property name="use-underline">True</property>
<property name="sensitive">False</property>
<property name="can-default">True</property>
<style>
<class name="suggested-action"/>
</style>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkSizeGroup">
<property name="mode">vertical</property>
<widgets>
+2
View File
@@ -129,6 +129,7 @@ IGNORE_HFILES = \
gtkmountoperationprivate.h \
gtkorientableprivate.h \
gtkpixelcacheprivate.h \
gtkplacessidebarprivate.h \
gtkpopoverprivate.h \
gtkprinter-private.h \
gtkprintoperation-private.h \
@@ -144,6 +145,7 @@ IGNORE_HFILES = \
gtksearchentryprivate.h \
gtkselectionprivate.h \
gtksettingsprivate.h \
gtksidebarrowprivate.h \
gtksizegroup-private.h \
gtksizerequestcacheprivate.h \
gtksocketprivate.h \
+8
View File
@@ -381,6 +381,8 @@ gtk_assistant_set_page_side_image
gtk_assistant_get_page_side_image
gtk_assistant_set_page_complete
gtk_assistant_get_page_complete
gtk_assistant_set_page_has_padding
gtk_assistant_get_page_has_padding
gtk_assistant_add_action_widget
gtk_assistant_remove_action_widget
gtk_assistant_update_buttons_state
@@ -2638,6 +2640,8 @@ gtk_places_sidebar_set_open_flags
gtk_places_sidebar_get_open_flags
gtk_places_sidebar_set_location
gtk_places_sidebar_get_location
gtk_places_sidebar_set_show_recent
gtk_places_sidebar_get_show_recent
gtk_places_sidebar_set_show_desktop
gtk_places_sidebar_get_show_desktop
gtk_places_sidebar_add_shortcut
@@ -2650,6 +2654,7 @@ gtk_places_sidebar_get_local_only
gtk_places_sidebar_set_local_only
gtk_places_sidebar_get_show_enter_location
gtk_places_sidebar_set_show_enter_location
gtk_places_sidebar_set_drop_targets_visible
<SUBSECTION Standard>
GTK_PLACES_SIDEBAR
GTK_IS_PLACES_SIDEBAR
@@ -7768,6 +7773,9 @@ GtkOverlayClass
gtk_overlay_new
gtk_overlay_add_overlay
gtk_overlay_reorder_overlay
gtk_overlay_get_overlay_pass_through
gtk_overlay_set_overlay_pass_through
<SUBSECTION Standard>
GTK_TYPE_OVERLAY
+2 -2
View File
@@ -392,7 +392,7 @@ broadway_buffer_encode (BroadwayBuffer *buffer, BroadwayBuffer *prev, GString *d
hash = 0;
for (j = x0; j < MIN(x1, x0 + block_size); j++)
hash = hash * prime + line[j];
for (j = j; j < x0 + block_size; j++)
for (; j < x0 + block_size; j++)
hash = hash * prime;
for (j = x0; j < x1; j++)
@@ -405,7 +405,7 @@ broadway_buffer_encode (BroadwayBuffer *buffer, BroadwayBuffer *prev, GString *d
}
}
// Do the last rows if height < block_size
for (i = i; i < y0 + block_size; i++)
for (; i < y0 + block_size; i++)
{
for (j = x0; j < x1; j++)
block_hashes[j] = block_hashes[j] * vprime;
+15 -3
View File
@@ -825,19 +825,31 @@ map_named_shm (char *name, gsize size)
int fd;
void *ptr;
char *filename = NULL;
fd = shm_open(name, O_RDONLY, 0600);
if (fd == -1)
{
perror ("Failed to shm_open");
return NULL;
filename = g_build_filename (g_get_tmp_dir (), name, NULL);
fd = open (filename, O_RDONLY);
if (fd == -1)
{
perror ("Failed to map shm");
return NULL;
}
}
ptr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
(void) close(fd);
shm_unlink (name);
if (filename)
{
unlink (filename);
g_free (filename);
}
else
shm_unlink (name);
return ptr;
+36 -9
View File
@@ -524,10 +524,11 @@ _gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
}
static void *
map_named_shm (char *name, gsize size)
map_named_shm (char *name, gsize size, gboolean *is_shm)
{
#ifdef G_OS_UNIX
char *filename = NULL;
int fd;
void *ptr;
int res;
@@ -535,10 +536,24 @@ map_named_shm (char *name, gsize size)
fd = shm_open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
if (fd == -1)
{
if (errno != EEXIST)
g_error ("Unable to allocate shared mem for window");
return NULL;
if (errno == EEXIST)
return NULL;
filename = g_build_filename (g_get_tmp_dir (), name, NULL);
fd = open (filename, O_RDWR | O_CREAT | O_EXCL, 0600);
g_free (filename);
if (fd == -1)
{
if (errno != EEXIST)
g_error ("Unable to allocate shared mem for window");
return NULL;
}
else
*is_shm = FALSE;
}
else
*is_shm = TRUE;
res = ftruncate (fd, size);
g_assert (res != -1);
@@ -547,7 +562,10 @@ map_named_shm (char *name, gsize size)
res = posix_fallocate (fd, 0, size);
if (res != 0 && errno == ENOSPC)
{
shm_unlink (name);
if (filename)
unlink (filename);
else
shm_unlink (name);
g_error ("Not enough shared memory for window surface");
}
#endif
@@ -579,6 +597,7 @@ map_named_shm (char *name, gsize size)
return NULL;
}
*is_shm = TRUE;
res = ftruncate (fd, size);
g_assert (res != -1);
@@ -614,7 +633,7 @@ make_valid_fs_char (char c)
/* name must have at least space for 34 bytes */
static gpointer
create_random_shm (char *name, gsize size)
create_random_shm (char *name, gsize size, gboolean *is_shm)
{
guint32 r;
int i, o;
@@ -638,7 +657,7 @@ create_random_shm (char *name, gsize size)
}
name[o++] = 0;
ptr = map_named_shm (name, size);
ptr = map_named_shm (name, size, is_shm);
if (ptr)
return ptr;
}
@@ -650,6 +669,7 @@ typedef struct {
char name[36];
void *data;
gsize data_size;
gboolean is_shm;
} BroadwayShmSurfaceData;
static void
@@ -660,7 +680,14 @@ shm_data_destroy (void *_data)
#ifdef G_OS_UNIX
munmap (data->data, data->data_size);
shm_unlink (data->name);
if (data->is_shm)
shm_unlink (data->name);
else
{
char *filename = g_build_filename (g_get_tmp_dir (), data->name, NULL);
unlink (filename);
g_free (filename);
}
#elif defined(G_OS_WIN32)
@@ -689,7 +716,7 @@ _gdk_broadway_server_create_surface (int width,
data = g_new (BroadwayShmSurfaceData, 1);
data->data_size = width * height * sizeof (guint32);
data->data = create_random_shm (data->name, data->data_size);
data->data = create_random_shm (data->name, data->data_size, &data->is_shm);
surface = cairo_image_surface_create_for_data ((guchar *)data->data,
CAIRO_FORMAT_ARGB32, width, height, width * sizeof (guint32));
+1
View File
@@ -314,6 +314,7 @@ struct _GdkWindow
guint8 fullscreen_mode;
guint input_only : 1;
guint pass_through : 1;
guint modal_hint : 1;
guint composited : 1;
guint has_alpha_background : 1;
+139 -7
View File
@@ -198,8 +198,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
static gpointer parent_class = NULL;
static const cairo_user_data_key_t gdk_window_cairo_key;
G_DEFINE_ABSTRACT_TYPE (GdkWindow, gdk_window, G_TYPE_OBJECT)
#ifdef DEBUG_WINDOW_PRINTING
@@ -5979,10 +5977,25 @@ gdk_window_set_background_rgba (GdkWindow *window,
const GdkRGBA *rgba)
{
cairo_pattern_t *pattern;
GdkRGBA prev_rgba;
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (rgba != NULL);
/*
* If the new RGBA matches the previous pattern, ignore the change so that
* we do not invalidate the window contents.
*/
if ((window->background != NULL) &&
(cairo_pattern_get_type (window->background) == CAIRO_PATTERN_TYPE_SOLID) &&
(cairo_pattern_get_rgba (window->background,
&prev_rgba.red,
&prev_rgba.green,
&prev_rgba.blue,
&prev_rgba.alpha) == CAIRO_STATUS_SUCCESS) &&
gdk_rgba_equal (&prev_rgba, rgba))
return;
pattern = cairo_pattern_create_rgba (rgba->red, rgba->green,
rgba->blue, rgba->alpha);
@@ -6786,6 +6799,63 @@ gdk_window_set_child_input_shapes (GdkWindow *window)
do_child_input_shapes (window, FALSE);
}
/**
* gdk_window_set_pass_through:
* @window: a #GdkWindow
* @pass_through: a boolean
*
* Sets whether input to the window is passed through to the window
* below.
*
* The default value of this is %FALSE, which means that pointer
* events that happen inside the window are send first to the window,
* but if the event is not selected by the event mask then the event
* is sent to the parent window, and so on up the hierarchy.
*
* If @pass_through is %TRUE then such pointer events happen as if the
* window wasn't there at all, and thus will be sent first to any
* windows below @window. This is useful if the window is used in a
* transparent fashion. In the terminology of the web this would be called
* "pointer-events: none".
*
* Note that a window with @pass_through %TRUE can still have a subwindow
* without pass through, so you can get events on a subset of a window. And in
* that cases you would get the in-between related events such as the pointer
* enter/leave events on its way to the destination window.
*
* Since: 3.18
**/
void
gdk_window_set_pass_through (GdkWindow *window,
gboolean pass_through)
{
g_return_if_fail (GDK_IS_WINDOW (window));
window->pass_through = !!pass_through;
/* Pointer may have e.g. moved outside window due to the input region change */
_gdk_synthesize_crossing_events_for_geometry_change (window);
}
/**
* gdk_window_get_pass_through:
* @window: a #GdkWindow
*
* Returns whether input to the window is passed through to the window
* below.
*
* See gdk_window_set_pass_through() for details
*
* Since: 3.18
**/
gboolean
gdk_window_get_pass_through (GdkWindow *window)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
return window->pass_through;
}
/**
* gdk_window_merge_child_input_shapes:
* @window: a #GdkWindow
@@ -7135,6 +7205,63 @@ point_in_window (GdkWindow *window,
x, y));
}
/* Same as point_in_window, except it also takes pass_through and its
interaction with child windows into account */
static gboolean
point_in_input_window (GdkWindow *window,
gdouble x,
gdouble y,
GdkWindow **input_window,
gdouble *input_window_x,
gdouble *input_window_y)
{
GdkWindow *sub;
double child_x, child_y;
GList *l;
if (!point_in_window (window, x, y))
return FALSE;
if (!window->pass_through)
{
if (input_window)
{
*input_window = window;
*input_window_x = x;
*input_window_y = y;
}
return TRUE;
}
/* For pass-through, must be over a child input window */
/* Children is ordered in reverse stack order, i.e. first is topmost */
for (l = window->children; l != NULL; l = l->next)
{
sub = l->data;
if (!GDK_WINDOW_IS_MAPPED (sub))
continue;
gdk_window_coords_from_parent ((GdkWindow *)sub,
x, y,
&child_x, &child_y);
if (point_in_input_window (sub, child_x, child_y,
input_window, input_window_x, input_window_y))
{
if (input_window)
gdk_window_coords_to_parent (sub,
*input_window_x,
*input_window_y,
input_window_x,
input_window_y);
return TRUE;
}
}
return FALSE;
}
static GdkWindow *
convert_native_coords_to_toplevel (GdkWindow *window,
gdouble child_x,
@@ -7228,7 +7355,8 @@ _gdk_window_find_child_at (GdkWindow *window,
gdk_window_coords_from_parent ((GdkWindow *)sub,
x, y,
&child_x, &child_y);
if (point_in_window (sub, child_x, child_y))
if (point_in_input_window (sub, child_x, child_y,
NULL, NULL, NULL))
return (GdkWindow *)sub;
}
@@ -7251,7 +7379,7 @@ _gdk_window_find_descendant_at (GdkWindow *window,
gdouble *found_x,
gdouble *found_y)
{
GdkWindow *sub;
GdkWindow *sub, *input_window;
gdouble child_x, child_y;
GList *l;
gboolean found;
@@ -7272,11 +7400,12 @@ _gdk_window_find_descendant_at (GdkWindow *window,
gdk_window_coords_from_parent ((GdkWindow *)sub,
x, y,
&child_x, &child_y);
if (point_in_window (sub, child_x, child_y))
if (point_in_input_window (sub, child_x, child_y,
&input_window, &child_x, &child_y))
{
x = child_x;
y = child_y;
window = sub;
window = input_window;
found = TRUE;
break;
}
@@ -11084,7 +11213,10 @@ gdk_window_get_unscaled_size (GdkWindow *window,
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (impl_class->get_unscaled_size)
return impl_class->get_unscaled_size (window, unscaled_width, unscaled_height);
{
impl_class->get_unscaled_size (window, unscaled_width, unscaled_height);
return;
}
}
scale = gdk_window_get_scale_factor (window);
+6
View File
@@ -654,6 +654,12 @@ GDK_AVAILABLE_IN_ALL
void gdk_window_merge_child_input_shapes (GdkWindow *window);
GDK_AVAILABLE_IN_3_18
void gdk_window_set_pass_through (GdkWindow *window,
gboolean pass_through);
GDK_AVAILABLE_IN_3_18
gboolean gdk_window_get_pass_through (GdkWindow *window);
/*
* Check if a window has been shown, and whether all its
* parents up to a toplevel have been shown, respectively.
+18
View File
@@ -184,8 +184,26 @@ _gdk_mir_print_close_event (const MirCloseSurfaceEvent *event)
void
_gdk_mir_print_event (const MirEvent *event)
{
const MirInputEvent *input_event;
switch (mir_event_get_type (event))
{
case mir_event_type_input:
input_event = mir_event_get_input_event (event);
switch (mir_input_event_get_type (input_event))
{
case mir_input_event_type_key:
_gdk_mir_print_key_event (mir_event_get_input_event (event));
break;
case mir_input_event_type_touch:
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
break;
case mir_input_event_type_pointer:
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
break;
}
break;
case mir_event_type_key:
_gdk_mir_print_key_event (mir_event_get_input_event (event));
break;
-12
View File
@@ -133,16 +133,4 @@ void _gdk_mir_print_resize_event (const MirResizeEvent *event);
void _gdk_mir_print_event (const MirEvent *event);
/* TODO: Remove once we have proper transient window support. */
GdkWindow * _gdk_mir_window_get_visible_transient_child (GdkWindow *window,
gdouble x,
gdouble y,
gdouble *out_x,
gdouble *out_y);
/* TODO: Remove once we have proper transient window support. */
void _gdk_mir_window_transient_children_foreach (GdkWindow *window,
void (*func) (GdkWindow *, gpointer),
gpointer user_data);
#endif /* __GDK_PRIVATE_MIR_H__ */
+36 -36
View File
@@ -107,7 +107,7 @@ _gdk_mir_display_open (const gchar *display_name)
MirPixelFormat sw_pixel_format, hw_pixel_format;
GdkMirDisplay *display;
g_printerr ("gdk_mir_display_open\n");
//g_printerr ("gdk_mir_display_open\n");
connection = mir_connect_sync (NULL, "GDK-Mir");
if (!connection)
@@ -207,26 +207,26 @@ gdk_mir_display_get_default_screen (GdkDisplay *display)
static void
gdk_mir_display_beep (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_beep\n");
//g_printerr ("gdk_mir_display_beep\n");
/* No system level beep... */
}
static void
gdk_mir_display_sync (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_sync\n");
//g_printerr ("gdk_mir_display_sync\n");
}
static void
gdk_mir_display_flush (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_flush\n");
//g_printerr ("gdk_mir_display_flush\n");
}
static gboolean
gdk_mir_display_has_pending (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_has_pending\n");
//g_printerr ("gdk_mir_display_has_pending\n");
/* We don't need to poll for events - so nothing pending */
return FALSE;
}
@@ -247,14 +247,14 @@ gdk_mir_display_make_default (GdkDisplay *display)
static GdkWindow *
gdk_mir_display_get_default_group (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_get_default_group\n");
//g_printerr ("gdk_mir_display_get_default_group\n");
return NULL;
}
static gboolean
gdk_mir_display_supports_shapes (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_shapes\n");
//g_printerr ("gdk_mir_display_supports_shapes\n");
/* Mir doesn't support shaped windows */
return FALSE;
}
@@ -262,42 +262,42 @@ gdk_mir_display_supports_shapes (GdkDisplay *display)
static gboolean
gdk_mir_display_supports_input_shapes (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_input_shapes\n");
//g_printerr ("gdk_mir_display_supports_input_shapes\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_composite (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_composite\n");
//g_printerr ("gdk_mir_display_supports_composite\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_clipboard_persistence (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_clipboard_persistence\n");
//g_printerr ("gdk_mir_display_supports_clipboard_persistence\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_cursor_alpha (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_cursor_alpha\n");
//g_printerr ("gdk_mir_display_supports_cursor_alpha\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_cursor_color (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_cursor_color\n");
//g_printerr ("gdk_mir_display_supports_cursor_color\n");
return FALSE;
}
static gboolean
gdk_mir_display_supports_selection_notification (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_supports_selection_notification\n");
//g_printerr ("gdk_mir_display_supports_selection_notification\n");
return FALSE;
}
@@ -305,7 +305,7 @@ static gboolean
gdk_mir_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
g_printerr ("gdk_mir_display_request_selection_notification\n");
//g_printerr ("gdk_mir_display_request_selection_notification\n");
return FALSE;
}
@@ -316,7 +316,7 @@ gdk_mir_display_store_clipboard (GdkDisplay *display,
const GdkAtom *targets,
gint n_targets)
{
g_printerr ("gdk_mir_display_store_clipboard\n");
//g_printerr ("gdk_mir_display_store_clipboard\n");
}
static void
@@ -324,7 +324,7 @@ gdk_mir_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height)
{
g_printerr ("gdk_mir_display_get_default_cursor_size\n");
//g_printerr ("gdk_mir_display_get_default_cursor_size\n");
*width = *height = 32; // FIXME: Random value
}
@@ -333,7 +333,7 @@ gdk_mir_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height)
{
g_printerr ("gdk_mir_display_get_maximal_cursor_size\n");
//g_printerr ("gdk_mir_display_get_maximal_cursor_size\n");
*width = *height = 32; // FIXME: Random value
}
@@ -357,14 +357,14 @@ gdk_mir_display_get_cursor_for_surface (GdkDisplay *display,
gdouble x,
gdouble y)
{
g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
//g_printerr ("gdk_mir_display_get_cursor_for_surface (%f, %f)\n", x, y);
return NULL;
}
static GList *
gdk_mir_display_list_devices (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_list_devices\n");
//g_printerr ("gdk_mir_display_list_devices\n");
// FIXME: Should this access the device manager?
return NULL;
}
@@ -372,20 +372,20 @@ gdk_mir_display_list_devices (GdkDisplay *display)
static GdkAppLaunchContext *
gdk_mir_display_get_app_launch_context (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_get_app_launch_context\n");
//g_printerr ("gdk_mir_display_get_app_launch_context\n");
return NULL;
}
static void
gdk_mir_display_before_process_all_updates (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_before_process_all_updates\n");
//g_printerr ("gdk_mir_display_before_process_all_updates\n");
}
static void
gdk_mir_display_after_process_all_updates (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_after_process_all_updates\n");
//g_printerr ("gdk_mir_display_after_process_all_updates\n");
}
static gulong
@@ -411,11 +411,11 @@ gdk_mir_display_create_window_impl (GdkDisplay *display,
GdkWindowAttr *attributes,
gint attributes_mask)
{
g_printerr ("gdk_mir_display_create_window_impl");
g_printerr (" window=%p", window);
g_printerr (" location=(%d, %d)", window->x, window->y);
g_printerr (" size=(%d, %d)", window->width, window->height);
g_printerr ("\n");
//g_printerr ("gdk_mir_display_create_window_impl");
//g_printerr (" window=%p", window);
//g_printerr (" location=(%d, %d)", window->x, window->y);
//g_printerr (" size=(%d, %d)", window->width, window->height);
//g_printerr ("\n");
if (attributes->wclass == GDK_INPUT_OUTPUT)
{
@@ -442,14 +442,14 @@ gdk_mir_display_get_keymap (GdkDisplay *display)
static void
gdk_mir_display_push_error_trap (GdkDisplay *display)
{
g_printerr ("gdk_mir_display_push_error_trap\n");
//g_printerr ("gdk_mir_display_push_error_trap\n");
}
static gint
gdk_mir_display_pop_error_trap (GdkDisplay *display,
gboolean ignored)
{
g_printerr ("gdk_mir_display_pop_error_trap\n");
//g_printerr ("gdk_mir_display_pop_error_trap\n");
return 0;
}
@@ -457,7 +457,7 @@ static GdkWindow *
gdk_mir_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection)
{
g_printerr ("gdk_mir_display_get_selection_owner\n");
//g_printerr ("gdk_mir_display_get_selection_owner\n");
return NULL;
}
@@ -468,7 +468,7 @@ gdk_mir_display_set_selection_owner (GdkDisplay *display,
guint32 time,
gboolean send_event)
{
g_printerr ("gdk_mir_display_set_selection_owner\n");
//g_printerr ("gdk_mir_display_set_selection_owner\n");
return FALSE;
}
@@ -480,7 +480,7 @@ gdk_mir_display_send_selection_notify (GdkDisplay *display,
GdkAtom property,
guint32 time)
{
g_printerr ("gdk_mir_display_send_selection_notify\n");
//g_printerr ("gdk_mir_display_send_selection_notify\n");
}
static gint
@@ -490,7 +490,7 @@ gdk_mir_display_get_selection_property (GdkDisplay *display,
GdkAtom *ret_type,
gint *ret_format)
{
g_printerr ("gdk_mir_display_get_selection_property\n");
//g_printerr ("gdk_mir_display_get_selection_property\n");
return 0;
}
@@ -501,7 +501,7 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
GdkAtom target,
guint32 time)
{
g_printerr ("gdk_mir_display_convert_selection\n");
//g_printerr ("gdk_mir_display_convert_selection\n");
}
static gint
@@ -512,7 +512,7 @@ gdk_mir_display_text_property_to_utf8_list (GdkDisplay *display,
gint length,
gchar ***list)
{
g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
//g_printerr ("gdk_mir_display_text_property_to_utf8_list\n");
return 0;
}
@@ -520,7 +520,7 @@ static gchar *
gdk_mir_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str)
{
g_printerr ("gdk_mir_display_utf8_to_string_target\n");
//g_printerr ("gdk_mir_display_utf8_to_string_target\n");
return NULL;
}
+53 -89
View File
@@ -308,47 +308,6 @@ handle_key_event (GdkWindow *window, const MirInputEvent *event)
}
}
/* TODO: Remove once we have proper transient window support. */
typedef struct
{
GdkWindow *except;
gdouble x;
gdouble y;
guint32 time;
} LeaveInfo;
/* TODO: Remove once we have proper transient window support. */
/*
* leave_windows_except:
*
* Generate a leave event for every window except the one the cursor is in.
*/
static void
leave_windows_except (GdkWindow *window,
gpointer user_data)
{
LeaveInfo info = *((LeaveInfo *) user_data);
info.x -= window->x;
info.y -= window->y;
_gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
if (window != info.except)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
gboolean cursor_inside;
guint button_state;
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside, &button_state);
if (cursor_inside)
generate_crossing_event (window, GDK_LEAVE_NOTIFY, info.x, info.y, info.time);
_gdk_mir_window_impl_set_cursor_state (impl, info.x, info.y, FALSE, button_state);
}
}
static guint
mir_pointer_event_get_button_state (const MirPointerEvent *event)
{
@@ -388,49 +347,6 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
modifier_state = get_modifier_state (mir_pointer_event_modifiers (pointer_event), mir_pointer_event_get_button_state (pointer_event));
event_time = NANO_TO_MILLI (mir_input_event_get_event_time (event));
/* TODO: Remove once we have proper transient window support. */
if (mir_pointer_event_action (pointer_event) == mir_pointer_action_leave)
{
LeaveInfo info;
info.x = x;
info.y = y;
info.time = event_time;
info.except = window;
/* Leave all transient children from leaf to root, except the root since we do it later. */
_gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
}
else
{
LeaveInfo info;
info.x = x;
info.y = y;
info.time = event_time;
info.except = _gdk_mir_window_get_visible_transient_child (window, x, y, &x, &y);
/* Leave all transient children from leaf to root, except the pointer window since we enter it. */
_gdk_mir_window_transient_children_foreach (window, leave_windows_except, &info);
window = info.except;
if (window)
{
/* Enter the pointer window. */
gboolean cursor_inside_pointer_window;
impl = GDK_MIR_WINDOW_IMPL (window->impl);
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, &cursor_inside_pointer_window, NULL);
if (!cursor_inside_pointer_window)
{
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
_gdk_mir_window_impl_set_cursor_state (impl, x, y, TRUE, mir_pointer_event_get_button_state (pointer_event));
}
}
}
if (window)
{
gdouble new_x;
@@ -460,12 +376,23 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
hscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_hscroll);
vscroll = mir_pointer_event_axis_value (pointer_event, mir_pointer_axis_vscroll);
if (hscroll > 0.5 || vscroll > 0.5)
if (ABS (hscroll) > 0.5 || ABS (vscroll) > 0.5)
generate_scroll_event (window, x, y, hscroll, vscroll, modifier_state, event_time);
if (ABS (new_x - x) > 0.5 || ABS (new_y - y) > 0.5)
generate_motion_event (window, new_x, new_y, modifier_state, event_time);
{
generate_motion_event (window, new_x, new_y, modifier_state, event_time);
x = new_x;
y = new_y;
}
break;
case mir_pointer_action_enter:
if (!cursor_inside)
{
cursor_inside = TRUE;
generate_crossing_event (window, GDK_ENTER_NOTIFY, x, y, event_time);
}
break;
case mir_pointer_action_leave:
if (cursor_inside)
{
@@ -485,6 +412,7 @@ static void
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
MirSurfaceState state;
switch (mir_surface_event_get_attribute (event))
{
@@ -492,8 +420,43 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
_gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
break;
case mir_surface_attrib_state:
_gdk_mir_window_impl_set_surface_state (impl, mir_surface_event_get_attribute_value (event));
// FIXME: notify
state = mir_surface_event_get_attribute_value (event);
_gdk_mir_window_impl_set_surface_state (impl, state);
switch (state)
{
case mir_surface_state_restored:
case mir_surface_state_hidden:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_MAXIMIZED |
GDK_WINDOW_STATE_FULLSCREEN,
0);
break;
case mir_surface_state_minimized:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED |
GDK_WINDOW_STATE_FULLSCREEN,
GDK_WINDOW_STATE_ICONIFIED);
break;
case mir_surface_state_maximized:
case mir_surface_state_vertmaximized:
case mir_surface_state_horizmaximized:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_FULLSCREEN,
GDK_WINDOW_STATE_MAXIMIZED);
break;
case mir_surface_state_fullscreen:
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_ICONIFIED |
GDK_WINDOW_STATE_MAXIMIZED,
GDK_WINDOW_STATE_FULLSCREEN);
break;
default:
break;
}
break;
case mir_surface_attrib_swapinterval:
break;
@@ -616,6 +579,7 @@ static void
gdk_mir_queued_event_free (GdkMirQueuedEvent *event)
{
_gdk_mir_window_reference_unref (event->window_ref);
mir_event_unref (event->event);
g_slice_free (GdkMirQueuedEvent, event);
}
@@ -800,7 +764,7 @@ _gdk_mir_event_source_queue (GdkMirWindowReference *window_ref,
queued_event = g_slice_new (GdkMirQueuedEvent);
g_atomic_int_inc (&window_ref->ref_count);
queued_event->window_ref = window_ref;
queued_event->event = event;
queued_event->event = mir_event_ref (event);
g_mutex_lock (&source->mir_event_lock);
g_queue_push_tail (&source->mir_events, queued_event);
+21 -21
View File
@@ -203,7 +203,7 @@ get_output (GdkScreen *screen, gint monitor_num)
static gint
gdk_mir_screen_get_width (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_width\n");
//g_printerr ("gdk_mir_screen_get_width\n");
gint width, height;
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return width;
@@ -212,7 +212,7 @@ gdk_mir_screen_get_width (GdkScreen *screen)
static gint
gdk_mir_screen_get_height (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_height\n");
//g_printerr ("gdk_mir_screen_get_height\n");
gint width, height;
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return height;
@@ -221,7 +221,7 @@ gdk_mir_screen_get_height (GdkScreen *screen)
static gint
gdk_mir_screen_get_width_mm (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_width_mm\n");
//g_printerr ("gdk_mir_screen_get_width_mm\n");
gint width, height;
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return width;
@@ -230,7 +230,7 @@ gdk_mir_screen_get_width_mm (GdkScreen *screen)
static gint
gdk_mir_screen_get_height_mm (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_height_mm\n");
//g_printerr ("gdk_mir_screen_get_height_mm\n");
gint width, height;
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
return height;
@@ -293,7 +293,7 @@ gdk_mir_screen_get_n_monitors (GdkScreen *screen)
static gint
gdk_mir_screen_get_primary_monitor (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_primary_monitor\n");
//g_printerr ("gdk_mir_screen_get_primary_monitor\n");
return 0; //?
}
@@ -301,7 +301,7 @@ static gint
gdk_mir_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num)
{
g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
//g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
MirDisplayOutput *output = get_output (screen, monitor_num);
return output ? output->physical_width_mm : 0;
}
@@ -310,7 +310,7 @@ static gint
gdk_mir_screen_get_monitor_height_mm (GdkScreen *screen,
gint monitor_num)
{
g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
//g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
MirDisplayOutput *output = get_output (screen, monitor_num);
return output ? output->physical_height_mm : 0;
}
@@ -319,7 +319,7 @@ static gchar *
gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num)
{
g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
//g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
MirDisplayOutput *output = get_output (screen, monitor_num);
if (output)
@@ -399,7 +399,7 @@ gdk_mir_screen_get_monitor_workarea (GdkScreen *screen,
static GList *
gdk_mir_screen_list_visuals (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_list_visuals\n");
//g_printerr ("gdk_mir_screen_list_visuals\n");
return g_list_append (NULL, GDK_MIR_SCREEN (screen)->visual);
}
@@ -428,21 +428,21 @@ gdk_mir_screen_is_composited (GdkScreen *screen)
static gchar *
gdk_mir_screen_make_display_name (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_make_display_name\n");
//g_printerr ("gdk_mir_screen_make_display_name\n");
return NULL; // FIXME
}
static GdkWindow *
gdk_mir_screen_get_active_window (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_active_window\n");
//g_printerr ("gdk_mir_screen_get_active_window\n");
return NULL; // FIXME
}
static GList *
gdk_mir_screen_get_window_stack (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_get_window_stack\n");
//g_printerr ("gdk_mir_screen_get_window_stack\n");
return NULL; // FIXME
}
@@ -450,7 +450,7 @@ static void
gdk_mir_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event)
{
g_printerr ("gdk_mir_screen_broadcast_client_message\n");
//g_printerr ("gdk_mir_screen_broadcast_client_message\n");
// FIXME
}
@@ -673,21 +673,21 @@ gdk_mir_screen_get_setting (GdkScreen *screen,
static gint
gdk_mir_screen_visual_get_best_depth (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
//g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
return VISUAL_DEPTH;
}
static GdkVisualType
gdk_mir_screen_visual_get_best_type (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_visual_get_best_type\n");
//g_printerr ("gdk_mir_screen_visual_get_best_type\n");
return VISUAL_TYPE;
}
static GdkVisual*
gdk_mir_screen_visual_get_best (GdkScreen *screen)
{
g_printerr ("gdk_mir_screen_visual_get_best\n");
//g_printerr ("gdk_mir_screen_visual_get_best\n");
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -695,7 +695,7 @@ static GdkVisual*
gdk_mir_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
//g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -703,7 +703,7 @@ static GdkVisual*
gdk_mir_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
//g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -712,7 +712,7 @@ gdk_mir_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
//g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
return GDK_MIR_SCREEN (screen)->visual;
}
@@ -721,7 +721,7 @@ gdk_mir_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
g_printerr ("gdk_mir_screen_query_depths\n");
//g_printerr ("gdk_mir_screen_query_depths\n");
static gint supported_depths[] = { VISUAL_DEPTH };
*depths = supported_depths;
*count = 1;
@@ -732,7 +732,7 @@ gdk_mir_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
g_printerr ("gdk_mir_screen_query_visual_types\n");
//g_printerr ("gdk_mir_screen_query_visual_types\n");
static GdkVisualType supported_visual_types[] = { VISUAL_TYPE };
*visual_types = supported_visual_types;
*count = 1;
+158 -271
View File
@@ -46,11 +46,8 @@ struct _GdkMirWindowImpl
gint transient_x;
gint transient_y;
/* Child windows (e.g. tooltips) */
GList *transient_children;
/* Desired surface attributes */
MirSurfaceType surface_type;
GdkWindowTypeHint type_hint;
MirSurfaceState surface_state;
/* Pattern for background */
@@ -71,7 +68,6 @@ struct _GdkMirWindowImpl
EGLSurface egl_surface;
/* Dummy MIR and EGL surfaces */
MirSurface *dummy_surface;
EGLSurface dummy_egl_surface;
/* TRUE if the window can be seen */
@@ -103,9 +99,9 @@ _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState
}
void
_gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type)
_gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl,
MirSurfaceType type)
{
impl->surface_type = type;
}
void
@@ -141,7 +137,7 @@ _gdk_mir_window_impl_get_cursor_state (GdkMirWindowImpl *impl,
static void
gdk_mir_window_impl_init (GdkMirWindowImpl *impl)
{
impl->surface_type = mir_surface_type_normal;
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
impl->surface_state = mir_surface_state_unknown;
}
@@ -157,18 +153,6 @@ set_surface_state (GdkMirWindowImpl *impl,
mir_surface_set_state (impl->surface, state);
}
static void
set_surface_type (GdkMirWindowImpl *impl,
MirSurfaceType type)
{
if (impl->surface_type == type)
return;
impl->surface_type = type;
if (impl->surface)
mir_surface_set_type (impl->surface, type);
}
static void
event_cb (MirSurface *surface,
const MirEvent *event,
@@ -179,18 +163,87 @@ event_cb (MirSurface *surface,
static MirSurface *
create_mir_surface (GdkDisplay *display,
GdkWindow *parent,
gint x,
gint y,
gint width,
gint height,
GdkWindowTypeHint type,
MirBufferUsage buffer_usage)
{
GdkMirWindowImpl *parent_impl;
MirSurfaceSpec *spec;
MirConnection *connection;
MirPixelFormat format;
MirSurface *surface;
MirRectangle rect;
connection = gdk_mir_display_get_mir_connection (display);
format = _gdk_mir_display_get_pixel_format (display, buffer_usage);
spec = mir_connection_create_spec_for_normal_surface (connection, width, height, format);
if (parent)
parent_impl = GDK_MIR_WINDOW_IMPL (parent->impl);
else
parent_impl = NULL;
switch (type)
{
case GDK_WINDOW_TYPE_HINT_DIALOG:
case GDK_WINDOW_TYPE_HINT_DOCK:
spec = mir_connection_create_spec_for_dialog (connection,
width,
height,
format);
break;
case GDK_WINDOW_TYPE_HINT_MENU:
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
case GDK_WINDOW_TYPE_HINT_COMBO:
rect.left = x;
rect.top = y;
rect.width = 1;
rect.height = 1;
spec = mir_connection_create_spec_for_menu (connection,
width,
height,
format,
parent_impl ? parent_impl->surface : NULL,
&rect,
mir_edge_attachment_any);
break;
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
case GDK_WINDOW_TYPE_HINT_UTILITY:
spec = mir_connection_create_spec_for_modal_dialog (connection,
width,
height,
format,
parent_impl ? parent_impl->surface : NULL);
break;
case GDK_WINDOW_TYPE_HINT_DND:
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
rect.left = x;
rect.top = y;
rect.width = 1;
rect.height = 1;
spec = mir_connection_create_spec_for_tooltip (connection,
width,
height,
format,
parent_impl ? parent_impl->surface : NULL,
&rect);
break;
case GDK_WINDOW_TYPE_HINT_NORMAL:
case GDK_WINDOW_TYPE_HINT_DESKTOP:
default:
spec = mir_connection_create_spec_for_normal_surface (connection,
width,
height,
format);
break;
}
mir_surface_spec_set_name (spec, g_get_prgname ());
mir_surface_spec_set_buffer_usage (spec, buffer_usage);
surface = mir_surface_create_sync (spec);
@@ -199,13 +252,41 @@ create_mir_surface (GdkDisplay *display,
return surface;
}
/* TODO: Remove once we have proper transient window support. */
static gboolean
should_render_in_parent (GdkWindow *window)
static GdkDevice *
get_pointer (GdkWindow *window)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
return gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gdk_window_get_display (window)));
}
return impl->transient_for && gdk_window_get_window_type (window) != GDK_WINDOW_TOPLEVEL;
static void
send_event (GdkWindow *window, GdkDevice *device, GdkEvent *event)
{
GdkDisplay *display;
GList *node;
gdk_event_set_device (event, device);
gdk_event_set_source_device (event, device);
gdk_event_set_screen (event, gdk_display_get_screen (gdk_window_get_display (window), 0));
event->any.window = g_object_ref (window);
display = gdk_window_get_display (window);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, _gdk_display_get_next_serial (display));
}
static void
generate_configure_event (GdkWindow *window,
gint width,
gint height)
{
GdkEvent *event;
event = gdk_event_new (GDK_CONFIGURE);
event->configure.send_event = FALSE;
event->configure.width = width;
event->configure.height = height;
send_event (window, get_pointer (window), event);
}
static void
@@ -215,7 +296,7 @@ ensure_surface_full (GdkWindow *window,
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
GdkMirWindowReference *window_ref;
if (impl->surface || should_render_in_parent (window))
if (impl->surface)
return;
/* no destroy notify -- we must leak for now
@@ -223,8 +304,10 @@ ensure_surface_full (GdkWindow *window,
*/
window_ref = _gdk_mir_event_source_get_window_reference (window);
impl->surface = create_mir_surface (gdk_window_get_display (window),
impl->surface = create_mir_surface (gdk_window_get_display (window), impl->transient_for,
impl->transient_x, impl->transient_y,
window->width, window->height,
impl->type_hint,
buffer_usage);
/* FIXME: can't make an initial resize event */
@@ -241,9 +324,9 @@ ensure_surface_full (GdkWindow *window,
_gdk_mir_event_source_queue (window_ref, &resize_event);
*/
generate_configure_event (window, window->width, window->height);
mir_surface_set_event_handler (impl->surface, event_cb, window_ref); // FIXME: Ignore some events until shown
set_surface_type (impl, impl->surface_type);
set_surface_state (impl, impl->surface_state);
}
static void
@@ -281,66 +364,18 @@ ensure_no_surface (GdkWindow *window)
eglDestroySurface (egl_display, impl->dummy_egl_surface);
impl->dummy_egl_surface = NULL;
}
g_clear_pointer (&impl->dummy_surface, mir_surface_release_sync);
}
g_clear_pointer(&impl->surface, mir_surface_release_sync);
}
static void
redraw_transient (GdkWindow *window)
{
GdkRectangle r;
r.x = window->x;
r.y = window->y;
r.width = window->width;
r.height = window->height;
gdk_window_invalidate_rect (GDK_MIR_WINDOW_IMPL (window->impl)->transient_for, &r, FALSE);
}
static void
send_buffer (GdkWindow *window)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
/* Transient windows draw onto parent instead */
if (should_render_in_parent (window))
{
redraw_transient (window);
return;
}
/* Composite transient windows over this one */
if (impl->transient_children)
{
cairo_surface_t *surface;
cairo_t *c;
GList *link;
surface = gdk_mir_window_impl_ref_cairo_surface (window);
c = cairo_create (surface);
for (link = impl->transient_children; link; link = link->next)
{
GdkWindow *child_window = link->data;
GdkMirWindowImpl *child_impl = GDK_MIR_WINDOW_IMPL (child_window->impl);
/* Skip children not yet drawn to */
if (!child_impl->cairo_surface)
continue;
cairo_set_source_surface (c, child_impl->cairo_surface, child_window->x, child_window->y);
cairo_rectangle (c, child_window->x, child_window->y, child_window->width, child_window->height);
cairo_fill (c);
}
cairo_destroy (c);
cairo_surface_destroy (surface);
}
/* Send the completed buffer to Mir */
mir_surface_swap_buffers_sync (impl->surface);
mir_buffer_stream_swap_buffers_sync (mir_surface_get_buffer_stream (impl->surface));
/* The Cairo context is no longer valid */
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
@@ -363,7 +398,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
}
/* Transient windows get rendered into a buffer and copied onto their parent */
if (should_render_in_parent (window) || window->gl_paint_context)
if (window->gl_paint_context)
{
cairo_surface = cairo_image_surface_create (pixel_format, window->width, window->height);
}
@@ -371,7 +406,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
{
ensure_surface (window);
mir_surface_get_graphics_region (impl->surface, &region);
mir_buffer_stream_get_graphics_region (mir_surface_get_buffer_stream (impl->surface), &region);
g_assert (region.pixel_format == mir_pixel_format_argb_8888);
cairo_surface = cairo_image_surface_create_for_data ((unsigned char *) region.vaddr,
@@ -409,13 +444,6 @@ static void
gdk_mir_window_impl_finalize (GObject *object)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
GList *link;
for (link = impl->transient_children; link; link = link->next)
{
GdkWindow *window = link->data;
gdk_window_destroy (window);
}
if (impl->background)
cairo_pattern_destroy (impl->background);
@@ -423,7 +451,6 @@ gdk_mir_window_impl_finalize (GObject *object)
mir_surface_release_sync (impl->surface);
if (impl->cairo_surface)
cairo_surface_destroy (impl->cairo_surface);
g_list_free (impl->transient_children);
G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object);
}
@@ -460,9 +487,6 @@ gdk_mir_window_impl_hide (GdkWindow *window)
impl->cursor_inside = FALSE;
impl->visible = FALSE;
ensure_no_surface (window);
if (should_render_in_parent (window))
redraw_transient (window);
}
static void
@@ -474,9 +498,6 @@ gdk_mir_window_impl_withdraw (GdkWindow *window)
impl->cursor_inside = FALSE;
impl->visible = FALSE;
ensure_no_surface (window);
if (should_render_in_parent (window))
redraw_transient (window);
}
static void
@@ -530,19 +551,10 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
gboolean recreate_surface = FALSE;
/* Redraw parent where we moved from */
if (should_render_in_parent (window))
redraw_transient (window);
/* Transient windows can move wherever they want */
if (with_move)
{
if (should_render_in_parent (window))
{
window->x = x;
window->y = y;
}
else if (x != impl->transient_x || y != impl->transient_y)
if (x != impl->transient_x || y != impl->transient_y)
{
impl->transient_x = x;
impl->transient_y = y;
@@ -564,10 +576,6 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
ensure_no_surface (window);
ensure_surface (window);
}
/* Redraw parent where we moved to */
if (should_render_in_parent (window))
redraw_transient (window);
}
static void
@@ -603,7 +611,7 @@ gdk_mir_window_impl_reparent (GdkWindow *window,
gint x,
gint y)
{
g_printerr ("gdk_mir_window_impl_reparent window=%p new-parent=%p\n", window, new_parent);
//g_printerr ("gdk_mir_window_impl_reparent window=%p new-parent=%p\n", window, new_parent);
return FALSE;
}
@@ -703,14 +711,14 @@ gdk_mir_window_impl_end_paint (GdkWindow *window)
static cairo_region_t *
gdk_mir_window_impl_get_shape (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_get_shape window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_shape window=%p\n", window);
return NULL;
}
static cairo_region_t *
gdk_mir_window_impl_get_input_shape (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_get_input_shape window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_input_shape window=%p\n", window);
return NULL;
}
@@ -720,7 +728,7 @@ gdk_mir_window_impl_shape_combine_region (GdkWindow *window,
gint offset_x,
gint offset_y)
{
g_printerr ("gdk_mir_window_impl_shape_combine_region window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_shape_combine_region window=%p\n", window);
}
static void
@@ -742,70 +750,32 @@ gdk_mir_window_impl_destroy (GdkWindow *window,
impl->visible = FALSE;
ensure_no_surface (window);
if (should_render_in_parent (window))
{
/* Redraw parent */
redraw_transient (window);
/* Remove from transient list */
GdkMirWindowImpl *parent_impl = GDK_MIR_WINDOW_IMPL (impl->transient_for->impl);
parent_impl->transient_children = g_list_remove (parent_impl->transient_children, window);
}
}
static void
gdk_mir_window_impl_destroy_foreign (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_destroy_foreign window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_destroy_foreign window=%p\n", window);
}
static void
gdk_mir_window_impl_focus (GdkWindow *window,
guint32 timestamp)
{
g_printerr ("gdk_mir_window_impl_focus window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_focus window=%p\n", window);
}
static void
gdk_mir_window_impl_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint)
{
MirSurfaceType mir_type = mir_surface_type_normal;
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
switch (hint)
if (hint != impl->type_hint)
{
case GDK_WINDOW_TYPE_HINT_NORMAL:
case GDK_WINDOW_TYPE_HINT_DOCK:
case GDK_WINDOW_TYPE_HINT_DESKTOP:
mir_type = mir_surface_type_normal;
break;
case GDK_WINDOW_TYPE_HINT_DIALOG:
mir_type = mir_surface_type_dialog;
break;
case GDK_WINDOW_TYPE_HINT_UTILITY:
mir_type = mir_surface_type_utility;
break;
case GDK_WINDOW_TYPE_HINT_MENU:
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
case GDK_WINDOW_TYPE_HINT_COMBO:
mir_type = mir_surface_type_menu;
break;
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
mir_type = mir_surface_type_tip;
break;
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
case GDK_WINDOW_TYPE_HINT_DND:
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
mir_type = mir_surface_type_overlay;
break;
case GDK_WINDOW_TYPE_HINT_TOOLBAR:
mir_type = mir_surface_type_satellite;
break;
impl->type_hint = hint;
ensure_no_surface (window);
}
set_surface_type (GDK_MIR_WINDOW_IMPL (window->impl), mir_type);
}
static GdkWindowTypeHint
@@ -813,29 +783,7 @@ gdk_mir_window_impl_get_type_hint (GdkWindow *window)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
switch (impl->surface_type)
{
case mir_surface_type_normal:
case mir_surface_type_freestyle:
case mir_surface_type_inputmethod:
return GDK_WINDOW_TYPE_HINT_NORMAL;
case mir_surface_type_utility:
return GDK_WINDOW_TYPE_HINT_UTILITY;
case mir_surface_type_dialog:
return GDK_WINDOW_TYPE_HINT_DIALOG;
case mir_surface_type_tip:
return GDK_WINDOW_TYPE_HINT_TOOLTIP;
case mir_surface_type_menu:
return GDK_WINDOW_TYPE_HINT_MENU;
case mir_surface_type_overlay:
return GDK_WINDOW_TYPE_HINT_NOTIFICATION;
case mir_surface_type_satellite:
return GDK_WINDOW_TYPE_HINT_TOOLBAR;
case mir_surface_types:
break;
}
return GDK_WINDOW_TYPE_HINT_NORMAL;
return impl->type_hint;
}
void
@@ -850,21 +798,21 @@ static void
gdk_mir_window_impl_set_skip_taskbar_hint (GdkWindow *window,
gboolean skips_taskbar)
{
g_printerr ("gdk_mir_window_impl_set_skip_taskbar_hint window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_skip_taskbar_hint window=%p\n", window);
}
static void
gdk_mir_window_impl_set_skip_pager_hint (GdkWindow *window,
gboolean skips_pager)
{
g_printerr ("gdk_mir_window_impl_set_skip_pager_hint window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_skip_pager_hint window=%p\n", window);
}
static void
gdk_mir_window_impl_set_urgency_hint (GdkWindow *window,
gboolean urgent)
{
g_printerr ("gdk_mir_window_impl_set_urgency_hint window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_urgency_hint window=%p\n", window);
}
static void
@@ -887,21 +835,21 @@ static void
gdk_mir_window_impl_set_role (GdkWindow *window,
const gchar *role)
{
g_printerr ("gdk_mir_window_impl_set_role window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_role window=%p\n", window);
}
static void
gdk_mir_window_impl_set_startup_id (GdkWindow *window,
const gchar *startup_id)
{
g_printerr ("gdk_mir_window_impl_set_startup_id window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_startup_id window=%p\n", window);
}
static void
gdk_mir_window_impl_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
g_printerr ("gdk_mir_window_impl_set_transient_for window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_transient_for window=%p\n", window);
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
if (impl->transient_for == parent)
@@ -911,78 +859,20 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
/* Link this window to the parent */
impl->transient_for = parent;
if (should_render_in_parent (window))
{
GdkMirWindowImpl *parent_impl = GDK_MIR_WINDOW_IMPL (parent->impl);
parent_impl->transient_children = g_list_append (parent_impl->transient_children, window);
/* Move to where the client requested */
window->x = impl->transient_x;
window->y = impl->transient_y;
/* Remove surface if we had made one before this was set */
ensure_no_surface (window);
/* Redraw onto parent */
redraw_transient (window);
}
}
/* TODO: Remove once we have proper transient window support. */
GdkWindow *
_gdk_mir_window_get_visible_transient_child (GdkWindow *window,
gdouble x,
gdouble y,
gdouble *out_x,
gdouble *out_y)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
GdkWindow *child = NULL;
GList *i;
x -= window->x;
y -= window->y;
if (x < 0 || x >= window->width || y < 0 || y >= window->height)
return NULL;
for (i = impl->transient_children; i && !child; i = i->next)
{
if (GDK_MIR_WINDOW_IMPL (GDK_WINDOW (i->data)->impl)->visible)
child = _gdk_mir_window_get_visible_transient_child (i->data, x, y, out_x, out_y);
}
if (child)
return child;
*out_x = x;
*out_y = y;
return window;
}
/* TODO: Remove once we have proper transient window support. */
void
_gdk_mir_window_transient_children_foreach (GdkWindow *window,
void (*func) (GdkWindow *, gpointer),
gpointer user_data)
{
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
g_list_foreach (impl->transient_children, (GFunc) func, user_data);
}
static void
gdk_mir_window_impl_get_frame_extents (GdkWindow *window,
GdkRectangle *rect)
{
g_printerr ("gdk_mir_window_impl_get_frame_extents window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_frame_extents window=%p\n", window);
}
static void
gdk_mir_window_impl_set_override_redirect (GdkWindow *window,
gboolean override_redirect)
{
g_printerr ("gdk_mir_window_impl_set_override_redirect window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_override_redirect window=%p\n", window);
}
static void
@@ -1013,7 +903,7 @@ static void
gdk_mir_window_impl_set_icon_name (GdkWindow *window,
const gchar *name)
{
g_printerr ("gdk_mir_window_impl_set_icon_name window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_icon_name window=%p\n", window);
}
static void
@@ -1097,7 +987,7 @@ gdk_mir_window_impl_set_keep_below (GdkWindow *window,
static GdkWindow *
gdk_mir_window_impl_get_group (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_get_group window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_group window=%p\n", window);
return NULL;
}
@@ -1105,21 +995,21 @@ static void
gdk_mir_window_impl_set_group (GdkWindow *window,
GdkWindow *leader)
{
g_printerr ("gdk_mir_window_impl_set_group window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_group window=%p\n", window);
}
static void
gdk_mir_window_impl_set_decorations (GdkWindow *window,
GdkWMDecoration decorations)
{
g_printerr ("gdk_mir_window_impl_set_decorations window=%p decorations=%d\n", window, decorations);
//g_printerr ("gdk_mir_window_impl_set_decorations window=%p decorations=%d\n", window, decorations);
}
static gboolean
gdk_mir_window_impl_get_decorations (GdkWindow *window,
GdkWMDecoration *decorations)
{
g_printerr ("gdk_mir_window_impl_get_decorations window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_decorations window=%p\n", window);
return FALSE;
}
@@ -1127,7 +1017,7 @@ static void
gdk_mir_window_impl_set_functions (GdkWindow *window,
GdkWMFunction functions)
{
g_printerr ("gdk_mir_window_impl_set_functions window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_functions window=%p\n", window);
}
static void
@@ -1139,7 +1029,7 @@ gdk_mir_window_impl_begin_resize_drag (GdkWindow *window,
gint root_y,
guint32 timestamp)
{
g_printerr ("gdk_mir_window_impl_begin_resize_drag window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_begin_resize_drag window=%p\n", window);
}
static void
@@ -1150,19 +1040,19 @@ gdk_mir_window_impl_begin_move_drag (GdkWindow *window,
gint root_y,
guint32 timestamp)
{
g_printerr ("gdk_mir_window_impl_begin_move_drag window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_begin_move_drag window=%p\n", window);
}
static void
gdk_mir_window_impl_enable_synchronized_configure (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_enable_synchronized_configure window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_enable_synchronized_configure window=%p\n", window);
}
static void
gdk_mir_window_impl_configure_finished (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_configure_finished window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_configure_finished window=%p\n", window);
}
static void
@@ -1177,27 +1067,27 @@ static void
gdk_mir_window_impl_set_composited (GdkWindow *window,
gboolean composited)
{
g_printerr ("gdk_mir_window_impl_set_composited window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_set_composited window=%p\n", window);
}
static void
gdk_mir_window_impl_destroy_notify (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_destroy_notify window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_destroy_notify window=%p\n", window);
}
static GdkDragProtocol
gdk_mir_window_impl_get_drag_protocol (GdkWindow *window,
GdkWindow **target)
{
g_printerr ("gdk_mir_window_impl_get_drag_protocol window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_drag_protocol window=%p\n", window);
return 0;
}
static void
gdk_mir_window_impl_register_dnd (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_register_dnd window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_register_dnd window=%p\n", window);
}
static GdkDragContext *
@@ -1205,7 +1095,7 @@ gdk_mir_window_impl_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets)
{
g_printerr ("gdk_mir_window_impl_drag_begin window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_drag_begin window=%p\n", window);
return NULL;
}
@@ -1229,7 +1119,7 @@ gdk_mir_window_impl_process_updates_recurse (GdkWindow *window,
static void
gdk_mir_window_impl_sync_rendering (GdkWindow *window)
{
g_printerr ("gdk_mir_window_impl_sync_rendering window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_sync_rendering window=%p\n", window);
// FIXME: Only used for benchmarking
}
@@ -1241,7 +1131,7 @@ gdk_mir_window_impl_simulate_key (GdkWindow *window,
GdkModifierType modifiers,
GdkEventType key_pressrelease)
{
g_printerr ("gdk_mir_window_impl_simulate_key window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_simulate_key window=%p\n", window);
return FALSE;
}
@@ -1253,7 +1143,7 @@ gdk_mir_window_impl_simulate_button (GdkWindow *window,
GdkModifierType modifiers,
GdkEventType button_pressrelease)
{
g_printerr ("gdk_mir_window_impl_simulate_button window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_simulate_button window=%p\n", window);
return FALSE;
}
@@ -1269,7 +1159,7 @@ gdk_mir_window_impl_get_property (GdkWindow *window,
gint *actual_length,
guchar **data)
{
g_printerr ("gdk_mir_window_impl_get_property window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_get_property window=%p\n", window);
return FALSE;
}
@@ -1282,7 +1172,7 @@ gdk_mir_window_impl_change_property (GdkWindow *window,
const guchar *data,
gint nelements)
{
g_printerr ("gdk_mir_window_impl_change_property window=%p\n", window);
//g_printerr ("gdk_mir_window_impl_change_property window=%p\n", window);
}
static void
@@ -1509,7 +1399,7 @@ _gdk_mir_window_get_egl_surface (GdkWindow *window,
ensure_surface_full (window, mir_buffer_usage_hardware);
egl_display = _gdk_mir_display_get_egl_display (gdk_window_get_display (window));
egl_window = (EGLNativeWindowType) mir_surface_get_egl_native_window (impl->surface);
egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (mir_surface_get_buffer_stream (impl->surface));
impl->egl_surface =
eglCreateWindowSurface (egl_display, config, egl_window, NULL);
@@ -1533,11 +1423,8 @@ _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window,
EGLNativeWindowType egl_window;
display = gdk_window_get_display (window);
impl->dummy_surface = create_mir_surface (display, 1, 1,
mir_buffer_usage_hardware);
egl_display = _gdk_mir_display_get_egl_display (display);
egl_window = (EGLNativeWindowType) mir_surface_get_egl_native_window (impl->surface);
egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (mir_surface_get_buffer_stream (impl->surface));
impl->dummy_egl_surface =
eglCreateWindowSurface (egl_display, config, egl_window, NULL);
+177 -32
View File
@@ -68,7 +68,8 @@ struct _GdkWaylandDeviceData
GHashTable *touches;
GdkModifierType modifiers;
GdkModifierType key_modifiers;
GdkModifierType button_modifiers;
GdkWindow *pointer_focus;
GdkWindow *keyboard_focus;
struct wl_data_device *data_device;
@@ -347,11 +348,90 @@ gdk_wayland_device_query_state (GdkDevice *device,
if (child_window)
*child_window = wd->pointer_focus;
if (mask)
*mask = wd->modifiers;
*mask = wd->button_modifiers | wd->key_modifiers;
get_coordinates (wd, win_x, win_y, root_x, root_y);
}
static void
emulate_crossing (GdkWindow *window,
GdkWindow *subwindow,
GdkDevice *device,
GdkEventType type,
GdkCrossingMode mode,
guint32 time_)
{
GdkEvent *event;
event = gdk_event_new (type);
event->crossing.window = window ? g_object_ref (window) : NULL;
event->crossing.subwindow = subwindow ? g_object_ref (subwindow) : NULL;
event->crossing.time = time_;
event->crossing.mode = mode;
event->crossing.detail = GDK_NOTIFY_NONLINEAR;
gdk_event_set_device (event, device);
gdk_event_set_source_device (event, device);
gdk_window_get_device_position_double (window, device,
&event->crossing.x, &event->crossing.y,
&event->crossing.state);
event->crossing.x_root = event->crossing.x;
event->crossing.y_root = event->crossing.y;
_gdk_wayland_display_deliver_event (gdk_window_get_display (window), event);
}
static void
emulate_focus (GdkWindow *window,
GdkDevice *device,
gboolean focus_in,
guint32 time_)
{
GdkEvent *event;
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = g_object_ref (window);
event->focus_change.in = focus_in;
gdk_event_set_device (event, device);
gdk_event_set_source_device (event, device);
_gdk_wayland_display_deliver_event (gdk_window_get_display (window), event);
}
static void
device_emit_grab_crossing (GdkDevice *device,
GdkWindow *from,
GdkWindow *to,
GdkCrossingMode mode,
guint32 time_)
{
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
if (from)
emulate_focus (from, device, FALSE, time_);
if (to)
emulate_focus (to, device, TRUE, time_);
}
else
{
if (from)
emulate_crossing (from, to, device, GDK_LEAVE_NOTIFY, mode, time_);
if (to)
emulate_crossing (to, from, device, GDK_ENTER_NOTIFY, mode, time_);
}
}
static GdkWindow *
gdk_wayland_device_get_focus (GdkDevice *device)
{
GdkWaylandDeviceData *wayland_device = GDK_WAYLAND_DEVICE (device)->device;
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
return wayland_device->keyboard_focus;
else
return wayland_device->pointer_focus;
}
static GdkGrabStatus
gdk_wayland_device_grab (GdkDevice *device,
GdkWindow *window,
@@ -362,6 +442,10 @@ gdk_wayland_device_grab (GdkDevice *device,
guint32 time_)
{
GdkWaylandDeviceData *wayland_device = GDK_WAYLAND_DEVICE (device)->device;
GdkWindow *prev_focus = gdk_wayland_device_get_focus (device);
if (prev_focus != window)
device_emit_grab_crossing (device, prev_focus, window, GDK_CROSSING_GRAB, time_);
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
@@ -411,9 +495,23 @@ gdk_wayland_device_ungrab (GdkDevice *device,
GdkWaylandDeviceData *wayland_device = GDK_WAYLAND_DEVICE (device)->device;
GdkDisplay *display;
GdkDeviceGrabInfo *grab;
GdkWindow *focus, *prev_focus = NULL;
display = gdk_device_get_display (device);
grab = _gdk_display_get_last_device_grab (display, device);
if (grab)
{
grab->serial_end = grab->serial_start;
prev_focus = grab->window;
}
focus = gdk_wayland_device_get_focus (device);
if (focus != prev_focus)
device_emit_grab_crossing (device, prev_focus, focus, GDK_CROSSING_UNGRAB, time_);
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
{
/* Device is a keyboard */
@@ -421,11 +519,6 @@ gdk_wayland_device_ungrab (GdkDevice *device,
else
{
/* Device is a pointer */
grab = _gdk_display_get_last_device_grab (display, device);
if (grab)
grab->serial_end = grab->serial_start;
g_clear_object (&wayland_device->grab_cursor);
gdk_wayland_device_update_window_cursor (wayland_device);
@@ -452,7 +545,7 @@ gdk_wayland_device_window_at_position (GdkDevice *device,
if (win_y)
*win_y = wd->surface_y;
if (mask)
*mask = wd->modifiers;
*mask = wd->button_modifiers | wd->key_modifiers;
return wd->pointer_focus;
}
@@ -595,8 +688,7 @@ data_device_data_offer (void *data,
g_message ("data device data offer, data device %p, offer %p",
data_device, offer));
gdk_wayland_selection_set_offer (device->display, offer);
emit_selection_owner_change_forall (gdk_atom_intern_static_string ("GdkWaylandSelection"));
gdk_wayland_selection_ensure_offer (device->display, offer);
}
static void
@@ -610,6 +702,7 @@ data_device_enter (void *data,
{
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *)data;
GdkWindow *dest_window, *dnd_owner;
GdkAtom selection;
dest_window = wl_surface_get_user_data (surface);
@@ -627,7 +720,8 @@ data_device_enter (void *data,
gdk_wayland_drop_context_update_targets (device->drop_context);
dnd_owner = gdk_selection_owner_get_for_display (device->display, gdk_drag_get_selection (device->drop_context));
selection = gdk_drag_get_selection (device->drop_context);
dnd_owner = gdk_selection_owner_get_for_display (device->display, selection);
if (!dnd_owner)
dnd_owner = device->foreign_dnd_window;
@@ -641,9 +735,9 @@ data_device_enter (void *data,
wl_fixed_to_double (y));
_gdk_wayland_drag_context_emit_event (device->drop_context, GDK_DRAG_ENTER,
GDK_CURRENT_TIME);
gdk_wayland_selection_set_offer (device->display, offer);
emit_selection_owner_change (dest_window,
gdk_atom_intern_static_string ("GdkWaylandSelection"));
gdk_wayland_selection_set_offer (device->display, selection, offer);
emit_selection_owner_change_forall (selection);
}
static void
@@ -706,12 +800,7 @@ data_device_drop (void *data,
local_dnd_owner = gdk_selection_owner_get_for_display (device->display, gdk_drag_get_selection (device->drop_context));
if (local_dnd_owner)
{
GdkDragContext *source_context;
source_context = gdk_wayland_drag_context_lookup_by_source_window (local_dnd_owner);
gdk_wayland_drag_context_undo_grab (source_context);
}
gdk_wayland_device_unset_grab (device->master_pointer);
_gdk_wayland_drag_context_emit_event (device->drop_context,
GDK_DROP_START, GDK_CURRENT_TIME);
@@ -723,13 +812,15 @@ data_device_selection (void *data,
struct wl_data_offer *offer)
{
GdkWaylandDeviceData *device = (GdkWaylandDeviceData *) data;
GdkAtom selection;
GDK_NOTE (EVENTS,
g_message ("data device selection, data device %p, data offer %p",
wl_data_device, offer));
gdk_wayland_selection_set_offer (device->display, offer);
emit_selection_owner_change_forall (gdk_atom_intern_static_string ("CLIPBOARD"));
selection = gdk_atom_intern_static_string ("CLIPBOARD");
gdk_wayland_selection_set_offer (device->display, selection, offer);
emit_selection_owner_change_forall (selection);
}
static const struct wl_data_device_listener data_device_listener = {
@@ -874,7 +965,7 @@ pointer_handle_motion (void *data,
gdk_event_set_source_device (event, device->pointer);
event->motion.time = time;
event->motion.axes = NULL;
event->motion.state = device->modifiers;
event->motion.state = device->button_modifiers | device->key_modifiers;
event->motion.is_hint = 0;
gdk_event_set_screen (event, display->screen);
@@ -933,7 +1024,7 @@ pointer_handle_button (void *data,
gdk_event_set_source_device (event, device->pointer);
event->button.time = time;
event->button.axes = NULL;
event->button.state = device->modifiers;
event->button.state = device->button_modifiers | device->key_modifiers;
event->button.button = gdk_button;
gdk_event_set_screen (event, display->screen);
@@ -945,9 +1036,9 @@ pointer_handle_button (void *data,
modifier = 1 << (8 + gdk_button - 1);
if (state)
device->modifiers |= modifier;
device->button_modifiers |= modifier;
else
device->modifiers &= ~modifier;
device->button_modifiers &= ~modifier;
GDK_NOTE (EVENTS,
g_message ("button %d %s, device %p state %d",
@@ -998,7 +1089,7 @@ pointer_handle_axis (void *data,
event->scroll.direction = GDK_SCROLL_SMOOTH;
event->scroll.delta_x = delta_x;
event->scroll.delta_y = delta_y;
event->scroll.state = device->modifiers;
event->scroll.state = device->button_modifiers | device->key_modifiers;
gdk_event_set_screen (event, display->screen);
get_coordinates (device,
@@ -1254,14 +1345,14 @@ deliver_key_event (GdkWaylandDeviceData *device,
sym = xkb_state_key_get_one_sym (xkb_state, key);
device->time = time_;
device->modifiers = gdk_keymap_get_modifier_state (keymap);
device->key_modifiers = gdk_keymap_get_modifier_state (keymap);
event = gdk_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
event->key.window = device->keyboard_focus ? g_object_ref (device->keyboard_focus) : NULL;
gdk_event_set_device (event, device->master_keyboard);
gdk_event_set_source_device (event, device->keyboard);
event->key.time = time_;
event->key.state = device->modifiers;
event->key.state = device->button_modifiers | device->key_modifiers;
event->key.group = 0;
event->key.hardware_keycode = key;
event->key.keyval = sym;
@@ -1364,7 +1455,7 @@ keyboard_handle_modifiers (void *data,
keymap = device->keymap;
direction = gdk_keymap_get_direction (keymap);
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
device->modifiers = mods_depressed | mods_latched | mods_locked;
device->key_modifiers = mods_depressed | mods_latched | mods_locked;
xkb_state_update_mask (xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
@@ -1432,7 +1523,7 @@ _create_touch_event (GdkWaylandDeviceData *device,
gdk_event_set_device (event, device->master_pointer);
gdk_event_set_source_device (event, device->touch);
event->touch.time = time;
event->touch.state = device->modifiers;
event->touch.state = device->button_modifiers | device->key_modifiers;
gdk_event_set_screen (event, display->screen);
event->touch.sequence = GDK_SLOT_TO_EVENT_SEQUENCE (touch->id);
@@ -1621,7 +1712,7 @@ seat_handle_capabilities (void *data,
device_manager->devices =
g_list_prepend (device_manager->devices, device->pointer);
device->drop_context = _gdk_wayland_drop_context_new (device->pointer,
device->drop_context = _gdk_wayland_drop_context_new (device->master_pointer,
device->data_device);
g_signal_emit_by_name (device_manager, "device-added", device->pointer);
@@ -2102,3 +2193,57 @@ gdk_wayland_device_set_selection (GdkDevice *gdk_device,
wl_data_device_set_selection (device->data_device, source,
_gdk_wayland_display_get_serial (display_wayland));
}
void
gdk_wayland_device_unset_grab (GdkDevice *gdk_device)
{
GdkWaylandDeviceData *device;
GdkEventSequence *sequence;
GdkModifierType state;
GdkEvent *event;
guint button;
gdouble x, y;
device = GDK_WAYLAND_DEVICE (gdk_device)->device;
_gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (gdk_device), &sequence);
gdk_window_get_device_position_double (device->pointer_grab_window,
gdk_device, &x, &y, &state);
if (sequence)
{
event = gdk_event_new (GDK_TOUCH_END);
event->touch.window = g_object_ref (device->pointer_grab_window);
event->touch.send_event = TRUE;
event->touch.sequence = sequence;
event->touch.time = GDK_CURRENT_TIME;
event->touch.x = event->touch.x_root = x;
event->touch.y = event->touch.y_root = y;
}
else if (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
{
if (state & GDK_BUTTON1_MASK)
button = 1;
else if (state & GDK_BUTTON2_MASK)
button = 2;
else if (state & GDK_BUTTON3_MASK)
button = 3;
else
return;
event = gdk_event_new (GDK_BUTTON_RELEASE);
event->button.window = g_object_ref (device->pointer_grab_window);
event->button.send_event = TRUE;
event->button.button = button;
event->button.time = GDK_CURRENT_TIME;
event->button.x = event->button.x_root = x;
event->button.y = event->button.y_root = y;
}
else
return;
device->button_modifiers = 0;
gdk_event_set_device (event, gdk_device);
gdk_event_set_source_device (event, gdk_device);
_gdk_wayland_display_deliver_event (gdk_device_get_display (gdk_device), event);
}
+24 -63
View File
@@ -43,7 +43,6 @@ struct _GdkWaylandDragContext
GdkWindow *dnd_window;
struct wl_surface *dnd_surface;
struct wl_data_source *data_source;
struct wl_data_offer *offer;
uint32_t serial;
gdouble x;
gdouble y;
@@ -196,8 +195,10 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
struct wl_data_offer *wl_offer;
context_wayland = GDK_WAYLAND_DRAG_CONTEXT (context);
display = gdk_window_get_display (context->source_window);
wl_offer = gdk_wayland_selection_get_offer (display);
display = gdk_device_get_display (gdk_drag_context_get_device (context));
wl_offer = gdk_wayland_selection_get_offer (display,
gdk_drag_get_selection (context));
if (!wl_offer)
return;
@@ -214,8 +215,10 @@ gdk_wayland_drop_context_set_status (GdkDragContext *context,
if (l)
{
wl_data_offer_accept (wl_offer, context_wayland->serial,
gdk_atom_name (l->data));
gchar *mimetype = gdk_atom_name (l->data);
wl_data_offer_accept (wl_offer, context_wayland->serial, mimetype);
g_free (mimetype);
return;
}
}
@@ -245,10 +248,15 @@ gdk_wayland_drag_context_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time)
{
GdkDisplay *display = gdk_window_get_display (context->source_window);
GdkDisplay *display = gdk_device_get_display (gdk_drag_context_get_device (context));
GdkAtom selection;
if (gdk_selection_owner_get_for_display (display, gdk_drag_get_selection (context)))
gdk_wayland_selection_unset_data_source (display, gdk_drag_get_selection (context));
selection = gdk_drag_get_selection (context);
if (gdk_selection_owner_get_for_display (display, selection))
gdk_wayland_selection_unset_data_source (display, selection);
gdk_wayland_selection_set_offer (display, selection, NULL);
}
static gboolean
@@ -353,7 +361,12 @@ _gdk_wayland_window_drag_begin (GdkWindow *window,
gdk_wayland_drag_context_get_selection (context));
for (l = context->targets; l; l = l->next)
wl_data_source_offer (context_wayland->data_source, gdk_atom_name (l->data));
{
gchar *mimetype = gdk_atom_name (l->data);
wl_data_source_offer (context_wayland->data_source, mimetype);
g_free (mimetype);
}
wl_data_device_start_drag (gdk_wayland_device_get_data_device (device),
context_wayland->data_source,
@@ -389,7 +402,8 @@ gdk_wayland_drop_context_update_targets (GdkDragContext *context)
device = gdk_drag_context_get_device (context);
display = gdk_device_get_display (device);
g_list_free (context->targets);
context->targets = g_list_copy (gdk_wayland_selection_get_targets (display));
context->targets = g_list_copy (gdk_wayland_selection_get_targets (display,
gdk_drag_get_selection (context)));
}
void
@@ -463,59 +477,6 @@ gdk_wayland_drag_context_get_data_source (GdkDragContext *context)
return GDK_WAYLAND_DRAG_CONTEXT (context)->data_source;
}
void
gdk_wayland_drag_context_undo_grab (GdkDragContext *context)
{
GdkEventSequence *sequence;
GdkModifierType state;
GdkDevice *device;
GdkEvent *event;
guint button;
gdouble x, y;
device = gdk_drag_context_get_device (context);
_gdk_wayland_device_get_last_implicit_grab_serial (GDK_WAYLAND_DEVICE (device), &sequence);
gdk_window_get_device_position_double (gdk_drag_context_get_source_window (context),
device, &x, &y, &state);
if (sequence)
{
event = gdk_event_new (GDK_TOUCH_END);
event->touch.window = g_object_ref (gdk_drag_context_get_source_window (context));
event->touch.send_event = TRUE;
event->touch.sequence = sequence;
event->touch.time = GDK_CURRENT_TIME;
event->touch.x = event->touch.x_root = x;
event->touch.y = event->touch.y_root = y;
}
else if (state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK))
{
if (state & GDK_BUTTON1_MASK)
button = 1;
else if (state & GDK_BUTTON2_MASK)
button = 2;
else if (state & GDK_BUTTON3_MASK)
button = 3;
else
return;
event = gdk_event_new (GDK_BUTTON_RELEASE);
event->button.window = g_object_ref (gdk_drag_context_get_source_window (context));
event->button.send_event = TRUE;
event->button.button = button;
event->button.time = GDK_CURRENT_TIME;
event->button.x = event->button.x_root = x;
event->button.y = event->button.y_root = y;
}
else
return;
gdk_event_set_device (event, device);
gdk_event_set_source_device (event, device);
_gdk_wayland_display_deliver_event (gdk_device_get_display (device), event);
}
GdkWindow *
gdk_wayland_drag_context_get_dnd_window (GdkDragContext *context)
{
+9 -4
View File
@@ -125,8 +125,6 @@ GdkDragContext * gdk_wayland_drag_context_lookup_by_data_source (struct wl_dat
GdkDragContext * gdk_wayland_drag_context_lookup_by_source_window (GdkWindow *window);
struct wl_data_source * gdk_wayland_drag_context_get_data_source (GdkDragContext *context);
void gdk_wayland_drag_context_undo_grab (GdkDragContext *context);
void gdk_wayland_drop_context_update_targets (GdkDragContext *context);
void _gdk_wayland_display_create_window_impl (GdkDisplay *display,
@@ -187,6 +185,8 @@ struct wl_data_device * gdk_wayland_device_get_data_device (GdkDevice *gdk_devic
void gdk_wayland_device_set_selection (GdkDevice *gdk_device,
struct wl_data_source *source);
void gdk_wayland_device_unset_grab (GdkDevice *device);
void gdk_wayland_device_unset_touch_grab (GdkDevice *device,
GdkEventSequence *sequence);
@@ -237,10 +237,15 @@ GdkWaylandSelection * gdk_wayland_display_get_selection (GdkDisplay *display);
GdkWaylandSelection * gdk_wayland_selection_new (void);
void gdk_wayland_selection_free (GdkWaylandSelection *selection);
void gdk_wayland_selection_ensure_offer (GdkDisplay *display,
struct wl_data_offer *wl_offer);
void gdk_wayland_selection_set_offer (GdkDisplay *display,
GdkAtom selection,
struct wl_data_offer *wl_offer);
struct wl_data_offer * gdk_wayland_selection_get_offer (GdkDisplay *display);
GList * gdk_wayland_selection_get_targets (GdkDisplay *display);
struct wl_data_offer * gdk_wayland_selection_get_offer (GdkDisplay *display,
GdkAtom selection);
GList * gdk_wayland_selection_get_targets (GdkDisplay *display,
GdkAtom selection);
void gdk_wayland_selection_store (GdkWindow *window,
GdkAtom type,
+207 -62
View File
@@ -36,6 +36,7 @@
typedef struct _SelectionBuffer SelectionBuffer;
typedef struct _StoredSelection StoredSelection;
typedef struct _AsyncWriteData AsyncWriteData;
typedef struct _DataOfferData DataOfferData;
struct _SelectionBuffer
{
@@ -64,6 +65,13 @@ struct _DataSourceData
GdkAtom selection;
};
struct _DataOfferData
{
struct wl_data_offer *offer;
GList *targets; /* List of GdkAtom */
GdkAtom requested_target;
};
struct _AsyncWriteData
{
GOutputStream *stream;
@@ -81,14 +89,14 @@ static GdkAtom atoms[2] = { 0 };
struct _GdkWaylandSelection
{
/* Destination-side data */
struct wl_data_offer *offer;
GdkAtom source_requested_target;
DataOfferData *dnd_offer;
DataOfferData *clipboard_offer;
GHashTable *offers; /* Currently alive offers, Hashtable of wl_data_offer->DataOfferData */
GHashTable *selection_buffers; /* Hashtable of target_atom->SelectionBuffer */
GList *targets; /* List of GdkAtom */
/* Source-side data */
StoredSelection stored_selection;
GArray *source_targets;
struct wl_data_source *clipboard_source;
GdkWindow *clipboard_owner;
@@ -259,6 +267,25 @@ selection_buffer_read (SelectionBuffer *buffer)
buffer);
}
static DataOfferData *
data_offer_data_new (struct wl_data_offer *offer)
{
DataOfferData *info;
info = g_slice_new0 (DataOfferData);
info->offer = offer;
return info;
}
static void
data_offer_data_free (DataOfferData *info)
{
wl_data_offer_destroy (info->offer);
g_list_free (info->targets);
g_slice_free (DataOfferData, info);
}
GdkWaylandSelection *
gdk_wayland_selection_new (void)
{
@@ -270,8 +297,13 @@ gdk_wayland_selection_new (void)
selection = g_new0 (GdkWaylandSelection, 1);
selection->selection_buffers =
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) selection_buffer_cancel_and_unref);
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);
selection->stored_selection.fd = -1;
selection->source_targets = g_array_new (FALSE, FALSE, sizeof (GdkAtom));
return selection;
}
@@ -279,10 +311,9 @@ void
gdk_wayland_selection_free (GdkWaylandSelection *selection)
{
g_hash_table_destroy (selection->selection_buffers);
g_array_unref (selection->source_targets);
if (selection->targets)
g_list_free (selection->targets);
g_hash_table_destroy (selection->offers);
g_free (selection->stored_selection.data);
if (selection->stored_selection.cancellable)
@@ -294,8 +325,6 @@ gdk_wayland_selection_free (GdkWaylandSelection *selection)
if (selection->stored_selection.fd > 0)
close (selection->stored_selection.fd);
if (selection->offer)
wl_data_offer_destroy (selection->offer);
if (selection->clipboard_source)
wl_data_source_destroy (selection->clipboard_source);
if (selection->dnd_source)
@@ -310,57 +339,105 @@ data_offer_offer (void *data,
const char *type)
{
GdkWaylandSelection *selection = data;
DataOfferData *info;
GdkAtom atom = gdk_atom_intern (type, FALSE);
if (g_list_find (selection->targets, atom))
info = g_hash_table_lookup (selection->offers, wl_data_offer);
if (!info || g_list_find (info->targets, atom))
return;
selection->targets = g_list_prepend (selection->targets, atom);
info->targets = g_list_prepend (info->targets, atom);
}
static const struct wl_data_offer_listener data_offer_listener = {
data_offer_offer,
};
DataOfferData *
selection_lookup_offer_by_atom (GdkWaylandSelection *selection,
GdkAtom selection_atom)
{
if (selection_atom == atoms[ATOM_CLIPBOARD])
return selection->clipboard_offer;
else if (selection_atom == atoms[ATOM_DND])
return selection->dnd_offer;
else
return NULL;
}
void
gdk_wayland_selection_ensure_offer (GdkDisplay *display,
struct wl_data_offer *wl_offer)
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
DataOfferData *info;
info = g_hash_table_lookup (selection->offers, wl_offer);
if (!info)
{
info = data_offer_data_new (wl_offer);
g_hash_table_insert (selection->offers, wl_offer, info);
wl_data_offer_add_listener (wl_offer,
&data_offer_listener,
selection);
}
}
void
gdk_wayland_selection_set_offer (GdkDisplay *display,
GdkAtom selection_atom,
struct wl_data_offer *wl_offer)
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
struct wl_data_offer *prev_offer;
DataOfferData *info;
if (selection->offer == wl_offer)
return;
info = g_hash_table_lookup (selection->offers, wl_offer);
if (selection->offer)
wl_data_offer_destroy (selection->offer);
prev_offer = gdk_wayland_selection_get_offer (display, selection_atom);
selection->offer = wl_offer;
if (prev_offer)
g_hash_table_remove (selection->offers, prev_offer);
if (wl_offer)
wl_data_offer_add_listener (wl_offer,
&data_offer_listener,
selection);
if (selection_atom == atoms[ATOM_CLIPBOARD])
selection->clipboard_offer = info;
else if (selection_atom == atoms[ATOM_DND])
selection->dnd_offer = info;
/* Clear all buffers */
g_hash_table_remove_all (selection->selection_buffers);
g_list_free (selection->targets);
selection->targets = NULL;
}
struct wl_data_offer *
gdk_wayland_selection_get_offer (GdkDisplay *display)
gdk_wayland_selection_get_offer (GdkDisplay *display,
GdkAtom selection_atom)
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
const DataOfferData *info;
return selection->offer;
info = selection_lookup_offer_by_atom (selection, selection_atom);
if (info)
return info->offer;
return NULL;
}
GList *
gdk_wayland_selection_get_targets (GdkDisplay *display)
gdk_wayland_selection_get_targets (GdkDisplay *display,
GdkAtom selection_atom)
{
GdkWaylandSelection *selection = gdk_wayland_display_get_selection (display);
const DataOfferData *info;
return selection->targets;
info = selection_lookup_offer_by_atom (selection, selection_atom);
if (info)
return info->targets;
return NULL;
}
static void
@@ -465,6 +542,15 @@ gdk_wayland_selection_check_write (GdkWaylandSelection *selection)
selection->stored_selection.data_len == 0)
return FALSE;
/* Cancel any previous ongoing async write */
if (selection->stored_selection.cancellable)
{
g_cancellable_cancel (selection->stored_selection.cancellable);
g_object_unref (selection->stored_selection.cancellable);
}
selection->stored_selection.cancellable = g_cancellable_new ();
write_data = async_write_data_new (selection);
async_write_data_write (write_data);
selection->stored_selection.fd = -1;
@@ -491,10 +577,16 @@ gdk_wayland_selection_store (GdkWindow *window,
if (mode != GDK_PROP_MODE_REPLACE &&
type != selection->stored_selection.type)
{
gchar *type_str, *stored_str;
type_str = gdk_atom_name (type);
stored_str = gdk_atom_name (selection->stored_selection.type);
g_warning (G_STRLOC ": Attempted to append/prepend selection data with "
"type %s into the current selection with type %s",
gdk_atom_name (type),
gdk_atom_name (selection->stored_selection.type));
type_str, stored_str);
g_free (type_str);
g_free (stored_str);
return;
}
@@ -511,17 +603,10 @@ gdk_wayland_selection_store (GdkWindow *window,
g_free (selection->stored_selection.data);
}
if (selection->stored_selection.cancellable)
{
g_cancellable_cancel (selection->stored_selection.cancellable);
g_object_unref (selection->stored_selection.cancellable);
}
selection->stored_selection.source = window;
selection->stored_selection.data_len = array->len;
selection->stored_selection.data = (guchar *) g_array_free (array, FALSE);
selection->stored_selection.type = type;
selection->stored_selection.cancellable = g_cancellable_new ();
gdk_wayland_selection_check_write (selection);
}
@@ -545,12 +630,34 @@ gdk_wayland_selection_lookup_requestor_buffer (GdkWindow *requestor)
return NULL;
}
static gboolean
gdk_wayland_selection_source_handles_target (GdkWaylandSelection *wayland_selection,
GdkAtom target)
{
GdkAtom atom;
guint i;
if (target == GDK_NONE)
return FALSE;
for (i = 0; i < wayland_selection->source_targets->len; i++)
{
atom = g_array_index (wayland_selection->source_targets, GdkAtom, i);
if (atom == target)
return TRUE;
}
return FALSE;
}
static gboolean
gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
GdkWindow *window,
GdkAtom target,
gint fd)
{
DataOfferData *offer;
GdkAtom selection;
if (wayland_selection->clipboard_owner == window)
@@ -560,19 +667,33 @@ gdk_wayland_selection_request_target (GdkWaylandSelection *wayland_selection,
else
return FALSE;
offer = selection_lookup_offer_by_atom (wayland_selection, selection);
if (wayland_selection->stored_selection.fd == fd &&
wayland_selection->source_requested_target == target)
offer->requested_target == target)
return FALSE;
/* If we didn't issue gdk_wayland_selection_check_write() yet
* on a previous fd, it will still linger here. Just close it,
* as we can't have more than one fd on the fly.
*/
if (wayland_selection->stored_selection.fd >= 0)
close (wayland_selection->stored_selection.fd);
wayland_selection->stored_selection.fd = fd;
offer->requested_target = target;
wayland_selection->source_requested_target = target;
if (window && target != GDK_NONE)
if (window &&
gdk_wayland_selection_source_handles_target (wayland_selection, target))
{
gdk_wayland_selection_emit_request (window, selection, target);
return TRUE;
}
else
{
close (fd);
wayland_selection->stored_selection.fd = -1;
}
return FALSE;
}
@@ -633,7 +754,10 @@ data_source_send (void *data,
G_STRFUNC, source, mime_type, fd);
if (!mime_type)
return;
{
close (fd);
return;
}
context = gdk_wayland_drag_context_lookup_by_data_source (source);
@@ -642,7 +766,10 @@ data_source_send (void *data,
else if (source == wayland_selection->clipboard_source)
window = wayland_selection->clipboard_owner;
else
return;
{
close (fd);
return;
}
if (!gdk_wayland_selection_request_target (wayland_selection, window,
gdk_atom_intern (mime_type, FALSE),
@@ -651,12 +778,10 @@ data_source_send (void *data,
if (context)
{
gdk_wayland_drag_context_undo_grab (context);
gdk_wayland_device_unset_grab (gdk_drag_context_get_device (context));
_gdk_wayland_drag_context_emit_event (context, GDK_DROP_FINISHED,
GDK_CURRENT_TIME);
}
wayland_selection->source_requested_target = GDK_NONE;
}
static void
@@ -679,7 +804,7 @@ data_source_cancelled (void *data,
context = gdk_wayland_drag_context_lookup_by_data_source (source);
if (context)
gdk_wayland_drag_context_undo_grab (context);
gdk_wayland_device_unset_grab (gdk_drag_context_get_device (context));
}
else if (source == wayland_selection->clipboard_source)
gdk_wayland_selection_unset_data_source (display, atoms[ATOM_CLIPBOARD]);
@@ -879,8 +1004,14 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
SelectionBuffer *buffer_data;
struct wl_data_offer *offer;
gchar *mimetype;
GList *target_list;
if (!wayland_selection->offer)
offer = gdk_wayland_selection_get_offer (display, selection);
target_list = gdk_wayland_selection_get_targets (display, selection);
if (!offer)
{
GdkEvent *event;
@@ -898,10 +1029,12 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
return;
}
mimetype = gdk_atom_name (target);
if (target != gdk_atom_intern_static_string ("TARGETS"))
wl_data_offer_accept (wayland_selection->offer,
wl_data_offer_accept (offer,
_gdk_wayland_display_get_serial (GDK_WAYLAND_DISPLAY (display)),
gdk_atom_name (target));
mimetype);
buffer_data = g_hash_table_lookup (wayland_selection->selection_buffers,
target);
@@ -912,25 +1045,23 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
{
GInputStream *stream = NULL;
int pipe_fd[2], natoms = 0;
GdkAtom *atoms = NULL;
GdkAtom *targets = NULL;
if (target == gdk_atom_intern_static_string ("TARGETS"))
{
gint i = 0;
GList *l;
natoms = g_list_length (wayland_selection->targets);
atoms = g_new0 (GdkAtom, natoms);
natoms = g_list_length (target_list);
targets = g_new0 (GdkAtom, natoms);
for (l = wayland_selection->targets; l; l = l->next)
atoms[i++] = l->data;
for (l = target_list; l; l = l->next)
targets[i++] = l->data;
}
else
{
g_unix_open_pipe (pipe_fd, FD_CLOEXEC, NULL);
wl_data_offer_receive (wayland_selection->offer,
gdk_atom_name (target),
pipe_fd[1]);
wl_data_offer_receive (offer, mimetype, pipe_fd[1]);
stream = g_unix_input_stream_new (pipe_fd[0], TRUE);
close (pipe_fd[1]);
}
@@ -941,11 +1072,11 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
if (stream)
g_object_unref (stream);
if (atoms)
if (targets)
{
/* Store directly the local atoms */
selection_buffer_append_data (buffer_data, atoms, natoms * sizeof (GdkAtom));
g_free (atoms);
selection_buffer_append_data (buffer_data, targets, natoms * sizeof (GdkAtom));
g_free (targets);
}
g_hash_table_insert (wayland_selection->selection_buffers,
@@ -955,6 +1086,8 @@ _gdk_wayland_display_convert_selection (GdkDisplay *display,
if (!buffer_data->stream)
selection_buffer_notify (buffer_data);
g_free (mimetype);
}
gint
@@ -1011,6 +1144,8 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
guint ntargets,
GdkAtom *targets)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
struct wl_data_source *data_source;
guint i;
@@ -1021,8 +1156,15 @@ gdk_wayland_selection_add_targets (GdkWindow *window,
if (!data_source)
return;
g_array_append_vals (wayland_selection->source_targets, targets, ntargets);
for (i = 0; i < ntargets; i++)
wl_data_source_offer (data_source, gdk_atom_name (targets[i]));
{
gchar *mimetype = gdk_atom_name (targets[i]);
wl_data_source_offer (data_source, mimetype);
g_free (mimetype);
}
if (selection == atoms[ATOM_CLIPBOARD])
{
@@ -1041,5 +1183,8 @@ void
gdk_wayland_selection_clear_targets (GdkDisplay *display,
GdkAtom selection)
{
GdkWaylandSelection *wayland_selection = gdk_wayland_display_get_selection (display);
g_array_set_size (wayland_selection->source_targets, 0);
gdk_wayland_selection_unset_data_source (display, selection);
}
+46 -14
View File
@@ -108,6 +108,7 @@ struct _GdkWindowImplWayland
unsigned int use_custom_surface : 1;
unsigned int pending_commit : 1;
unsigned int awaiting_frame : 1;
unsigned int position_set : 1;
GdkWindowTypeHint hint;
GdkWindow *transient_for;
@@ -157,6 +158,8 @@ static void gdk_wayland_window_configure (GdkWindow *window,
static void maybe_set_gtk_surface_dbus_properties (GdkWindow *window);
static void gdk_window_request_transient_parent_commit (GdkWindow *window);
GType _gdk_window_impl_wayland_get_type (void);
G_DEFINE_TYPE (GdkWindowImplWayland, _gdk_window_impl_wayland, GDK_TYPE_WINDOW_IMPL)
@@ -881,6 +884,7 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
impl->surface, parent_impl->surface);
wl_subsurface_set_position (impl->subsurface, window->x, window->y);
wl_subsurface_set_desync (impl->subsurface);
gdk_window_request_transient_parent_commit (window);
}
}
@@ -1108,12 +1112,6 @@ gdk_wayland_window_create_xdg_popup (GdkWindow *window,
x = window->x - parent_x;
y = window->y - parent_y;
if (parent_impl->xdg_surface)
{
x -= parent_impl->margin_left;
y -= parent_impl->margin_top;
}
impl->xdg_popup = xdg_shell_get_xdg_popup (display->xdg_shell,
impl->surface,
parent_impl->surface,
@@ -1179,7 +1177,7 @@ static void
gdk_wayland_window_map (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindow *transient_for;
GdkWindow *transient_for = NULL;
if (!should_be_mapped (window))
return;
@@ -1189,17 +1187,50 @@ gdk_wayland_window_map (GdkWindow *window)
/* Popup menus can appear without a transient parent, which means they
* cannot be positioned properly on Wayland. This attempts to guess the
* surface they should be positioned with by finding the surface beneath
* the device that created the grab for the popup window
* the device that created the grab for the popup window.
*/
if (!impl->transient_for && impl->hint == GDK_WINDOW_TYPE_HINT_POPUP_MENU)
{
transient_for = gdk_device_get_window_at_position (impl->grab_device, NULL, NULL);
transient_for = gdk_window_get_toplevel (transient_for);
GdkDevice *grab_device;
/* start the popup at the position of the device that holds the grab */
gdk_window_get_device_position (transient_for,
impl->grab_device,
&window->x, &window->y, NULL);
/* The popup menu window is not the grabbed window. This may mean
* that a "transfer window" (see gtkmenu.c) is used, and we need
* to find that window to get the grab device. If so is the case
* the "transfer window" can be retrieved via the
* "gdk-attached-grab-window" associated data field.
*/
if (!impl->grab_device)
{
GdkWindow *attached_grab_window =
g_object_get_data (G_OBJECT (window),
"gdk-attached-grab-window");
if (attached_grab_window)
{
GdkWindowImplWayland *attached_impl =
GDK_WINDOW_IMPL_WAYLAND (attached_grab_window->impl);
grab_device = attached_impl->grab_device;
transient_for =
gdk_device_get_window_at_position (grab_device,
NULL, NULL);
}
}
else
{
grab_device = impl->grab_device;
transient_for =
gdk_device_get_window_at_position (grab_device, NULL, NULL);
}
if (transient_for)
transient_for = gdk_window_get_toplevel (transient_for);
/* If the position was not explicitly set, start the popup at the
* position of the device that holds the grab.
*/
if (!impl->position_set)
gdk_window_get_device_position (transient_for,
impl->grab_device,
&window->x, &window->y, NULL);
}
else
transient_for = impl->transient_for;
@@ -1418,6 +1449,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
{
window->x = x;
window->y = y;
impl->position_set = 1;
if (impl->subsurface)
{
+4 -4
View File
@@ -610,12 +610,12 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
{
xResourceReq *resource_req;
xGetPropertyReq *prop_req;
Window window = state.children[i];
Window win = state.children[i];
if (get_wm_state)
{
GetReq (GetProperty, prop_req);
prop_req->window = window;
prop_req->window = win;
prop_req->property = wm_state_atom;
prop_req->type = AnyPropertyType;
prop_req->delete = False;
@@ -625,10 +625,10 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
state.child_states[i].seq[CHILD_INFO_GET_PROPERTY] = dpy->request;
}
GetResReq(GetWindowAttributes, window, resource_req);
GetResReq(GetWindowAttributes, win, resource_req);
state.child_states[i].seq[CHILD_INFO_GET_WA] = dpy->request;
GetResReq(GetGeometry, window, resource_req);
GetResReq(GetGeometry, win, resource_req);
state.child_states[i].seq[CHILD_INFO_GET_GEOMETRY] = dpy->request;
}
+1 -2
View File
@@ -466,10 +466,9 @@ gdk_x11_device_core_window_at_position (GdkDevice *device,
{
gint width, height;
GList *toplevels, *list;
Window pointer_window, root, child;
Window pointer_window;
int rootx = -1, rooty = -1;
int winx, winy;
unsigned int xmask;
/* FIXME: untrusted clients case not multidevice-safe */
pointer_window = None;
+1 -1
View File
@@ -534,7 +534,7 @@ gdk_x11_device_xi2_window_at_position (GdkDevice *device,
{
gint width, height;
GList *toplevels, *list;
Window pointer_window, root, child;
Window pointer_window;
/* FIXME: untrusted clients case not multidevice-safe */
pointer_window = None;
+2 -5
View File
@@ -214,7 +214,6 @@ translate_device_classes (GdkDisplay *display,
case XIKeyClass:
{
XIKeyClassInfo *key_info = (XIKeyClassInfo *) class_info;
gint i;
_gdk_device_set_keys (device, key_info->num_keycodes);
@@ -1508,11 +1507,9 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
if (gdk_device_get_mode (event->motion.device) == GDK_MODE_WINDOW)
{
GdkDevice *device = event->motion.device;
/* Update event coordinates from axes */
gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_X, &event->motion.x);
gdk_device_get_axis (device, event->motion.axes, GDK_AXIS_Y, &event->motion.y);
gdk_device_get_axis (event->motion.device, event->motion.axes, GDK_AXIS_X, &event->motion.x);
gdk_device_get_axis (event->motion.device, event->motion.axes, GDK_AXIS_Y, &event->motion.y);
}
}
break;
+5 -5
View File
@@ -151,7 +151,7 @@ _gdk_x11_display_free_translate_queue (GdkDisplay *display)
static void
gdk_window_queue (GdkWindow *window,
GdkWindowQueueItem *item)
GdkWindowQueueItem *new_item)
{
GdkX11Display *display_x11 = GDK_X11_DISPLAY (GDK_WINDOW_DISPLAY (window));
@@ -205,13 +205,13 @@ gdk_window_queue (GdkWindow *window,
}
}
item->window = window;
item->serial = NextRequest (GDK_WINDOW_XDISPLAY (window));
new_item->window = window;
new_item->serial = NextRequest (GDK_WINDOW_XDISPLAY (window));
g_object_add_weak_pointer (G_OBJECT (window),
(gpointer *)&(item->window));
(gpointer *)&(new_item->window));
g_queue_push_tail (display_x11->translate_queue, item);
g_queue_push_tail (display_x11->translate_queue, new_item);
}
void
+5 -5
View File
@@ -372,17 +372,17 @@ update_keymaps (GdkX11Keymap *keymap_x11)
for (i = 0; i < map_size; i++)
{
/* Get the key code at this point in the map. */
gint keycode = keymap_x11->mod_keymap->modifiermap[i];
gint code = keymap_x11->mod_keymap->modifiermap[i];
gint j;
KeySym *syms;
guint mask;
/* Ignore invalid keycodes. */
if (keycode < keymap_x11->min_keycode ||
keycode > keymap_x11->max_keycode)
if (code < keymap_x11->min_keycode ||
code > keymap_x11->max_keycode)
continue;
syms = keymap_x11->keymap + (keycode - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
syms = keymap_x11->keymap + (code - keymap_x11->min_keycode) * keymap_x11->keysyms_per_keycode;
mask = 0;
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
@@ -398,7 +398,7 @@ update_keymaps (GdkX11Keymap *keymap_x11)
mask |= GDK_SUPER_MASK;
}
keymap_x11->modmap[i/keymap_x11->mod_keymap->max_keypermod] |= mask;
keymap_x11->modmap[i / keymap_x11->mod_keymap->max_keypermod] |= mask;
/* The fourth modifier, GDK_MOD1_MASK is 1 << 3.
* Each group of max_keypermod entries refers to the same modifier.
+3 -90
View File
@@ -37,94 +37,7 @@
#include <X11/Xatom.h>
#include <string.h>
static const gchar xatoms_string[] =
/* These are all the standard predefined X atoms */
"\0" /* leave a space for None, even though it is not a predefined atom */
"PRIMARY\0"
"SECONDARY\0"
"ARC\0"
"ATOM\0"
"BITMAP\0"
"CARDINAL\0"
"COLORMAP\0"
"CURSOR\0"
"CUT_BUFFER0\0"
"CUT_BUFFER1\0"
"CUT_BUFFER2\0"
"CUT_BUFFER3\0"
"CUT_BUFFER4\0"
"CUT_BUFFER5\0"
"CUT_BUFFER6\0"
"CUT_BUFFER7\0"
"DRAWABLE\0"
"FONT\0"
"INTEGER\0"
"PIXMAP\0"
"POINT\0"
"RECTANGLE\0"
"RESOURCE_MANAGER\0"
"RGB_COLOR_MAP\0"
"RGB_BEST_MAP\0"
"RGB_BLUE_MAP\0"
"RGB_DEFAULT_MAP\0"
"RGB_GRAY_MAP\0"
"RGB_GREEN_MAP\0"
"RGB_RED_MAP\0"
"STRING\0"
"VISUALID\0"
"WINDOW\0"
"WM_COMMAND\0"
"WM_HINTS\0"
"WM_CLIENT_MACHINE\0"
"WM_ICON_NAME\0"
"WM_ICON_SIZE\0"
"WM_NAME\0"
"WM_NORMAL_HINTS\0"
"WM_SIZE_HINTS\0"
"WM_ZOOM_HINTS\0"
"MIN_SPACE\0"
"NORM_SPACE\0"
"MAX_SPACE\0"
"END_SPACE\0"
"SUPERSCRIPT_X\0"
"SUPERSCRIPT_Y\0"
"SUBSCRIPT_X\0"
"SUBSCRIPT_Y\0"
"UNDERLINE_POSITION\0"
"UNDERLINE_THICKNESS\0"
"STRIKEOUT_ASCENT\0"
"STRIKEOUT_DESCENT\0"
"ITALIC_ANGLE\0"
"X_HEIGHT\0"
"QUAD_WIDTH\0"
"WEIGHT\0"
"POINT_SIZE\0"
"RESOLUTION\0"
"COPYRIGHT\0"
"NOTICE\0"
"FONT_NAME\0"
"FAMILY_NAME\0"
"FULL_NAME\0"
"CAP_HEIGHT\0"
"WM_CLASS\0"
"WM_TRANSIENT_FOR\0"
/* Below here, these are our additions. Increment N_CUSTOM_PREDEFINED
* if you add any.
*/
"CLIPBOARD\0" /* = 69 */
;
static const gint xatoms_offset[] = {
0, 1, 9, 19, 23, 28, 35, 44, 53, 60, 72, 84,
96, 108, 120, 132, 144, 156, 165, 170, 178, 185, 189, 201,
218, 232, 245, 258, 274, 287, 301, 313, 320, 329, 336, 347,
356, 374, 387, 400, 408, 424, 438, 452, 462, 473, 483, 493,
507, 521, 533, 545, 564, 584, 601, 619, 632, 641, 652, 659,
670, 681, 691, 698, 708, 720, 730, 741, 750, 767
};
#define N_CUSTOM_PREDEFINED 1
#define N_PREDEFINED_ATOMS 69
#define ATOM_TO_INDEX(atom) (GPOINTER_TO_UINT(atom))
#define INDEX_TO_ATOM(atom) ((GdkAtom)GUINT_TO_POINTER(atom))
@@ -156,7 +69,7 @@ lookup_cached_xatom (GdkDisplay *display,
{
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
if (ATOM_TO_INDEX (atom) < G_N_ELEMENTS (xatoms_offset) - N_CUSTOM_PREDEFINED)
if (ATOM_TO_INDEX (atom) < N_PREDEFINED_ATOMS)
return ATOM_TO_INDEX (atom);
if (display_x11->atom_from_virtual)
@@ -291,7 +204,7 @@ gdk_x11_xatom_to_atom_for_display (GdkDisplay *display,
display_x11 = GDK_X11_DISPLAY (display);
if (xatom < G_N_ELEMENTS (xatoms_offset) - N_CUSTOM_PREDEFINED)
if (xatom < N_PREDEFINED_ATOMS)
return INDEX_TO_ATOM (xatom);
if (display_x11->atom_to_virtual)
-14
View File
@@ -53,20 +53,6 @@ static gboolean gdk_visual_equal (Visual *a,
Visual *b);
#ifdef G_ENABLE_DEBUG
static const gchar *const visual_names[] =
{
"static gray",
"grayscale",
"static color",
"pseudo color",
"true color",
"direct color",
};
#endif /* G_ENABLE_DEBUG */
G_DEFINE_TYPE (GdkX11Visual, gdk_x11_visual, GDK_TYPE_VISUAL)
static void
+8 -2
View File
@@ -474,6 +474,7 @@ gtk_private_h_sources = \
gtkorientableprivate.h \
gtkpango.h \
gtkpathbar.h \
gtkplacessidebarprivate.h \
gtkpopoverprivate.h \
gtkprintoperation-private.h \
gtkprintutils.h \
@@ -481,6 +482,7 @@ gtk_private_h_sources = \
gtkpixelcacheprivate.h \
gtkquery.h \
gtkrangeprivate.h \
gtkrenderopsprivate.h \
gtkrbtree.h \
gtkrecentchooserdefault.h \
gtkrecentchooserprivate.h \
@@ -496,6 +498,7 @@ gtk_private_h_sources = \
gtksearchenginesimple.h \
gtksearchentryprivate.h \
gtkselectionprivate.h \
gtksidebarrowprivate.h \
gtksettingsprivate.h \
gtksizegroup-private.h \
gtksizerequestcacheprivate.h \
@@ -780,6 +783,7 @@ gtk_base_c_sources = \
gtkrenderbackground.c \
gtkrenderborder.c \
gtkrendericon.c \
gtkrenderops.c \
gtkresources.c \
gtkrevealer.c \
gtkroundedbox.c \
@@ -793,6 +797,7 @@ gtk_base_c_sources = \
gtkseparatormenuitem.c \
gtkseparatortoolitem.c \
gtksettings.c \
gtksidebarrow.c \
gtksizegroup.c \
gtksizerequest.c \
gtksizerequestcache.c \
@@ -1086,7 +1091,8 @@ templates = \
ui/gtksearchbar.ui \
ui/gtkscalebutton.ui \
ui/gtkstatusbar.ui \
ui/gtkvolumebutton.ui
ui/gtkvolumebutton.ui \
ui/gtksidebarrow.ui
#
# rules to generate built sources
@@ -1340,7 +1346,7 @@ distclean-local:
if HAVE_INTROSPECTION
introspection_files = \
$(filter-out %private.h gtktextdisplay.h gtktextlayout.h gtkx.h, $(gtkinclude_HEADERS) $(a11yinclude_HEADERS) $(deprecatedinclude_HEADERS)) \
$(filter-out %win32.c %quartz.c, $(gtk_base_c_sources)) \
$(filter-out %win32.c, $(gtk_base_c_sources)) \
gtkprintoperation-unix.c \
gtktypebuiltins.h \
gtktypebuiltins.c
+44
View File
@@ -136,6 +136,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
widget_class->get_preferred_height_for_width = gtk_alignment_get_preferred_height_for_width;
widget_class->get_preferred_height_and_baseline_for_width = gtk_alignment_get_preferred_height_and_baseline_for_width;
/**
* GtkAlignment:xalign:
*
* Horizontal position of child in available space. A value of 0.0
* will flush the child left (or right, in RTL locales); a value
* of 1.0 will flush the child right (or left, in RTL locales).
*
* Deprecated: 3.14: Use gtk_widget_set_halign() on the child instead
*/
g_object_class_install_property (gobject_class,
PROP_XALIGN,
g_param_spec_float("xalign",
@@ -146,6 +155,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
0.5,
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
/**
* GtkAlignment:yalign:
*
* Vertical position of child in available space. A value of 0.0
* will flush the child to the top; a value of 1.0 will flush the
* child to the bottom.
*
* Deprecated: 3.14: Use gtk_widget_set_valign() on the child instead
*/
g_object_class_install_property (gobject_class,
PROP_YALIGN,
g_param_spec_float("yalign",
@@ -155,6 +173,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
1.0,
0.5,
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
/**
* GtkAlignment:xscale:
*
* If available horizontal space is bigger than needed, how much
* of it to use for the child. A value of 0.0 means none; a value
* of 1.0 means all.
*
* Deprecated: 3.14: Use gtk_widget_set_hexpand() on the child instead
*/
g_object_class_install_property (gobject_class,
PROP_XSCALE,
g_param_spec_float("xscale",
@@ -164,6 +191,15 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
1.0,
1.0,
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
/**
* GtkAlignment:yscale:
*
* If available vertical space is bigger than needed, how much
* of it to use for the child. A value of 0.0 means none; a value
* of 1.0 means all.
*
* Deprecated: 3.14: Use gtk_widget_set_vexpand() on the child instead
*/
g_object_class_install_property (gobject_class,
PROP_YSCALE,
g_param_spec_float("yscale",
@@ -181,6 +217,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
* The padding to insert at the top of the widget.
*
* Since: 2.4
*
* Deprecated: 3.14: Use gtk_widget_set_margin_top() instead
*/
g_object_class_install_property (gobject_class,
PROP_TOP_PADDING,
@@ -198,6 +236,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
* The padding to insert at the bottom of the widget.
*
* Since: 2.4
*
* Deprecated: 3.14: Use gtk_widget_set_margin_bottom() instead
*/
g_object_class_install_property (gobject_class,
PROP_BOTTOM_PADDING,
@@ -215,6 +255,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
* The padding to insert at the left of the widget.
*
* Since: 2.4
*
* Deprecated: 3.14: Use gtk_widget_set_margin_start() instead
*/
g_object_class_install_property (gobject_class,
PROP_LEFT_PADDING,
@@ -232,6 +274,8 @@ gtk_alignment_class_init (GtkAlignmentClass *class)
* The padding to insert at the right of the widget.
*
* Since: 2.4
*
* Deprecated: 3.14: Use gtk_widget_set_margin_end() instead
*/
g_object_class_install_property (gobject_class,
PROP_RIGHT_PADDING,
+6 -4
View File
@@ -188,7 +188,8 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
*
* Child widget to appear next to the menu text.
*
* Deprecated: 3.10
* Deprecated: 3.10: Use a #GtkMenuItem containing a #GtkBox with
* a #GtkAccelLabel and a #GtkImage instead
*/
g_object_class_install_property (gobject_class,
PROP_IMAGE,
@@ -205,7 +206,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
*
* Since: 2.16
*
* Deprecated: 3.10
* Deprecated: 3.10: Use a named icon from the #GtkIconTheme instead
*/
g_object_class_install_property (gobject_class,
PROP_USE_STOCK,
@@ -225,7 +226,8 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
*
* Since: 2.16
*
* Deprecated: 3.10
* Deprecated: 3.10: Use a #GtkMenuItem containing a #GtkBox with
* a #GtkAccelLabel and a #GtkImage instead
*/
g_object_class_install_property (gobject_class,
PROP_ALWAYS_SHOW_IMAGE,
@@ -242,7 +244,7 @@ gtk_image_menu_item_class_init (GtkImageMenuItemClass *klass)
*
* Since: 2.16
*
* Deprecated: 3.10
* Deprecated: 3.10: Use gtk_widget_add_accelerator() instead
*/
g_object_class_install_property (gobject_class,
PROP_ACCEL_GROUP,
+37
View File
@@ -98,6 +98,16 @@ gtk_misc_class_init (GtkMiscClass *class)
widget_class->realize = gtk_misc_realize;
/**
* GtkMisc:xalign:
*
* The horizontal alignment. A value of 0.0 means left alignment (or right
* on RTL locales); a value of 1.0 means right alignment (or left on RTL
* locales).
*
* Deprecated: 3.14: Use gtk_widget_set_halign() instead. If you are using
* #GtkLabel, use #GtkLabel:xalign instead.
*/
g_object_class_install_property (gobject_class,
PROP_XALIGN,
g_param_spec_float ("xalign",
@@ -108,6 +118,15 @@ gtk_misc_class_init (GtkMiscClass *class)
0.5,
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
/**
* GtkMisc:yalign:
*
* The vertical alignment. A value of 0.0 means top alignment;
* a value of 1.0 means bottom alignment.
*
* Deprecated: 3.14: Use gtk_widget_set_valign() instead. If you are using
* #GtkLabel, use #GtkLabel:yalign instead.
*/
g_object_class_install_property (gobject_class,
PROP_YALIGN,
g_param_spec_float ("yalign",
@@ -118,6 +137,15 @@ gtk_misc_class_init (GtkMiscClass *class)
0.5,
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
/**
* GtkMisc:xpad:
*
* The amount of space to add on the left and right of the widget, in
* pixels.
*
* Deprecated: 3.14: Use gtk_widget_set_margin_start() and
* gtk_widget_set_margin_end() instead
*/
g_object_class_install_property (gobject_class,
PROP_XPAD,
g_param_spec_int ("xpad",
@@ -128,6 +156,15 @@ gtk_misc_class_init (GtkMiscClass *class)
0,
GTK_PARAM_READWRITE|G_PARAM_DEPRECATED));
/**
* GtkMisc:ypad:
*
* The amount of space to add on the top and bottom of the widget, in
* pixels.
*
* Deprecated: 3.14: Use gtk_widget_set_margin_top() and
* gtk_widget_set_margin_bottom() instead
*/
g_object_class_install_property (gobject_class,
PROP_YPAD,
g_param_spec_int ("ypad",
-87
View File
@@ -704,89 +704,6 @@ static const GScannerConfig gtk_rc_scanner_config =
TRUE /* symbol_2_token */,
FALSE /* scope_0_fallback */,
};
static const gchar symbol_names[] =
"include\0"
"NORMAL\0"
"ACTIVE\0"
"PRELIGHT\0"
"SELECTED\0"
"INSENSITIVE\0"
"fg\0"
"bg\0"
"text\0"
"base\0"
"xthickness\0"
"ythickness\0"
"font\0"
"fontset\0"
"font_name\0"
"bg_pixmap\0"
"pixmap_path\0"
"style\0"
"binding\0"
"bind\0"
"widget\0"
"widget_class\0"
"class\0"
"lowest\0"
"gtk\0"
"application\0"
"theme\0"
"rc\0"
"highest\0"
"engine\0"
"module_path\0"
"stock\0"
"im_module_file\0"
"LTR\0"
"RTL\0"
"color\0"
"unbind\0";
static const struct
{
guint name_offset;
guint token;
} symbols[] = {
{ 0, GTK_RC_TOKEN_INCLUDE },
{ 8, GTK_RC_TOKEN_NORMAL },
{ 15, GTK_RC_TOKEN_ACTIVE },
{ 22, GTK_RC_TOKEN_PRELIGHT },
{ 31, GTK_RC_TOKEN_SELECTED },
{ 40, GTK_RC_TOKEN_INSENSITIVE },
{ 52, GTK_RC_TOKEN_FG },
{ 55, GTK_RC_TOKEN_BG },
{ 58, GTK_RC_TOKEN_TEXT },
{ 63, GTK_RC_TOKEN_BASE },
{ 68, GTK_RC_TOKEN_XTHICKNESS },
{ 79, GTK_RC_TOKEN_YTHICKNESS },
{ 90, GTK_RC_TOKEN_FONT },
{ 95, GTK_RC_TOKEN_FONTSET },
{ 103, GTK_RC_TOKEN_FONT_NAME },
{ 113, GTK_RC_TOKEN_BG_PIXMAP },
{ 123, GTK_RC_TOKEN_PIXMAP_PATH },
{ 135, GTK_RC_TOKEN_STYLE },
{ 141, GTK_RC_TOKEN_BINDING },
{ 149, GTK_RC_TOKEN_BIND },
{ 154, GTK_RC_TOKEN_WIDGET },
{ 161, GTK_RC_TOKEN_WIDGET_CLASS },
{ 174, GTK_RC_TOKEN_CLASS },
{ 180, GTK_RC_TOKEN_LOWEST },
{ 187, GTK_RC_TOKEN_GTK },
{ 191, GTK_RC_TOKEN_APPLICATION },
{ 203, GTK_RC_TOKEN_THEME },
{ 209, GTK_RC_TOKEN_RC },
{ 212, GTK_RC_TOKEN_HIGHEST },
{ 220, GTK_RC_TOKEN_ENGINE },
{ 227, GTK_RC_TOKEN_MODULE_PATH },
{ 239, GTK_RC_TOKEN_STOCK },
{ 245, GTK_RC_TOKEN_IM_MODULE_FILE },
{ 260, GTK_RC_TOKEN_LTR },
{ 264, GTK_RC_TOKEN_RTL },
{ 268, GTK_RC_TOKEN_COLOR },
{ 274, GTK_RC_TOKEN_UNBIND }
};
static GHashTable *realized_style_ht = NULL;
@@ -1090,8 +1007,6 @@ gtk_rc_style_finalize (GObject *object)
if (rc_style->rc_properties)
{
guint i;
for (i = 0; i < rc_style->rc_properties->len; i++)
{
GtkRcProperty *node = &g_array_index (rc_style->rc_properties, GtkRcProperty, i);
@@ -1280,8 +1195,6 @@ gtk_rc_style_real_merge (GtkRcStyle *dest,
if (src->rc_properties)
{
guint i;
for (i = 0; i < src->rc_properties->len; i++)
insert_rc_property (dest,
&g_array_index (src->rc_properties, GtkRcProperty, i),
+2 -3
View File
@@ -154,9 +154,8 @@ gtk_recent_action_unselect_uri (GtkRecentChooser *chooser,
for (l = priv->choosers; l; l = l->next)
{
GtkRecentChooser *chooser = l->data;
gtk_recent_chooser_unselect_uri (chooser, uri);
GtkRecentChooser *c = l->data;
gtk_recent_chooser_unselect_uri (c, uri);
}
}
+9 -10
View File
@@ -317,7 +317,7 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
{
GtkCssStyleProperty *prop = key;
PropertyData *data = value;
GtkCssValue *value;
GtkCssValue *val;
guint id;
id = _gtk_css_style_property_get_id (prop);
@@ -325,11 +325,11 @@ gtk_style_properties_provider_lookup (GtkStyleProviderPrivate *provider,
if (!_gtk_css_lookup_is_missing (lookup, id))
continue;
value = property_data_match_state (data, _gtk_css_matcher_get_state (matcher));
if (value == NULL)
val = property_data_match_state (data, _gtk_css_matcher_get_state (matcher));
if (val == NULL)
continue;
_gtk_css_lookup_set (lookup, id, NULL, value);
_gtk_css_lookup_set (lookup, id, NULL, val);
}
if (change)
@@ -846,7 +846,7 @@ gtk_style_properties_merge (GtkStyleProperties *props,
{
GtkStylePropertiesPrivate *priv, *priv_to_merge;
GHashTableIter iter;
gpointer key, value;
gpointer key, val;
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props));
g_return_if_fail (GTK_IS_STYLE_PROPERTIES (props_to_merge));
@@ -859,13 +859,13 @@ gtk_style_properties_merge (GtkStyleProperties *props,
{
g_hash_table_iter_init (&iter, priv_to_merge->color_map);
while (g_hash_table_iter_next (&iter, &key, &value))
while (g_hash_table_iter_next (&iter, &key, &val))
{
const gchar *name;
GtkSymbolicColor *color;
name = key;
color = value;
color = val;
if (!replace &&
g_hash_table_lookup (priv->color_map, name))
@@ -878,9 +878,9 @@ gtk_style_properties_merge (GtkStyleProperties *props,
/* Merge symbolic style properties */
g_hash_table_iter_init (&iter, priv_to_merge->properties);
while (g_hash_table_iter_next (&iter, &key, &value))
while (g_hash_table_iter_next (&iter, &key, &val))
{
PropertyData *prop_to_merge = value;
PropertyData *prop_to_merge = val;
PropertyData *prop;
guint i;
@@ -926,7 +926,6 @@ gtk_style_properties_merge (GtkStyleProperties *props,
value->value != NULL)
{
GPtrArray *array, *array_to_merge;
gint i;
/* Append the array, mainly thought
* for the gtk-key-bindings property
+4 -4
View File
@@ -1792,10 +1792,10 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (col = 0; col < priv->ncols; col++)
if (priv->cols[col].shrink)
{
gint allocation = priv->cols[col].allocation;
gint alloc = priv->cols[col].allocation;
priv->cols[col].allocation = MAX (1, (gint) priv->cols[col].allocation - extra / nshrink);
extra -= allocation - priv->cols[col].allocation;
extra -= alloc - priv->cols[col].allocation;
nshrink -= 1;
if (priv->cols[col].allocation < 2)
{
@@ -1884,10 +1884,10 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (row = 0; row < priv->nrows; row++)
if (priv->rows[row].shrink)
{
gint allocation = priv->rows[row].allocation;
gint alloc = priv->rows[row].allocation;
priv->rows[row].allocation = MAX (1, (gint) priv->rows[row].allocation - extra / nshrink);
extra -= allocation - priv->rows[row].allocation;
extra -= alloc - priv->rows[row].allocation;
nshrink -= 1;
if (priv->rows[row].allocation < 2)
{
+3 -3
View File
@@ -2952,9 +2952,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
if (in_popup && !popup_accels)
{
/* don't show accels in popups */
GtkWidget *child = gtk_bin_get_child (GTK_BIN (info->proxy));
if (GTK_IS_ACCEL_LABEL (child))
g_object_set (child, "accel-closure", NULL, NULL);
GtkWidget *c = gtk_bin_get_child (GTK_BIN (info->proxy));
if (GTK_IS_ACCEL_LABEL (c))
g_object_set (c, "accel-closure", NULL, NULL);
}
}
+2
View File
@@ -132,6 +132,8 @@ needs_explicit_setting (MyParserData *data,
{ "GtkRadioButton", "draw-indicator", 0 },
{ "GtkGrid", "left-attach", 1 },
{ "GtkGrid", "top-attach", 1 },
{ "GtkWidget", "hexpand", 0 },
{ "GtkWidget", "vexpand", 0 },
{ NULL, NULL, 0 }
};
const gchar *class_name;
-1
View File
@@ -2108,7 +2108,6 @@ text_buffer_new (GtkAboutDialog *about,
gchar *link;
gchar *uri;
const gchar *link_type;
GtkTextTag *tag;
if (*q1 == '<')
{
+3 -2
View File
@@ -132,7 +132,6 @@ enum {
static GHashTable *accel_entry_ht = NULL; /* accel_path -> AccelEntry */
static GSList *accel_filters = NULL;
static gulong accel_map_signals[LAST_SIGNAL] = { 0, };
static GtkAccelMap *accel_map;
/* --- prototypes --- */
static void do_accel_map_changed (AccelEntry *entry);
@@ -1021,10 +1020,12 @@ gtk_accel_map_class_init (GtkAccelMapClass *accel_map_class)
}
static void
gtk_accel_map_init (GtkAccelMap *accel_map)
gtk_accel_map_init (GtkAccelMap *map)
{
}
static GtkAccelMap *accel_map;
/**
* gtk_accel_map_get:
*
-1
View File
@@ -414,7 +414,6 @@ accels_set_accels_for_action (Accels *accels,
if (keys)
{
gchar *my_key;
gint i;
my_key = g_strdup (action_and_target);
+109 -6
View File
@@ -84,6 +84,7 @@ struct _GtkAssistantPage
GtkAssistantPageType type;
guint complete : 1;
guint complete_set : 1;
guint has_padding : 1;
gchar *title;
@@ -196,7 +197,8 @@ enum
CHILD_PROP_PAGE_TITLE,
CHILD_PROP_PAGE_HEADER_IMAGE,
CHILD_PROP_PAGE_SIDEBAR_IMAGE,
CHILD_PROP_PAGE_COMPLETE
CHILD_PROP_PAGE_COMPLETE,
CHILD_PROP_HAS_PADDING
};
enum
@@ -622,6 +624,10 @@ gtk_assistant_class_init (GtkAssistantClass *class)
FALSE,
G_PARAM_READWRITE));
gtk_container_class_install_child_property (container_class, CHILD_PROP_HAS_PADDING,
g_param_spec_boolean ("has-padding", P_("Has padding"), P_("Whether the assistant adds padding around the page"),
TRUE, G_PARAM_READWRITE));
/* Bind class to template
*/
gtk_widget_class_set_template_from_resource (widget_class,
@@ -1109,8 +1115,8 @@ on_page_notify_visibility (GtkWidget *widget,
}
static void
assistant_remove_page_cb (GtkNotebook *notebook,
GtkWidget *page,
assistant_remove_page_cb (GtkNotebook *notebook,
GtkWidget *page,
GtkAssistant *assistant)
{
GtkAssistantPrivate *priv = assistant->priv;
@@ -1118,6 +1124,15 @@ assistant_remove_page_cb (GtkNotebook *notebook,
GList *page_node;
GList *element;
if (GTK_IS_BOX (page))
{
GList *children;
children = gtk_container_get_children (GTK_CONTAINER (page));
page = GTK_WIDGET (children->data);
g_list_free (children);
}
element = find_page (assistant, page);
if (!element)
return;
@@ -1236,6 +1251,10 @@ gtk_assistant_set_child_property (GtkContainer *container,
gtk_assistant_set_page_complete (GTK_ASSISTANT (container), child,
g_value_get_boolean (value));
break;
case CHILD_PROP_HAS_PADDING:
gtk_assistant_set_page_has_padding (GTK_ASSISTANT (container), child,
g_value_get_boolean (value));
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
@@ -1277,6 +1296,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS
g_value_set_boolean (value,
gtk_assistant_get_page_complete (assistant, child));
break;
case CHILD_PROP_HAS_PADDING:
g_value_set_boolean (value,
gtk_assistant_get_page_has_padding (assistant, child));
break;
default:
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID (container, property_id, pspec);
break;
@@ -1445,12 +1468,16 @@ gtk_assistant_remove (GtkContainer *container,
GtkWidget *page)
{
GtkAssistant *assistant = (GtkAssistant*) container;
GtkWidget *box;
/* Forward this removal to the content notebook */
if (gtk_widget_get_parent (page) == assistant->priv->content)
box = gtk_widget_get_parent (page);
if (GTK_IS_BOX (box) &&
assistant->priv->content != NULL &&
gtk_widget_get_parent (box) == assistant->priv->content)
{
container = (GtkContainer *) assistant->priv->content;
gtk_container_remove (container, page);
gtk_container_remove (container, box);
}
}
@@ -1743,6 +1770,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
GtkAssistantPage *page_info;
gint n_pages;
GtkStyleContext *context;
GtkWidget *box;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
@@ -1754,6 +1782,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
page_info = g_slice_new0 (GtkAssistantPage);
page_info->page = page;
page_info->regular_title = gtk_label_new (NULL);
page_info->has_padding = TRUE;
gtk_widget_set_no_show_all (page_info->regular_title, TRUE);
page_info->current_title = gtk_label_new (NULL);
gtk_widget_set_no_show_all (page_info->current_title, TRUE);
@@ -1785,7 +1814,12 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->regular_title, 2 * position);
gtk_box_reorder_child (GTK_BOX (priv->sidebar), page_info->current_title, 2 * position + 1);
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), page, NULL, position);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (box);
gtk_box_pack_start (GTK_BOX (box), page, TRUE, TRUE, 0);
g_object_set (box, "margin", 12, NULL);
gtk_notebook_insert_page (GTK_NOTEBOOK (priv->content), box, NULL, position);
if (gtk_widget_get_mapped (GTK_WIDGET (assistant)))
{
@@ -2352,6 +2386,75 @@ gtk_assistant_get_page_complete (GtkAssistant *assistant,
return page_info->complete;
}
/**
* gtk_assistant_set_page_has_padding:
* @assistant: a #GtkAssistant
* @page: a page of @assistant
* @has_padding: whether this page has padding
*
* Sets whether the assistant is adding padding around
* the page.
*
* Since: 3.18
*/
void
gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
GtkWidget *page,
gboolean has_padding)
{
GtkAssistantPage *page_info;
GList *child;
g_return_if_fail (GTK_IS_ASSISTANT (assistant));
g_return_if_fail (GTK_IS_WIDGET (page));
child = find_page (assistant, page);
g_return_if_fail (child != NULL);
page_info = (GtkAssistantPage*) child->data;
if (page_info->has_padding != has_padding)
{
page_info->has_padding = has_padding;
g_object_set (gtk_widget_get_parent (page),
"margin", has_padding ? 12 : 0,
NULL);
gtk_container_child_notify (GTK_CONTAINER (assistant), page, "has-padding");
}
}
/**
* gtk_assistant_get_page_has_padding:
* @assistant: a #GtkAssistant
* @page: a page of @assistant
*
* Gets whether page has padding.
*
* Returns: %TRUE if @page has padding
* Since: 3.18
*/
gboolean
gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
GtkWidget *page)
{
GtkAssistantPage *page_info;
GList *child;
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), FALSE);
g_return_val_if_fail (GTK_IS_WIDGET (page), FALSE);
child = find_page (assistant, page);
g_return_val_if_fail (child != NULL, TRUE);
page_info = (GtkAssistantPage*) child->data;
return page_info->has_padding;
}
/**
* gtk_assistant_update_buttons_state:
* @assistant: a #GtkAssistant
+8
View File
@@ -217,6 +217,14 @@ void gtk_assistant_update_buttons_state (GtkAssistant *assista
GDK_AVAILABLE_IN_ALL
void gtk_assistant_commit (GtkAssistant *assistant);
GDK_AVAILABLE_IN_3_18
void gtk_assistant_set_page_has_padding (GtkAssistant *assistant,
GtkWidget *page,
gboolean has_padding);
GDK_AVAILABLE_IN_3_18
gboolean gtk_assistant_get_page_has_padding (GtkAssistant *assistant,
GtkWidget *page);
G_END_DECLS
#endif /* __GTK_ASSISTANT_H__ */
+3 -3
View File
@@ -163,11 +163,11 @@ gtk_builder_menu_start_element (GMarkupParseContext *context,
{
const gchar *typestr;
const gchar *name;
const gchar *context;
const gchar *ctxt;
if (COLLECT (STRING, "name", &name,
OPTIONAL | BOOLEAN, "translatable", &state->translatable,
OPTIONAL | STRING, "context", &context,
OPTIONAL | STRING, "context", &ctxt,
OPTIONAL | STRING, "comments", NULL, /* ignore, just for translators */
OPTIONAL | STRING, "type", &typestr))
{
@@ -182,7 +182,7 @@ gtk_builder_menu_start_element (GMarkupParseContext *context,
state->type = typestr ? g_variant_type_new (typestr) : NULL;
state->string = g_string_new (NULL);
state->attribute = g_strdup (name);
state->context = g_strdup (context);
state->context = g_strdup (ctxt);
gtk_builder_menu_push_frame (state, NULL, NULL);
}
+1 -1
View File
@@ -2435,7 +2435,7 @@ gtk_builder_add_callback_symbols (GtkBuilder *builder,
}
/**
* gtk_builder_lookup_callback_symbol:
* gtk_builder_lookup_callback_symbol: (skip)
* @builder: a #GtkBuilder
* @callback_name: The name of the callback
*
+3 -8
View File
@@ -15,13 +15,6 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/* TODO
* - touch
* - accessible relations for popups
* - saving per-application (?)
* - better popup theming
*/
#include "config.h"
#include "gtkcoloreditorprivate.h"
@@ -209,7 +202,9 @@ popup_edit (GtkWidget *widget,
focus = editor->priv->a_entry;
}
if (popup)
if (popup == editor->priv->current_popup)
dismiss_current_popup (editor);
else if (popup)
{
dismiss_current_popup (editor);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (editor));
+17 -4
View File
@@ -41,6 +41,7 @@ struct _GtkColorSwatchPrivate
guint has_color : 1;
guint use_alpha : 1;
guint selectable : 1;
guint has_menu : 1;
GdkWindow *event_window;
@@ -52,7 +53,8 @@ enum
{
PROP_ZERO,
PROP_RGBA,
PROP_SELECTABLE
PROP_SELECTABLE,
PROP_HAS_MENU
};
enum
@@ -82,6 +84,7 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
swatch->priv = gtk_color_swatch_get_instance_private (swatch);
swatch->priv->use_alpha = TRUE;
swatch->priv->selectable = TRUE;
swatch->priv->has_menu = TRUE;
gtk_widget_set_can_focus (GTK_WIDGET (swatch), TRUE);
gtk_widget_set_has_window (GTK_WIDGET (swatch), FALSE);
@@ -357,7 +360,7 @@ swatch_key_press (GtkWidget *widget,
event->keyval == GDK_KEY_KP_Enter ||
event->keyval == GDK_KEY_KP_Space)
{
if (swatch->priv->has_color &&
if (swatch->priv->has_color &&
swatch->priv->selectable &&
(gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED) == 0)
gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_SELECTED, FALSE);
@@ -517,7 +520,7 @@ tap_action (GtkGestureMultiPress *gesture,
}
else if (button == GDK_BUTTON_SECONDARY)
{
if (swatch->priv->has_color)
if (swatch->priv->has_color && swatch->priv->has_menu)
do_popup (GTK_WIDGET (swatch), button, gtk_get_current_event_time ());
}
}
@@ -575,7 +578,7 @@ swatch_realize (GtkWidget *widget)
gtk_widget_set_window (widget, window);
g_object_ref (window);
swatch->priv->event_window =
swatch->priv->event_window =
gdk_window_new (window,
&attributes, attributes_mask);
gtk_widget_register_window (widget, swatch->priv->event_window);
@@ -641,6 +644,9 @@ swatch_get_property (GObject *object,
case PROP_SELECTABLE:
g_value_set_boolean (value, gtk_color_swatch_get_selectable (swatch));
break;
case PROP_HAS_MENU:
g_value_set_boolean (value, swatch->priv->has_menu);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -663,6 +669,9 @@ swatch_set_property (GObject *object,
case PROP_SELECTABLE:
gtk_color_swatch_set_selectable (swatch, g_value_get_boolean (value));
break;
case PROP_HAS_MENU:
swatch->priv->has_menu = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -728,10 +737,14 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
g_object_class_install_property (object_class, PROP_SELECTABLE,
g_param_spec_boolean ("selectable", P_("Selectable"), P_("Whether the swatch is selectable"),
TRUE, GTK_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_HAS_MENU,
g_param_spec_boolean ("has-menu", P_("Has Menu"), P_("Whether the swatch should offer customization"),
TRUE, GTK_PARAM_READWRITE));
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_COLOR_SWATCH_ACCESSIBLE);
}
/* Public API {{{1 */
GtkWidget *
+2 -3
View File
@@ -2622,14 +2622,13 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
if (gtk_widget_get_visible (priv->popup_widget))
{
gint width, menu_width;
gint menu_width;
if (priv->wrap_width == 0)
{
GtkAllocation combo_box_allocation;
gtk_widget_get_allocation (GTK_WIDGET (combo_box), &combo_box_allocation);
width = combo_box_allocation.width;
gtk_widget_set_size_request (priv->popup_widget, -1, -1);
if (combo_box->priv->popup_fixed_width)
@@ -2638,7 +2637,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
gtk_widget_get_preferred_width (priv->popup_widget, NULL, &menu_width);
gtk_widget_set_size_request (priv->popup_widget,
MAX (width, menu_width), -1);
MAX (combo_box_allocation.width, menu_width), -1);
}
/* reposition the menu after giving it a new width */
+6 -6
View File
@@ -41,18 +41,18 @@ gtk_css_image_win32_draw (GtkCssImage *image,
if (wimage->state2 >= 0)
{
cairo_surface_t *surface2;
cairo_t *cr;
cairo_t *cr2;
int dx2, dy2;
surface2 = _gtk_win32_theme_part_create_surface (wimage->theme, wimage->part2, wimage->state2, wimage->margins,
width, height, &dx2, &dy2);
cr = cairo_create (surface);
cr2 = cairo_create (surface);
cairo_set_source_surface (cr, surface2, dx2 - dx, dy2-dy);
cairo_paint_with_alpha (cr, wimage->over_alpha);
cairo_destroy (cr);
cairo_set_source_surface (cr2, surface2, dx2 - dx, dy2-dy);
cairo_paint_with_alpha (cr2, wimage->over_alpha);
cairo_destroy (cr2);
cairo_surface_destroy (surface2);
}
+5 -3
View File
@@ -66,7 +66,6 @@ gtk_css_value_initial_compute (GtkCssValue *value,
{
PangoFontDescription *description;
char *font_name;
GtkCssValue *value;
g_object_get (settings, "gtk-font-name", &font_name, NULL);
description = pango_font_description_from_string (font_name);
@@ -76,9 +75,12 @@ gtk_css_value_initial_compute (GtkCssValue *value,
if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_FAMILY)
{
value = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (description)));
GtkCssValue *val;
val = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (description)));
pango_font_description_free (description);
return value;
return val;
}
pango_font_description_free (description);

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