Compare commits

...

1466 Commits

Author SHA1 Message Date
Matthias Clasen
675214574c css: Break the selector tree into many
Since we can only match one name, doing a hash
by matcher name lets us quickly discard most
initial selectors, and having much smaller trees.

We can apply the same idea for style classes,
as well, by looking up a tree for each class.

Comparing the number of gtk_css_selector_match() calls
while moving the pointer outside the window, I see:

Before:
65773 selector matches (12863 positive)

After:
32704 selector matches (12278 positive)

So this cuts the numer of selectors we need to check
roughly in half, at the cost of a handful of hash table
lookups.
2020-01-19 19:00:00 -05:00
Matthias Clasen
31b15bf5e0 css: Add getters for a matchers name and classes
These will be used in the selector tree in the future.

The classes getter annoyingly has to allow returning
allocated memory, due to widget paths. This can be
removed when widget paths go away.
2020-01-19 19:00:00 -05:00
Matthias Clasen
7e2e92a87e cssselector: Inline a few things 2020-01-19 15:56:54 -05:00
Matthias Clasen
be4d42507c style cascade: Remove some pointless casts
The casts and checks in gtkstylecascade.c are leftovers
from when we had GtkStyleProviderPrivate, and no longer
serve any purpose.
2020-01-19 15:56:54 -05:00
Matthias Clasen
6e88ccf7fb pick: Take advantage of transform categories
Transform categories let us easily avoid doing matrix math
when we can just do a simple translation.
2020-01-19 15:56:54 -05:00
Matthias Clasen
cec4c15f05 Refactor gtk_widget_pick
Split this into a recursive part and a public
entry point. This lets us avoid some duplicate
checks.
2020-01-19 15:56:54 -05:00
Piotr Drąg
ce1f1f7dec Update Polish translation 2020-01-19 13:04:34 +01:00
Matthias Clasen
95f00c6071 css: Redo the pseudoclass selectors
There is no need to duplicate the classes, we can make
do with a single class for all the states.
2020-01-18 23:06:25 -05:00
Matthias Clasen
55cfeccfd2 css: Go back to clearing out selectors
Now that we use the selector tree for change computation
again, we don't need the ruleset selectors anymore.
Bring back the code that cleans them out.
2020-01-18 23:06:25 -05:00
Goran Vidović
2301916fa4 Update Croatian translation 2020-01-19 00:33:57 +00:00
Goran Vidović
bb4efe18b7 Update Croatian translation 2020-01-19 00:13:42 +00:00
Matthias Clasen
a463dccd81 Refine the selector tree printing
Also show which tree nodes have exact matches.
2020-01-18 14:32:55 -05:00
Matthias Clasen
eff129323f Fix a css change testcase
The ui file here was invalid, leading to nonsensical
results.
2020-01-18 14:32:55 -05:00
Matthias Clasen
a5530caec3 Actually turn of css value accounting
We need an #undef here. While doing so, make sure
it compiles without warnings when disabled.
2020-01-18 14:30:23 -05:00
Matthias Clasen
92cfc03821 inspector: Avoid an array overrun
Commit 3f56af3738 added a new value to the
GdkInputSource enum, forgetting that the inspector
has an array of names to match this enum.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2385
2020-01-18 11:49:16 -05:00
Matthias Clasen
46bb1a9b6a wayland: Fix release build warnings 2020-01-18 11:49:16 -05:00
Matthias Clasen
19280db075 x11: Fix release build warnings 2020-01-18 11:49:16 -05:00
Piotr Drąg
7210c5484e Update POTFILES.skip 2020-01-18 17:39:53 +01:00
Timm Bäder
433c8307b2 gl renderer: Pull a local variable in the closest scope 2020-01-18 08:49:52 +01:00
Timm Bäder
26506b0a15 cssimagefallback: Don't snapshot invisible colors
This avoids a few render nodes later.
2020-01-18 08:49:52 +01:00
Timm Bäder
f8fa946989 widget: Get opacity without GtkStyleContext
GtkStyleContext is really just unnecessary here.
2020-01-18 08:49:52 +01:00
Timm Bäder
119ebe1d70 cssstyle: set font variations in get_pango_font()
Doesn't make sense to set all the css values on the font description in
there except for the font variations, so do these here as well.
2020-01-18 08:49:52 +01:00
Timm Bäder
dda54b2b8f widget: Get DPI from style directly
Instead of going through GtkStyleContext.
2020-01-18 08:49:52 +01:00
Timm Bäder
821efcb725 cssstyle: Implement get_pango_font() directly
Instead of going through the slow GValue code path. This function was
unused, so use it in GtkWidget's update_pango_context() now.
2020-01-18 08:49:52 +01:00
Timm Bäder
85793fe6b6 testsuite: Update expected css errors 2020-01-18 08:49:52 +01:00
Timm Bäder
dc8dedce07 gl renderer: Draw outset shadows white
and only apply the actual shadow color when we draw them from the
texture. This way we can reuse the cached shadows during color
transitions.
2020-01-18 08:49:52 +01:00
Matthias Clasen
f5182f1c35 css: Mark transform value as computed
This is not very useful, since transitions generate
a ton of transforms anyway.
2020-01-18 08:49:52 +01:00
Matthias Clasen
1efa39672b css: Simplify default values
We no longer need to create one-element arrays or
corners with two identical values.
2020-01-18 08:49:52 +01:00
Matthias Clasen
3f38a1c94c css: Re-add a lost special case
When the border-style special cases were moved in
c687f485fd, the one for outline-width was lost.

Make the code more compact, and bring the special
case back.
2020-01-18 08:49:52 +01:00
Timm Bäder
d861dd5df8 csshorthandproperty: Try to avoid allocating a GString for 1 font 2020-01-18 08:49:52 +01:00
Timm Bäder
8c98fd2e46 cssdimensionvalue: remove early-out code from transition()
We do this directly in gtk_css_value_transition() now
2020-01-18 08:49:52 +01:00
Timm Bäder
3091679ffa gl renderer: Render simple border nodes in a simple way
Roughly 80% of the border nodes are just one color and have the same
width on all sides, so we can draw them by uploading just one rect and
not four.
2020-01-18 08:49:52 +01:00
Timm Bäder
2e89c5360a numbervalue: Add early-out to multiply()
If the factor is 1, we already know what the result is going to be.
2020-01-18 08:49:52 +01:00
Timm Bäder
e448fc41f3 cssnumbervalue: Move early-out code to GtkCssValue
These checks make sense for all css values.
2020-01-18 08:49:52 +01:00
Timm Bäder
c9e972eecb cssdimensionvalue: Implement transition()
Instead of falling back to the generic gtk_css_number_value_transition
(which can allocate multiple new css values), just implement this here.
2020-01-18 08:49:52 +01:00
Timm Bäder
45455f1bdb Remove GtkCssShadowsValue
Previously, we wrapped all GtkCssShadowValues in a GtkCssShadowsValue,
even if it was just one shadow. This causes an unnecessary bloat in
css values.

Make each GtkCssShadowValue able to handle multiple shadows instead, and
use gtk_css_shadow_value* API everywhere.
2020-01-18 08:49:52 +01:00
Timm Bäder
a3769eb0e5 cssshadowvalue: Only create 2 shadows values for transitions
This is for cases where we want to transition from "no shadow" to
"shadow", which we need quite a lot.
2020-01-18 08:49:52 +01:00
Timm Bäder
7c75ea376f cssvalue: Improve css value accounting output
And make it fully optional behind an #ifdef.
2020-01-18 08:49:52 +01:00
Timm Bäder
96143548ac csscolorvalue: check for singletons in new_literal
Gets rid of another ~400 GtkCssValue instances in the widget-factory.
2020-01-18 08:49:51 +01:00
Timm Bäder
0b2a6e34c4 cssimage: Add is_computed vfunc
Same semantics as the is_computed field of GtkCssValue
2020-01-18 08:49:51 +01:00
Timm Bäder
24d8c0a7dc css: Set the is_computed flag for more values
With these changes, we skip roughly 85% of compute() calls during
widget-factory startup
2020-01-18 08:49:51 +01:00
Timm Bäder
ba08f5e67d cssvalue: Don't call compute() for already computed css values
As per the previous commit, this is unnecessary.

Even with the small amount of css values we mark as is_computed, we
already skip computing over 60% of them like this during the startup of
the widget factory.
2020-01-18 08:49:51 +01:00
Timm Bäder
31aa5a0e53 cssvalue: Add is_computed flag
When a css value has "child" css values (e.g. a linear gradient has
several color stop css values) which are all computed (won't change when
compute() is called on them), we want to skip computing the entire
subtree.

Since css values are immutable, we can set the is_computed flag at
construct time.

Since GtkCssValue instances are 0-initialized in _gtk_css_value_alloc,
the default for is_computed it FALSE. This commit only sets it to TRUE
in a few cases, such as various "none" singleton values which will never
change. Later commits will refine this and set it for more values.
2020-01-18 08:49:51 +01:00
Timm Bäder
7aa17afe7a testsuite: Update css color output 2020-01-18 08:49:51 +01:00
Timm Bäder
8c678ac756 css: Move border-width special cases out of GtkCssDimensionValue
Move them to style computation instead, so we don't have them in such a
generic place.
2020-01-18 08:49:51 +01:00
Timm Bäder
7d1f915a61 csscolorvalue: Don't copy rgbas when applying function
We get const pointers to the colors, so just use those and unref the
values later.
2020-01-18 08:49:51 +01:00
Timm Bäder
afa991752c gl renderer: Look at shadow color in the outset shadow cache
It would probably be better to not do this and always render the outline
in plain white, then later recolor it but do this for no, just for
correctness.
2020-01-18 08:49:51 +01:00
Timm Bäder
fc2d05ee38 cssimageradial: Use array + length instead of GArray
This makes sense since we're not going to change the (amount of) colors
after parsing.
2020-01-18 08:49:51 +01:00
Timm Bäder
00aa4f0597 cssimagelinear: Use count+array for the color stops, not GArray
This makse sense but will also make later changes to GtkCssImageLinear
simpler.
2020-01-18 08:49:51 +01:00
Timm Bäder
3401150cca cssimagefallback: Don't compute new image if only a color is set
Themes might use e.g. image(red), which is a constant value and will
never change. In that case, the fallback image has ->color set, but not
->images. If that's the case and the computed color is the same as
the one we already have, just return the already existing image.
2020-01-18 08:49:51 +01:00
Timm Bäder
67991ed0f4 Remove GtkCssRgbaValue
The differenciation between a literal color value and an RGBA value
caused problems in various situations. Just treat the two the same but
don't allow access to the rgba value of a non-literal color value.

This gets rid of around 1.6k rgba values in the widget-factory.
2020-01-18 08:49:51 +01:00
Matthias Clasen
741e12012d dump css value stats 2020-01-18 08:49:51 +01:00
Timm Bäder
91aa60b210 csssshadwovalue: Remove unused function prototype 2020-01-18 08:49:51 +01:00
Timm Bäder
e31c0898e5 cssnumbervalue: Add early-outs to transition code
we don't need to do the calculation at all if the progress is 0 or 1
anyway.

We also sometimes transition from 0 to 0 etc., so we can short-circuit
that as well by doing the fast pointer-equality check and relying on the
singletons.
2020-01-18 08:49:51 +01:00
Timm Bäder
1f2f2777e1 csscornervalue: Accept other values if x == y
Most corners are square, so x == y. In that case, just accept either of
them. This makes the corner value unnecessary.

In fact none of the corner values in the widget-factory are needed, so
this spares us around 500 corner value allocations.

css value stats before:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

and after:

GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
SUM: 7872

8428 to 7872 is a 556 reduction (6.5%)

asdf
2020-01-18 08:49:51 +01:00
Timm Bäder
9cb2fe5cac cssarrayvalue: Don't allocate memory when parsing array values
We probably won't find CSS with more than 128 values in array.
2020-01-18 08:49:51 +01:00
Timm Bäder
8d15efba8f cssarrayvalue: Allow calling array API on non-arrays
Just allow calling _get_nth() and _get_n_values() on every kind of css
value. This way we can allow all values in places where only array
values would be allowed before.

This spares us around 1000 array values in the widget factory.

css value stats before:

GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 1130
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
SUM: 9415

and after:

GtkCssBgSizeValue: 23
GtkCssIdentValue: 25
GtkCssPositionValue: 81
GtkCssCornerValue: 556
GtkCssArrayValue: 143
GtkCssStringValue: 33
GtkCssPaletteValue: 29
GtkCssImageValue: 2765
GtkCssColorValue: 1452
GtkCssFilterValue: 3
GtkCssRgbaValue: 1092
GtkCssShadowValue: 708
GtkCssEaseValue: 33
GtkCssBorderValue: 2
GtkCssTransformValue: 11
GtkCssDimensionValue: 882
GtkCssShadowsValue: 584
SUM: 8428

9415 to 8428 is a 987 reduction (10.4%)
2020-01-18 08:49:51 +01:00
Timm Bäder
1200fe2daf cssvalue: Add type names for all classes
This is important to have for debugging and e.g. to print statistics for
the individual css value types
2020-01-18 08:49:51 +01:00
Timm Bäder
515a527b27 csscolorvalue: Compute alpha/shade/mix of color literals directly
The values of these are never gonna change so we can as well create
literal color values from the resulting colors instead.
2020-01-18 08:49:51 +01:00
Timm Bäder
06dbde22a0 csscolorvalue: Don't resolve literal color values 2020-01-18 08:49:51 +01:00
Matthias Clasen
c21280e455 Merge branch 'adwaita-performance' into 'master'
Adwaita: Remove wildcards

Closes #2380

See merge request GNOME/gtk!1330
2020-01-18 06:43:11 +00:00
Matthias Clasen
0d9a7fe089 Adwaita: Remove wildcards
Selectors like *:disabled or *:link have bad performance
implications, since they cause all styles to be recomputed
when the state of the window changes. Replace these by a
list of the elements that are actually affected.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2380
2020-01-18 01:30:02 -05:00
Matthias Clasen
03883b8b1a Merge branch 'matthiasc/css-change-tracking-4' into 'master'
Improve change computation

See merge request GNOME/gtk!1327
2020-01-18 05:41:26 +00:00
Matthias Clasen
f28cd6cea9 Remove the widget-factory test again
This was failing in ci, in hard to track down ways.
2020-01-18 00:27:52 -05:00
Matthias Clasen
b8b90fefd8 change tests: Update test output
Some of these test cases involve :not, and thus are affected
by our now correct handling of it for change computation.

All of them are affected by the window now being visible.
2020-01-17 23:47:34 -05:00
Matthias Clasen
b4a9cf2bfb Remove no longer needed code
We no longer use superset or any matchers to find changes.
2020-01-17 23:47:34 -05:00
Matthias Clasen
2a919a4d4f Go back to the tree for computing change 2020-01-17 23:47:34 -05:00
Matthias Clasen
b2775d9bdd Redo the way we compute change
Instead of expecting a superset matcher, call
gtk_css_selector_match_for_change while walking the tree with the
original matcher. This fixes the handling of :not while determining
changes.
2020-01-17 23:47:34 -05:00
Matthias Clasen
d0a8a717ef Bring back the reserved bit 2020-01-17 23:47:34 -05:00
Matthias Clasen
7d72703d54 Revert "Remove no longer used code"
This reverts commit 105acfe908.
2020-01-17 23:47:34 -05:00
Matthias Clasen
8ecd4e87e3 Add testcases for css change flags
Add various tests for the change flag computation that
we do in the css selector tree.

test1: Just test the basic machinery of this test
test2: Trigger every change flag at least once
test3: Test that multiple states combine as expected
test4: Test negations (known to produce wrong results)
test5: Test a complex selector (not producing the expected
       output atm)
widget-factory.ui:
       The real thing: widget-factory+Adwaita. Note that
       this expedts to be run with GSETTINGS_BACKEND=memory

Note that test4 checks the wrong results that we currently
produce for selectors involving :not. It will have to be
updated when we fix the handling of :not. The widget-factory.ui
testcase will certainly also be affected.
2020-01-17 23:47:34 -05:00
Matthias Clasen
9de31929d6 Add a test for css change flags 2020-01-17 23:47:34 -05:00
Matthias Clasen
b41bba07fa Add a way to dump css node change values
Add a GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE flag that
tells gtk_style_context_to_string to include the
change values of nodes in the output. This will
help debugging css change tracking.
2020-01-17 23:47:34 -05:00
Matthias Clasen
0f694b8beb style tests: Update expected output
The printing of css nodes has changed, and the window
is visible now.
2020-01-17 23:47:34 -05:00
Matthias Clasen
7b1ab8fb8b style tests: Show the window
Not doing so somewhat defeats the point that we want
to verify the regular styles, not some weird initial
conditions.
2020-01-17 23:47:34 -05:00
Matthias Clasen
d9b1a1ebb1 style tests: Clean up --generate support
Reshuffle things so we don't call gtk_test_init() when --generate
is passed, to avoid polluting the output with test spew.
2020-01-17 23:47:34 -05:00
Matthias Clasen
d4f3979896 node tests: Update expected output
The printing of css nodes has changed and the
window is visible now.
2020-01-17 23:47:34 -05:00
Matthias Clasen
2e7cb6019f node tests: Show the window
This avoids using default styles.
2020-01-17 23:47:34 -05:00
Matthias Clasen
f1fce5253e node tests: Clean up --generate support
Reshuffle things so we don't call gtk_test_init() when --generate
is passed, to avoid polluting the output with test spew.
2020-01-17 23:47:34 -05:00
Matthias Clasen
81b65eadcb Add an Empty theme for tests 2020-01-17 23:47:34 -05:00
Matthias Clasen
1e7705c08e cssnode: Fix a corner case in style computation
When we recomputed the change flags, and the style
did not change, we still need to replace the style
object, since it holds the new change flags.
2020-01-17 23:47:34 -05:00
Matthias Clasen
cc3cf581ab cssnodedeclaration: Make print output deterministic
This was depending on the memory order of quarks, which
is not a good fit for tests that depend on this output.
2020-01-17 23:47:34 -05:00
Matthias Clasen
6e09c5cee8 Quiet compiler warnings in release builds 2020-01-17 23:47:34 -05:00
Matthias Clasen
69fb3648b2 Tweak the file transfer portal _again_
This is a neverending story. I was seeing problems in tests where
the nested mainloop was picking up unrelated timeouts.

Break down and make this async. This changes the ordering in which
the (de)serializers are registered. If this is causing issues, we
can introduce priorities or something else.
2020-01-17 23:46:37 -05:00
Matthias Clasen
23f84e3a3d Merge branch 'gtk-fix-gesture-get-center' into 'master'
gtkgesture: Fix gtk_gesture_get_bounding_box_center() for touchpads

Closes #2316

See merge request GNOME/gtk!1257
2020-01-17 21:59:33 +00:00
Yariv Barkan
1a9b1f38a4 demo: Use pinch translation in the gestures demo
Add the pinch translation offset to the pinch gesture demo. That allows
moving the square around in addition to the already-supported rotate and
zoom.
2020-01-17 22:34:48 +02:00
Yariv Barkan
00a488a5b5 gtkgesture: Fix get-center for touchpad gestures
Touchpad gestures have only a single event sequence. The current
'center' of the gesture is the starting point + accumulated deltas.
Update gtk_gesture_get_bounding_box_center() accordingly.
2020-01-17 22:34:48 +02:00
Matthias Clasen
26c4c28068 Fix a few bugs in the css change flag definition
These were found by the new change flag tests.
2020-01-17 11:26:50 -05:00
Timm Bäder
da2e184639 Merge branch 'fix-imwayland-cursor' into 'master'
imwayland: Fix get_preedit_string cursor position (GTK4)

Closes #2383

See merge request GNOME/gtk!1328
2020-01-17 09:24:48 +00:00
xdavidwu
9576222b47 imwayland: Fix get_preedit_string cursor position
GtkIMContext get_preedit_string should return cursor position counted
in characters, but cursor_begin here is counted in bytes. This add the
missing conversion.
2020-01-17 16:16:13 +08:00
Matthias Clasen
7738a05bd2 Merge branch 'matthiasc/css-change-tracking-3' into 'master'
Preliminary css matcher work

See merge request GNOME/gtk!1326
2020-01-17 00:38:04 +00:00
Matthias Clasen
93b5b487ae cssmatcher: Change get_state to has_state
This matches all the other vfuncs, and it gets us
out of keeping several big state flag enumerations
in sync.

Update all callers.
2020-01-16 19:24:43 -05:00
Matthias Clasen
7588655a42 Allow printing css matchers
This can help in debugging css matching.
2020-01-16 19:11:21 -05:00
Matthias Clasen
007713c0ba css: Add a matcher type enum
For now, this just replaces the is_any boolean
by a type field in the class. It will be used in
future commits.
2020-01-16 19:11:21 -05:00
Matthias Clasen
f0c1c3349f css: Simplify the superset matcher
We use the superset matcher in exactly one place,
so there is no need for the generality of allowing
to ignore different aspects. Just hardcode the one
case we need: ignoring everything except for name,
id and class.
2020-01-16 19:11:08 -05:00
Matthias Clasen
0dba6e5759 Cosmetic change
Update comments for name changes that happened long ago.
2020-01-16 19:10:03 -05:00
Matthias Clasen
60cd7cd96c css: Fix the ANY matcher state list
The ANY and matcher was not, in fact, matching any state,
since the list of states was not up-to-date.

The same fix applies to the superset matcher as well.
2020-01-16 19:09:19 -05:00
Matthias Clasen
2b504201e3 Merge branch 'matthiasc/css-change-tracking-2' into 'master'
Better css change tracking

See merge request GNOME/gtk!1325
2020-01-16 23:00:17 +00:00
Matthias Clasen
3fcbe8d5f3 Remove an unused define
We no longer use the GTK_CSS_CHANGE_RESERVED_BIT define.
2020-01-16 17:39:03 -05:00
Matthias Clasen
105acfe908 Remove no longer used code
We no longer consult the selector tree to find changes,
so this code is no longer needed.
2020-01-16 17:24:34 -05:00
Matthias Clasen
1caf197a0d css: Don't got to the selector tree for change
The tree is optimized for mimizing the decisions, and is built ahead-of-time.
That prevents us from taking advantage of the information in the matcher when
collecting changes.

So, instead do what we used to do for verification: Use the selector tree
for finding the superset matches, then just walk the rulesets to collect
the changes.

Since we are now recomputing the change masks much less frequently, this
slightly less optimized way of computing them is not a problem, and will
let us compute better results in the future, by improving the superset
matcher to be more precise.
2020-01-16 17:20:45 -05:00
Matthias Clasen
0a49726c73 cssprovider: Keep selectors around
Don't remove selectors from the rulsets after
creating the selector tree. We want to use them
in future commits.
2020-01-16 17:17:07 -05:00
Benjamin Otte
dd0cc9df9f Merge branch 'matthiasc/css-change-tracking' into 'master'
Better css change handling

See merge request GNOME/gtk!1324
2020-01-16 22:13:57 +00:00
Matthias Clasen
789f6f3941 css: Avoid computing change too often
Most of the time when styles need to be recreated, the name and classes
of the css node haven't changed. In this case, the change value will not
change either, since we are computing change under the assumption that
name and classes are unchanged.

So don't recompute the change. This avoids the second match we do to
find the superset, cutting down the number of times we consult the
selector tree.
2020-01-16 17:03:51 -05:00
Matthias Clasen
2c231f4336 Revisit gtk_css_style_get_static_style one more time
Move the implementation to where it belongs.
2020-01-16 17:02:21 -05:00
Matthias Clasen
3c50e5324f Change the signature of gtk_css_style_get_static_style
It is clearer if this function returns a GtkCssStaticStyle.
2020-01-16 14:06:14 -05:00
Matthias Clasen
3182063ffe Quiet a compiler warning
This was causing warnings in a release build.
2020-01-16 13:04:33 -05:00
Matthias Clasen
5910e5ac6d Merge branch 'static-style-getter' into 'master'
css: Add gtk_css_style_get_static_style

See merge request GNOME/gtk!1323
2020-01-16 17:10:31 +00:00
Matthias Clasen
b2b89f6c57 css: Add gtk_css_style_get_static_style
This lets us avoid poking directly at the GtkCssAnimatedStyle
struct in gtkcssnode.c.
2020-01-16 12:02:44 -05:00
Matthias Clasen
5ac24db049 Merge branch 'matthiasc/css-split-states' into 'master'
Split off some states in css change tracking

See merge request GNOME/gtk!1322
2020-01-16 16:58:23 +00:00
Matthias Clasen
192a24fa1f css: Track selected state separately
Like the previous change, this reduces the number of
css nodes reacting to parent-state changes. The remaining
parent-state cases here are due to :link.

Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2245
hover 562
disabled 859
backdrop 1080
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
parent-backdrop 4

After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2245
hover 562
disabled 859
backdrop 1080
selected 579
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 115
parent-hover 5
parent-disabled 91
parent-backdrop 4
parent-selected 144
2020-01-16 11:26:46 -05:00
Matthias Clasen
2426b9e23a css: Track backdrop state separately
Like the previous change, this reduces the number of
css nodes reacting to parent-state changes.

Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 562
disabled 859
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91

After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2245
hover 562
disabled 859
backdrop 1080
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
parent-backdrop 4
2020-01-16 11:25:04 -05:00
Matthias Clasen
64848aebf4 css: Track disabled state separately
Significantly reduces the number of nodes that react to
parent-state changes.

Before (numbers from widget-factory with Adwaita):
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 2247
sibling-name 63
sibling-state 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 2226
parent-hover 5

After:
2247 nodes
class 612
name 2246
id 2
first-child 148
last-child 156
state 2247
hover 562
disabled 859
sibling-name 63
sibling-disabled 51
parent-class 586
parent-name 788
parent-id 2
parent-first-child 78
parent-last-child 78
parent-state 236
parent-hover 5
parent-disabled 91
2020-01-16 11:23:25 -05:00
Matthias Clasen
fcceac6d11 css: Track hover state changes separately
The idea is that this reduce the amount of frequently
changing state that css nodes are sensitive to.

This is going to reduce the amount of style recomputation.
2020-01-16 11:17:48 -05:00
Matthias Clasen
975f6529b1 Merge branch 'wip/carlosg/x11-dnd' into 'master'
X11 dnd fixes.

See merge request GNOME/gtk!1321
2020-01-16 14:29:48 +00:00
Carlos Garnacho
357e215fb8 gdkdrag/x11: Issue XdndLeave on cancellation
According to XDND "The XdndLeave message cancels the session.",
issue one when cancelling a drag, so the dest side has an opportunity
to forget about the GdkDrop.
2020-01-16 15:03:24 +01:00
Carlos Garnacho
4716c9ae2f gdkdrag/x11: Drop timestamp argument from gdk_drag_do_leave()
This is not necessary for the XdndLeave message, nor used.
2020-01-16 15:02:16 +01:00
Carlos Garnacho
5aad3d7d0e gdk/x11: Ensure to hide DnD surface after failed operation
The drag source might be cached and held alive, only disposed after
future drag begin operations. Ensure the drag surface gets hidden
properly or might might stay transparent but mapped till then.
2020-01-16 13:34:08 +01:00
Carlos Garnacho
fe36c24b07 gdk/x11: Ensure to sync type list after sending XdndEnter
Otherwise we are not ensured the GdkDrop is up-to-date, might even
be a stale one from an older DnD operation.
2020-01-16 13:33:57 +01:00
Carlos Garnacho
682068f887 gdk/x11: Serialize gtype content formats before sending Xdnd enter
This ensures GType handlers get serialized to mimetypes at the time
the drag dest inspects the XdndTypeList property.
2020-01-16 13:31:40 +01:00
Matthias Clasen
e8eb1df29f Speed up gtk_widget_pick
Add early exits, and avoid as much work as
possible.
2020-01-15 11:01:20 -05:00
Matthias Clasen
82dc7b903c Fix the filetransfer portal initialization
Reusing the cancellable only works if you don't throw
it away after first use.
2020-01-15 10:58:54 -05:00
Matthias Clasen
b020a3fcf9 Try harder to make ci not timeout
Make getting the file transfer portal proxy more
async, and avoid leaking a bus connection. This
causes GTestDBus to hang at the end of the test
run.
2020-01-14 18:32:05 -05:00
Matthias Clasen
cb88de5938 css: Drop unsused bitmasks
GtkCssProvider was maintaining bitmasks for the
set properties in each ruleset. The masks are never
used, so drop them.
2020-01-14 18:32:05 -05:00
Matthias Clasen
94b1e72aa3 css: Remove an unused function
_gtk_css_style_property_get_mask_affecting was superseded
by GtkCssStyleChange back in 2015.
2020-01-14 18:32:05 -05:00
Matthias Clasen
20b92638ec testsuite: Improve --generate support
We don't want annoying spew from GTest when
using --generate, since it interferes with just
piping the output to a text file.
2020-01-14 18:32:05 -05:00
Matthias Clasen
dccb83c9ec quiet a compiler warning in release builds 2020-01-14 18:32:05 -05:00
Alex Samorukov
d668d2fa25 Use bundle id instead of package name for the macOS preview as filename is now changed 2020-01-14 22:15:05 +00:00
Matthias Clasen
34f1ae8fad fontchooser: Fix up the previous commit 2020-01-14 15:42:01 -05:00
Matthias Clasen
042537cf0d fontchooser: Fix objects-finalize test
The treeview is evil and keeps reference cycles in the
form of various tree row references. That gets cleaned up
if you explicitly gtk_widget_destroy the treeview. But since
07f2024bfc, the scrolled window no longer destroys
its child, exposing this issue as a reference leak in
the objects-finalize test.

The font chooser widget is affected here because it calls
gtk_tree_view_scroll_to_path from init(), which creates one
of those reference cycles. Work around this in the font
chooser by unsetting the tree view model in dispose, which
clears up this cycle.
2020-01-14 15:25:27 -05:00
Matthias Clasen
d03f38470e Fix encoding symbolic pixbufs
This was broken in 1a931da046.
2020-01-14 14:14:45 -05:00
Sucipto
a7d72cf69b Update Indonesian translation 2020-01-14 15:11:27 +00:00
Matthias Clasen
256139baab testsuite: Skip GtkDragIcon
GtkDragIcon needs a special surface, so skip it
in the notify tests.
2020-01-14 09:20:18 -05:00
Daniel Mustieles
a935aae6f1 Updated Spanish translation 2020-01-14 12:39:44 +01:00
Kukuh Syafaat
9955d686ee Update Indonesian translation 2020-01-14 06:27:18 +00:00
Matthias Clasen
a9da41c66a Merge branch 'adwaita-cross-fade-fix-gtk4' into 'master'
Adwaita: Fix syntax error in cross-fade() (GTK4)

Closes #2371

See merge request GNOME/gtk!1308
2020-01-14 06:08:24 +00:00
Matthias Clasen
4d8691b762 Merge branch 'wip/chergert/fix-dragicon-installation' into 'master'
build: fix gtkdragicon header installation

See merge request GNOME/gtk!1306
2020-01-14 06:06:35 +00:00
Matthias Clasen
806e159b8b Handle lack of file transfer portal
Don't block for 25 seconds trying to get a bus
connection. Give up after 1 second.
2020-01-14 01:03:48 -05:00
Matthias Clasen
794ee0b8c0 gtk-demo: Use a default action in the infobars demo
This makes the question infobar activatable by clicking
anywhere in it.
2020-01-14 00:05:23 -05:00
Matthias Clasen
2b7de841a9 Adwaita: Add hover for clickable infobars 2020-01-14 00:05:23 -05:00
Matthias Clasen
45309811c5 infobar: Activate default action on clicks
When we have a default action set on the infobar, activate it
for clicks anywhere in the infobar.  Also add an .action style
class in this case, so we can add a hover highlight to the infobar
just for this case.
2020-01-14 00:05:23 -05:00
Matthias Clasen
2b695ac8d1 Merge branch 'wip/chergert/textview-propagate-undo-state' into 'master'
textview: propagate GtkTextBuffer can-undo/redo action state

See merge request GNOME/gtk!1311
2020-01-14 01:59:22 +00:00
Christian Hergert
cb03969c5f textview: propagate GtkTextBuffer can-undo/redo action state
This ensures the action state for undo and redo are propagated from the
buffer. Doing so means menu items now properly show sensitivity.
2020-01-13 17:26:18 -08:00
Matthias Clasen
57e71a6a69 Merge branch 'wip/chergert/textview-undo-menu-item' into 'master'
textview: add undo/redo menu actions

See merge request GNOME/gtk!1310
2020-01-13 23:51:40 +00:00
Christian Hergert
15b5a404b8 textview: add undo/redo menu actions 2020-01-13 15:25:05 -08:00
nana-4
4056a40d2d Adwaita: Fix syntax error in cross-fade()
cross-fade() requires two images.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2371
2020-01-14 06:19:12 +09:00
Christian Hergert
c1e9523f0e build: fix gtkdragicon header installation 2020-01-13 09:07:24 -08:00
Daniel Mustieles
4c1ccfd7be Updated Spanish translation 2020-01-13 16:51:22 +01:00
Daniel Mustieles
823e00dec9 Updated Spanish translation 2020-01-13 16:50:21 +01:00
Timm Bäder
3e51966ea9 Merge branch 'wip/jimmac/updated-checkmark' into 'master'
Adwaita: update checkbox & radio

Closes #2291

See merge request GNOME/gtk!1289
2020-01-13 14:12:51 +00:00
Jakub Steiner
e292767a01 Adwaita: update checkbox & radio
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2291
2020-01-13 13:45:34 +01:00
Matthias Clasen
75c433fb5f Merge branch 'closure-annotations' into 'master'
Fix incorrect use of GIR closure annotations.

See merge request GNOME/gtk!1305
2020-01-13 05:00:12 +00:00
Robert Ancell
83867f9cbf Add missing (closure) GIR annotations 2020-01-13 14:26:50 +13:00
Robert Ancell
ea9f0df67b Fix incorrect use of GIR closure annotations.
They were being applied to the callback function, not the data that is passed
to that function.
2020-01-13 14:11:15 +13:00
Matthias Clasen
15c7980ba6 Merge branch 'textbuffer-missing-api-docs' into 'master'
Add missing public API documentation.

See merge request GNOME/gtk!1301
2020-01-13 00:51:24 +00:00
Matthias Clasen
de5fde1e12 Merge branch 'menutoolbutton-missing-api-docs' into 'master'
menutoolbutton: Add missing public API documentation.

See merge request GNOME/gtk!1303
2020-01-13 00:50:58 +00:00
Matthias Clasen
a83b360224 Merge branch 'docstring-typos' into 'master'
Fix docstring errors with drag and drop code

See merge request GNOME/gtk!1304
2020-01-13 00:50:16 +00:00
Matthias Clasen
4d55d23c1a Merge branch 'missing-transfer-notation' into 'master'
Add missing transfer notation for function return types.

See merge request GNOME/gtk!1302
2020-01-13 00:49:25 +00:00
Robert Ancell
2b6162116d Fix docstring errors with drag and drop code 2020-01-13 12:30:17 +13:00
Robert Ancell
b2ca947934 textbuffer: Add missing public API documentation.
This API was added in a52757874e.
2020-01-13 12:19:43 +13:00
Robert Ancell
3eaf88b84c menutoolbutton: Add missing public API documentation.
This API was added in 03e30431a8
2020-01-13 12:17:55 +13:00
Robert Ancell
9e9eae3ad4 Add missing transfer notation for function return types. 2020-01-13 12:14:08 +13:00
Matthias Clasen
903afcbddd Adwaita: Fix needs-attention
Stack switchers are now stackswitcher, no longer .stack-switcher.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2370
2020-01-11 20:14:35 -05:00
Piotr Drąg
d37612a476 Update POTFILES.in 2020-01-11 16:07:48 +01:00
Matthias Clasen
f5daecf353 Merge branch 'dnd-gestures-2' into 'master'
Add new dnd api

See merge request GNOME/gtk!1278
2020-01-11 06:09:58 +00:00
Matthias Clasen
b76940bab5 dragdest: More documentation 2020-01-11 00:50:22 -05:00
Matthias Clasen
ec255f9bb1 Update all callers 2020-01-11 00:50:22 -05:00
Matthias Clasen
9dc6be4fb0 Reshuffle droptarget api a little bit
Add a ::drag-motion signal back, remove x,y from
the ::accept signal, and only emit ::accept once.
2020-01-11 00:49:59 -05:00
Matthias Clasen
186b783f9d Merge branch 'wip/chergert/gtk4-gtk-main-sync' into 'master'
Rubustness fixes for gtk_main_sync()

See merge request GNOME/gtk!1299
2020-01-11 04:41:46 +00:00
Christian Hergert
2f3518c80d gtkmain: be deterministic in source removal
Fixes gtk_main_sync() to only remove a source if it has not
already executed (and been removed). The previous code was
using gtk_main_quit() directly which would be non-determinstic
based on the previous value in the return register.
2020-01-10 15:04:44 -08:00
Christian Hergert
4a7f68e79e gtkmain: short-circuit gtk_main_sync() where no display
If there is no display, we will hit the slow path here which
can introduce long latencies in unit tests. This checks for
a NULL list of displays and simply short-circuits.
2020-01-10 15:00:10 -08:00
Matthias Clasen
65af983ddb Merge branch 'css-font-values' into 'master'
Css font values

See merge request GNOME/gtk!1298
2020-01-10 22:47:41 +00:00
Matthias Clasen
f0dc5e0be5 css: Simplify font features
Don't store numbers as GtkCssValues needlessly.
2020-01-10 16:59:56 -05:00
Alex Samorukov
f0cbd175cd gdk_quartz_keymap_translate_keyboard_state fills consumed_modifiers
incorrectly (closes #2102)

See merge request GNOME/gtk!1225
2020-01-10 22:18:24 +01:00
Matthias Clasen
99aa47185e css: Simplify compute for font variations
Just like font features, font variations are stored
as a hash table mapping strings to pure number values,
which never change during compute.
2020-01-10 15:49:00 -05:00
Matthias Clasen
898e29c989 css: Simplify compute for font features
Font features consist of a hash table of number
values, which will never change during compute,
so there is no point in recreating a new value
with a copy of the hash table, constaining the
same string->number mapping.
2020-01-10 15:48:51 -05:00
Matthias Clasen
cf1700fd13 Merge branch 'kill-builtin-image' into 'master'
Kill builtin image

See merge request GNOME/gtk!1297
2020-01-10 19:43:14 +00:00
Matthias Clasen
112aed590f Remove builtin icons altogether
This removes support for GtkCssImageBuiltin and
GtkCssImageBuiltinType from everywhere.
2020-01-10 14:34:56 -05:00
Matthias Clasen
6763443c5d css: Stop supporting builtin images
Change the default value of -gtk-icon-source to 'none',
and stop parsing 'builtin' as a value.
2020-01-10 14:32:06 -05:00
Dušan Kazik
7d99339c39 Update Slovak translation 2020-01-10 06:47:50 +00:00
Matthias Clasen
f33fe6daed testdnd: Fix up for current api 2020-01-09 10:29:33 -05:00
Matthias Clasen
c7dc17d837 docs: Expand the dnd migration hints 2020-01-09 07:47:28 -05:00
Matthias Clasen
a51ee20ed9 dragicon: Add docs 2020-01-09 00:50:33 -05:00
Matthias Clasen
8d3e1eb314 docs: Fix a typo 2020-01-09 00:31:13 -05:00
Matthias Clasen
c941a2d9c6 Properly export GtkDragIcon
The get_type function was missing.
2020-01-09 00:30:41 -05:00
Matthias Clasen
1c03bbeb9c Update all users 2020-01-08 18:48:23 -05:00
Matthias Clasen
a4059cd02d dragdest: Rename ::drag-motion to ::accept 2020-01-08 18:48:23 -05:00
Matthias Clasen
eab6df31ac dragdest: Allow denying drops asynchronously
Add an api to deny a drop, this is meant to be used
when delaying the decision on whether to accept a
drop until after reading the data.
2020-01-08 18:48:23 -05:00
Matthias Clasen
8a085fcc5a remove debug spew 2020-01-08 18:48:23 -05:00
Matthias Clasen
7668669d56 dragdest: Add a ::drag-enter signal
Mainly for symmetry with ::drag-leave.
2020-01-08 18:48:22 -05:00
Matthias Clasen
5e57b3d07a testdnd2: Fix the text case
We must take mime types into account when checking.
2020-01-08 18:48:22 -05:00
Matthias Clasen
187a701a99 content provider impl: Take mime types into account 2020-01-08 18:48:22 -05:00
Matthias Clasen
d5f4579384 dragdest: Steps towards allowing nested drop sites 2020-01-08 18:48:22 -05:00
Matthias Clasen
0297039b38 Add another dnd testcase
This one tests nested drop sites and interaction between
DND and other gestures.
2020-01-08 18:48:22 -05:00
Matthias Clasen
5206a92522 Update all callers 2020-01-08 18:48:22 -05:00
Matthias Clasen
233ec1a5d6 Add GdkDrop back to signal signatures 2020-01-08 18:48:22 -05:00
Matthias Clasen
579d8e427b Drop gtk_drag_(un)highlight 2020-01-08 18:48:22 -05:00
Matthias Clasen
9c11c60530 filechooser: Remove code for sidebar pre-arming
This is just not a feature we can support currently.
Doing it properly would require infrastructure for
a generalized :drag(sensitive) state highlighting
potential drag sites everywhere.
2020-01-08 18:48:22 -05:00
Matthias Clasen
66c8da4750 listbox: Stop using gtk_drag_(un)highlight
This api is going away, so just do what needs to
be done manually.
2020-01-08 18:48:22 -05:00
Matthias Clasen
05a9b72fc8 calendar: Remove drag highlighting calls
This is happening unconditionally, anyway.
2020-01-08 18:48:22 -05:00
Matthias Clasen
4fe5710456 textview: Remove unnecessary drag highlighting
GTK does this unconditionally anyway, now.
2020-01-08 18:48:22 -05:00
Matthias Clasen
ac5b4a6307 text: Remove unnecessary drag highlighting
GTK does this unconditionally anyway, now.
2020-01-08 18:48:22 -05:00
Matthias Clasen
5ce7bfbbd8 notebook: Receive tab dnd on the tabs
Don't make the whole notebook a drop target
for tab dnd, but just the tab bar. This will
help with drag highlighting, and it arguably
more correct anyway.
2020-01-08 18:48:22 -05:00
Matthias Clasen
7646d1b22c Adwaita: No drag highlight for placessidebar
It does its own custom thing.
2020-01-08 18:48:22 -05:00
Matthias Clasen
61db81ab8e Adwaita: No dnd highlight for iconviews
We only want to highlight the drop location
that is rendered with a separate css node now.
2020-01-08 18:48:22 -05:00
Matthias Clasen
24d7586163 iconview: Use a named subnode for dnd highlight
This is necessary because we want to style the
iconview itself and the item highlighting differently.
2020-01-08 18:48:22 -05:00
Matthias Clasen
b150625105 Adwaita: No dnd highlight for treeviews
We only want to highlight the drop location
that is rendered with a separate css node now.
2020-01-08 18:48:22 -05:00
Matthias Clasen
5787146238 treeview: Use a named subnode for dnd highlight
This is necessary because we want to style the
treeview itself and the row highlighting differently.
2020-01-08 18:48:22 -05:00
Matthias Clasen
8a72031e99 Adwaita: No drag highlight for stack switchers 2020-01-08 18:48:22 -05:00
Matthias Clasen
201a791076 Adwaita: No drag highlight for expanders
This is pretty ugly, because Adwaita has a very
generic drop-highlight implementaiton that we
need to overrule.
2020-01-08 18:48:22 -05:00
Matthias Clasen
359003670a dragdest: Rename ::armed to ::contains 2020-01-08 18:48:22 -05:00
Matthias Clasen
6b7c5174ed gtk-demo: Update the ::prepare handler 2020-01-08 18:48:22 -05:00
Matthias Clasen
8a521accbc dragsource: Change the ::prepare return type
Make it return the content provider to use for
the next drag. This allows just-in-time provision
of the content provider. The default handler just
returns the value of the ::content property.
2020-01-08 18:48:22 -05:00
Matthias Clasen
d116bbf0c8 docs: Expand the GDK dnd docs 2020-01-08 18:48:22 -05:00
Matthias Clasen
42e440a111 docs: Add GtkDragIcon 2020-01-08 18:48:22 -05:00
Matthias Clasen
13adb2591c docs: Add GtkDropTarget section 2020-01-08 18:48:22 -05:00
Matthias Clasen
7b73824dfe docs: Remove dropped drag source apis 2020-01-08 18:48:22 -05:00
Matthias Clasen
403aba82a9 docs: Remove the dnd section
These functions in this section are all gone.
2020-01-08 18:48:22 -05:00
Matthias Clasen
a053d7ddb1 dragsource: Drop gtk_drag_source_drag_begin
No longer used. Also, minor cleanups all over.
2020-01-08 18:48:22 -05:00
Matthias Clasen
c878f650ce dragksource: Small doc fix 2020-01-08 18:48:22 -05:00
Matthias Clasen
2d2cdeae88 Drop GTK content formats apis
These functions have been superseded by better
facilities in GDK.
2020-01-08 18:48:22 -05:00
Matthias Clasen
009228471c testdnd2: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
379166e1ff text: Use GDK content formats API 2020-01-08 18:48:22 -05:00
Matthias Clasen
a59a20c1d4 placessidebar: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
fb4b5c666b filechooserwidget: Use GDK content formats api: 2020-01-08 18:48:22 -05:00
Matthias Clasen
b59c70aaeb filechooserbutton: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
6fcae42dde calendar: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
2ee087f25f iconbrowser: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
9cc29efa25 gtk-demo: Use GDK content formats api 2020-01-08 18:48:22 -05:00
Matthias Clasen
a04d314910 text: Fix dragging of text across focus changes
When dragging selected text from an entry over a stackswitcher
to show a different page, the focus changes, causing the selection
to be lost; we should not lose the dragged content in this case.
2020-01-08 18:48:22 -05:00
Matthias Clasen
f83f7a2b4d Adwaita: Add drop highlight for iconview items 2020-01-08 18:48:22 -05:00
Matthias Clasen
edb175cf75 iconview: Render drop highlight properly
Use :drop(active) and render a frame, not focus.
2020-01-08 18:48:22 -05:00
Matthias Clasen
1eefaf8b41 dragsource: Fix cancellation
We need to properly end the drag.
2020-01-08 18:48:22 -05:00
Matthias Clasen
0224517806 filechooser: Stop using gtk_drag_source_get_drag 2020-01-08 18:48:22 -05:00
Matthias Clasen
27c521cce8 placessidebar: Update a comment 2020-01-08 18:48:22 -05:00
Matthias Clasen
62b87182c5 Remove an unused enum
We are not using GtkDragResult anymore.
2020-01-08 18:48:22 -05:00
Matthias Clasen
c95659bf32 testdnd2: Update to the api change in the previous commit 2020-01-08 18:48:22 -05:00
Matthias Clasen
865fc9c925 dragsource: Rename ::drag-failed to ::drag-cancel
This matches the names of the GdkDrag signals.
2020-01-08 18:48:22 -05:00
Matthias Clasen
a1f4f52fcb dragsource: Tweak docs more 2020-01-08 18:48:22 -05:00
Matthias Clasen
bdb4bf00c5 dragsource: Document prepare 2020-01-08 18:48:22 -05:00
Matthias Clasen
aca252837d dragsource: Make ::prepare return a boolean
Make ::prepare return TRUE to start a drag.
The default handler simply checks that we
have a content provider and actions.
2020-01-08 18:48:22 -05:00
Matthias Clasen
8b058572f0 dragsource: Drop gtk_drag_get_source 2020-01-08 18:48:22 -05:00
Matthias Clasen
df050c51bb notebook: Stop using gtk_drag_get_source 2020-01-08 18:48:21 -05:00
Matthias Clasen
bd20ae4fa5 dragsource: Drop gtk_drag_source_get_origin 2020-01-08 18:48:21 -05:00
Matthias Clasen
818b456f9f filechooserwidget: Stop using gtk_drag_source_get_origin 2020-01-08 18:48:21 -05:00
Matthias Clasen
c1c8abf275 notebook: Stop using gtk_drag_source_get_origin 2020-01-08 18:48:21 -05:00
Matthias Clasen
c1029535ca testtoolbar: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
a5ca5eb865 testlist3: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
2227d2a2b5 testdnd2: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
61559e38f4 testdnd: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
134fca47e3 pathbar: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
4630dd8d68 notebook: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
d2f7d1b1d7 linkbutton: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
cfa9e6da4a colorswatch: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
ceca2f9202 colorbutton: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
bf98ebcb12 iconbrowser: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
1a5dece09c gtk-demo: Use gtk_widget_add_controller for drag source 2020-01-08 18:48:21 -05:00
Matthias Clasen
8e8254feae filechooserwidget: wip 2020-01-08 18:48:21 -05:00
Matthias Clasen
90cda9e307 treeview: Use gdk_drag_begin 2020-01-08 18:48:21 -05:00
Matthias Clasen
fdfa371d90 iconview: Use gdk_drag_begin
This is a little more involved here.
2020-01-08 18:48:21 -05:00
Matthias Clasen
deb16c1a00 Make GtkDragSource a gesture 2020-01-08 18:48:21 -05:00
Matthias Clasen
8c3736709e notebook: Use gdk_drag_begin
Use gdk_drag_begin for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f459164f8a placessidebar: Use gdk_drag_begin
Use gdk_drag_begin for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
00169a06bf textview: Use gdk_drag_begin
Use gdk_drag_begin for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
e09f2b8b56 entry: Use gdk_drag_begin
Use gdk_drag_begin for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
092c115ff0 text: Use gdk_drag_begin
Use gdk_drag_begin directly for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
5144d15168 calendar: Use gdk_drag_begin
Use gdk_drag_begin directly for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
5a6ab8cbd3 label: Use gdk_drag_begin
Use gdk_drag_begin directly for one-off drags.
2020-01-08 18:48:21 -05:00
Matthias Clasen
8c73f882af dragsource: Use public drag icon api 2020-01-08 18:48:21 -05:00
Matthias Clasen
78832c65b5 Make GtkDragIcon public
This is needed if we want to use gdk_drag_begin
for one-off drags, without a GtkDragSource.
2020-01-08 18:48:21 -05:00
Matthias Clasen
e8b830a3dd dragsource: Reshuffle api a bit
Remove arguments from the constructor.

For actions, we now default to COPY, which is the most common one
that we should enable by default (MOVE requires handling deletion
on the the source side, and ASK only makes sense if we have
multiple actions).

For the content provider, we add a new ::prepare signal where
it should be provided just-in-time.
2020-01-08 18:48:21 -05:00
Matthias Clasen
38974d7d2b dragsource: Tweak api, update all callers
Add GdkDrag back to signals, drop ::drag-data-delete,
and replace it with a boolean in ::drag-end.
2020-01-08 18:48:21 -05:00
Carlos Garnacho
f6f331efe3 gdk/x11: Forward suggested action (if any) to XdndStatus
Go ahead with the suggested action, so the drag source may update
cursor feedback properly, and eventually result in the correct
action.
2020-01-08 18:48:21 -05:00
Carlos Garnacho
dbb3727b03 popover: Use g_signal_connect_object on parent widget signal
The popover may be destroyed, leaving this dangling signal. This
may cause crashes on future parent widget resizes.
2020-01-08 18:48:21 -05:00
Matthias Clasen
508570864d Remove gtk_drop_target_get_target
Now that drop targets are event controllers,
we can just use gtk_event_controller_get_widget.
Update all callers.
2020-01-08 18:48:21 -05:00
Matthias Clasen
96c77b61c1 Remove an unused signal 2020-01-08 18:48:21 -05:00
Matthias Clasen
2b819c830b docs: Tweak GtkDropTarget docs 2020-01-08 18:48:21 -05:00
Matthias Clasen
f3be49838f Move code over
Move remaining code from gtkdnd.c to gtkdragdest.c
and nuke gtkdnd.c and gtkdndprivate.h.
2020-01-08 18:48:21 -05:00
Matthias Clasen
e9067ae2db Replace gtk_drop_target_attach/detach
Since drop targets are now just event controller,
gtk_widget_add/remove_controller works just fine
for them.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f898bee032 Use normal event propagation for DND events
This works just fine, now that drop targets are
event controllers. There is only a very vestigial
gtk_drag_dest_handle_event() left that deals with
corner cases.
2020-01-08 18:48:21 -05:00
Matthias Clasen
6a7f39e6d2 Get rid of GtkDragDestInfo
We can just attach the GtkDropTarget directly to
the GdkDrop.
2020-01-08 18:48:21 -05:00
Matthias Clasen
dfb2cbdfdb Turn GtkDropTarget into an event controller
We are still propagating the drag events manually,
but we are now calling gtk_widget_run_controllers
to pass them to drop targets.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f960eb6ab4 More internal restructuring 2020-01-08 18:48:21 -05:00
Matthias Clasen
60fc2c6a7a dnd: Another internal refactoring step 2020-01-08 18:48:21 -05:00
Matthias Clasen
3080592234 gdk: Make gdk_event_set_coords support dnd events
GTK event propagation code relies on this working.
2020-01-08 18:48:21 -05:00
Matthias Clasen
532fdde720 dnd: More internal restructuring 2020-01-08 18:48:21 -05:00
Matthias Clasen
f8399588e9 dnd: Some internal restructuring
Nudge the code towards being like event controllers.
2020-01-08 18:48:20 -05:00
Matthias Clasen
ad019be75b Drop an unused define 2020-01-08 18:48:20 -05:00
Matthias Clasen
e505dab487 Stop passing timestamps around
We were not using these in a useful way in the end,
so stop passing them around.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1262184269 droptarget: Drop the track-motion property
It does not have any effect anymore.

Update all callers
2020-01-08 18:48:20 -05:00
Matthias Clasen
46f42fc53d droptarget: Drop defaults flags
These no longer have any effect.

Update all callers.
2020-01-08 18:48:20 -05:00
Matthias Clasen
cb26cd7391 Simplify some drag dest internals
Change things around to make the default handler
of GtkDropTarget::drag-motion implement the default
handling. Always emit ::drag-motion and ::drag-leave,
and always arm the drop target.

This makes the GTK_DEST_DEFAULT_MOTION flag and
the ::track-motion property unnecessary.

Drop targets that are purely after track-motion
handling for ui switching purposes, such as
GtkStackSwitcher, will have to undo the automatic
arming in a notify::armed handler.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1a3eeb1233 Drop GTK_DEST_DEFAULT_HIGHLIGHT
Redo highlight handling slightly. GtkDropTarget now has
a ::armed property that can be tracked to do custom highlighting,
and we always add the dnd style class to armed drop sites.
2020-01-08 18:48:20 -05:00
Matthias Clasen
e1f74c8f69 dragdest: Clean up internals
Remove the no-longer needed GtkDragDest struct
and just attach the GtkDropTarget directly.
2020-01-08 18:48:20 -05:00
Matthias Clasen
58106af54d testdnd2: Add a test for ASK handling
It is a bit unfortunate that we need to extend the
lifespan of the drop object by keeping our own
ref, but I don't see a better way of doing it.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
19ee9b4c57 Remove gdk_drag_get_data
This is not used anymore, so we can remove it,
and the GtkDropTarget::drag-data-received signal
that it emits.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1075607528 treeview: Stop using ::drag-data-received 2020-01-08 18:48:20 -05:00
Matthias Clasen
d2bd9b0850 iconview: Avoid drag-data-received 2020-01-08 18:48:20 -05:00
Matthias Clasen
74d445636c testtreednd: Use the new asyn selection read 2020-01-08 18:48:20 -05:00
Matthias Clasen
7048790931 testlist3: Use async read api for selection 2020-01-08 18:48:20 -05:00
Matthias Clasen
b9034015d7 filechooser: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
c7b70b122a placessidebar: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
6e01a49d10 iconview: Port to GtkDropTarget
A small api change here is that
gtk_icon_view_enable_model_drag_dest now returns
a GtkDropTarget that can be used to connect signals.
2020-01-08 18:48:20 -05:00
Matthias Clasen
c290bd6367 Add an async read function for selection
This is meant as a replacement for ::drag-data-received
in cases where a #GtkSelectionData object is still needed,
such as when using GtkTreeModel DND support.
2020-01-08 18:48:20 -05:00
Matthias Clasen
853063bea7 Remove old drag dest api 2020-01-08 18:48:20 -05:00
Matthias Clasen
69e3fee5e2 Move some remaining api over 2020-01-08 18:48:20 -05:00
Matthias Clasen
aa276a181e listbox: Remove unhighlighting
This will have to be done differently, if necessary.
2020-01-08 18:48:20 -05:00
Matthias Clasen
583705b4ae notebook: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
cd7303d47c testtreednd: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
0f9cbf49ac testnotebookdnd: Fix, partially
Make this mostly work again.
2020-01-08 18:48:20 -05:00
Matthias Clasen
a309e74be7 testtoolbar: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
ccaf70e1b7 testlist3: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
2fd9431f23 testdnd: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
3f33a0ed27 testdnd2: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
4ea18a22e6 treeview: Port to GtkDropTarget
A small api change here is that
gtk_tree_view_enable_model_drag_dest now returns
a GtkDropTarget that can be used to connect signals.
2020-01-08 18:48:20 -05:00
Matthias Clasen
746dc5c3a2 textview: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
17131f1137 filechoserbutton: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
07c889c5ea stackswitcher: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
b0d9a6ff20 expander: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
802c7975e2 window: Port to GtkDragDest 2020-01-08 18:48:20 -05:00
Matthias Clasen
6e602e052b text: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
025eee112c colorswatch: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
70cdd4e951 colorbutton: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
75b789f20f calendar: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
ac09500d74 gtk-demo: Convert clipboard demo to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
a76b187a5b drop: Add a convenience api
This is a question that drag-drop handlers frequently
need to answer, so make it easy.
2020-01-08 18:48:20 -05:00
Matthias Clasen
45679d7bc3 dragdest: doc improvements 2020-01-08 18:48:20 -05:00
Matthias Clasen
6dc8fc3a4d Add a GtkDropTarget object
Add an explicit GtkDropTarget object, and move the destination-side
DND signals here. The object is used by connecting to its signals
and attaching it to a widget with gtk_drop_target_attach().
2020-01-08 18:48:20 -05:00
Matthias Clasen
e53e0f461e Hook up the GtkDragSource docs 2020-01-08 18:48:20 -05:00
Matthias Clasen
37b849b808 Move the rest of the drag-source api over
Just reshuffling some source.
2020-01-08 18:48:20 -05:00
Matthias Clasen
e03bdbe307 docs: Mention DND in the migration guide 2020-01-08 18:48:20 -05:00
Matthias Clasen
9b01d9a784 Remove traditional drag source API
gtk_drag_source_set, gtk_drag_begin, related apis
and the GtkWidget source-side signals have all been
replaced by GtkDragSource.
2020-01-08 18:48:20 -05:00
Matthias Clasen
b4c689ecd6 tests: Convert to GtkDragSource
Some tests, such as testimage did not have
anything particularly worth keeping, so
were removed instead of fixed.
2020-01-08 18:48:19 -05:00
Matthias Clasen
78a0913f0f notebook: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
74722fb10e filechooser: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
3891ce36fe treeview: Port to GtkDragSource
A small api change here is that
gtk_tree_view_enable_model_drag_source now returns
a GtkDragSource that can be used to connect signals.
2020-01-08 18:48:19 -05:00
Matthias Clasen
5a940408fe placessidebar: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
efce8c2899 iconview: Port to GtkDragSource
A small api change here is that
gtk_icon_view_enable_model_drag_source now returns
a GtkDragSource that can be used to connect signals.
2020-01-08 18:48:19 -05:00
Matthias Clasen
ea9f2abcc4 Add another callback-based provider
This one can be used in cases where data needs
to be served in multiple formats that may not
all be covered by content serializers.
2020-01-08 18:48:19 -05:00
Matthias Clasen
993d6388ee iconbrowser: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
5ad4b75ae2 gtk-demo: Convert the clipboard demo to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
24ef9df0f1 pathbar: Convert to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
5d49b11ffd colorswatch: Convert to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
8e3db48482 colorbutton: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
fdcfe0e80a Add a generic callback content provider
This one is convenient to use in cases where a
drag is just serving an existing GType which
is covered by content serializers.
2020-01-08 18:48:19 -05:00
Matthias Clasen
8137dea8c1 Add (de)serializers for GdkRGBA
This is a format that we use in various
color picker widgets, so support it in GDK.
2020-01-08 18:48:19 -05:00
Matthias Clasen
b15c31a3f7 textview: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
a52757874e textbuffer: Add a content provider api
We need a content provider for the selection,
to implement DND, and the text buffer already
has one. Just add an api to get it.
2020-01-08 18:48:19 -05:00
Matthias Clasen
e9203eeef7 text: Convert to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
337057eb35 entry: Port icon dnd to GtkDragSource
This requires a small change in the api,
since we need to provide a GdkContentProvider now.
2020-01-08 18:48:19 -05:00
Matthias Clasen
2803a15a51 calendar: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
d145032cb6 linkbutton: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
2612331282 label: Port to GtkDragSource 2020-01-08 18:48:19 -05:00
Matthias Clasen
d3fd071809 dnd: Patch up gtk_drag_get_source_widget
This is temporary until gtk_drag_dest_set users
have been ported over.
2020-01-08 18:48:19 -05:00
Matthias Clasen
303c9becf8 Add a GtkDragSource object
Add an explicit GtkDragSource object, and move the source-side
DND signals here. The object can be used on the spot, by calling
gtk_drag_source_drag_begin() yourself, or for static drag-source
configuration, by calling gtk_drag_source_attach(). In the latter
case, we set up and conect a drag gesture to trigger the drag_begin
call.
2020-01-08 18:48:19 -05:00
Matthias Clasen
6bf46c8f30 marshalers: Add another 2020-01-08 18:48:19 -05:00
Timm Bäder
1e2c03beee rename CODE-OWNERS to CODEOWNERS
gitlab reads the new filename but not the old one.
2020-01-08 21:03:15 +01:00
Emmanuele Bassi
b24e10fa30 Merge branch 'fixed-fixed' into 'master'
fixed layout: Actually set child transforms

See merge request GNOME/gtk!1292
2020-01-08 15:46:19 +00:00
Matthias Clasen
173952cbc8 fixed layout: Actually set child transforms
The code was unintentionally appending to the
existing child transform, leading to ever-moving
children when you call gtk_fixed_put.
2020-01-08 10:40:44 -05:00
Alex Samorukov
b31f4f2bae Merge branch 'master-fix-set-functions' into 'master'
quartz: impl_class->set_functions listed twice in the object

See merge request GNOME/gtk!1283
2020-01-08 14:15:45 +00:00
Alex Samorukov
df9d9c1f8a impl_class->set_functions listed twice in the object 2020-01-08 14:15:45 +00:00
Alex Samorukov
7dcb25bd46 Merge branch 'master-eventloop-fix' into 'master'
Move `[NSApplication sharedApplication]` after event loop init to avoid window focus issues (closes #2342).

See merge request GNOME/gtk!1286
2020-01-08 14:10:06 +00:00
Alex Samorukov
d131c8d0e7 move [NSApplication sharedApplication] after _gdk_quartz_events_init() to avoid initialization issues
(cherry picked from commit 46c2451c5a3cd42aa5a94935bfc850a484288ff3)
2020-01-08 14:10:06 +00:00
Timm Bäder
0582a4ef1b Merge branch 'check-for-sincosf' into 'master'
gsk/gsktransform.c: Fix building on non-GCC

See merge request GNOME/gtk!1291
2020-01-08 09:27:51 +00:00
Chun-wei Fan
a9b1d4a389 build: Check for sincosf()
sincosf() is really a GCC-specific function that may more may not be
supported on non-GCC compilers, so we want to check for it, otherwise we
use a fallback implementation, not unlike the one in
demos/gtk-demo/gtkgears.c.
2020-01-08 17:15:29 +08:00
Timm Bäder
ea810f176b gl renderer: Handle repeat nodes with invisible children
We can handle this pretty easily by normally drawing the other
(visible) child node, if any.
2020-01-07 17:27:19 +01:00
Timm Bäder
262ac4247a testsuite: Add a testcase for blend nodes with invisible children 2020-01-07 17:27:19 +01:00
Timm Bäder
8e4f0b9484 sizerequest: Remove _gtk_widget_get_preferred_size_and_baseline
Private and unused function.
2020-01-07 17:27:19 +01:00
Timm Bäder
7669e6e42e transform: Properly compare scale transforms
If the epsilon we use there is too much, we can run into rendering
errors because the GPU will use the actual scale value.
2020-01-07 17:27:19 +01:00
Timm Bäder
a3f14a3395 rendernodepaintable: ceil() bounds for intrinsic size
Otherweise we floor() implicitly when casting to int, resulting in
slight scaling later.
2020-01-07 17:27:19 +01:00
Timm Bäder
73b8212bf3 label: Fix assumptions regaring link 2020-01-07 17:27:18 +01:00
Timm Bäder
6ba6f361be gltextureatlas: Packing must succeed here 2020-01-07 17:27:18 +01:00
Timm Bäder
726909d735 Window: Avoid some redundant assignments 2020-01-07 17:27:18 +01:00
Timm Bäder
04899e3707 colorswatch: Avoid redundant assignment 2020-01-07 17:27:18 +01:00
Timm Bäder
7a27122dab transform: Scale+translate bounds directyl
Make these two code paths look the same.
2020-01-07 17:27:18 +01:00
Timm Bäder
73ce437459 widget: Use cssnode api to get the filter value
it's confusing that we use GtkStyleContext here while we use the CssNode
directly elsewhere.
2020-01-07 17:27:18 +01:00
Timm Bäder
ca4ae81170 transform: Compare class before ->next 2020-01-07 17:27:18 +01:00
Timm Bäder
21a7dfae96 snapshot: Only normalize rectangle if we have to
We can even replace the comment this way.
2020-01-07 17:27:18 +01:00
Timm Bäder
6c188f7c93 bin: Move vfunc implementations before class_init
And avoid every single function prototype.
2020-01-07 17:27:18 +01:00
Timm Bäder
c30e0f78ad bin: Avoid some type checks 2020-01-07 17:27:18 +01:00
Timm Bäder
76795ffba9 gl renderer: Sprinkle some const around 2020-01-07 17:27:18 +01:00
Timm Bäder
c38c5c4ce1 text: Reset cursor opacity when unmapping
Otherwise we might get mapped again with a half-transparent cursor.
2020-01-07 17:27:18 +01:00
Timm Bäder
108aac9ee3 scrolledwindow: Don't snapshot junction if we use indicators
The junction doesn't make sense when we use indicators, since the
scrollbars overlap anyway. Not snappshotting it anymore has no visual
effect since it's being drawn below the scrollbars anyway.
2020-01-07 17:27:18 +01:00
Timm Bäder
c427c2b22a cssimagelinear: Don't call get_start_end if !repeating
This makes it clear that the !repeating case is easier.
2020-01-07 17:27:18 +01:00
Timm Bäder
59111d100f cssimagelinear: Avoid computing the length if we know it
We handlet the common easy cases manually anyway, so don't bother
sqrt()ing the x/y coords in those cases.
2020-01-07 17:27:18 +01:00
Timm Bäder
cee8f78c6e toolitem: Remove unused members 2020-01-07 17:27:18 +01:00
Timm Bäder
0fc35b2124 toolitem: Plug memory leak 2020-01-07 17:27:18 +01:00
Timm Bäder
eebe67cf0a gl renderer: Add util to load vertex data with texture region 2020-01-07 17:27:18 +01:00
Timm Bäder
b9726901a5 gl renderer: Fix inverted dy in inset shadows 2020-01-07 17:27:17 +01:00
Timm Bäder
df1d2b8417 gsk: Add GskParseErrorFunc to the docs 2020-01-07 17:27:17 +01:00
Timm Bäder
8b1af398a0 gl renderer: Avoid another manual rounded rect transform
We have transform_rect() for this now.
2020-01-07 17:27:17 +01:00
Timm Bäder
982d73df0b adwaita: Solve junction problem without border image
This genius piece of CSS colors only the top left (or top right in RTL)
pixel of the scrollbar junction.
Doing it this way is better because we don't have to upload a cairo node
every frame.
2020-01-07 17:27:17 +01:00
Timm Bäder
1e55e01692 scrolledwindow: Remove a useless local variable 2020-01-07 17:27:17 +01:00
Timm Bäder
412fcb0330 scrolledwindow: Avoid using gtk_widget_get_preferred_size
This way we only measure in the direction we need.
2020-01-07 17:27:17 +01:00
Timm Bäder
b8d1c3ab55 gl renderer: Don't force repeat node child offscreen 2020-01-07 17:27:17 +01:00
Timm Bäder
4fb519f04d renderborder: Only get border width if we really need to
We did this unconditionally before the if statement, but we don't need
to do it if any of the early-out checks in the not-border-image branch
hits.
2020-01-07 17:27:17 +01:00
Timm Bäder
054d69aaf9 gl renderer: Fix a misleading comment 2020-01-07 17:27:17 +01:00
Timm Bäder
1dea6d4fc7 gl renderer: Speed up bounds transformation
We started saving the scale of the current modelview directly in the
RenderOpBuilder, so we don't need to poke the modelview stack anymore.
2020-01-07 17:27:17 +01:00
Timm Bäder
022d19a4c6 gl renderer: Add debug code for color nodes 2020-01-07 17:27:17 +01:00
Timm Bäder
ef7276c398 gl renderer: Trivial variable reordering 2020-01-07 17:27:17 +01:00
Timm Bäder
0a8ca49b5e gl renderer: transform border outline like everything else 2020-01-07 17:27:17 +01:00
Timm Bäder
74f18f71d3 gl renderer: Move work to the blur vertex shader 2020-01-07 17:27:17 +01:00
Timm Bäder
c0d4a6fc81 gl renderer: Avoid copying a matrix 2020-01-07 17:27:17 +01:00
Timm Bäder
1dd31d58fb testsuite: Add a test case for rotated border node 2020-01-07 17:27:17 +01:00
Timm Bäder
766d4dff76 GskTransform: Compute sin/deg of 90deg rotations manually
Otherwise we might end up with inaccuracies, e.g. when
gsk_transform_transform_bounds()'ing bounds.
2020-01-07 17:27:17 +01:00
Timm Bäder
e62f135c6a GskTransform: Normalize angles
Make sure all angles are in the [0..365) range
2020-01-07 17:27:17 +01:00
Timm Bäder
4788f88840 snapshot: Repeat color nodes by creating a larger color node 2020-01-07 17:27:17 +01:00
Timm Bäder
587bc82c37 gl renderer: Print debug node message 2020-01-07 17:27:17 +01:00
Timm Bäder
750dc8dbe2 gl driver: Inline function into only caller 2020-01-07 17:27:17 +01:00
Timm Bäder
d490d8f1f3 renderbackground: Try to omit a save/restore pair 2020-01-07 17:27:16 +01:00
Timm Bäder
cb2f523994 rendernodes: Use floats for everything 2020-01-07 17:27:16 +01:00
Timm Bäder
075a0ccb5e renderbackground: Save a snapshot_translate() call
Just add the values manually when really using the snapshot later. Also
unifies the two if branches by pulling out getting the x/y values.
2020-01-07 17:27:16 +01:00
Timm Bäder
db91b6dc61 gl renderer: Load vertex data directly into vertices GArray 2020-01-07 17:27:16 +01:00
Timm Bäder
44ac2d5abb gl renderer: Pass linear gradient stops to shaders directly
No need to copy them into the render ops like this.
2020-01-07 17:27:16 +01:00
Timm Bäder
d7df56b6cb gsk: Make GskColorStop.offset a float
Doesn't make sense for this to be double if everything else is float.
Also makes it possible to 'easily' pass this to the GPU.
2020-01-07 17:27:16 +01:00
Timm Bäder
6a9bc5daef Avoid a few state changes
We can't optimize the save/restore calls away in the snapshot code, so
do it from the caller side.
2020-01-07 17:27:16 +01:00
Timm Bäder
b8aa51d522 gl renderer: Move more work to the vertex shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
f79c807645 gl renderer: Don't invert offset value twice 2020-01-07 17:27:16 +01:00
Timm Bäder
d0d2ad9f5b gl renderer: Remove unused variable from shader 2020-01-07 17:27:16 +01:00
Timm Bäder
0b8298038a gl renderer: Move color computation to vertex shader 2020-01-07 17:27:16 +01:00
Timm Bäder
6ef0bb8bea gl renderer: Move final color computation to vertex shader
.. of the coloring program, which is used all the time for text.
2020-01-07 17:27:16 +01:00
Timm Bäder
91472b2ecd gl renderer: Compute final color in vertex shader
This is a very often used shader. No need to to do this for every
fragment.
2020-01-07 17:27:16 +01:00
Timm Bäder
80ddcf38d4 supp: Ignore calloc in the AMD driver
What'cha gonna do
2020-01-07 17:27:16 +01:00
Timm Bäder
1477882b31 testentryicons: Fix a memory leak 2020-01-07 17:27:16 +01:00
Timm Bäder
73f2167fe4 gl renderer: Avoid an invalid read
We need to copy the color here, since the program state can live across
frame boundaries.
2020-01-07 17:27:16 +01:00
Timm Bäder
2079c898e7 gl renderer: Remove some unneeded calculations from shaders 2020-01-07 17:27:16 +01:00
Timm Bäder
c79c18f39c gl renderer: Shuffle things around a bit 2020-01-07 17:27:16 +01:00
Timm Bäder
cef7f7f87d gl renderer: Move work to the gradient vertex shader
No need to do this stuff once per fragment.
2020-01-07 17:27:16 +01:00
Timm Bäder
fdce30d3f8 gl renderer: Add some in/out compat glue to the shaders
so we can use _IN_ and _OUT_ and get the right things for
desktop/es/legacy GL.
2020-01-07 17:27:16 +01:00
Timm Bäder
f07397f4dd gl renderer: Upload GL_RGBA texture data in GLES
Colored icons are still broken this way, but at least they show up and
text works.
2020-01-07 17:27:16 +01:00
Timm Bäder
f1751f514c gltextureatlas: Use more correct debug name for texture
These aren't all glyph atlases anymore.
2020-01-07 17:27:16 +01:00
Timm Bäder
2cbfb0e980 GdkGLContext: check for GL_KHR_debug for GL debug output
This is available in GLES.
2020-01-07 17:27:16 +01:00
Timm Bäder
8dd7f5aefe gl renderer: Mark beginning of frame if DEBUG_OPS is set 2020-01-07 17:27:16 +01:00
Timm Bäder
398f49ad31 gl renderer: Trivial declaration reorder 2020-01-07 17:27:16 +01:00
Timm Bäder
3d260a950e gl renderer: Remove a few outdated comments 2020-01-07 17:27:16 +01:00
Timm Bäder
f31667f437 gl renderer: Remove unused translation handling 2020-01-07 17:27:15 +01:00
Timm Bäder
219493c818 gl renderer: Don't copy matrix/offset of color matrix nodes into ops 2020-01-07 17:27:15 +01:00
Timm Bäder
06f63764fb gl renderer: Initialize alpha uniform to 1.0
This makes gl-legacy work and gl-gles work except for text and icons.
2020-01-07 17:27:15 +01:00
Timm Bäder
1243174e53 gl renderer: Make RoundedRect work in gles
Which can't return struct types containing arrays. So let's revert to
the previous version but still send the rect along as a vec4[3];
2020-01-07 17:27:15 +01:00
Timm Bäder
cc909b160f gl renderer: Rewrite shader builder
Use a unified approach to write both vertex and fragment shader in the
same file.
2020-01-07 17:27:15 +01:00
Timm Bäder
d12dde07c3 gl renderer: Fix program uniform updating code
This breaks the initial uniform value, but we will fix that in a later
commit in a different way.
2020-01-07 17:27:15 +01:00
Timm Bäder
5191b6fccd gl renderer: Only send clip corners if we need to
We change the clip bounds a lot more ofthen than the clip corners and
they are already split up in the shader, so only send the corners if we
need to.
2020-01-07 17:27:15 +01:00
Timm Bäder
2e6e6c1779 gl renderer: Fix color comparison 2020-01-07 17:27:15 +01:00
Timm Bäder
a29b8fbef4 gl renderer: Shorten debug output impl
This will leak a string but WHATEVER.
2020-01-07 17:27:15 +01:00
Timm Bäder
5b072e716c gl renderer: Fix debug color output 2020-01-07 17:27:15 +01:00
Timm Bäder
49845795d9 gl renderer: Rewort passing rounded rects to shaders 2020-01-07 17:27:15 +01:00
Timm Bäder
ab04c74ec9 gl renderer: Don't copy border outline corner sizes around
We already offset + scale the outline and its corners, just pass those
directly to the shader.
2020-01-07 17:27:15 +01:00
Timm Bäder
4744bb9099 gl renderer: stop copying current color around
Just use a pointer now.
2020-01-07 17:27:15 +01:00
Timm Bäder
91522dda63 gl renderer: remove a memory leak 2020-01-07 17:27:15 +01:00
Timm Bäder
095a378dbc GdkRGBA: Use floats instead of doubles 2020-01-07 17:27:15 +01:00
Timm Bäder
0956c30ee5 progressbar: Remove unnecessary snapshot implementation 2020-01-07 17:27:15 +01:00
Timm Bäder
f85448ffbf gl renderer: Split blurring a node into its own function 2020-01-07 17:27:15 +01:00
Timm Bäder
d3852ca33a gl renderer: Remove some unused uniforms 2020-01-07 17:27:15 +01:00
Timm Bäder
9d9a730659 gl renderer: Drop a dead if statement
We already handle this earlier.
2020-01-07 17:27:15 +01:00
Jordi Mas
3f4cd4190f Update Catalan translation 2020-01-06 20:36:28 +01:00
Matthias Clasen
448a402353 widget: Remove an unused signal
HIERARCHY_CHANGED is no longer used.
2020-01-06 08:19:01 -05:00
Matthias Clasen
2ee9752822 wayland: Remove debug spew 2020-01-06 08:19:01 -05:00
Matthias Clasen
f8a1f796b5 Merge branch 'wayland-dnd-fixes' into 'master'
Wayland dnd fixes

See merge request GNOME/gtk!1284
2020-01-06 05:44:33 +00:00
Piotr Drąg
3b5a4cf215 Update Polish translation 2020-01-05 17:27:40 +01:00
Matthias Clasen
759d53cfa0 wayland: Don't artificially prefer ASK
We were always adding ASK to the list of possible
actions, and preferring it. This was causing the
ask cursor to show up when both the source and
the target support ASK, even though it is only
meant to happen if you hold the Alt modifier.

Instead, use one of the supported actions as
preferred action.
2020-01-04 12:51:32 -05:00
Matthias Clasen
814d20d61a docs: Small clarifications to DND docs
Clear up the documentation around ASK handling
a bit.
2020-01-04 12:48:39 -05:00
Matthias Clasen
6cef520804 wayland: Minor cleanup
Stop storing selected_action, mainly since the name
is confusing. Instead, just pass the value directly
in the 2 places where it is used.
2020-01-04 12:48:39 -05:00
Matthias Clasen
8c77491150 wayland: Fix action handling more
When updating GdkDrop::actions from changes sent by
the compositor, we were inadvertently setting them to 0,
causing drops to appear impossible.
2020-01-04 09:38:31 -05:00
Matthias Clasen
709ebcedd4 wayland: Finish pending offer handling
When creating a new GdkDrop object on drag_enter, take pending
source_actions and action into account. The code to store the
pending actions was already there, they were just not passed
on to the drop object when we create it.
2020-01-04 09:38:01 -05:00
Matthias Clasen
47e6b88555 wayland: Clean up drags
We need to set the drag to NULL in gdk_wayland_drag_drop_done,
otherwise, all future drags will be considered local after the
first local one. Worse, they will also provide the wrong data.
2020-01-04 09:36:38 -05:00
Matthias Clasen
df58d0acf3 Adwaita: Make dnd marks in text views green
We already do this in entries, this just updates
text views to match.
2020-01-03 13:00:53 -05:00
Matthias Clasen
9c2c5665df textview: Render visible marks better
The only other visible mark that is in common use
besides insert and selection_bound is dnd_mark, and
we don't want it to blink or be affected by 'cursor'
visibility.

Therefore, cache not just the cursor positions, but
also whether they are insert or selection_bound,
and take that into account when rendering them.
2020-01-03 13:00:53 -05:00
Matthias Clasen
1be9c6aa3f Merge branch 'remove-xim' into 'master'
Remove the XIM input method

See merge request GNOME/gtk!1195
2020-01-03 17:56:26 +00:00
Matthias Clasen
96d2bf10b9 Add a text view mark/cursor test
This has testcases for some issues around invalidation
of marks.
2020-01-03 11:18:08 -05:00
Matthias Clasen
7a1aefc7f3 Fix the previous commit
We need to actually use the right coordinates.
2020-01-02 00:43:27 -05:00
Matthias Clasen
f7f06f810b stackswitcher: Fix switch-while-drag functionality 2020-01-02 00:24:54 -05:00
Matthias Clasen
e02fd80adb dnd: Be safer
The contents of the selection are documented
to not be NULL if size is non-negative. So
use an empty string instead of NULL for size 0,
avoiding a crash.
2020-01-01 12:51:19 -05:00
Matthias Clasen
4b818495ca wayland: Fix dnd type negotiation
We need to call gdk_content_formats_union_serialize_mime_types
like GdkClipboard does, in order to get mime types that we can
sent out.
2020-01-01 12:51:19 -05:00
Matthias Clasen
1841ec4f8e contentprovider: cosmetic fix 2020-01-01 12:51:19 -05:00
Matthias Clasen
21708e4352 contentserializer: Fix an annotation 2020-01-01 12:51:19 -05:00
Daniel Mustieles
662bcb34b1 Updated Spanish translation 2019-12-31 08:45:12 +01:00
Matthias Clasen
f8a19506ab Merge branch 'drag-icon' into 'master'
Drag icon

See merge request GNOME/gtk!1274
2019-12-30 21:20:26 +00:00
Matthias Clasen
67d1d5ec80 mountoperation: Handle D-Bus missing
Still not great to make sync calls here, but
at least we should handle failure without criticals.
2019-12-30 16:03:47 -05:00
Matthias Clasen
49c6e99970 Merge branch 'fix-dnd' into 'master'
Fix dnd

See merge request GNOME/gtk!1273
2019-12-30 17:12:30 +00:00
Matthias Clasen
15242d66e1 wayland: Pass root coordinates for dnd events
That is what the api currently requires, so provide it.

This fixes DND to work again, for the most part.
2019-12-30 12:00:53 -05:00
Matthias Clasen
94a0bc01f9 gdk: Populate dnd event coords
The GdkDrop emit... apis take root coordinates.
That should be changed to surface coordinates,
eventually. For now, make the functions fill
the x, y fields.
2019-12-30 11:58:11 -05:00
Matthias Clasen
677c4b140c gdk: Fix coordinates in dnd events
Don't store coordinates as shorts. Use doubles,
as everywhere else. Also add x, y in addition
to x_root, y_root, and actually return those
in gdk_event_get_coords.
2019-12-30 11:56:49 -05:00
Piotr Drąg
838ad5ed6d Update POTFILES.in 2019-12-30 17:30:18 +01:00
Matthias Clasen
772ac2b0c5 tooltip: Never set a window to be its own parent
We do get events on the tooltip window too, and
we better ignore them, or bad things may happen,
such as widgets that are their own parents and
cause infinite loops.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2339
2019-12-30 09:52:13 -05:00
Matthias Clasen
68b3b66c03 tooltipwindow: Cosmetic fix 2019-12-30 09:28:22 -05:00
Daniel Mustieles García
0d1614be63 Revert "Updated Spanish translation"
This reverts commit 62b95e33b8
2019-12-30 13:59:22 +00:00
Daniel Mustieles
62b95e33b8 Updated Spanish translation 2019-12-30 12:53:45 +01:00
Daniel Mustieles
dc5c8d2d29 Updated Spanish translation 2019-12-30 12:52:55 +01:00
Daniel Mustieles
425d5cc7c6 Updated Spanish translation 2019-12-30 12:52:01 +01:00
Matthias Clasen
baf99bb868 Remove gtk_window_set_hardcoded_surface
It is not used anymore.
2019-12-30 00:31:32 -05:00
Matthias Clasen
538efd0cc6 container: Be more careful with roots
We were warning if we hit non-container
roots. Instead, call suitable naive api.
2019-12-30 00:30:01 -05:00
Matthias Clasen
9ba184adf7 widget: Be more careful with roots
We were assuming that all roots are windows,
and calling GtkWindow apis on them.
2019-12-30 00:29:52 -05:00
Matthias Clasen
710b8d7f40 dnd: Use GtkDragIcon
Use the new GtkDragIcon instead of a window
of type GTK_WINDOW_POPUP and
gtk_window_set_hardcoded_surface.
2019-12-30 00:29:10 -05:00
Matthias Clasen
a6244a95be Add GtkDragIcon
This is a GtkRoot implemntation for drag icons,
using the surface provided by GdkDrag. This lets
us avoid GTK_WINDOW_POPUP and
gtk_window_set_hardcoded_surface.
2019-12-30 00:28:02 -05:00
Matthias Clasen
133b6f2f23 tooltipwindow: Cosmetic fix 2019-12-29 22:48:25 -05:00
Matthias Clasen
53a634e23e Merge branch 'tooltip-redo' into 'master'
Tooltip redo

See merge request GNOME/gtk!1271
2019-12-30 03:24:58 +00:00
Matthias Clasen
156935e0e9 docs: Mention custom tooltip windows in the migration guide
These no longer exist.
2019-12-29 22:09:13 -05:00
Matthias Clasen
f31a016efb tooltips: Stop using GTK_WINDOW_POPUP
Make GtkTooltipWindow a GtkNative implementation,
instead of using a GTK_WINDOW_POPUP window.
2019-12-29 22:09:13 -05:00
Matthias Clasen
e56eb7b17b testtooltips: Test tooltips on popovers
They do not currently work right.
2019-12-29 22:09:13 -05:00
Matthias Clasen
de694958b5 Drop custom tooltip windows
We want to put tooltips into something other than
windows, so this needs to go. Custom widgets are
still possible.
2019-12-29 20:52:08 -05:00
Matthias Clasen
e12a580b0b Merge branch 'kill-tree-menu' into 'master'
Menu removal, part 2

See merge request GNOME/gtk!1270
2019-12-30 01:46:29 +00:00
Matthias Clasen
52e0eef6cb docs: Touch up menu button docs 2019-12-29 20:31:58 -05:00
Matthias Clasen
85bf4cf895 docs: Mention the demise of menus in the migration guide
This needs more details, but it is a start.

Also add sections about grabs and about toolbar
overflow handling.
2019-12-29 20:31:58 -05:00
Matthias Clasen
b06331218d docs: Rewrite popover menu docs
These were outdated and did not reflect current api.
2019-12-29 20:31:58 -05:00
Matthias Clasen
9b165c8bec treeview: Use a popover for search
This is a more modern way of doing things, and avoids a window
of type GTK_WINDOW_POPUP. With a popover, it doesn't make sense
to have a positioning function, so remove that api.
2019-12-29 20:31:58 -05:00
Matthias Clasen
3fd427cfce win32: Use a regular window for printing
We never show this window, so it should not matter.
Ideally, we'd just create a surface to get handle,
anyway.
2019-12-29 20:31:58 -05:00
Matthias Clasen
0bb9fc65ad Remove gdk_seat_grab
We are no longer using free-standing grabs
in GTK. The replacement is the autohide
functionality of popup surfaces.
2019-12-29 20:31:58 -05:00
Matthias Clasen
3dd6cc405e accelcellrenderer: Stop grabbing
Standalone grabs are going away.
2019-12-29 20:31:58 -05:00
Matthias Clasen
06860bb2be accelcellrenderer: Fix editing 2019-12-29 20:31:58 -05:00
Matthias Clasen
7ee5779efc gtk: Remove menu code
GtkMenu, GtkMenuBar, GtkMenuItem and their subclasses
and supporting classes are replaced by model-based popover
implementations.
2019-12-29 20:31:58 -05:00
Matthias Clasen
53d9445715 doc: Build fixes 2019-12-29 20:31:58 -05:00
Matthias Clasen
54b2727b50 docs: Remove mentions of GtkMenuItem 2019-12-29 20:31:58 -05:00
Matthias Clasen
a2aefa83bb accellabel: Don't mention GtkMenuItem in the docs 2019-12-29 20:31:58 -05:00
Matthias Clasen
0854140b22 label: Stop referring to GtkMenuItem in the docs 2019-12-29 20:31:58 -05:00
Matthias Clasen
57a861723c buildertool: Drop menu properties 2019-12-29 20:31:58 -05:00
Matthias Clasen
b59521bb82 inspector: Remove menu special-casing 2019-12-29 20:31:58 -05:00
Matthias Clasen
7e8393ba0f widget: Remove menu special-casing 2019-12-29 20:31:58 -05:00
Matthias Clasen
9e15f3df75 label: Remove menu support code 2019-12-29 20:31:58 -05:00
Matthias Clasen
5c97f09796 tests: Stop using menus 2019-12-29 20:31:58 -05:00
Matthias Clasen
bf4ec504b2 testsuite: Remove menu special-casing 2019-12-29 20:31:58 -05:00
Matthias Clasen
59aeae3c8e testsuite: Remove menu tests
Menus are going away.
2019-12-29 20:31:57 -05:00
Matthias Clasen
941f22c033 testsuite: Cosmetic change 2019-12-29 20:31:57 -05:00
Matthias Clasen
27543120f2 menubutton: Stop supporting menus 2019-12-29 20:31:57 -05:00
Matthias Clasen
901518ec25 headerbar: Stop using GtkMenuButton::use-popover
This property is going away.
2019-12-29 20:31:57 -05:00
Matthias Clasen
4c9b0d82af menutoolbutton: Stop supporting menus 2019-12-29 20:31:57 -05:00
Matthias Clasen
2c5f4c5871 menutoolbutton: Fix sensitivity handling
We don't need to set the arrow button explicitly
to insensitive, GtkMenuButton handles that automatically.
2019-12-29 20:31:57 -05:00
Matthias Clasen
8ee44d200d toolbar: Simplify overflow implementation
Do away with the proxy menu items, and instead
just have toolitems provide a label for overflow
items. We create the overflow widgets ourselves
already, as model buttons.
Also replace the toggle button used for overflow
with a menubutton, simplifying things further.
2019-12-29 20:31:57 -05:00
Matthias Clasen
57b7e87d76 testsuite: Update combobox tests
Some of the expected output needs to be updated.
2019-12-29 18:45:40 -05:00
Matthias Clasen
e424246134 combobox: Replace GtkTreeMenu with a popover
This does not currently try to reproduce the exact
placement, since GtkPopover doesn't have to have
the necessary placement hints.
2019-12-29 18:45:40 -05:00
Matthias Clasen
ca87048045 gtk-demo: Remove the change display demo
The window picking code has been broken for a while.
Since this is not really functionality that we should
highlight to application developers, remove the demo
instead of patching it up.
2019-12-29 18:45:40 -05:00
Matthias Clasen
5ec9b15d84 gtk-demo: Convert the builder demo to a menu model 2019-12-29 18:45:40 -05:00
Matthias Clasen
6b691bc02d gtk-demo: Remove menus from listbox demo 2019-12-29 18:45:40 -05:00
Matthias Clasen
abcd83dd78 gtk-demo: Cosmetics 2019-12-29 18:45:40 -05:00
Matthias Clasen
5d2113ff5d gtk-demo: Remove the menus demo
Menus are going away.
2019-12-29 18:45:40 -05:00
Matthias Clasen
5c086b9d44 gtk-demo: Convert the dnd demo to a popover 2019-12-29 18:45:40 -05:00
Matthias Clasen
8efa612288 gtk-demo: Remove a somewhat silly bit of code
Putting a context menu on an overlay scrollbar
is too much of an easter egg to count as a useful
demo. Remove it, rather than changing it to a
popover.
2019-12-29 18:45:40 -05:00
Matthias Clasen
928f7faf7d gtk-demo: Use a popover in the clipboard demo 2019-12-29 18:45:40 -05:00
Matthias Clasen
4b4cf36b03 gtk-demo: Replace a menu with a popover 2019-12-29 18:45:40 -05:00
Matthias Clasen
5d821425b3 accellabel: Remove an example using menus 2019-12-29 18:45:40 -05:00
Matthias Clasen
8b3066127f docs: Avoid using a menu for an example 2019-12-29 18:45:40 -05:00
Matthias Clasen
360239a6c8 docs: Remove menubars from the visual index 2019-12-29 18:45:37 -05:00
Matthias Clasen
80e903afeb docs: Stop taking menubar screenshots
The widget is going away.
2019-12-29 18:44:26 -05:00
Matthias Clasen
62e9ea412a widget-factory: Remove the menubar 2019-12-29 18:44:26 -05:00
Matthias Clasen
3d4acf6360 window: Move F10 handling to popover menubars 2019-12-29 18:44:26 -05:00
Matthias Clasen
0cf1e1e106 applicationwindow: Stop using a menu bar
We have a replacement with popovers now.
2019-12-29 17:10:16 -05:00
Matthias Clasen
b23fbe1f39 notebook: Remove menu remnants 2019-12-29 17:10:16 -05:00
Matthias Clasen
f5e79b9bc5 appchooserwidget: Remove ::populate-popup
We are no longer doing menus this way; if a menu turns out to be
needed at all here, we can add a menu model later.
2019-12-29 17:10:16 -05:00
Matthias Clasen
94e238c467 placesview: Use a popover
Replace the context menu with a popover.
2019-12-29 17:10:16 -05:00
Matthias Clasen
22f6787283 mountoperation: Use a popover
Replace the context menu with a popover.
2019-12-29 17:10:16 -05:00
Matthias Clasen
6255dcd8ec filechooserbutton: Be smarter about 'None'
Don't refilter the model while the combo box is popped up,
that wreaks havoc with layout and does not really work.
Instead, repurpose one of the separator rows for the 'none'
case. This works because the row separator function is not
consulted for the cellview in the button.
2019-12-29 17:10:16 -05:00
Matthias Clasen
6f80eee962 window: Complete the popover conversion 2019-12-29 17:10:16 -05:00
Matthias Clasen
fd0f01bcad popovermenubar: Cosmetics 2019-12-29 17:10:16 -05:00
Matthias Clasen
0b6e521dc5 popovermenu: Use a weak ref for active item
Otherwise, we can end up with a dangling pointer,
leading to badness.
2019-12-29 17:10:15 -05:00
Matthias Clasen
ad6fe9d6a0 surface: Only unpause events if we paused them
When a new popup surface is created, it may end up
getting a resume-events signal from its frame clock
without having seen a flush-events first.

Don't unpause events in that case, since it messes
up the displays pause counter.

This was causing criticals with tooltips.
2019-12-29 13:35:36 -05:00
Matthias Clasen
7078765903 Revert unintended changes
I didn't mean to make this a complicated
portal test. Go back to being a simple test.
2019-12-29 13:03:44 -05:00
Matthias Clasen
a73947e54f Remove more mir remnants
The mir backend was removed a while ago, so
GDK_WINDOWING_MIR is never defined.
2019-12-28 21:52:34 -05:00
Matthias Clasen
7525271de1 tooltip: Remove some unneeded includes 2019-12-28 21:49:09 -05:00
Matthias Clasen
0bc65f0bde popover: Remove some dead code 2019-12-28 21:46:39 -05:00
Aurimas Černius
4a0476752c Updated Lithuanian translation 2019-12-28 18:18:53 +02:00
Matthias Clasen
9543a5daeb popovermenu: Fix keynav with submenus
When we right-arrow all the way into a submenu
and then cycle to the next menu in a menubar,
we need to reset all open submenus, so that
left-arrowing back to the menu puts the focus
on the first item again.
2019-12-27 22:54:11 -05:00
Matthias Clasen
28b91a4450 modelbutton: Be focusable
This got lost when modelbuttons stopped being
derived from buttons. It is necessary, since
the GTK focus machinery takes this flag seriously
nowadays, and won't let us grab focus to non-focusable
widgets.
2019-12-27 21:58:54 -05:00
Matthias Clasen
6b89d8a199 inspector: Add a focus overlay
It helps to see what is going on.
2019-12-27 17:35:09 -05:00
Fran Dieguez
e999016273 Update Galician translation 2019-12-27 14:42:53 +00:00
Jordi Mas
7c6e620f16 Fixes to Catalan translation 2019-12-27 14:06:32 +01:00
Piotr Drąg
267d5ae011 Update Polish translation 2019-12-25 16:36:41 +01:00
Matthias Clasen
08d4bb4785 widget: Fix a memory leak
The transform passed to gtk_widget_allocate is
transfer full, so we must consume the reference
before returning.
2019-12-25 09:47:22 -05:00
Matthias Clasen
a02e25ffff widget: Avoid a crash in event handling
I was seeing crashes in gtk_widget_run_controllers.
We were accessing the controller after calling out
to application code that might remove it. Better
be safe and do the access before.
2019-12-25 09:47:22 -05:00
Matthias Clasen
280bdb0567 inspector: Fix a small memory leak
We were leaking overlays.
2019-12-25 09:47:22 -05:00
Matthias Clasen
1a94e5fb0e inspector: Fix a small memory leak
The property editor was leaking a few GValues.
2019-12-25 09:47:22 -05:00
Matthias Clasen
b6cfe59460 inspector: Small cleanup 2019-12-25 09:47:22 -05:00
Matthias Clasen
7db2abf918 widget: Fix a small memory leak 2019-12-25 09:47:22 -05:00
Matthias Clasen
b398af914f eventcontroller: Fix name property
This never worked. Oops.
2019-12-25 09:47:22 -05:00
Matthias Clasen
29e1dac1ff testfilechooser: Test the choice apis 2019-12-25 09:47:22 -05:00
Fran Dieguez
3af8a658a7 Update Galician translation 2019-12-25 04:05:00 +00:00
Fran Dieguez
b5aeb29146 Update Galician translation 2019-12-25 03:16:43 +00:00
Matthias Clasen
85b702b0d1 Merge branch 'print-dialog-fixes' into 'master'
Print dialog fixes

See merge request GNOME/gtk!1268
2019-12-24 17:41:38 +00:00
Matthias Clasen
77c57b4b14 Adwaita: update the README 2019-12-24 12:30:54 -05:00
Matthias Clasen
10d260ec71 HighContrast: print dialog fixes
Fix up the paper drawing.
2019-12-24 12:30:44 -05:00
Matthias Clasen
1ac8bb0128 Adwaita: print dialog tweaks
Fix up the paper drawing.
2019-12-24 12:30:35 -05:00
Matthias Clasen
28539ba838 print dialog: Fix up page drawing
This fixes up page drawing enough to appear properly
with the builtin themes.
2019-12-24 12:30:28 -05:00
Matthias Clasen
f1bb6ef658 Merge branch 'widget-factory-fixes' into 'master'
Widget factory fixes

See merge request GNOME/gtk!1267
2019-12-24 15:08:15 +00:00
Matthias Clasen
24c66f831f widgetfactory: Undo more builder-tool damage
The two volume buttons are supposed to be
vertically arranged.
2019-12-24 09:59:23 -05:00
Matthias Clasen
87502b4f2e Fix the build 2019-12-24 09:58:56 -05:00
Matthias Clasen
3644d3a100 Merge branch 'gtk-demo-fixes' into 'master'
Gtk demo fixes

See merge request GNOME/gtk!1266
2019-12-24 08:47:28 +00:00
Matthias Clasen
9e3147f78d treeview: Fix embedding cell renderers
We need to manually set up the css node,
since the treeview has children whose css
node is not a direct child of the treeview
css node (header buttons).
2019-12-24 03:39:02 -05:00
Matthias Clasen
cc3ecac6d8 cell renderer spin: Bring this back
GtkSpinButton lost its cell editable implementation
when it stopped being a GtkEntry subclass. Add it
back, and make it work.
2019-12-24 03:33:02 -05:00
Matthias Clasen
72932d2776 cell renderer text: Fix this to work again
We were showing the entry, and removing it right
away when the focus moved to the text child.
Avoid that.
2019-12-24 03:13:58 -05:00
Matthias Clasen
58bc9452f6 paper dialog: Make this look less horrible 2019-12-24 03:12:30 -05:00
Matthias Clasen
2a7b5d8229 accelgroup: Fix a buffer overrun
gtk_accelerator_parse_with_keycode can
overrun its buffer for certain inputs.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2325
2019-12-23 23:17:29 -05:00
Matthias Clasen
245546de61 Merge branch 'drop-GtkTreeViewPrivate' into 'master'
tree-view: Drop GtkTreeViewPrivate

See merge request GNOME/gtk!1240
2019-12-24 03:49:48 +00:00
Matthias Clasen
a3793ff137 Merge branch 'drop-gtk-tree-selection-private' into 'master'
tree-selection: Drop GtkTreeSelectionPrivate

See merge request GNOME/gtk!1256
2019-12-24 03:48:18 +00:00
Matthias Clasen
0a98817a6f Merge branch 'wip/oholy/placesview-default-location' into 'master'
placesview: Always open default location after mounting

See merge request GNOME/gtk!1263
2019-12-24 03:47:15 +00:00
Matthias Clasen
663fb93af7 gtk-demo: Fix font explore initial state 2019-12-23 22:35:44 -05:00
Matthias Clasen
db42c23c0a gtk-demo: Fix a crash in the font explorer demo
gtk_widget_add_controller is transfer-full.
2019-12-23 22:33:02 -05:00
Matthias Clasen
33716d1e50 gtk-demo: Cosmetic fixes to the dnd demo 2019-12-23 22:14:52 -05:00
Matthias Clasen
65769fd7a6 gtk-demo: Cosmetic fixes to the assistant demo 2019-12-23 21:58:45 -05:00
Matthias Clasen
e6d3f3d91e gtk-demo: Fix the application demo
This was broken in d223752c55, when the
support for internal children was removed
from GtkInfoBar.
2019-12-23 21:52:52 -05:00
Matthias Clasen
79a17d5a25 Merge branch 'validate-templates' into 'master'
builder-tool: Validate templates again

See merge request GNOME/gtk!1265
2019-12-23 23:40:43 +00:00
Matthias Clasen
c924b48a6c builder-tool: Validate templates again
This wasn't working because it was expecting
some no-longer-existing error message.
2019-12-23 18:32:37 -05:00
Matthias Clasen
519ff576cd colorchooser: Document actions
This is mainly a trial balloon for gtk-doc
support for this syntax.

See https://gitlab.gnome.org/GNOME/gtk-doc/merge_requests/30
2019-12-23 13:39:05 -05:00
Matthias Clasen
5bc3bed461 Merge branch 'inspector-advice' into 'master'
inspector: Give better advice

See merge request GNOME/gtk!1264
2019-12-22 19:02:37 +00:00
Matthias Clasen
442f13ef6f inspector: Give better advice
Provide the meson syntax for building a debug-enabled GLib.
2019-12-21 21:09:18 -05:00
Christoph Reiter
95aeadf36c Merge branch 'ci-msys2-newer-pango' into 'master'
CI: Install a newer MSYS2 pango package; Don't allow failures again

Closes #2243

See merge request GNOME/gtk!1258
2019-12-19 17:59:40 +00:00
Ondrej Holy
267ea7552b placesview: Always open default location after mounting
The default location (obtained over g_mount_get_default_location) is
opened after mounting volume, or when opening mounts from sidebar, but
not after mounting over "Connect to Server". Let's unify the behavior
and always open the default location.

https://gitlab.gnome.org/GNOME/nautilus/issues/1319
2019-12-19 17:28:35 +01:00
Matthias Clasen
08f7526f8f Merge branch 'fix-gtkgesturerotate-potential-leak' into 'master'
gtkgesturerotate: Fix a memory leak

See merge request GNOME/gtk!1260
2019-12-19 03:42:31 +00:00
Yariv Barkan
0604924c20 gtkgesturerotate: Fix a memory leak
On touchpads gtk_gesture_get_sequences() was called without a
corresponding g_list_free(). The same was true for touchscreens
if due to some reason only a single sequence was found.
2019-12-18 23:03:19 +02:00
Christoph Reiter
5ef2748cef CI: Install a newer MSYS2 pango package; Don't allow failures again
gtk master requires a newer pango than msys2 has, so install our own copy on top.

See #2243
2019-12-18 09:25:06 +01:00
Christoph Reiter
8f8229dcd2 Fix various new mingw compiler warnings
These are the result of us missing CI for some time now and
MSYS2 having a newer GCC now I guess.
2019-12-18 09:25:06 +01:00
Peter Bloomfield
a5b5657e96 tree-selection: Drop GtkTreeSelectionPrivate
GtkTreeSelection is now private (since commit 79940b32),
so it doesn't need an instance-private structure.
2019-12-16 20:54:23 -05:00
Emmanuele Bassi
0f2281e267 Merge branch 'ci-update-at-spi' into 'master'
Update CI image

Closes #2313

See merge request GNOME/gtk!1254
2019-12-16 19:26:37 +00:00
Emmanuele Bassi
994a807819 ci: Use latest CI image 2019-12-16 19:01:03 +00:00
Emmanuele Bassi
79f42cec8e ci: Add libXtst-devel to the Docker image
New requirement from at-spi2-core.

Fixes: #2313
2019-12-16 19:00:02 +00:00
Matthias Clasen
0546fd7c8a Merge branch 'fix.nonunix.builds' into 'master'
Fix non-portal (UNIX) builds

See merge request GNOME/gtk!1252
2019-12-16 17:38:56 +00:00
Chun-wei Fan
d51e3e835e tests/: Revert bbb56d8 for non-UNIX
The portal bits are only supported on *nix, so use the old code on
non-*nix.
2019-12-17 00:52:25 +08:00
Chun-wei Fan
3d8d4921af gdk: Build portal bits on *nix only
The newly-added portal items are supported on *nix only, so only build
them on *nix.
2019-12-17 00:52:18 +08:00
Matthias Clasen
ba3549fa34 Merge branch 'matthiasc/for-master' into 'master'
file transfer: Fix build on non-Linux

See merge request GNOME/gtk!1253
2019-12-16 16:48:01 +00:00
Matthias Clasen
721595edea file transfer: Fix build on non-Linux
O_PATH and O_CLOEXEC are not universally available.
2019-12-16 11:38:04 -05:00
Peter Bloomfield
46d960ddfd tree-view: Drop GtkTreeViewPrivate
GtkTreeView is now private, so it doesn't need an instance-private
structure.
2019-12-15 19:19:42 -05:00
Benjamin Otte
ed24f93fb9 popover: Remove unneeded vfunc
The vfunc is identical to the GtkWidget implementation it replaces. So
just keep using that one.
2019-12-15 21:07:54 +01:00
Benjamin Otte
c4043a8eef treelistmodel: Improve docs
- Move into its own section
- Split GtkTreeListRow into its own document

Trees are weird with listmodels and they deserve their own treatment,
they shouldn't be mushed up with the rest of the list machinery.
2019-12-15 21:07:54 +01:00
Benjamin Otte
dff86c0e12 eventcontrollermotion: Add getters for the properties
... and use them.

Also, rename them from is/contains-pointer-focus to is/contains-pointer,
that's clear enough and not too long.

Finally, adapt the semantics of contains-pointer to mirror
GtkEventControllerKey::contains-focus. If is-pointer is set, so is
contains-pointer, they are not exclusive.
Which is what all users of this property wanted, too.
2019-12-15 21:07:54 +01:00
Matthias Clasen
9a5ec33d61 Merge branch 'fix-x11-cursor-crash' into 'master'
x11: Only update cursors if we have any

Closes #2308

See merge request GNOME/gtk!1249
2019-12-13 20:02:43 +00:00
Matthias Clasen
78227bf5b0 Merge branch 'matthiasc/for-master' into 'master'
some builder-tool improvements

See merge request GNOME/gtk!1248
2019-12-13 19:58:53 +00:00
Matthias Clasen
bf2c29a36a x11: Only update cursors if we have any
We were accessing an on-demand created hash table
without checking if it had been created first.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2308
2019-12-13 14:46:00 -05:00
Matthias Clasen
47285c6642 builder: Improve type name mangling
When looking for the get_type function for GThemedIcon,
try both g_themed_icon_get_type and gthemed_icon_get_type
The former is what gio has, the latter is still supported
to avoid breaking gweather_location_get_type.

Update tests to cover this new case.
2019-12-13 14:21:44 -05:00
Matthias Clasen
e4fb4116fd builder-tool: Don't try to find default boxed values
This doesn't work and yields an ugly, unnecessary
error message.
2019-12-13 14:21:44 -05:00
Matthias Clasen
6d3373cb2c gtk-builder-tool: More helpful error messages
Include line numbers in the error messages we
report, so it is possible to find the error.
2019-12-13 14:21:44 -05:00
Marek Kasik
6ddc214e68 printing: Fill device URI for non-Avahi printers
Device URI was not filled for non-Avahi printers by my previous commit.
I've added it back. It was a mistake during rebasing of the patch
to current master.
2019-12-13 17:53:14 +01:00
Matthias Clasen
91a802a1e5 Merge branch '1509-don-t-show-Rejecting-Jobs-when-we-don-t-know' into 'master'
Fix getting info for standalone IPP printers

Closes #1509

See merge request GNOME/gtk!1247
2019-12-13 16:13:17 +00:00
Daniel Mustieles
886ab54eda Updated Spanish translation 2019-12-13 12:24:36 +01:00
Matthias Clasen
4470e5bc93 gtk-demo: Some touchups
Make the theming style classes demo look a bit less odd.
2019-12-12 18:46:53 -05:00
Matthias Clasen
9bbacd3e4c Run gtk-builder-tool simplify over our ui files
This was done mainly to verify that the tool does not
make any unwarranted changes. The changes included here
are all cosmetic.
2019-12-12 18:37:39 -05:00
Matthias Clasen
353df67c0b Add GtkNative to the docs
It was not included in the generated docs.
2019-12-12 18:21:16 -05:00
Matthias Clasen
050eb9ba73 Fix up GtkBuilderScope docs
They were not hooked into the document generation.
2019-12-12 18:18:49 -05:00
Matthias Clasen
4fa5f5497a builder: Another small docs fix 2019-12-12 17:59:24 -05:00
Matthias Clasen
21a032b783 docs: Ignore more private headers 2019-12-12 17:59:24 -05:00
Matthias Clasen
207efd8932 docs: Remove symbols that no longer exist 2019-12-12 17:59:24 -05:00
Matthias Clasen
43c943e48a Merge branch 'issue-179' into 'master'
Use a separate gesture for middle clicks on PlaceView rows

Closes #179

See merge request GNOME/gtk!1199
2019-12-12 22:53:36 +00:00
Matthias Clasen
d6dc5da6db textbuffer: Minor doc fixes
Fix parameter name mismatches.
2019-12-12 17:31:13 -05:00
Matthias Clasen
12d787286e builder: Minor doc fixes
Fix parameter name mismatches.
2019-12-12 17:30:36 -05:00
Matthias Clasen
c33a7670d0 Merge branch 'wip/otte/builder' into 'master'
More builder work

Closes #2267

See merge request GNOME/gtk!1230
2019-12-12 20:36:08 +00:00
Matthias Clasen
bbb56d8216 Merge branch 'file-transfer' into 'master'
clipboard: file transfer portal support

See merge request GNOME/gtk!1244
2019-12-12 19:33:02 +00:00
Matthias Clasen
a20c8af678 clipboard: file transfer portal support
Implement file-list <-> application/vnd.flatpak.file-list
serialization by talking to the file transfer portal.

See https://github.com/flatpak/xdg-desktop-portal/pull/222
2019-12-12 14:25:33 -05:00
Matthias Clasen
0eb2b382a2 Merge branch 'master-gitlab-HC-tooltip' into 'master'
Set HighContrast tooltip back to black text over white background

See merge request GNOME/gtk!1242
2019-12-12 19:18:06 +00:00
Benjamin Otte
101298c54d gtk-demo: Don't include "gtk.h" 2019-12-12 19:50:55 +01:00
Benjamin Otte
f6bdfc32d3 tests: Set an existing font in testfontchooser 2019-12-12 19:50:55 +01:00
Benjamin Otte
5015730212 builder: Turn last dlsym() function into a scope API
Looking up a get_type function by its name is now also part of
GtkBuilderScope.
2019-12-12 19:39:36 +01:00
Benjamin Otte
f8a7f30a0d builder: Add GtkBuilderScope
GtkBuilderScope is an interface that provides the scope that a builder
instance operates in.
It creates closures and resolves types. Language bindings are meant to
use this interface to customize the behavior of builder files, in
particular when instantiating templates.

A default implementation for C is provided via GtkBuilderCScope (to keep
with the awkward naming that glib uses for closures). It is derivable on
purpose so that languages or extensions that extend C can use it.

The reftest code in fact does derive GtkBuilderCScope for its own scope
implementation that implements looking up symbols in modules.

gtk-widget-factory was updated to use the new GtkBuilderCScope to add
its custom callback symbols.
So it does it different from gtk-demo, which uses the normal way of
exporting symbols for dlsym() and thereby makes the 2 demos test the 2
ways GtkBuilder uses for looking up symbols.
2019-12-12 19:39:23 +01:00
Benjamin Otte
1f94028ff7 builder: Add gtk_builder_set_current_object()
Use it as the default object for expression binds and when connecting
signals. It is intended to work kind of as the "this" object while
parsing. In fact, the term "current object" was stolen from the Java
docs and various C++ tutorials for the this pointer.

Set the current object in gtk_widget_init_template() and
GtkListItemBuilder.

This more-or-less replaces the object passed to
gtk_builder_connect_signals() in GTK3.
2019-12-12 19:12:11 +01:00
Benjamin Otte
512c4c13a6 builder: Add gtk_builder_lookup_object()
... and use it. This function looks up an object like
gtk_builder_get_object() but generates an error on failure.

Unlike the evil function _gtk_builder_lookup_object() which also
generates an error but hides it for later lookup.

Use this to avoid continuing applying properties when an error was
encountered.
2019-12-12 19:12:11 +01:00
Benjamin Otte
552db7cb08 types: Move GTK_INVALID_LIST_POSITION here
I have no idea where it should go really - maybe glib?

It certainly shouldn't require everybody including selectionmodel code
just to get at this value.
2019-12-12 19:10:45 +01:00
Matthias Clasen
d564cb2a7e Merge branch 'terminal' into 'master'
imwayland: Suppport terminal purpose

See merge request GNOME/gtk!1243
2019-12-12 17:57:05 +00:00
Marek Kasik
a6e3fc2d2f printing: Fix getting info for standalone IPP printers
Create printer name from name of the advertised service
for standalone IPP printers as opposed to CUPS printers
advertised via Avahi which get name from their
resource path.
This is similar to what cups-filters does.

Pass GtkPrinter class to request for printer info
so that it does not need to be searched for
(such search could fail for standalone IPP printers).

https://gitlab.gnome.org/GNOME/gtk/issues/1509
2019-12-12 17:08:30 +01:00
Marek Kasik
e54049bc26 printing: Don't show Rejecting Jobs when we don't know
Set reasonable default values for printers discovered
by Avahi which do not have 'printer-type' attribute.
This is the case for network printers which were not
published by CUPS.

Related to the issue #1509.
2019-12-12 17:08:30 +01:00
Dorota Czaplejewicz
e331b39ca5 imwayland: Suppport terminal purpose 2019-12-12 14:37:51 +00:00
Jonathan Michalon
e6270ca43f Set HighContrast tooltip back to black text over white background
8abdbfee16 pulled Adwaita tooltip selectors,
but in the meantime the colors were also set to Adwaita's. Push back the same
behaviour as before because it's better for visually-impaired users.
2019-12-12 09:51:40 +01:00
Christoph Reiter
88da95d921 Merge branch 'honor-hotspot-gtk4' into 'master'
gdk/x11: Honor hotspot during drag cancel animation

See merge request GNOME/gtk!1236
2019-12-11 12:59:23 +00:00
Chun-wei Fan
44f9c67466 Merge branch 'vulkan-no-layered-windows' into 'master'
Win32: Do not enable layered windows when using Vulkan

See merge request GNOME/gtk!1217
2019-12-11 06:24:49 +00:00
Matthias Clasen
02bbe399df Merge branch 'matthiasc/for-master' into 'master'
widget factory: Fix more grid layout fallout

See merge request GNOME/gtk!1237
2019-12-10 03:05:09 +00:00
Matthias Clasen
41bb40feee widget factory: Fix more grid layout fallout 2019-12-09 21:29:03 -05:00
Benjamin Otte
336d652be5 a11y: We can peek here
Avoids instantiating a11y objects when we don't need to.
2019-12-09 16:35:41 +01:00
Benjamin Otte
d3e8678955 treeview: Don't create a cyclic reference
TreeRowReference refs the proxy object, so don't use proxies.
2019-12-09 16:35:41 +01:00
Benjamin Otte
503d988c1b label: Compute label baselines correctly
When we were switching smallest and widest, we were not switching the
baselines.
2019-12-09 16:35:41 +01:00
Robert Mader
7a46378e71 gdk/x11: Honor hotspot during drag cancel animation
Otherwise the icon "jumps" to the cursor position with its top left when
the animation starts.
This is especially visible if the dragged item is big, like when dragging
mails in Thunderbird.
2019-12-09 01:45:30 +01:00
Matthias Clasen
9f6d12551f Add GtkTreeListRow type to the docs 2019-12-08 17:58:09 -05:00
Matthias Clasen
43c93d6f85 Add missing listmodel and selection types to the docs 2019-12-08 13:56:47 -05:00
Matthias Clasen
d683d085c0 tree list model: Add a missing annotation
The GtkTreeListModelCreateModelFunc returns
a new reference.
2019-12-08 00:30:32 -05:00
Matthias Clasen
92ab450983 inspector: Avoid critical warnings
We were still using this but it's not defined in the UI xml.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2295
2019-12-07 19:39:02 -05:00
Matthias Clasen
7b14c65b41 Merge branch 'inspector-display' into 'master'
Inspector display

See merge request GNOME/gtk!1234
2019-12-07 23:20:51 +00:00
Matthias Clasen
c89c652401 inspector: Make the css tree respect inspected display
The display is used here to force reparsing the theme
on the right settings object.
2019-12-07 18:07:44 -05:00
Matthias Clasen
f0f57d156b inspector: Make logs respect inspected display 2019-12-07 18:07:05 -05:00
Matthias Clasen
cecf4f2763 inspector: Make inspect button use inspected display
This may not matter, but just for cleanliness.
2019-12-07 18:07:05 -05:00
Matthias Clasen
4eeed47c7b inspector: Make general respect inspected display 2019-12-07 18:07:05 -05:00
Matthias Clasen
bd1f7e057a inspector: Make visual settings respect the inspected display
This is not quite complete, GTK and GSK debug flags
are not per display, and slowdown and text direction
are not either.
2019-12-07 18:07:05 -05:00
Matthias Clasen
174d8b72a5 inspector: Make css editor respect inspected display
Stop using gdk_display_get_default and use the
inspected display instead.
2019-12-07 18:07:05 -05:00
Matthias Clasen
1437b0856c inspector: Make object tree respect inspected display
Stop using gdk_display_get_dfault and use the
inspected display instead.
2019-12-07 14:59:49 -05:00
Matthias Clasen
917181cb67 window: Get rid of the inspector_window static
Use the new per-display inspector plumbing and
stop relying on a static variable.
2019-12-07 14:59:49 -05:00
Matthias Clasen
a207a4b3cd inspector: Attach inspector window to display
Give the inspector window a ::inspected-display
property, and pass a display when obtaining an
inspector window. Update the caller.
2019-12-07 14:59:49 -05:00
Matthias Clasen
39a1d27960 window: Inspector cleanups
Reduce the use of the inspector_window static.
The goal is to have one inspector window per
display, so we need to get rid of the static.
2019-12-07 14:59:49 -05:00
Matthias Clasen
5ef4a64084 window: Remove inspector updating fully
Commit 05e752e096 left some ruins behind.
Clean that up.
2019-12-07 14:59:49 -05:00
Matthias Clasen
baacd9efbf inspector: Init yourself
No need to have GTK call this from the outside.
2019-12-07 14:59:49 -05:00
Matthias Clasen
abde37a4d7 inspector: Cleanup
Remove an unused enum.
2019-12-07 14:59:49 -05:00
Matthias Clasen
3ee9b0cf4b Make a test with a custom display
This completely breaks the inspector.
2019-12-07 10:03:42 -05:00
Matthias Clasen
88049915a2 Merge branch 'doc-update' into 'master'
doc: Cleanup doc removing mentions of gdk_surface_shape_combine_region()

See merge request GNOME/gtk!1232
2019-12-05 22:11:31 +00:00
Hubert Figuière
585397937d doc: Cleanup doc removing mentions of gdk_surface_shape_combine_region() 2019-12-05 11:33:09 -05:00
Matthias Clasen
256b6f1aff Merge branch 'matthiasc/for-master' into 'master'
fix leaks in the testsuite

See merge request GNOME/gtk!1231
2019-12-05 00:01:23 +00:00
Matthias Clasen
acabdafb35 Fix treelistmodel tests
They were failing to return a reference where they
need to. This was uncovered by fixing an unrelated
ref leak.
2019-12-04 18:30:37 -05:00
Matthias Clasen
168c1f440d Fix leaks in tests
All the list model tests were leaking items,
because g_list_model_get_item is transfer full.

Fixing these unveils a crash in the treelistmodel
and maplistmodel tests.
2019-12-04 18:24:56 -05:00
Tim Sabsch
33a8ef4bce Update German translation 2019-12-04 19:37:01 +00:00
Benjamin Otte
33bd8f322c builder: Improve error message 2019-12-03 18:12:25 +01:00
Benjamin Otte
bfe4255807 builder: Allow objects in gtk_builder_value_from_string_type()
Instead of throwing an error, lookup objects with
gtk_builder_get_object().
2019-12-03 18:12:25 +01:00
Benjamin Otte
a15fb95c46 gtk-demo: Use normal way to lookup up symbols
We're a normal application, so we can use the normal way to hook up code
into builder files, which is using dlsym() for the function pointers.

There's no need to to extra work exporting static symbols.
2019-12-03 18:12:25 +01:00
Benjamin Otte
292371932b css: Handle invalid :not() selectors
We weren't correctly ending the ( ) block when encountering an error.

Testcases added.

Fixes #2281
2019-12-03 18:12:25 +01:00
Timm Bäder
564e8f483c Merge branch 'wip/wayland-hidpi-swap-region' into 'master'
Fix HiDPI swap regions on Wayland

See merge request GNOME/gtk!1228
2019-12-03 16:05:08 +00:00
Jonas Ådahl
ba74f41a70 wayland/vulkancontext: Fix present region on HiDPI
VkPresentRegionsKHR is expected to operate in buffer coordinates, but
the region we get passed is in surface coordinates, so it must be scaled.
2019-12-03 16:45:37 +01:00
Jonas Ådahl
d6a6313493 wayland/glcontext: Fix damage region on HiDPI
The passed regions are in surface coordinates, but
eglSwapBuffersWithDamage() is in buffer coordinates.
2019-12-03 16:45:37 +01:00
Emmanuele Bassi
9b5a7ae802 Merge branch 'fix-treemodelsort_processed_as_treemodel' into 'master'
Annotate GtkTreeModelSort.new_with_model() appropriately

See merge request GNOME/gtk!1134
2019-12-03 15:36:43 +00:00
LutzLue
e4b8481dd0 Annotate GtkTreeModelSort.new_with_model() appropriately
The new_with_model() method is a constructor, and it returns a GtkTreeModelSort
instance, even if the C API returns a GtkTreeModel for the convenience of C
developers.

Fixes: #1077
2019-12-03 15:36:42 +00:00
Timm Bäder
d868b23c76 gl renderer: Implement blurred inset shadow nodes
And with this...

Fixes #1101
2019-12-03 08:40:35 +01:00
Timm Bäder
56b456ff21 gl renderer: Remove unused uniform from inset shadow shader 2019-12-03 08:40:35 +01:00
Timm Bäder
b91913d10d opbuffer: Remove unused op member 2019-12-03 08:40:35 +01:00
Timm Bäder
ac1497eb2d testsuite: Add an inset shadow rendering test case 2019-12-03 08:40:35 +01:00
Timm Bäder
1854f3f49c gl renderer: Cache current scale in RenderOpBuilder
We call ops_get_scale a lot, so this should be better. It will also make
a later x/y split for the scaling easier.
2019-12-03 08:40:34 +01:00
Timm Bäder
a75523da68 cssshadowvalue: Simplify inset shadow nodes to color nodes if possible
inset shadows like this are frequently used to implement highlights in
CSS without crowing them min size of the element.
2019-12-03 08:40:34 +01:00
Timm Bäder
ca66e9788c gl renderer: Save one level of indentation 2019-12-03 08:40:34 +01:00
Timm Bäder
83ec7d562a window: Don't set invalid csd input shape
This might happen if the CSS values of the decoration node are broken,
e.g. if people *accidentally* type large negative values for the
margins.

Fixes #2268
2019-12-03 08:40:34 +01:00
Timm Bäder
05e9a9b572 snapshot: Reorder color matrix nodes containing a transform node
A color matrix node that contains a transform node can also be expressed
the other way around, as a transform node containing a color matrix
node.

In the general case, the color matrix node will have to draw its
child to a texture so it can color every pixel of that texture, but the
renderers can short-cut this if the child of the color matrix node is
already a texture node. So if we have a node tree like

Color Matrix
    - Transform
        - Texture

The renderer would have to either check the grandchild of the color
matrix or simply fall back to rendering the transform node to a texture.

In the new configuration:

Transform
    - Color Matrix
        - Texture

The renderer can easily see that the child node of the color matrix node
is a texture, and skip rendering it to a texture.

This is for example happening in current Adwaita for spinners, which are
rotated symbolics.
2019-12-03 08:40:34 +01:00
Timm Bäder
bc7b37d307 snapshot: Factor out color matrix merging
We will use that elsewhere in the next commit.
2019-12-03 08:40:34 +01:00
Timm Bäder
fb5dc73841 gl renderer: Implement blurred shadow nodes 2019-12-03 08:40:34 +01:00
Timm Bäder
8d61d9f627 gl renderer: Take a TextureRegion in blur_texture
So we can refer to textures on a texture atlas.
2019-12-03 08:40:34 +01:00
Timm Bäder
22b6085c32 gl renderer: Scale blur radius
We scale the texture size, so as a consequence we have to scale the blur
radius.
2019-12-03 08:40:34 +01:00
Timm Bäder
2deb1a05a0 gl renderer: Add some often needed debug code 2019-12-03 08:40:34 +01:00
Timm Bäder
8ca46169b1 gl renderer: Blur shader improvements
Use a two-pass blur shader, fix a few other things and unify the
blurring of blur nodes and blurred outset shadow nodes.

Related to #1283
2019-12-03 08:40:34 +01:00
Timm Bäder
642ced0cfc testblur: Fix default blur radius
sync it up with the adjustment value. also just add the destroyed
handler.
2019-12-03 08:40:34 +01:00
Matthias Clasen
a635076106 Merge branch 'improve-popover-menu-style' into 'master'
Adwaita: Improve popover.menu styling

See merge request GNOME/gtk!1083
2019-12-02 13:19:50 +00:00
nana-4
23d8aa40fe Adwaita: Remove unused popover check/radio styling 2019-12-02 20:48:10 +09:00
nana-4
0933630ee5 Adwaita: Flatten circular buttons in popover.menu
Just reuse the list button style.

https://gitlab.gnome.org/GNOME/gtk/issues/1824
2019-12-02 20:48:09 +09:00
nana-4
797cecd9ae Adwaita: Make check & radio symbolic icon style in popover.menu
The disabled modelbutton color needs to be specified explicitly
in order for check & radio to properly read the color with
currentColor.

https://gitlab.gnome.org/GNOME/gtk/issues/1824
2019-12-02 20:48:09 +09:00
nana-4
4c2707916c Adwaita: Improve popover.menu styling
Based on the mockup:
https://gitlab.gnome.org/Teams/Design/os-mockups/blob/master/menus/menu-design-patterns.png

- Remove horizontal padding from popover.menu contents
- Remove roundness from modelbutton
- Adjust sizing to match the mockup
- Fix visual glitches on button.image-button.model
- Add missing mergin to arrow icons
- Fix accelerator position in rtl direction
- Fix accelerator color

https://gitlab.gnome.org/GNOME/gtk/issues/1824
2019-12-02 20:48:09 +09:00
Matthias Clasen
ab32b1bba2 Merge branch 'wip/muktupavels/opaque-region-master' into 'master'
window: fix opaque region

See merge request GNOME/gtk!1222
2019-12-01 15:11:00 +00:00
Matthias Clasen
619c892032 Merge branch 'sass-no-extend-compound-master' into 'master'
themes: remove various @extend with compound selectors

See merge request GNOME/gtk!1223
2019-12-01 15:09:39 +00:00
nana-4
87ea0253aa themes: remove various @extend with compound selectors
They are no longer supported by sass and broken with libsass 3.6.3
(https://github.com/sass/libsass/issues/3033)

This removes them by replacing them with a placeholder selector. This at
least brings the resulting CSS size down a bit so gtk can be build
again.

`%button.flat.suggested-action` has been replaced by
`%selection_mode_button_flat`, which is a more appropriate selector for
`.selection-mode button.titlebutton`.

The CSS was generated with libsass 3.5.5.

Co-authored-by: Christoph Reiter <reiter.christoph@gmail.com>

See https://gitlab.gnome.org/GNOME/gtk/issues/2237
2019-12-01 10:43:16 +09:00
Alberts Muktupāvels
e81a90c432 window: fix opaque region
Decoration node for drawing is used only for client side decorated
windows, but corners from opaque region is subtracted also for
normal windows.

Rename function to better reflect what it does and do not subtract
corners if decoration node was not used for drawing.
2019-11-30 20:19:26 +02:00
Timm Bäder
fe385c28f6 Merge branch 'gtk-link-color' into 'master'
Adwaita: always use link specific colors for link selector

See merge request GNOME/gtk!1201
2019-11-30 07:40:48 +00:00
Matthias Clasen
6c4ab7d208 Merge branch 'matthiasc/for-master' into 'master'
some builder-tool tests

See merge request GNOME/gtk!1220
2019-11-29 15:21:40 +00:00
Matthias Clasen
dd52dd8bb0 Update the test scripts
All tools got renamed to have a gtk4 prefix.
2019-11-29 10:06:39 -05:00
Matthias Clasen
174cdb09a7 Add a test for the previous fix 2019-11-29 10:04:59 -05:00
Matthias Clasen
c3ca34cf51 Merge branch 'matthiasc/for-master' into 'master'
builder-tool: Fix handling of layout properties

See merge request GNOME/gtk!1219
2019-11-29 14:00:05 +00:00
Matthias Clasen
85950afbbd builder-tool: Fix handling of layout properties
We were not properly identifying layout properties
that need to be kept, causing GtkGrid left-attachment
to go missing in widget-factory.ui.
2019-11-29 08:47:35 -05:00
Matthias Clasen
da063a8aa5 Fix up widget-factory ui 2019-11-29 08:34:09 -05:00
Timm Bäder
9d94627f75 Merge branch 'dont-color-labels-directly-gtk4' into 'master'
Adwaita: Avoid directly coloring labels wherever possible (GTK4)

Closes #1643

See merge request GNOME/gtk!1209
2019-11-29 11:53:07 +00:00
Timm Bäder
5bdd25627f reftests: Fix css-multi-state test
Properly unset theme CSS and use the right selector for the toggle
buttons.
2019-11-29 20:26:45 +09:00
Carlo Lobrano
7bb8a480f1 Adwaita: always use link specific colors for link selector
link target uses `$selected_bg_color` and `$selected_fg_color` for the
definition of some selectors (e.g. selected).

While `$link_color` and `$link_visited_color` are based on
`$selected_bg_color`, this does not seem coherent.

Replacing `$selected_*g_color` in link target style with link colors
defined in `_colors.scss file`.
2019-11-29 07:32:16 +01:00
Matthias Clasen
be74be0e3b widget-factory: Fix a popover menu
This one is manually constructed, and things have
changed enough for that to break. Fix it up.
2019-11-27 17:41:44 -05:00
Timm Bäder
982890515d gl renderer: Don't use g_assert() for code that should always run
g_assert can be compiled out.
2019-11-27 16:56:47 +01:00
Timm Bäder
1817025f46 gl renderer: Don't save repeat nodes to disk
This is just debuggin code someone forgot.
2019-11-27 16:47:14 +01:00
Matthias Clasen
c5d24fc5cd Merge branch 'single-compilation-symbol' into 'master'
Use a single compilation symbol

See merge request GNOME/gtk!1216
2019-11-27 15:14:54 +00:00
Timm Bäder
965e37bee9 Merge branch 'fix-issue-1646-master' into 'master'
HighContrast: Add missing color to entry

Closes #1646

See merge request GNOME/gtk!1215
2019-11-27 13:52:08 +00:00
Emmanuele Bassi
def700739d Use a single compilation symbol
We use a compilation symbol in our build to allow the inclusion of
specific headers while building GTK, to avoid the need to include only
the global header.

Each namespace has its own compilation symbol because we used to have
different libraries, and strict symbol visibility between libraries;
now that we have a single library, and we can use private symbols across
namespaces while building GTK, we should have a single compilation
symbol, and simplify the build rules.
2019-11-27 13:33:43 +00:00
nana-4
5590bcb9cc HighContrast: Add missing color to entry
So entries don't inherit color from the parent element anymore.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1646
2019-11-27 22:22:11 +09:00
Timm Bäder
9f69c7f3e8 Merge branch 'broken-annotation' into 'master'
builder: Fix broken annotation

See merge request GNOME/gtk!1213
2019-11-27 06:46:15 +00:00
Robert Ancell
0df45f0de0 builder: Fix broken annotation
Missing a ':', was introduced in 0627bba5a0.
2019-11-27 16:06:36 +13:00
Chun-wei Fan
9c5ea8eba4 gdkvulkancontext-win32.c: Suppress layered Windows on Vulkan
The Vulkan renderer does not work well with layered windows enabled, so
turn it off when we successfully created the Vulkan context on Windows.
2019-11-26 17:00:11 +08:00
Timm Bäder
8f6de1f955 gl renderer: Load flipped-y offscreen vertex data directly
Instead of loading the unflipped version first and then flipping it.
Don't do it in add_render_ops either but only in the function actually
adding the render ops for the nodes, since those frequently have
early-out conditions that don't need the vertex data at all.
2019-11-26 09:09:25 +01:00
Timm Bäder
4f532224e0 testsuite: Add another repeat node test case 2019-11-26 09:09:25 +01:00
Timm Bäder
1c2661ed12 gl renderer: Fix repeat node shader once again 2019-11-26 09:09:25 +01:00
Timm Bäder
91f7ac2d58 gl renderer: Care more about 0×0 offscreen nodes
These never result in a rendering of course, but we must make sure not
to create a 0×0 texture for them, since that will cause problems later
on.
2019-11-26 09:09:25 +01:00
Timm Bäder
3d1a9c7484 Merge branch 'unsafe-strdup-printf' into 'master'
gtk-demo: Fix incorrect use of g_strdup_printf

See merge request GNOME/gtk!1211
2019-11-26 07:11:19 +00:00
Robert Ancell
25e4174a38 gtk-demo: Fix incorrect use of g_strdup_printf
Was broken in a refactoring in 4a2f313
2019-11-26 10:11:28 +13:00
Emmanuele Bassi
04bb5aad36 Use a separate gesture for middle clicks on PlaceView rows
The click gesture in GtkListBox is exclusively for primary button
clicks; this means we're never going to get a click from the middle
button. We need to use a separate GtkGestureClick controller for middle
clicks, in order to activate rows with the 'open-in-tab' flag.

Fixes: #179
2019-11-25 16:02:40 +00:00
nana-4
4f82a0de89 Adwaita: Avoid directly coloring labels wherever possible
Directly coloring labels can create a lot of unintended behaviors.
Unfortunately we can't avoid directly coloring `label:disabled` because
it can be used individually. This, however, tries to inherit color from
the parent element of labels wherever possible.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1643
2019-11-26 00:39:33 +09:00
Benjamin Otte
9e4901e8ce testsuite: Fix expected test output
This reverts part of 91497348bf
2019-11-23 19:33:36 +01:00
Benjamin Otte
7523a3f2f2 cssprovider: Don't add empty rulesets
This change was lost during the parser changes, but the newly added test
exposes it.

And fix the expected error, the syntax has changed.
2019-11-23 19:02:36 +01:00
Alexandr Miloslavskiy
fd1630e049 Fix crash in parse_border()
The bug was introduced in commit:
	9b7640b8 by Benjamin Otte, 2012-03-26 17:24:02
	styleproperty: Make _gtk_style_property_parse_value() return a CssValue

In that commit, `values` changed from `GValue*` to `GtkCssValue**`,
but one `!G_IS_VALUE (&values[8])` was left untouched. As a result,
if `border` shorthand contains anything after color, it might crash,
depending on memory layout.

New test included.

Fixes: #751
2019-11-23 18:15:19 +01:00
Benjamin Otte
e3c3cbbbcb Merge branch 'wip/otte/builder' into 'master'
Reorganize various GtkBuilder things

See merge request GNOME/gtk!1204
2019-11-23 17:09:15 +00:00
Benjamin Otte
4fbb0d7ce4 builder: Make the struct private
We don't want anyone to subclass it - if we want to allow bindings to
extend GtkBuilder, we will be using delegate objects/functions for it.
2019-11-22 17:42:32 +01:00
Benjamin Otte
245fdc8b38 builder: Remove get_type_from_name() vfunc 2019-11-22 17:42:32 +01:00
Benjamin Otte
420169d5cd builder: Improve signal connecting
- Propagate the error back to the parser, so we get a proper GError
  instead of a g_warning().
- Connect closures by id, don't construct a name from the ids so that
  glib can take it apart again.
2019-11-22 17:42:31 +01:00
Benjamin Otte
b025ee428c builder: Connect signals automatically
gtk_builder_connect_signals() is no longer necessary, because all the
setup that made it necessary to have this extra step is now done
automatically via the closure functions.
2019-11-22 17:42:31 +01:00
Benjamin Otte
82395a93b0 reftests: Switch to gtk_builder_set_closure_func() 2019-11-22 17:42:31 +01:00
Benjamin Otte
b7ff017f8d widget: Change templates to use closure functions
... instead of connect functions.
2019-11-22 17:42:31 +01:00
Benjamin Otte
0627bba5a0 builder: Add gtk_builder_set_closure_func()
This allows bindings and templates to setup a way to create closures.
2019-11-22 08:13:16 +01:00
Benjamin Otte
ab53731f4a widget: Reinstate custom closure func
It turns out it ws used in various places.
2019-11-22 07:46:18 +01:00
Benjamin Otte
094c537001 builder: Add gtk_builder_create_closure()
This will be the future way to connect signals automatically (and be
used for other things, too).

For now, gtk_builder_connect_signals_default() is ported to use it.
2019-11-22 07:46:18 +01:00
Benjamin Otte
27d05102ab builder: Remove user_data argument from gtk_builder_connect_signals()
This is pretty unused and gets in the way of the next steps.

A potential side effect is that for templates the widget was passed as
the user data argument. If that turns out to be important, we have to
special case that situation.
2019-11-22 07:46:18 +01:00
Benjamin Otte
f5e4dc824c builder: Remove application setter/getter
It's unused and doesn't belong to GtkBuilder.
2019-11-22 07:46:18 +01:00
Benjamin Otte
80acc8f296 builder: Carry the module as part of the GtkBuilder object
This way, we don't open the module in every place we want to look up
functions.
2019-11-22 07:46:18 +01:00
Benjamin Otte
e3860d25e9 builder: Fix typo in docs 2019-11-22 07:35:03 +01:00
Benjamin Otte
a2634077e7 testsuite: Print useful statement on notify test error
... and don't instantly abort, test the rest of the properties, too.
2019-11-22 07:35:03 +01:00
Benjamin Otte
c72c0f4d43 types: Remove and unused typedef
GtkRcPropertyParser is gone.
2019-11-22 07:35:03 +01:00
Benjamin Otte
d92cfa2179 settings: Remove RC property parsers
They've not been used for a long time and the APIs where they could
reasonably be used have been gone for as long.
2019-11-22 07:35:03 +01:00
Benjamin Otte
bbdaa4a0ff settings: Remove code dealing with property parsers
They only remained in private code where they were always set to NULL.
2019-11-22 07:35:03 +01:00
Sam Hewitt
5e11a2ae6a adwaita: level bar refinements
- shave a few pixels off large level bar
 - thinner discrete level bar
2019-11-19 11:46:18 -05:00
Timm Bäder
053360df85 gl renderer: Remove unused function 2019-11-19 11:06:08 +01:00
Timm Bäder
39a48de025 testsuite: Add a testcase for repeat nodes that don't repeat 2019-11-19 10:45:35 +01:00
Timm Bäder
600ce68210 gl renderer: Add a short cut for repeat nodes that don't repeat
These happen and we don't even need to draw the child to a texture.
2019-11-19 10:45:02 +01:00
Timm Bäder
604f44da11 gl renderer: Fix repeat nodes that don't repeat
Fixes #2234
2019-11-19 10:31:21 +01:00
Timm Bäder
581f5bd749 csstokenizer: Plug a leak 2019-11-19 09:37:45 +01:00
Timm Bäder
ecc40cf115 rendernodeparser: Only report a GError* if we have one 2019-11-19 09:37:26 +01:00
Timm Bäder
3d7817154c rendernodeparser: Handle resolving NULL urls 2019-11-19 09:37:03 +01:00
Emmanuele Bassi
232e313823 docs: Add migration note for iconify → minimize
See commit b70e4f6de9.
2019-11-18 14:12:41 +00:00
Daniel Mustieles
914e2a6656 Updated Spanish translation 2019-11-18 15:08:59 +01:00
Emmanuele Bassi
9a88d17ef2 Merge branch 'gdk-backend-imports' into 'master'
Correct Gdk backend import paths and related gtk-doc

See merge request GNOME/gtk!1197
2019-11-18 10:27:32 +00:00
Andy Holmes
907a86fd93 Correct Gdk backend import paths and related gtk-doc
Correct the paths in the include guard warnings and use the `@Include`
directive for the Gdk backends.
2019-11-18 00:31:38 -08:00
Matthias Clasen
d4180931f8 Merge branch 'seal-popover-menu' into 'master'
Privatize popover menu pieces

See merge request GNOME/gtk!925
2019-11-18 01:57:55 +00:00
Matthias Clasen
dd913423d3 Merge branch 'signal-naming' into 'master'
gtkstyleprovider: Rename -gtk-style-changed signal to have a valid name

See merge request GNOME/gtk!1176
2019-11-18 01:55:34 +00:00
Matthias Clasen
c296101a2f Merge branch 'issue-67' into 'master'
Rename "iconify" to "minimize"

Closes #67

See merge request GNOME/gtk!1190
2019-11-18 00:52:53 +00:00
Emmanuele Bassi
a439be5161 Remove the XIM input method
It's old and busted, and mostly broken in weird ways when it comes to
extended input devices. All that XIM does, these days, is make a mess
when people enable it by mistake.
2019-11-16 21:05:25 +00:00
Emmanuele Bassi
1ba2923616 Merge branch 'meson-bump' into 'master'
Bump up the required version of Meson

See merge request GNOME/gtk!1191
2019-11-16 20:26:31 +00:00
Emmanuele Bassi
1ec4cb7f17 Disable GdkSurface.minimize on Wayland
The existing xdg-shell protocols do not support minimization in a way
that allows us to implement the GdkSurface API; the only minimization
operation does not come with a state notification, nor it comes with
a way to undo itself.

Closes: #67
2019-11-16 20:25:01 +00:00
Emmanuele Bassi
b70e4f6de9 Rename "iconify" to "minimize"
The "iconified" state is mostly an X11-ism; every other platform calls
this state "minimized" because it may not involve turning a window into
an icon at all.
2019-11-16 20:07:37 +00:00
Emmanuele Bassi
3c11c57755 Bump up the required version of Meson
Match the one we're testing on our CI infrastructure.
2019-11-16 18:40:23 +00:00
Emmanuele Bassi
1b7c6e5687 Merge branch 'gdkx-import-doc' into 'master'
Correct GdkX11 import path in docs and include guards

Closes #2254

See merge request GNOME/gtk!1188
2019-11-16 18:19:26 +00:00
Andy Holmes
d32cd210bb Correct GdkX11 import path in docs and include guards
Update the include directives in the documentation, as well as the
include guards in headers, to point to gdk/x11/gdkx.h.

closes #2254
2019-11-16 01:35:09 -08:00
Emmanuele Bassi
e056e4ff58 Merge branch 'fix-menu-check-radio-styling-gtk4' into 'master'
Adwaita: Fix check/radio styling in menu (GTK4)

See merge request GNOME/gtk!1187
2019-11-15 23:26:17 +00:00
Emmanuele Bassi
ae66c07a70 Merge branch 'dont-hardcode-shared-library' into 'master'
build: Don't hardcode shared_library() in meson

See merge request GNOME/gtk!1172
2019-11-15 23:24:42 +00:00
Niklas Hambüchen
3936412332 Try building static libs on CI 2019-11-15 18:42:36 +01:00
nana-4
ea5eeb7c7a Adwaita: Fix check/radio styling in menu
The new check/radio style increased their specificity, but it was not
synchronized in the menu styling.

This commit increases the specificity to match the updated check/radio
styling.

https://gitlab.gnome.org/GNOME/gtk/issues/2096
2019-11-16 01:08:44 +09:00
Emmanuele Bassi
767df50eda Merge branch 'building-docs' into 'master'
Document the use of build types when configuing GTK

See merge request GNOME/gtk!1113
2019-11-15 13:05:39 +00:00
Emmanuele Bassi
baae2920dc Merge branch 'Master_checkradio_refresh' into 'master'
Refresh check/radio styling, ported from gtk3

See merge request GNOME/gtk!1175
2019-11-15 12:36:12 +00:00
frederik.feichtmeier
832419b2c3 Refresh check/radio styling, ported from gtk3 2019-11-15 13:16:07 +01:00
Emmanuele Bassi
ff78adb25d Merge branch 'fix-emoji-picker-styling' into 'master'
Adwaita: Fix emoji picker styling (GTK4)

See merge request GNOME/gtk!1181
2019-11-14 16:30:49 +00:00
nana-4
e05f404fc5 Adwaita: Fix emoji picker styling
- Adjust the emoji picker appearance to be the same as gtk3's.
- Fix button.emoji-section margins in RTL.
- Prevent the .emoji hover effect from being applied to the entire
  nested popover.
2019-11-15 00:04:18 +09:00
Kjell Ahlstedt
d572b5d94c headerbar: Disconnect signal handlers when children are removed
The signal handler that calls notify_child_cb() is disconnected
from a child widget before the child is removed from the header bar.
gtk_header_bar_dispose() chains up before destroying the start and end
boxes, thus avoiding calls to notify_child_cb() after start_box and
end_box have been cleared.

Fixes #2246
2019-11-14 09:15:58 +01:00
Timm Bäder
c2306d3ba6 inspector: Select an object when activating it 2019-11-14 09:15:58 +01:00
Timm Bäder
edf56b438e css: short-circuit gtk_css_dimension_value_try_add
No need to allocate a new css value for something that we already have,
because one of the two values is 0
2019-11-14 09:15:58 +01:00
Timm Bäder
cd3cd64769 cssdimenstionvalue: Add common degree value singletons 2019-11-14 09:15:58 +01:00
Timm Bäder
fb0b0ddfe0 cssdimensionvalue: Add 50% singleton
Also pretty common
2019-11-14 09:15:58 +01:00
Timm Bäder
3180cdb9ef cssdimensionvalue: Add more common pixel values
These are used for icon sizes, etc.
2019-11-14 09:15:58 +01:00
Timm Bäder
07d1ea4356 cssimagerecolor: Avoid copying colors 2019-11-14 09:15:58 +01:00
Timm Bäder
e5f1ff6a4d popover: Use a bin layout for the contents gizmo 2019-11-14 09:15:58 +01:00
Timm Bäder
f8303c7a22 testpopover: Plug two GtkBuilder leaks 2019-11-14 09:15:58 +01:00
Timm Bäder
af6d1839e1 Merge branch 'wip/christopherdavis/issue-2233' into 'master'
Adwaita: remove unwanted spacing for boxes as titlebars

Closes #2233

See merge request GNOME/gtk!1177
2019-11-13 14:29:01 +00:00
Christopher Davis
b4b7fe122e Adwaita: remove unwanted spacing for boxes as titlebars
A GtkBox in a titlebar could have unwanted spacing.
This caused a glitch in split-header applications where
parts of the titlebar would be transparent or black.

This commit tweaks Adwaita to make sure no spacing is added for boxes when used as titlebars.

Fixes #2233
2019-11-13 06:19:05 -08:00
Timm Bäder
e36940fa8c Merge branch 'master.msvc.fix' into 'master'
gtk/gtkcssrgbavalue.c: Fix build on Visual Studio

See merge request GNOME/gtk!1178
2019-11-13 10:40:02 +00:00
Chun-wei Fan
d2e13dd3e4 gtk/gtkcssrgbavalue.c: Fix build on Visual Studio
Visual Studio does not allow static or global structures to use
static storage duration by compound literals, which is actually a
GCCism[1].

[1]: See https://gcc.gnu.org/onlinedocs/gcc/Compound-Literals.html
2019-11-13 18:08:15 +08:00
Philip Withnall
13f4d639fd gtkstyleprovider: Rename -gtk-style-changed signal to have a valid name
Signal names must start with a letter. They can’t start with a hyphen.

It was originally added in commit 74f4c6f6bd with no given reason
for why the signal name was chosen as it was.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 19:51:33 +00:00
Emmanuele Bassi
ad48bbb849 Merge branch 'issue-2230' into 'master'
Add GtkCss API to the introspection data

Closes #2230

See merge request GNOME/gtk!1173
2019-11-11 16:11:06 +00:00
Emmanuele Bassi
2497d982b0 Add GtkCss API to the introspection data
Some of the CSS API has been moved to a public namespace, so we need to
include it into the introspection data we build in order for people to
use it.

Fixes: #2230
2019-11-11 15:53:09 +00:00
Niklas Hambüchen
bb9c07d8fe build: Don't hardcode shared_library() in meson.
Instead, use the standard library().
This is a meson best practice.

Fixes -Ddefault_library=static not having any effect.
2019-11-11 16:37:46 +01:00
Emmanuele Bassi
ace2208f45 docs: Rename SGML files
We've been using XML for ages.
2019-11-11 13:52:08 +00:00
Emmanuele Bassi
b8c4009686 docs: Fix the XML indentation 2019-11-11 13:52:08 +00:00
Emmanuele Bassi
6f0ff3a8cb docs: We run meson, not configure 2019-11-11 13:52:08 +00:00
Emmanuele Bassi
209e8b54e9 docs: Add a section on supported build types
GTK uses the Meson `buildtype` option to determine whether to enable or
disable debugging code and safeties. We should document our behaviour
and expectations.
2019-11-11 13:52:08 +00:00
Matthias Clasen
bfa0509f08 Privatize popover menu pieces
Don't allow manual creation of popover menus
anymore. This lets us also make GtkModelButton
private
2019-11-11 12:42:06 +01:00
Piotr Drąg
07d17c5bc1 Update Polish translation 2019-11-10 12:45:22 +01:00
Daniel Mustieles
e26c361d2d Updated Spanish translation 2019-11-08 12:44:39 +01:00
Timm Bäder
290e250886 Merge branch 'adwaita-emoji-picker-adjustments-gtk4' into 'master'
Adwaita: Emoji picker adjustments

See merge request GNOME/gtk!1160
2019-11-07 11:56:17 +00:00
Alex Monday
22d5b9bc41 Adwaita: Emoji picker adjustments
- Add margins for search entry;
- Increase side margins for emoji-section buttons box;
- Apply border-radius on hovered emoji;
- Adjust indication of hovered emoji-section button.
2019-11-06 18:41:11 +05:00
Benjamin Otte
ab407ba57c Merge branch 'kill-entry-buffer-demo' into 'master'
gtk-demo: Drop the entry buffer demo

See merge request GNOME/gtk!1166
2019-11-05 19:08:22 +00:00
Benjamin Otte
07f2024bfc scrolledwindow: Use dispose(), not destroy() 2019-11-05 20:06:44 +01:00
Benjamin Otte
accbfc0083 Merge branch 'wip/chergert/textundo' into 'master'
Add undo/redo support for GtkTextView, GtkText, and GtkEntry

See merge request GNOME/gtk!1158
2019-11-05 18:52:25 +00:00
Matthias Clasen
e8d890ae0c gtk-demo: Drop the entry buffer demo
We all agree that entry buffers are not something
we should promote in demos.
2019-11-05 18:50:06 +00:00
Christian Hergert
bfc1e77b7f migration: add GtkEntryBuffer::deleted-text to migration guide 2019-11-05 10:27:29 -08:00
Christian Hergert
dba9298c14 gtk-demo: set irreversable actions for textview demos 2019-11-05 10:27:29 -08:00
Christian Hergert
67c0f88c00 gtk-demo: add a demo for TextView undo/redo 2019-11-05 10:27:29 -08:00
Christian Hergert
e93408e962 gtk-demo: add an undo demo for GtkEntry 2019-11-05 10:27:29 -08:00
Christian Hergert
6d193d7cb4 gtk-demo: wrap text operations in irreversible actions
This ensures that the actions to set the text for the demo tabs cannot
be undone. This matches the previous behavior for GtkTextBuffer.
2019-11-05 10:27:29 -08:00
Christian Hergert
fb4fbfb2a8 text: add undo support to GtkText
This adds support using the GtkTextHistory helper for undo/redo to the
GtkText widget. It is similar in use to GtkTextView, but with a simplified
interface.

You can disable undo support using the GtkText:enable-undo property. By
default, it is enabled.
2019-11-05 10:27:29 -08:00
Christian Hergert
7e77afe94c entrybuffer: remove text in ::deleted-text default handler
This changes the semantics of ::deleted-text to perform the removal of
text in the default handler. This means, that if you want the old behavior
where your signal handler is called after the text has been deleted, you
should connect with G_CONNECT_AFTER in your signal handler (or use
g_signal_connect_after).

Without this change, there was never a way to get the deleted-text before
the operation had completed and this is necessary to provide undo support
to the text widgets.
2019-11-05 10:27:29 -08:00
Christian Hergert
7587996279 editable: add enable-undo property
This property is intended to be mapped to a GtkText so that undo/redo
support can be used from a number of editable widgets.
2019-11-05 10:27:27 -08:00
Christian Hergert
15b3c0f563 textview: add undo/redo support to GtkTextView
This builds upon the GtkTextHistory helper to provide undo and redo support
for the GtkTextView widget and GtkTextBuffer object.

You can undo/redo using familiar shortcuts such as Primary+Z,
Primary+Shift+Z, ad Primary+Y.

Developers that wish to disable undo, should set the
GtkTextBuffer:enable-undo property to FALSE.

You can wrap irreversible actions
gtk_text_buffer_begin_irreversible_action() and
gtk_text_buffer_end_irreversible_action(). This will cause the undo stack
to drop all undo/redo actions and the changes made between them will be
the "initial state" of the buffer.

Calling gtk_text_buffer_set_text() will do this automatically for you.
2019-11-05 09:34:29 -08:00
Christian Hergert
5e341210a1 texthistory: add GtkTextHistory helper
The GtkTextHistory helper provides the fundamental undo/redo stack that
can be integrated with other text widgets. It allows coalescing related
actions to reduce both the number of undo actions to the user as well as
the memory overhead.

A new istring helper is used by GtkTextHistory to allow for "inline
strings" that gracefully grow to using allocations with g_realloc(). This
ensure that most undo operations require no additional allocations other
than the struct for the action itself.

A queue of undoable and redoable actions are maintained and the link for
the queue is embedded in the undo action union. This allows again, for
reducing the number of allocations involved for undo operations.
2019-11-05 09:34:29 -08:00
Daniel Mustieles
fbea677a5c Updated Spanish translation 2019-11-05 15:44:34 +01:00
Emmanuele Bassi
b271db4f5b ci: Allow msys2 jobs to fail
The msys2 runner has started failing for internal reasons:

 - gtk-3-24 times out
 - master fails with a ld.exe assertion:
   BFD (GNU Binutils) 2.33.1 assertion fail
   ../../binutils-2.33.1/bfd/cofflink.c:2348

Both seem related to some MSYS2 issue. Until the runner is updated, we
should not block on it.
2019-11-05 10:44:05 +00:00
Emmanuele Bassi
b5ed2d310e tests: Add label-sizing.ui to the XFAIL list
Changes in Pango may make this test fail.
2019-11-04 23:46:22 +00:00
Emmanuele Bassi
3bf9277de6 Revert "Adwaita: radios & checkboxes styling updates"
This reverts commit 427b5d187c.

The commit breaks Adwaita:

Theme parsing error: gtk-contained.css:1191:28-44: No property named "-gtk-icon-effect"
2019-11-04 23:35:49 +00:00
Matthias Clasen
53c9eb5a5b Move the ifdef to the right spot 2019-11-04 23:24:49 +00:00
Matthias Clasen
6e5da14294 cell text: Handle new pango enum values
The PangoUnderline enum grew some new values.
2019-11-04 23:14:44 +00:00
Jakub Steiner
427b5d187c Adwaita: radios & checkboxes styling updates
- port from gtk3
2019-11-04 19:41:58 +01:00
Benjamin Otte
5d07877b35 Merge branch 'wip/sadiq/fix-leak' into 'master'
selection-output-stream-x11: Fix a memory leak

See merge request GNOME/gtk!1149
2019-11-04 17:46:28 +00:00
Benjamin Otte
3086715d54 Merge branch 'gtkstack-addnamed-return' into 'master'
stack: return the stack page when adding a child, to ease setting props

See merge request GNOME/gtk!1161
2019-11-04 02:35:22 +00:00
Andy Holmes
44093f4966 stack: return the stack page when adding a child, to ease setting props 2019-11-03 18:05:03 -08:00
Christian Hergert
6d16f7ad35 textview: use g_slice_new0 for proper initial state
This fixes the missuse of the GList embedded node for prev/next.
2019-11-01 11:37:07 -07:00
Matthias Clasen
5f627a2cb6 Merge branch 'reftest-fixes' into 'master'
Reftest fixes

See merge request GNOME/gtk!1157
2019-11-01 17:45:38 +00:00
Matthias Clasen
34d002121d reftests: Print out a helpful error
When module loading fails, print out the error.
2019-11-01 13:37:52 -04:00
Matthias Clasen
22bb1bd568 reftests: Drop libtool hack
We are not using libtool anymore.
2019-11-01 13:37:43 -04:00
Matthias Clasen
28898445ff Merge branch 'bump-pango' into 'master'
Bump pango

See merge request GNOME/gtk!1154
2019-11-01 17:26:33 +00:00
Matthias Clasen
828b58247c label: Handle new pango attributes
overline and overline-color were introduced in Pango 1.45.
2019-11-01 13:01:54 -04:00
Matthias Clasen
de29c3e193 label: Handle insert_hyphens pango attribute
This was introduced in Pango 1.44.4.
2019-11-01 13:01:54 -04:00
Matthias Clasen
8ccf2a722a gsk: Stop using deprecated pango api
Shape engines are not used anymore.
2019-11-01 13:01:54 -04:00
Matthias Clasen
fa8ce17e1e build: We no longer need freetype 2019-11-01 13:01:54 -04:00
Matthias Clasen
4a2f3130d2 gtk-demo: Use harfbuzz for font features
We don't need freetype anymore here; harfbuzz
has what we need.
2019-11-01 13:01:54 -04:00
Matthias Clasen
eaa6301e53 Port the font chooser to just use harfbuzz 2019-11-01 13:01:54 -04:00
Matthias Clasen
41c52e955d Bump the pango dependency
This lets us avoid freetype uses, and simplifies
some other things as well.
2019-11-01 13:01:54 -04:00
Matthias Clasen
eca7fa075e Merge branch 'fix-print-dialog' into 'master'
Update the print dialog for headerbar changes

See merge request GNOME/gtk!1156
2019-11-01 17:00:34 +00:00
Matthias Clasen
19a4e76034 Update the print dialog for headerbar changes
This was breaking the templates test.
2019-11-01 12:51:42 -04:00
Matthias Clasen
6cacff9df1 Merge branch 'ci-update' into 'master'
Update the CI image

See merge request GNOME/gtk!1155
2019-11-01 16:30:17 +00:00
Emmanuele Bassi
2d309725c9 ci: Add internal links to the HTML report
Makes it easier to link to various sections, and to specific failures.
2019-11-01 15:44:12 +00:00
Emmanuele Bassi
a5c00685c5 ci: Add diffutils to the CI image
Some transitive dependency got dropped, and we lost diff.
2019-11-01 15:22:02 +00:00
Emmanuele Bassi
48cc26246f Check for diff's availability
The tests suite calls `diff` in various places, which means we need to
check if it's installed.
2019-11-01 15:20:47 +00:00
Benjamin Otte
4b41dd4eb1 Merge branch 'otte/for-master' into 'master'
Otte/for master

See merge request GNOME/gtk!1153
2019-11-01 14:13:28 +00:00
Benjamin Otte
41beae1956 vulkan: Add missing enum value
Also update comment to point to new header after Vulkan reorganized
their repositories.
2019-11-01 14:52:36 +01:00
Emmanuele Bassi
c48fe6d7ec ci: Update the image to Fedora 31
Fedora 31 ships with a newer version of Pango.
2019-11-01 12:52:19 +00:00
Matthias Clasen
a31a80277c Merge branch 'fallback-rendering' into 'master'
Fallback rendering

See merge request GNOME/gtk!1152
2019-10-31 02:55:34 +00:00
Matthias Clasen
745a701b3d inspector: Add a switch for fallback rendering 2019-10-30 22:31:47 -04:00
Matthias Clasen
d4c97ea2b4 gl: Use the fallback debug flag
This debug flag was unused; use it to enable
fallback highlighting at runtime.
2019-10-30 22:31:47 -04:00
Matthias Clasen
03738634ac inspector: Remove fallback from logs
There are no logs that this debug flag produces.
2019-10-30 22:31:47 -04:00
Matthias Clasen
9dd8652a66 Merge branch 'wl-key-repeat' into 'master'
wayland: Rely on server key repeat info

See merge request GNOME/gtk!1150
2019-10-30 02:39:49 +00:00
Matthias Clasen
cb81a06793 wayland: Drop the keyboard settings object
It is no longer used.
2019-10-29 22:20:57 -04:00
Matthias Clasen
4d9cc483c9 wayland: Rely on server key repeat info
Using gsettings for this information does not work
in sandboxed scenarios, where settings are per-app.
Since the Wayland protocol provides this information
nowadays, just drop the old code for reading
the gsettings.
2019-10-29 21:58:45 -04:00
Benjamin Otte
4cca27a7af builder: Allow parsing G_TYPE_BYTES from strings
Just create a bytes containing the literal string.
2019-10-29 04:56:19 +01:00
Benjamin Otte
553a9c292d togglebutton: Don't emit clicked during set_active()
set_active() is meant to set the state of the property, which happens
during setup.
The clicked signal is emitting events from user actions.

It is impossible to use Togglebuttons for MVC applications as long as it
does that.
2019-10-29 04:56:19 +01:00
Benjamin Otte
abd4754648 messagedialog: Remove useless GTK_TYPE_BUILDABLE interface
It was just chaining up.
2019-10-29 04:56:19 +01:00
Mohammed Sadiq
e79d585b00 gdkselectionoutputstream-x11: Fix a memory leak 2019-10-27 14:05:46 +05:30
Matthias Clasen
1f0310ddff gtk-demo: Add a scrolling image demo
This tests big textures.
2019-10-22 21:20:36 -04:00
Matthias Clasen
0284d40e24 window: Unrealize renderer before children
Unrealize the GSK renderer before destroying children.
This makes the renderer drop any texture caches that
it might have, so that we don't needlessly download
them when releasing the widget-side holder objects.

As a fortunate side effect, this fixes crashes on
exit with GtkGLArea-containing windows under Wayland.
2019-10-22 20:28:28 -04:00
Matthias Clasen
ffaf26fdf5 Merge branch 'readonly-all-the-things' into 'master'
Readonly all the things

See merge request GNOME/gtk!1145
2019-10-22 13:23:06 +00:00
Matthias Clasen
5b508ea94a Revert "gl: Speed up icon cache lookups"
This reverts commit dd5ee87b5b.
2019-10-22 07:16:41 -04:00
Matthias Clasen
472d8eebbe gl: Avoid pointless iteration 2019-10-22 07:16:41 -04:00
Matthias Clasen
dd316c8051 gl: Add some comments 2019-10-22 07:16:41 -04:00
Matthias Clasen
1038bc781a Revert "Cache glyph textures in render nodes"
This reverts commit c5af463843.
2019-10-22 07:16:41 -04:00
Timm Bäder
44137574a1 inspector: Fix expander arrow node names
They vanished after the GtkExpander node rename
2019-10-22 09:37:08 +02:00
Timm Bäder
6b07ce2b13 filechooserwidget: Remove unused function parameter 2019-10-22 09:37:08 +02:00
Timm Bäder
008e8076a1 filechooserwidget: Inline function into only caller 2019-10-22 09:37:08 +02:00
Timm Bäder
2cd4b255cd placesview: open address popover upwards 2019-10-22 09:37:08 +02:00
Timm Bäder
11a38dd455 entry: Remove unused function 2019-10-22 09:37:08 +02:00
Timm Bäder
dfcc40ef9a text: Propagate pango attributes to placeholder
Not sure if this is really always wanted or whether we need to filter
the attributes, or even create a separate property for them.
2019-10-22 09:37:08 +02:00
Timm Bäder
1882034323 text: Fix _set_attributes docs
The list is nullable.
2019-10-22 09:37:08 +02:00
Timm Bäder
aaaa3e141b placessidebar: Remove some unused members 2019-10-22 09:37:08 +02:00
Timm Bäder
15af87345d placesview: Use proper setters for properties 2019-10-22 09:37:08 +02:00
Timm Bäder
640db05b18 text: Remove some unused members 2019-10-22 09:37:08 +02:00
Timm Bäder
31ae93475d text: Fix context menu position
Fixes #2209
2019-10-22 09:37:08 +02:00
Timm Bäder
8fc4d229da text: Inline function into only caller 2019-10-22 09:37:08 +02:00
Timm Bäder
a62efb8257 text: Remove gtk_text_get_text_allocation
We can just replace that with get_width/get_height everywhere.
2019-10-22 09:37:08 +02:00
Timm Bäder
acf927fe14 text: Don't destroy pango layout in size_allocate
It's not needed.
2019-10-22 09:37:08 +02:00
Timm Bäder
ca71340c6b Adwaita: Fix menubutton in headerbar margins
Add the margins to the menubutton and not the button inside the
menubutton. This way popovers properly point to the inner button again
instead to somewhere 6px off.
2019-10-22 09:37:08 +02:00
Timm Bäder
350495cf1c Adwaita: Remove padding from popover.menu
The padding belongs to the contents subnode in this case.
2019-10-22 09:37:08 +02:00
Timm Bäder
426d5ca1b7 filechooserwidget: Add .menu to right-click popover
Make it look like the other menus.
2019-10-22 09:37:08 +02:00
Timm Bäder
aaae141687 filechooserwidget: Focus the searchbar when searching
This code path is taken if the search is already active, so focus the
search entry.
2019-10-22 09:37:08 +02:00
Timm Bäder
4826255ea3 filechooserwidget: Rename a callback 2019-10-22 09:37:08 +02:00
Timm Bäder
9ba08a09cb shortcutlabel: Inherit from GtkWidget 2019-10-22 09:37:08 +02:00
Timm Bäder
bb2c68452c shortcutlabel: Inherit from GtkWidget 2019-10-22 09:37:07 +02:00
Timm Bäder
23be10cf69 searchentry: Make the text entry expand
Fixes the broken layout.
2019-10-22 09:37:07 +02:00
Timm Bäder
17a111968b text: Remove an unnecessary queue_draw() call 2019-10-22 09:37:07 +02:00
Matthias Clasen
d3431f569c Revert "inspector: Fix node recording"
This reverts commit ba7649b388.
2019-10-22 01:32:51 -04:00
Matthias Clasen
7a73f43de3 Merge branch 'wip/matthiasc/icon-theme' into 'master'
Misc icon theme cleanups

See merge request GNOME/gtk!1139
2019-10-19 22:43:34 +00:00
Matthias Clasen
ba7649b388 inspector: Fix node recording
When attaching renderer-specific data, we need to
make sure that we key it off the renderer that is
in use, and cope with the absence of render data.

This fixes recording nodes in the inspector.
2019-10-18 09:33:45 -05:00
Matthias Clasen
1dd55ed600 Drop gtk_icon_info_new_for_pixbuf
It is better to keep icon infos as something you
only get from the icon theme.
2019-10-18 08:53:23 -05:00
Matthias Clasen
416b2cd18d Move symbolic pixbuf recoloring code
This function is better off next to the other
symbolic png code in gdkpixbufutils.c.
2019-10-18 08:53:23 -05:00
Matthias Clasen
15dffb47dc icon theme: Drop icon_file from GtkIconInfo
It is not used anymore.
2019-10-18 08:53:23 -05:00
Matthias Clasen
20e70a78c4 Drop another use of icon_file
Stop using icon_file when loading symbolic svgs.
2019-10-18 08:53:23 -05:00
Matthias Clasen
e190b4536a Drop another use of icon_file 2019-10-18 08:53:23 -05:00
Matthias Clasen
3c219bf968 Add another symbolic pixbuf helper 2019-10-18 08:53:23 -05:00
Matthias Clasen
c3de5e3624 Avoid a use of icon_file
This is a step towards getting rid of GtkIconInfo->icon_file.
2019-10-18 08:53:23 -05:00
Matthias Clasen
dd69bcabf7 icon theme: Start to untangle GtkIconInfo
GtkIconInfo contains too much redundant data,
and it is hard to know which fields are to be
used when.

This commit starts to move towards dropping the
icon_file field - we prefer to work with the
filename directly, since it lets us avoid mime
sniffing and strdups.
2019-10-18 08:53:23 -05:00
Matthias Clasen
6373ced608 Drop gtk_icon_theme_get_example_icon_name
This function is not useful. Every icon theme
on my system either does not have that field,
or has it as 'folder'. So, just use 'folder'
when you need an example icon.
2019-10-18 08:53:23 -05:00
Matthias Clasen
2ea95a7674 Drop gtk_icon_theme_list_contexts
Contexts in icon themes are not useful for anything.
2019-10-18 08:53:23 -05:00
Matthias Clasen
dbbb7eef15 testicontheme: Remove useless function
Contexts in icon themes are not useful for anything,
so drop this function from testicontheme.
2019-10-18 08:53:23 -05:00
Matthias Clasen
233d096261 icon theme: Avoid a string copy
This is in an error path, so mostly cosmetic.
2019-10-18 08:53:23 -05:00
Piotr Drąg
239c178ef4 Update POTFILES.in 2019-10-17 20:11:58 +02:00
Matthias Clasen
fdbb925654 gl: Remove an unimplemented profiler counter 2019-10-17 07:59:34 -05:00
Matthias Clasen
aeabe3c40e gl: Add debug spew to texture atlas 2019-10-17 07:59:34 -05:00
Matthias Clasen
222b6c2b58 glyph cache: Go back to memcmp
Be careful to avoid padding data, and only
compare the relevant parts, leaving out the
hash key.
2019-10-17 07:59:34 -05:00
Matthias Clasen
5ab5ff7677 Cosmetics 2019-10-17 07:59:34 -05:00
Matthias Clasen
8a603ff5bd Revert "icon theme: Avoid a string copy"
This reverts commit 0895f0211e.

This negatively affected icons that are included as
resources, since peek_path returns NULL for them.
2019-10-17 07:16:30 -05:00
Goran Vidović
468295a9f7 Update Croatian translation 2019-10-17 12:03:32 +00:00
Matthias Clasen
6c92b824f3 Merge branch 'wip/chergert/opbuffer' into 'master'
Add OpBuffer helper for building op buffer

See merge request GNOME/gtk!1131
2019-10-17 11:37:07 +00:00
Goran Vidović
77e9788517 Update Croatian translation 2019-10-17 11:36:10 +00:00
Goran Vidović
0b1845b0cb Update Croatian translation 2019-10-17 11:23:00 +00:00
Benjamin Otte
342d88a1dc Merge branch 'otte/for-master' into 'master'
Otte/for master

See merge request GNOME/gtk!1136
2019-10-16 20:25:57 +00:00
Benjamin Otte
bab7f56f64 entry: Return boolean from gtk_entry_grab_focus_without_selecting()
This follows recent changes to gtk_widget_grab_focus().
2019-10-16 22:08:53 +02:00
Benjamin Otte
9b87cace47 render: Fix goto
if we have pushed a shadow, we better pop it again.

Broken since d1ea591f18
2019-10-16 21:45:33 +02:00
Benjamin Otte
c2a32afe97 Initialize cursor alpha to 1.0
That way, non-animated cursors don't disappear.
2019-10-16 21:45:33 +02:00
Benjamin Otte
d0e14f79a6 bindings: Make gtk_bindings_add_callback() allow for variant args 2019-10-16 21:45:33 +02:00
Benjamin Otte
7f2ab0d576 bindings: Refactor
Refactor code so that each bindings type has its own struct instead of
sharing one big union.
2019-10-16 21:45:33 +02:00
Timm Bäder
d36d7d93e6 Merge branch 'fix-popover-styles' into 'master'
Fix popover styles (GTK 4)

Closes #2061

See merge request GNOME/gtk!1079
2019-10-16 07:42:45 +00:00
Matthias Clasen
d777300d4e Fix a crash with glyph caching
We need to treat atlas-less cached glyphs like
atlases, when it comes to invalidating text node
render data.
2019-10-15 22:52:28 -04:00
Matthias Clasen
173bb2e1e8 gsk: Fix uninitialized memory
This was causing crashes in some circumstances.
2019-10-15 20:54:24 -04:00
Matthias Clasen
0895f0211e icon theme: Avoid a string copy
GIO has gained a way to peek at a GFile
path; lets use that.
2019-10-15 19:44:26 -04:00
Matthias Clasen
be13a23722 icon theme: Avoid mime sniffing
Themed icons are always pngs or svgs.
Take advantage of that to avoid costly
mime sniffing.
2019-10-15 19:44:26 -04:00
Matthias Clasen
7197743938 pixbuf utils: Preserve format information
When we are loading themed icons, we know if
we deal with an svg or png file, so it is
entirely unnecessarily to have gdk-pixbuf
use g_content_type guess to rediscover that
information.

Change the pixbuf utils apis we have to allow
passing format information down to where we
can use it when creating the pixbuf loader.
2019-10-15 19:44:26 -04:00
Matthias Clasen
dd5ee87b5b gl: Speed up icon cache lookups
Use gdk_texture_set_render_data to avoid
hash table lookups when we can.
2019-10-15 19:44:26 -04:00
Matthias Clasen
e34d1b8a26 gl: Slightly rework the icon cache api
Return a pointer to the IconData struct. This is
closer to the glyph cache api, and will allow us
to add similar shortcuts. For now, just store
texture coords in the form we need, avoiding
converting them over and over.
2019-10-15 19:44:26 -04:00
Matthias Clasen
c5af463843 Cache glyph textures in render nodes
This is a quick implementation that avoids many
glyph cache lookups. We keep an array of direct
pointers in the text render node, and throw those
cached pointers away whenever any atlases have
been dropped (since that may invalidate the cached
glyphs).
2019-10-15 19:44:26 -04:00
Matthias Clasen
49748c9c23 Some more vertex data reshuffling
In some cases, the vertex data is just a trivial
modification of the default data, so do that instead
of recalculating it.
2019-10-15 19:44:26 -04:00
Matthias Clasen
b53fa48794 Fix load_vertex_data
There was a copy-paste error that set all
uv coordinates to 0,0.
2019-10-15 19:44:26 -04:00
Christian Hergert
97f3371709 gl: avoid calculating vertex_data until necessary
In many cases of the switch, we do not need the vertex data. This moves
the creation of the vertex_data array into a secondary function and only
calculates it the cases for which it is required.
2019-10-15 19:44:26 -04:00
Matthias Clasen
58d57e1087 gl: Drop buffer_size
No need to maintain buffer_size separately.
It is always vertices->len * sizeof (GskQuadVertex).
2019-10-15 19:44:26 -04:00
Matthias Clasen
571068af12 Drop OP_CHANGE_VAO
Instead, we accumulate vertices in a separate
array, which simplifies various things and lets
us avoid the extra copying step for the vao.
2019-10-15 19:44:26 -04:00
Christian Hergert
a00d12c62a prototype OpBuffer helper for building op buffer 2019-10-15 19:44:26 -04:00
Benjamin Otte
7fc74eaeae Merge branch 'otte/for-master' into 'master'
Otte/for master

See merge request GNOME/gtk!1133
2019-10-15 18:47:57 +00:00
Benjamin Otte
4eb077979f widget: Don't grab focus when can-focus == false
... inside the default vfunc.

Instead, walk the children until we find the first widget that can be
focused. If no child can be focused, return FALSE from grab_focus.
2019-10-15 16:33:05 +02:00
Benjamin Otte
9c1b1eb894 widget: Insist that widgets are rooted to be focusable
This check was in the vfunc before, but it's a general rule, so apply it
before.
2019-10-15 16:33:05 +02:00
Benjamin Otte
14c34a7014 widget: Make grab_focus() fail on insensitive widgets
We can return FALSE early now instead of silently failing in
gtk_window_set_focus().
2019-10-15 16:33:05 +02:00
Benjamin Otte
427deb4f13 widget: Make gtk_widget_grab_focus() return a boolean
So now it can actually fail.

It doesn't yet though.
2019-10-15 16:33:05 +02:00
Benjamin Otte
a1a70a1130 bindings: Add gtk_binding_entry_add_callback()
This allows bindings that have no public API.
2019-10-15 07:17:30 +02:00
Benjamin Otte
19304c1d2c bindings: Add gtk_binding_entry_add_action()
Allows registering bindings for activating widget actions, as an
alternative to signal emissions.
2019-10-15 07:17:30 +02:00
Benjamin Otte
01be7f0666 widget: Make gtk_widget_activate_action() return TRUE/FALSE
TRUE if an action was successfully activated, FALSE if it wasn't found.
2019-10-15 07:17:30 +02:00
Benjamin Otte
1b68e76852 gtk: Add GtkNoSelection
Allows not to have anything selected.
2019-10-15 07:17:07 +02:00
Benjamin Otte
9f5ee77a44 singleselection: Fix model property
1. Make the model property construct-only. Allowing to change the
   model has invalid side effects.

2. Add a getter for the model property.
2019-10-15 07:17:07 +02:00
Benjamin Otte
6d20fe0bf9 expander: Rename CSS nodes
The expander icon is renamed from "arrow" to "expander".
The expander widget itself is renamed from "expander" to
"expander-widget" (Better ideas welcome).

This makes it possible to have an "expander" icon in more places then
the GtkExpander widget (in particular in tree lists) and not
confuse it with arrows.
2019-10-15 07:17:07 +02:00
Timm Bäder
bb56b4ef5d cssimagebuiltin: Don't create cairo nodes for empty icons
GTK_CSS_IMAGE_BUILTIN_NONE is not going to draw anything of course, so
don't bother creating an empty cairo node for it.
2019-10-15 07:13:28 +02:00
Timm Bäder
5ea21f7910 gl renderer: Fix an out of bounds read
Fixes #2200
2019-10-15 07:13:14 +02:00
Matthias Clasen
acb7f437fa notebook: Avoid a crash
This is fallout from turning the menu into
a popover, causing it to be be a child.
2019-10-12 19:00:35 -04:00
Matthias Clasen
7bff3abe8e glyph cache: Fix handling of big glyphs
We were putting big glyphs in the cache, in their
own texture, but forgetting to mark the texture
as permanent, so it could be reused, leading to
occasional misrendering. Fix this by marking these
textures as permanent, and explicitly freeing them
when the cache entry gets old.
2019-10-12 18:53:22 -04:00
Matthias Clasen
e46a7ca706 shadow cache: Remove outdated comments
No comments are better than outdated comments.
2019-10-12 17:06:39 -04:00
Matthias Clasen
e9ba7eda47 gl: Increate the cache check frequency
Otherwise, we spread the cache over more atlases
than necessary, increasing the amount of texture
changes in each frame.
2019-10-12 12:37:11 -04:00
Matthias Clasen
88649b6aae gl: Interleave cache aging
Every few frames, we do extra work for the
cache aging. Arrange for the glyph and icon
caches to not cause extra work on the same
frame, to smooth things out.
2019-10-12 12:37:11 -04:00
Matthias Clasen
60d63bbada gl: Improve debug spew for caches
Dump similar information for both caches,
and correct the unused percentage for
the atlases.
2019-10-12 12:37:11 -04:00
Timm Bäder
b8f62d1e10 Update stackswitcher CSS
Add the spacing to circular stack switchers back.
2019-10-12 18:26:54 +02:00
Timm Bäder
989307e4c2 stackswitcher: Inherit from GtkWidget 2019-10-12 18:12:58 +02:00
Timm Bäder
7344723a95 colorscale: Remove some duplicated code 2019-10-12 17:59:23 +02:00
Timm Bäder
4c4bca0c39 menuitem: Remove unused members 2019-10-12 17:59:23 +02:00
Timm Bäder
d570121704 menu: Align function parameters 2019-10-12 17:59:23 +02:00
Timm Bäder
93122ac935 menu: Remove unused members 2019-10-12 17:59:23 +02:00
Timm Bäder
f9e100cb1e menu: Remove menu_queue_resize
The have_layout flag is unused, so this is equal to a normal
gtk_widget_queue_resize().
2019-10-12 17:59:23 +02:00
Matthias Clasen
d3ad178d95 Merge branch 'glyphcache-fiddling' into 'master'
Glyphcache fiddling

See merge request GNOME/gtk!1132
2019-10-12 15:56:08 +00:00
Matthias Clasen
123cbd42bb gl: Make icon cache work like glyph cache
Replace timestamp tracking with an accessed bit
here too, to keep the glyph and icon cache code
similar.
2019-10-12 11:46:10 -04:00
Matthias Clasen
977ac2b31f gl: Do less work on glyph caching
There is no need for us to be very precise about
aging the glyph entries. It is enough to check
occasionally and mark old entries. This reduces
the overhead of work we do every frame on the
caches, at the cost of letting glyphs linger
a bit longer in the cache.
2019-10-12 11:35:46 -04:00
Timm Bäder
bcdc3b706c iconcache: Fix icon padding 2019-10-12 09:17:24 +02:00
Matthias Clasen
61db797f29 gl: Simplify glyph cache lookup
Make this function more similar to the icon
cache equivalent, and simplify it a bit. We
don't use the boolean return, and we don't need
to look at the age of entry when marking it
used.
2019-10-12 01:35:13 -04:00
Matthias Clasen
0a876f11a0 gl: Don't use memcmp for comparing cache keys
Some innocent change made us use a stack-allocated
key, and things broke. Lets go back to comparing
cache keys field by field.
2019-10-12 01:00:08 -04:00
Matthias Clasen
019e3c02ed Make the scrolling demo more versatile
Allow to swap out the content, so we can compare
text and icon scrolling.
2019-10-11 22:04:30 -04:00
Matthias Clasen
1c17316f9c gl: Handle row stride for icon cache upload
Same as the previous commit: Downloading a texture
may in theory give us data with a stride, so handle
that.
2019-10-11 21:17:30 -04:00
Matthias Clasen
646c5f369f gl: Handle row stride for glyph cache upload
In theory, we can have data with a stride here,
so set the necessary parameters to tell GL about
it.
2019-10-11 21:16:40 -04:00
Matthias Clasen
8839e10d44 gl: Do less work to maintain caches
Remember which atlases were removed, and only
check those when looking for icons or glyphs
to remove. For most frames, we don't have to
check at all since no atlases were removed.
2019-10-11 20:42:24 -04:00
Matthias Clasen
9b61bfb3c8 gl: Speed up icon caching
Avoid expensive padding, and just upload the
image in several slices.
2019-10-11 19:36:26 -04:00
Matthias Clasen
60e2242256 Add an icon scrolling demo
This is good to exercise the GL renderer icon cache.
2019-10-11 17:36:38 -04:00
Timm Bäder
4f5a9be465 gl renderer: Get blur node child only once 2019-10-11 22:31:33 +02:00
Timm Bäder
6a4c778791 gl renderer: Shorten function 2019-10-11 22:31:33 +02:00
Timm Bäder
1caa95b814 gl renderer: Avoid copying a rect 2019-10-11 22:31:33 +02:00
Matthias Clasen
cf44ba7847 gl: Avoid stray use of doubles
Everything else in this code is floats,
so stick to that and avoid unnecessary
precision.
2019-10-11 16:16:09 -04:00
Matthias Clasen
30433d7659 Cosmetics 2019-10-11 16:16:09 -04:00
Matthias Clasen
849b950763 gl: glyph cache tweaks
Reduce the cost of lookups by storing
the hash value directly.
2019-10-11 16:15:15 -04:00
Matthias Clasen
8937cd992d gl: Shrink CachedGlyph structs slightly
Plug a hole in this struct.
2019-10-11 16:15:14 -04:00
Matthias Clasen
e296c6a356 gsk: Store color bit info in text nodes
Keep the 'has color glyphs' info in text nodes,
instead of determining it over and over in both
the vulkan and gl backends.
2019-10-11 16:15:14 -04:00
Timm Bäder
136400e8a2 gl renderer: Remove unused modelview matrix 2019-10-11 16:56:24 +02:00
Timm Bäder
90199534e0 gl renderer: Don't copy outset shadow node outline 2019-10-11 16:38:58 +02:00
Timm Bäder
f7c64b4ebb gl renderer: Don't copy colors into render ops 2019-10-11 15:06:51 +02:00
Timm Bäder
f4f060c843 snapshot: Don't move shadows too much
dx/dy are relative to the node bounds, which are already moved by x/y.
2019-10-11 13:47:40 +02:00
Timm Bäder
2977e91aed gl renderer: Grow unblurred outset shadow outline on the gpu 2019-10-11 10:16:39 +02:00
Timm Bäder
0b999c73d1 gl renderer: Fix glsl rounded rect shrinking
Previous code would add rounded corners to a rect with all 0 corners
when growing.
2019-10-11 10:15:58 +02:00
Timm Bäder
9b1e0dd4a3 gl renderer: Cosmetics 2019-10-11 09:32:24 +02:00
Timm Bäder
a29826bb71 gl renderer: Only add outset shadow center piece if dx/dy != 0 2019-10-11 08:46:33 +02:00
Daniel Mustieles
a181136646 Updated Spanish translation 2019-10-10 14:00:22 +02:00
Matthias Clasen
5b04201da8 Merge branch 'wip/chergert/avoid-renderop-copy' into 'master'
gl: avoid copying RenderOp

See merge request GNOME/gtk!1128
2019-10-09 22:49:36 +00:00
Christian Hergert
528297f5e5 gl: avoid copying RenderOp to GArray
Instead of copying the (rather large) RenderOp to the GArray, we can
simply set the fields directly in the allocated space for the struct.
In most cases, there wont be any allocations to make as the array size
is kept in tact across frame renderings.
2019-10-09 15:41:53 -07:00
Christian Hergert
b29feb193e gl: use memcmp to compare glyph cache keys
We can just use memcmp here because even in the use of lookup keys with
C99 initializers, we can rely on any space between fields added by the
compiler to be zeroed. So we might as well use wider memory cmopares.
2019-10-09 14:47:23 -07:00
Matthias Clasen
75b5c2a293 Merge branch 'wip/chergert/const-glyph-cache' into 'master'
gl: avoid copying GskGLCachedGlyph in lookup

See merge request GNOME/gtk!1127
2019-10-09 21:45:41 +00:00
Christian Hergert
e32c992886 gl: avoid copying GskGLCachedGlyph in lookup
This saves a minor amount of CPU time by avoiding the copy of structure
on each lookup (which is short-lived).
2019-10-09 14:37:08 -07:00
Christian Hergert
c7a5d99286 textview: use gtk_snapshot_new_with_parent()
As recommended by Timm Bäder at:

3b959456ac (note_621655)
2019-10-09 12:56:06 -07:00
Christian Hergert
c9ca60c201 gl: short-circuit on NULL program
The NULL check is a more inclusive check than each of the individual
op->op checks.
2019-10-09 11:51:32 -07:00
Matthias Clasen
d9f6f26cd8 Merge branch 'wip/chergert/textview-fix-selection' into 'master'
textview: fix off-by-one in y_range invalidation

See merge request GNOME/gtk!1126
2019-10-09 17:50:40 +00:00
Christian Hergert
e4a00f864d textview: fix off-by-one in y_range invalidation
Previously, with selection bounds, we could have a state where a line
display with selections set would eroniously stay in the cache. This
aggresively releases those at the boundary cases fixing deselection
drawing state.
2019-10-09 10:43:34 -07:00
Timm Bäder
329f7c1c40 gl renderer: Remove rounded rect intersection code
Caused correctness issues.

Fixes #1917
2019-10-09 16:57:22 +02:00
Timm Bäder
c23afb2c86 widget: Compare adjusted sizes in size_allocate 2019-10-09 16:57:22 +02:00
Timm Bäder
e838ea3bc8 gl renderer: Fix scaled fallback node drawing 2019-10-09 16:57:22 +02:00
Timm Bäder
e5de03144f inspector: Don't add padding to spinbuttons
That looks stupid.
2019-10-09 16:57:22 +02:00
Timm Bäder
e325f65c8a spinbutton: Fix adjustment value thinko
Using ints here is wrong as it makes it impossible to e.g. edit a double
in the [0; 1] range.
2019-10-09 16:57:22 +02:00
Timm Bäder
2a40ff1b47 Adwaita: add statusbar padding back
We removed the widget margins from the ui file over 2 years ago.
2019-10-09 16:57:22 +02:00
Timm Bäder
371c325ed1 statusbar: Use a bin layout 2019-10-09 16:57:22 +02:00
Timm Bäder
542b95e7e8 widget-factory: Remove double border around textview
Replace the scrolledwindow border with two separator on top/bottom.
2019-10-09 16:57:22 +02:00
Timm Bäder
3d3525a589 stacksidebar: Inherit from GtkWidget
The child widgets are completely managed by the stacksidebar itself, so
this has no business being a GtkBin.
2019-10-09 16:57:22 +02:00
Timm Bäder
553c458e5a Adwaita: Remove superfluous border from stacksidebar
We already get a border from .sidebar
2019-10-09 16:57:22 +02:00
Timm Bäder
7cdb8d8565 gtk-demo: Fix up sidebar demo style
Remove a superfluous separator and add the icon-dropshadow class to the
gtk logo
2019-10-09 16:57:22 +02:00
Timm Bäder
172f68e77d popovermenu: Switch to main submenu before mapping 2019-10-09 16:57:22 +02:00
Timm Bäder
fb1145d72d popovermenu: Only close if there's a new focus widget
Makes sense and otherwise we end up closing the popover for no reason
2019-10-09 16:57:22 +02:00
Timm Bäder
bd9687a4f2 popovermenu: Switch back to "main" AFTER unmapping
Otherwise we might set things to child visible etc. while being
unmapped, which is a violation of the widget invariants of these
properties.
2019-10-09 16:57:22 +02:00
Timm Bäder
8928323c6b popover2.ui: Stop trying to set GtkModelButton:label
The property is called "text"
2019-10-09 16:57:22 +02:00
Timm Bäder
c7203550a2 testmodelbutton: Remove toggles for removed properties 2019-10-09 16:57:22 +02:00
Timm Bäder
49887d4c81 filechooserbutton: Only destroy existing native dialogs 2019-10-09 16:57:22 +02:00
Timm Bäder
d8c940325c widget: Create finalize assertions in destroy() 2019-10-09 16:57:22 +02:00
Timm Bäder
3944d64d08 demo: Don't manually add labels to menubuttons 2019-10-09 16:57:22 +02:00
Timm Bäder
e20f547317 demo: Fix modelbutton demo 2019-10-09 16:57:22 +02:00
Timm Bäder
a3cef6c05e label: Use TRUE/FALSE instead of 1/0 2019-10-09 16:57:22 +02:00
Timm Bäder
11ee72fc7e dialog: Fix action button rearrangement
The gtk_widget_get_parent() check does not work anymore since the
headerbar adds the buttons to a child box.
2019-10-09 16:57:22 +02:00
Timm Bäder
bcd8941769 widget-factory: Skip xml files in background selection dialog
The default contains a xml file for an animated background, so don't try
loading it as a pixbuf.
2019-10-09 16:57:22 +02:00
Timm Bäder
355d3f070a widget: Plug layout manager leak 2019-10-09 16:57:22 +02:00
Timm Bäder
b5b81dea7f modelbutton: Rework
Create all the widgets on demand and use a box layout to arrange them
instead of manual size allocation.

Also don't inherit from GtkButton
2019-10-09 16:57:21 +02:00
Timm Bäder
5803366f7d button: Remove unused signal enum members 2019-10-09 16:57:21 +02:00
Timm Bäder
d3fc47e149 modelbutton: Use a box layout 2019-10-09 16:57:21 +02:00
Timm Bäder
b8f37da911 modelbutton: Replace map() with root() 2019-10-09 16:57:21 +02:00
Timm Bäder
722f8e825e modelbutton: Remove end_box
it's unused.
2019-10-09 16:57:21 +02:00
Timm Bäder
a743412c58 modelbutton: Create accel label on demand 2019-10-09 16:57:21 +02:00
Timm Bäder
a6f14555d1 Adwaita: Blue check/radiobuttons
Align with 3.24.
2019-10-09 16:57:21 +02:00
Feichtmeier
1c091a03f3 Tiny refactoring
- use checkradio_fg_color for check/radio in treeview, which points to fg_color, so no change of the hex color, thus no change to the parsed CSS
2019-10-09 16:57:21 +02:00
frederik.feichtmeier
2dfb8de0ec Adwaita: Add color defines from 3.24 2019-10-09 16:57:21 +02:00
Jakub Steiner
876e256f94 Adwaita: make links in infobars legible
- No longer tinted blue, make legible

Fixes https://gitlab.gnome.org/GNOME/gnome-software/issues/751
2019-10-09 16:57:21 +02:00
Timm Bäder
eb834b8370 adwaita: Use border-spacing to style checkbuttons 2019-10-09 16:57:21 +02:00
Timm Bäder
dbabdf8341 radiobutton: Fix a warning in a code sample 2019-10-09 16:57:21 +02:00
Timm Bäder
703fda3be8 label: Remove set_selectable_hint
It's just updating the cursor, so do it via update_cursor()
2019-10-09 16:57:21 +02:00
Timm Bäder
2f6d6f2473 label: Remove gtk_label_realize
We don't need this to update the cursor anymore.
2019-10-09 16:57:21 +02:00
Timm Bäder
3f3c8436c5 label: Don't update cursor after unsetting select_info
update_cursor() doesn't do anything in the priv->select_info == NULL
case.
2019-10-09 16:57:21 +02:00
Timm Bäder
d8b0a78c1e label: Change cursor even if unrealized
Cursor don't depend on that anymore.
2019-10-09 16:57:20 +02:00
Timm Bäder
013538daf9 placesviewrow: popup-menu returns a boolean 2019-10-09 16:57:20 +02:00
Matthias Clasen
919d823311 Merge branch 'wip/carlosg/tablet-invalid-reads-master' into 'master'
Fix invalid reads on tablet input (master)

Closes #2157

See merge request GNOME/gtk!1122
2019-10-09 12:18:26 +00:00
Carlos Garnacho
075c77325b gdk: Avoid poking possibly freed memory
The event may end up freed after delivery, ensure to keep a ref in order
to emit the matching emulated crossed event matching a proximity event.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
2019-10-09 10:35:50 +02:00
Matthias Clasen
5f8dc5459e Merge branch 'wip/chergert/quick-fixes' into 'master'
renderer quick fixes

See merge request GNOME/gtk!1124
2019-10-08 19:43:14 +00:00
Benjamin Otte
adff8c2c60 Merge branch 'wip/chergert/cache-text-render-node' into 'master'
textview: cache paragraph render nodes

See merge request GNOME/gtk!1125
2019-10-08 19:21:57 +00:00
Christian Hergert
3b959456ac textview: cache paragraph render nodes
We can avoid recreating a number of text nodes from render_para() on
sub-sequent runs if we cache the rendernode instead of just the
PangoLayout.

When used with GtkSourceMap, this can yield a ~7 FPS improvement during
smooth scrolling at the cost of some more memory.
2019-10-08 11:44:27 -07:00
Christian Hergert
47ef5af778 gl: remove stray + 2019-10-08 10:58:29 -07:00
Christian Hergert
76ea157f17 rendernode: remove unused macros 2019-10-08 10:57:45 -07:00
Carlos Garnacho
f354a7787a gdk: Fix wl_output accounting on tablet devices
The code managing this accounting mixed seat and tablet output lists,
can't bode well. Fixes invalid reads on list elements, as there are
dangling pointers.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/2157
2019-10-08 17:59:57 +02:00
Sam Hewitt
83eeeb6a19 Adwaita: circular button fix
- remove old border drawing code that was breaking coloured buttons
 - fixes #2173
2019-10-07 16:50:34 -04:00
Sam Hewitt
6db181980a Adwaita: osd button fixes
- remove text/icon shadow from osd buttons
 - use :only-child to get circular standalone button
 - fixes #1696
2019-10-07 15:27:55 -04:00
Sam Hewitt
023bb2c984 Adwaita: use borders_color for separators
- fixes #2175
2019-10-07 13:05:12 -04:00
Benjamin Otte
a3cfb42888 eventcontrollerkey: Change behavior of contains-focus
contains-focus now returns TRUE when is-focus is TRUE instead of FALSE.

Fixes #2184
2019-10-07 04:49:50 +02:00
Benjamin Otte
578dc9e70b eventcontrollerkey: Add getters for the properties
...and use them.
2019-10-07 04:49:50 +02:00
Benjamin Otte
6769db160d icontheme: Don't try to scale pixbufs to 0px
Always insist on at least 1px, even if the thumbnail we're turning into
an icon was 256 * 3 and should be scaled to 32 * 3/8.
2019-10-07 04:49:50 +02:00
Benjamin Otte
56d16aae42 selectionmodel: Remove doubled semicolon 2019-10-07 04:49:50 +02:00
Alan Mortensen
d614f4c96d Updated Danish translation of gtk 2019-10-06 23:36:47 +02:00
Daniel Boles
98f0d85c4a Builder: Fix a couple of typos in documentation 2019-10-06 20:48:10 +01:00
Piotr Drąg
b3115454ce Update POTFILES.in 2019-10-06 15:13:31 +02:00
Benjamin Otte
cb3b6ff624 Merge branch 'gbsneto/vulkan-fixes' into 'master'
Implement VK_KHR_incremental_present

See merge request GNOME/gtk!1116
2019-10-05 15:19:04 +00:00
Georges Basile Stavracas Neto
a795d6635b vulkan/context: Implement VK_KHR_incremental_present
This is the Vulkan version of eglSwapBuffersWithDamage(), and
it's always a good idea to limit the number of pixels we're
pushing to the GPU and/or swapping into the display.
2019-10-05 12:13:22 -03:00
Georges Basile Stavracas Neto
a2b49322fb vulkan/renderpass: Use GENERAL for initial layout
UNDEFINED initial layouts may not preserve the contents
of the attachment after transitioning the layout. We want
them to be preserved because we do partial rendering.

Use GENERAL as the initial layout for render passes.
2019-10-05 12:13:22 -03:00
Georges Basile Stavracas Neto
0b2006b74f vulkan/image: Set HOST and TRANSFER bits for before barriers
Multiple images in the before barrier array are defined with
VK_ACCESS_TRANSFER_WRITE_BIT and VK_ACCESS_TRANSFER_READ_BIT,
which requires passing VK_PIPELINE_STAGE_TRANSFER_BIT and
VK_PIPELINE_STAGE_HOST_BIT to vkCmdPipelineBarrier().

Pass these flags correctly.
2019-10-05 12:13:22 -03:00
Georges Basile Stavracas Neto
a91d0ac156 wayland: Allow binding to wl_compositor v4
This is a requirement for using VK_KHR_incremental_present.
Vulkan Wayland drivers translate the VkPresentRegionsKHR to
wl_surface.damage_buffer(), which a v4-only request.
2019-10-05 12:13:22 -03:00
Christian Hergert
d71995ab5c Merge branch 'wip/chergert/textview-widgets' into 'master'
textview: use GtkWidget for borders and center_child

See merge request GNOME/gtk!1099
2019-10-04 23:30:04 +00:00
Christian Hergert
fea2a82ef6 textview: use GtkTextViewChild for border and overlay children
This creates a new GtkTextViewChild that can manage overlay children at
given x,y offsets in buffer coordinates. This simplifies GtkTextView by
extracting this from GtkTextWindow as well as providing a real widget for
the borders.

With this change, we also rename gtk_text_view_add_child_in_window() to
gtk_text_view_add_overlay(). For those that were using
GTK_TEXT_WINDOW_WIDGET, they can use a GtkOverlay. It does not appear
that anyone was using GTK_TEXT_WINDOW_(LEFT|RIGHT|TOP|BOTTOM) for widgets
in this fashion, but that can be done by setting a gutter widget with
gtk_text_view_set_gutter(). We can make GtkTextViewChild public if
necessary to simplify this should it become necessary.

GtkTextViewChild will setup a CSS node of either "text" or "border"
depending on the GtkTextWindowType.

The old GtkTextViewChild has been renamed to AnchoredChild as it is only
used for widgets with anchors in the GtkTextBuffer. This also removes the
use of allocated GSList and instead embeds a GQueue and GList to save a
few extraneous allocations.
2019-10-04 14:45:43 -07:00
Christian Hergert
8373cc6c47 textview: revert renaming of buffer_to_surface_coords()
The renaming of this function doesn't make much since because the window
is the GtkTextWindowType, not GdkWindow specifically. So we can keep the
old name which is closer to the proper meaning and less code for consumers
to change when porting to 4.x.
2019-10-04 13:22:49 -07:00
Matthias Clasen
872d2046fd Merge branch 'list-box-headers' into 'master'
Fix reuse of list box header widgets

See merge request GNOME/gtk!1114
2019-10-04 18:27:05 +00:00
Sam Hewitt
44ec142fa9 Adwaita: new levelbar style 2019-10-04 14:16:11 -04:00
Philip Withnall
b70f389b64 gtklistbox: Only unparent header rows if they haven’t been reused
It’s possible for code which uses a `GtkListBox` to reuse a single
header row, and move it around between rows. For example, this might
happen if the code has interactive widgets (like buttons) in the row,
and doesn’t want to continually recreate them and reattach signals to
them whenever the row headers change.

Unfortunately, this was broken, as the old header widget was
unconditionally unparented, even if it had just been set as the header
for a different row in the same `GtkListBox`. This left it assigned as
a child widget in the `GtkListBox` (so it was iterated over by
`forall`), but without its parent widget set.

Fix that by only unparenting the header if it hasn’t already been
assigned as the parent of a different row.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-04 18:48:53 +01:00
Philip Withnall
1c73edd9b0 gtklistbox: Factor the new header out into a separate variable
Makes the code a little clearer, but makes no functional changes.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-04 18:48:51 +01:00
Christoph Reiter
94d9088034 Print a warning if GTK_DEBUG is set but gtk isn't built with G_ENABLE_DEBUG
G_ENABLE_DEBUG is tied to the meson builttype property, so building with "plain"
results in G_ENABLE_DEBUG not being defined and the GTK_DEBUG env var just gets ignored
for that build.

Since it can be confusing that GTK_DEBUG has no effect print a warning message instead.

See #2020. This is a port of !1109 to master
2019-10-02 21:35:20 +02:00
Ask Hjorth Larsen
cbd9e560b0 Updated Danish translation of gtk-properties 2019-10-02 05:54:14 +02:00
Ask Hjorth Larsen
abc595b810 Updated Danish translation of gtk 2019-10-02 05:54:12 +02:00
Marek Černocký
7d26d3926c Updated Czech translation 2019-10-02 02:06:50 +02:00
Georges Basile Stavracas Neto
0e55f7a52f wayland/surface: Fix crash when unexporting
This is the exact same problem of 655c9dd526.
2019-10-01 16:13:43 -03:00
Marek Černocký
febe128e72 Updated Czech translation 2019-10-01 17:32:46 +02:00
Georges Basile Stavracas Neto
3afc7b0883 Merge branch 'gbsneto/fix-wayland-export-handle' into 'master'
wayland/surface: Only call destroy func when available

Closes #2179

See merge request GNOME/gtk!1112
2019-10-01 15:22:22 +00:00
Georges Basile Stavracas Neto
655c9dd526 wayland/surface: Only call destroy func when available
When calling gdk_wayland_surface_export_handle(), if we pass
some 'user_data' but no 'destroy_func', GTK4 crashes. That's
because in xdg_exported_handle() we are unconditionally calling
destroy_func -- even when it's NULL.

Fix that by checking if there's a destroy function before calling
it.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2179
2019-10-01 11:54:28 -03:00
Matej Urbančič
bcea96528a Updated Slovenian translation 2019-09-28 21:14:54 +02:00
Piotr Drąg
7336e18410 Update Polish translation 2019-09-28 13:59:24 +02:00
Aurimas Černius
412af0269d Updated Lithuanian translation 2019-09-28 12:51:44 +03:00
Matthias Clasen
5e17afbc0a Merge branch 'printing-get-ppd-from-original-host-if-needed' into 'master'
Printing get ppd from original host if needed

See merge request GNOME/gtk!1100
2019-09-27 19:24:00 +00:00
Benjamin Otte
912236439c Merge branch 'wip/ricotz/mediafile' into 'master'
mediafile: Use correct return-type for factory methods

See merge request GNOME/gtk!1105
2019-09-26 10:44:30 +00:00
Rico Tzschichholz
0ad4166482 mediafile: Add g-i annotations for actual return-type of factory methods 2019-09-26 08:19:25 +02:00
Timm Bäder
7ce1055656 eventcontrollerscroll: Events are unhandled by default
While the ::scroll signal always returns whether it handled the event,
the others do not, for example ::decelerate.

Previously, this caused the event to stop at a scroll controller with
CAPTURE phase, never emitting the ::decelerate signal on later
controllers with BUBBLE phase.

Fixes #2151
2019-09-25 17:51:53 +02:00
Timm Bäder
78a376aa7f snapshot: Try to avoid some linear gradient nodes 2019-09-25 17:51:52 +02:00
Timm Bäder
43f2b47fc9 searchentry: Use a box layout 2019-09-25 17:51:52 +02:00
Timm Bäder
413cfed7d7 searchentry: Use edit-clear-all-symbolic as clear icon
Fixes #2109
2019-09-25 17:51:52 +02:00
Timm Bäder
e05b87c8d0 gl renderer: Fix rounded rect intersection 2019-09-25 17:51:52 +02:00
Timm Bäder
1b4bce4182 fontchooserwidget: Use a bin layout 2019-09-25 17:51:52 +02:00
Timm Bäder
387587dedb colorbutton: Use a bin layout 2019-09-25 17:51:52 +02:00
Timm Bäder
5d8c8f33c0 dialog: Remove useless gtk_widget_show() call 2019-09-25 17:51:52 +02:00
Timm Bäder
d032396031 filechooserbutton: Add icon to default (None) combo box item
See #2118
2019-09-25 17:51:52 +02:00
Timm Bäder
12438b30a0 filechooserbutton: Remove priv->child
We never use it except when updating the state flags, but we can as well
do that for both children.
2019-09-25 17:51:52 +02:00
Timm Bäder
ea1ff9c482 filechooserbutton: Remove an outdated comment
The path used is wrong but the string isn't used in the testsuite
anyway.
2019-09-25 17:51:52 +02:00
Timm Bäder
8122156e84 scrolledwindow: Remove set_placement_internal()
set_placement() does the exact same thing.
2019-09-25 17:51:52 +02:00
Timm Bäder
991f4ed993 menubar: Use a box layout 2019-09-25 17:51:51 +02:00
Timm Bäder
29244c5c40 video: Use a bin layout 2019-09-25 17:51:51 +02:00
Timm Bäder
ca3d855c44 levelbar: Use a bin layout 2019-09-25 17:51:51 +02:00
Matthias Clasen
3fcd39f659 docs: Add GtkNative to types
This is needed to make doc generation work
for GtkNative.
2019-09-24 11:38:35 -04:00
Danial Behzadi
c2b823f185 Update Persian translation 2019-09-22 11:36:55 +00:00
Timm Bäder
7de076481e headerbar: Fix end-packed child order
We pack from right to left there.
2019-09-21 09:41:53 +02:00
Marek Kasik
58cfa3fd49 printing: Get PPD from original host if needed
Try to get PPD from original host if there is no PPD for remote printer
on current CUPS server.
2019-09-19 18:35:23 +02:00
Matthias Clasen
87e7fa9917 Merge branch 'wip/kill-menu' into 'master'
Use menus less

See merge request GNOME/gtk!1098
2019-09-16 22:10:02 +00:00
Matthias Clasen
b14b0efefe toolbar: Use a popover for overflow
We are phasing out menus.

This is not quite complete, toolitems still
create menuitems, which we translate on the fly.
2019-09-16 17:30:47 -04:00
Matthias Clasen
1b271f3335 notebook: Use a popover for the tab menu
We are phasing out menus.
2019-09-16 17:30:47 -04:00
Matthias Clasen
03e30431a8 menutoolbutton: Add support for popovers
Just like the underlying menu button, support
popovers too.
2019-09-16 07:24:59 -04:00
Matthias Clasen
5a93449b89 window: Make fallback menu a popover
We want to phase out menus.
2019-09-16 07:23:17 -04:00
Matthias Clasen
222e05c2d2 Remove unused includes
Don't include gtkmenu.h in places where
it isn't used anymore.
2019-09-16 07:23:17 -04:00
Matthias Clasen
c0071a0676 text util: Remove an unused function
_gtk_text_util_append_special_char_menuitems was not used.
2019-09-15 15:01:45 -04:00
Rico Tzschichholz
97231ca231 gtk: Fix some g-i annotation warnings 2019-09-15 17:57:28 +02:00
Rico Tzschichholz
67bd28eaaf gtk: Fix parameter annotations for gtk_buildable_parse_context_get_position 2019-09-15 17:57:28 +02:00
Rico Tzschichholz
51b2fd1777 build: gtkbuilderparser.c contains g-i annotations for public API 2019-09-15 17:57:28 +02:00
Matthias Clasen
ff5eac6da5 Merge branch 'wip/rah/screensaver-active-fix' into 'master'
gtkapplication-dbus: Initialise screensaver-active property

See merge request GNOME/gtk!1091
2019-09-15 15:54:08 +00:00
Matthias Clasen
4987cb0407 Merge branch 'wip/chergert/fix-textview-clip' into 'master'
textview: clip to text window when drawing

See merge request GNOME/gtk!1095
2019-09-14 21:18:02 +00:00
Christian Hergert
7927f7a440 textview: clip to text window when drawing
When drawing the GtkTextView text, we need to clip to the visible area
so that we do not risk drawing under the border windows.
2019-09-13 16:44:04 -07:00
Christian Hergert
605284bc36 textview: fix textview drawing in presence of gutters
When drawing a left or top gutter, we need to adjust the origin of the
text snapshot or we risk the gutter drawing above the text.
2019-09-13 16:02:28 -07:00
Timm Bäder
54ed31ebaf notebook: Use a box layout
And incidentally make the CSS node docs correct again.
2019-09-13 19:21:04 +02:00
Timm Bäder
6320bd5849 fontbutton: Shorten clear_font_data a bit 2019-09-13 19:21:02 +02:00
Timm Bäder
86cc7f6925 fontbutton: Use a bin layout 2019-09-13 11:53:24 +02:00
Timm Bäder
adb77e1a92 appchooserdialog: Remove unnecessary gtk_widget_show() calls 2019-09-13 11:39:34 +02:00
Timm Bäder
097f3c9514 headerbar: Remove spacing property
Replace it with border-spacing in css
2019-09-13 11:07:56 +02:00
Timm Bäder
f0266cbef3 pixbuf: Add a missing return value transfer annotation
And add a (nullable)
2019-09-13 11:07:56 +02:00
Timm Bäder
519967cc69 headerbar: Use a center layout
Get rid of the custom title centering etc. and use a GtkCenterLayout.
Use a box on the start/end to manage the child widgets.
2019-09-13 11:07:56 +02:00
Timm Bäder
a7b9a33efc Add GtkCenterLayout
And use it in GtkCenterBox, different widgets following.
2019-09-13 11:07:54 +02:00
Timm Bäder
32b84b8ab6 native: Don't compare a pointer with 0
We have NULL for that.
2019-09-11 08:12:31 +02:00
Timm Bäder
8ec1c866e1 widget: Inline build_finalize_assertions into only caller 2019-09-11 08:12:31 +02:00
Timm Bäder
3a06394fde headerbar: Don't update window buttons when unrealized
It doesn't make much sense in that case and we will update them again
when realizing.
2019-09-11 08:12:31 +02:00
Timm Bäder
ce72154913 Rename gtkbookmarkmanager.h to gtkbookmarksmanagerprivate.h
It's a private type, so gets a private header file name.
2019-09-11 08:12:31 +02:00
Timm Bäder
ed11f2a9e4 bookmarksmanager: Stop exporting get_xdg_type 2019-09-11 08:12:31 +02:00
Timm Bäder
60f2e452a1 switch: Stop using a private struct
Private type, no private struct needed.
2019-09-11 08:12:31 +02:00
Alexander Larsson
76103ee286 GtkBuildable: Fix indentation 2019-09-10 12:08:20 -04:00
Alexander Larsson
73042bfc54 GtkWidget: Precompile template xml on class creation
Ideally we will precompile during build and store the result in the
resource, but if that doesn't happen at least we will only parse
the xml once.
2019-09-10 12:08:20 -04:00
Alexander Larsson
ff23397701 GtkBuilder: Add support for precompiling builder xml 2019-09-10 12:08:20 -04:00
Alexander Larsson
96b37f4eb8 Use the new GtkBuildableParser type in GtkBuildable interfaces 2019-09-10 12:08:20 -04:00
Alexander Larsson
135cea76fb GtkBuildableParser: Add a wrapper for GMarkupParser
This currenly just wraps GMarkupParser, but the plan is to expose this
instead of GMarkup in the GtkBuildable interfaces, allowing us to
replace the parser with something that handles pre-parsed input
instead.

Note that we duplicate some of the features of GMarkup to implement
the APIs rather then call down to GMarkup, as we need to support these
in the pre-parsed case anyway.
2019-09-10 12:07:15 -04:00
Matthias Clasen
ff087e126f Merge branch 'wip/chergert/tune-linedisplay-cache' into 'master'
textview: optimize linedisplay cache based on number of visible rows

See merge request GNOME/gtk!1090
2019-09-10 01:42:13 +00:00
Matthias Clasen
9501fc2c14 Merge branch 'nested-popover-menu' into 'master'
Nested popover menus

See merge request GNOME/gtk!1076
2019-09-10 01:09:31 +00:00
Piotr Drąg
7547291450 Update POTFILES.in 2019-09-09 19:13:53 +02:00
Timm Bäder
0603b4431a icontheme: Stop using a private struct
The GtkIconTheme/GtkIconInfo structs aren't public anymore, so use the
structs directly instead of a priv pointer.
2019-09-09 17:36:27 +02:00
Timm Bäder
5f48f60a93 Icontheme: Clean up gtk_icon_info_load_async 2019-09-09 17:36:27 +02:00
Timm Bäder
cc9faf3cfa scrolledwindow: Actually add controller to widget
Closes #2127
2019-09-09 17:36:27 +02:00
Timm Bäder
7d93e9963a testlist2: quit on window close 2019-09-09 17:36:27 +02:00
Timm Bäder
32cec6c1cb icontheme: Adapt a code sample to the GdkPaintable transition 2019-09-09 17:36:27 +02:00
Timm Bäder
c0827e2c54 pixbufutils: Escape file data only once 2019-09-09 17:36:27 +02:00
Timm Bäder
1a931da046 pixbufutils: Pass colors as string to load_symbolic_svg
We were converting the same colors over and over again to a string, just
to free them again at the end of the function. We know the colors at
compile time however, so don't convert them at all.
2019-09-09 17:36:27 +02:00
Timm Bäder
8eb62f138b pixbufutils: Only get icon size once
load_symbolic_svg was loading the pixbuf just to get its size via
gdk_pixbuf_get_{width,height}. However, this function is called in a
loop in gtk_make_symbolic_pixbuf_from_data.

So, do this only once and pass the icon size along to load_symbolic_svg.
2019-09-09 17:36:27 +02:00
Timm Bäder
6a8921ec6b icontheme: Remove symbolic pixbuf cache
We recolor icons on via color matrix nodes these days, so this cache is
basically unused.
2019-09-09 17:36:27 +02:00
Timm Bäder
53132d0235 icontheme: Add LRU cache back
Add a cache of icon infos that we keep around a little longer, to avoid
loading icons from disk that only exist for a short amount of time (e.g.
during one frame of a cell renderer snapshot).

We make sure recently used items are kept alive by just adding them to
the cache on lookup.
2019-09-09 17:36:27 +02:00
Timm Bäder
32bed34935 icontheme: Remove GtkIconInfo->pixbuf
Create textures as soon as possible.
2019-09-09 17:36:26 +02:00
Timm Bäder
1873b38a94 icontheme: Remove icon_info_load_pixbuf
What it does overlaps with the only caller a lot now.
2019-09-09 17:36:26 +02:00
Timm Bäder
38b4a2a8e2 icontheme: Optimize suffix_from_name
We call this function a lot, so avoid repeated strlen() calls on @name
and the different suffixes.
2019-09-09 17:36:26 +02:00
Timm Bäder
b65d9ca955 icontheme: Avoid creating useless IconThemeDirs
We were allocating IconThemeDir instances and then only later assign a
value to has_icons. In the !has_icons case, we were directly throwing
the IconThemeDir away again.

Delay allocating the IconThemeDirs until we know that it has icons.
This avoids allocating and then de-allocating around 1400 IconThemeDir
instances when opening the widget-factory.
2019-09-09 17:36:26 +02:00
Timm Bäder
0b472c23d7 icontheme: Inline scan_resources into only caller
The previous code was hiding the fact that the scan_resources function
almost always did nothing and just used g_resources_enumerate_children()
and then returned FALSE, leaving the caller with cleaning up the already
allocated IconThemeDir. By inlining this, we make sure that calling code
does not even need to allocate the IconThemeDir.
2019-09-09 17:36:26 +02:00
Timm Bäder
bb89ee184f icontheme: Remove proxy pixbufs
These were only used for the LRU cache.
2019-09-09 17:36:26 +02:00
Timm Bäder
eb087c9943 icontheme: Remove lru cache
We will replace it with something else later
2019-09-09 17:36:26 +02:00
Timm Bäder
eeec6f8fb9 icontheme: Annotate return value as nullable 2019-09-09 17:36:26 +02:00
Timm Bäder
71339225eb icontheme: Remove gtk_icon_info_load_texture
It's the same as load_icon now.
2019-09-09 17:36:26 +02:00
Timm Bäder
590e70d4d1 icontheme: Return a paintable from gtk_icon_info_load_icon 2019-09-09 17:36:26 +02:00
Timm Bäder
fd16ac4d5e icontheme: Return paintables from more API 2019-09-09 17:36:26 +02:00
Timm Bäder
f3099afcc5 icontheme: Return textures from load_icon{,_for_scale} 2019-09-09 17:36:26 +02:00
Timm Bäder
37f8e6aabd gdk: Add gtk_pixbuf_get_from_texture 2019-09-09 17:36:26 +02:00
Timm Bäder
e0fe2882ad icontheme: Don't try to scale pixbufs to same size 2019-09-09 17:36:26 +02:00
Timm Bäder
4413592a70 recentmanager: Stop using linked lists
It doesn't really make sense to save the applications and groups in
recent infos as linked lists. We get them from glib as arrays, so we can
as well just save them as such.
2019-09-09 17:36:26 +02:00
Timm Bäder
4c28ee80a6 filechooserwidget: Create recent manager when setting operation mode
Creating a recent manager can be fairly expensive and we won't use it if
the widget is not visible or the recent mode has not been entered. Code
other places can already handle a NULL recent manager, so just create it
when entering the recent mode. And shove 25ms of startup time off the
widget-factory this way.
2019-09-09 17:36:26 +02:00
Timm Bäder
f4c4fe860b filechooserwidget: Remove custom recent_info_has_application impl 2019-09-09 17:36:26 +02:00
Timm Bäder
4766b475d0 filechooserwidget: Inline come functions into only callers
Similar to the previous commit(s), make it clearer what this function
does.
2019-09-09 17:36:26 +02:00
Timm Bäder
ae75d4b565 filechooser: Move extract_recent_folders to filechooserwidget
It's not used anywhere else.
2019-09-09 17:36:26 +02:00
Timm Bäder
c102387916 filechooserwidget: Load recent files synchronously
Delaying this by one frame by putting it in an idle just makes the code
more complex for no gain. The actual slow part is reading the
recently-used.xbel, which happens when creating the recent manager.
2019-09-09 17:36:26 +02:00
Timm Bäder
86ad215deb recentmanager: Indentation 2019-09-09 17:36:26 +02:00
Timm Bäder
c3f82534bd widget-factory: Use proper setter to set has-arrow 2019-09-09 17:36:26 +02:00
Timm Bäder
2ffbb37783 icontheme: Annotate return value of load_icon as nullable
It returns NULL in the error case.
2019-09-09 17:36:26 +02:00
Timm Bäder
6821fe0c13 icontheme: Add error argument to _load_texture
Loading an icon might fail.
2019-09-09 17:36:26 +02:00
Timm Bäder
a0947232fa icontheme: optimize icon_uri_is_symbolic as well 2019-09-09 17:36:26 +02:00
Timm Bäder
e3f1a3d27c main: Check if any debug flags are set in gtk_get_debug_flags()
We end up checking the debug flags for the default display, but that's
unnecessary if we know that no display has any debug flags set anyway.
2019-09-09 17:36:26 +02:00
Timm Bäder
d98e05b91a icontheme: Save the min_suffix for the min_dir
We already have to compute that value in the loop before, so just save
it.
2019-09-09 17:36:26 +02:00
Timm Bäder
fa85f4fc2e icontheme: Remove use_builtin parameter from theme_lookup_icon
Unused.
2019-09-09 17:36:26 +02:00
Timm Bäder
44352b375e icontheme: Remove paramter from get_icon_suffix
Turns out nobody care about that one.
2019-09-09 17:36:26 +02:00
Timm Bäder
ebe88ea322 icontheme: Optimize icon_name_is_symbolic
We call this function *a lot* it's doing lots of unnecessary work inside
g_str_has_suffix. Get the icon name length only once instead and
open-code the suffix check.
2019-09-09 17:36:26 +02:00
Timm Bäder
6d77723fe0 gtkicontheme: Avoid a get_icon_flags call
We're only using the value of the first call at all if
symbolic_suffix & ICON_SUFFIX_PNG is FALSE.
2019-09-09 17:36:26 +02:00
Timm Bäder
c5ed51a188 icontheme: Remove outdated comment
It's not called css_fg anymore and it can't possibly be NULL since we
make sure before passing it here.
2019-09-09 17:36:25 +02:00
Timm Bäder
1339c425a8 widget: Queue an allocate on native widgets when changing opacity
This way the opacity change works on toplevel windows on wayland.
2019-09-09 17:36:25 +02:00
Timm Bäder
7c723dfc58 inspect-button: Inline deemphasize_window() into only caller 2019-09-09 17:36:25 +02:00
Timm Bäder
72814a8153 inspect-button: Inline some functions into only caller
Make them clearer for later commits.
2019-09-09 17:36:25 +02:00
Timm Bäder
9952f72680 filechooserwidget: Properly watch for different display
The value returned by gtk_widget_get_settings() depends on the widget's
display, so watch for notify::display instead of using (un)root for
this.

Fixes the warnings seen when show a file chooser from the inspector.
2019-09-09 17:36:25 +02:00
Timm Bäder
b9473bc99c glarea: Fix buffer initialization
This only worked when the vao id and the buffer id accidentally matched,
for example when running gtk4-demo with --run=glarea

Fixes #2042
2019-09-09 17:36:25 +02:00
Timm Bäder
cbc3ce5b03 box: Don't do casts before preconditions 2019-09-09 17:36:25 +02:00
Timm Bäder
d223752c55 infobar: Inherit from GtkContainer
infobars being a GtkBox doesn't make sense.
Also implement infobars without exposing internal children.

Closes #1957 because it adds the bottom border.
2019-09-09 17:36:25 +02:00
Timm Bäder
74208e9e0c text: Fix a crash when retrieving the selected text 2019-09-09 17:36:25 +02:00
Timm Bäder
14b7fa1dd6 textview: Remove useless warning
The output doesn't make sense anymore and it breaks cursor blinking when
moving the focus back into the textview.
2019-09-09 17:36:25 +02:00
Timm Bäder
4bfe8605cb layoutoverlay: Fix everything
This code is better because:

  1) The coordinates translations are actually correct and not sometimes
     wrong like before
  2) We clip widgets that have overflow set
  3) We honor the widget's transform
  4) It is less code
2019-09-09 17:36:25 +02:00
Timm Bäder
e86bf764a8 scale: Allocate value close to slider
The scale might be allocated at a height greater than requested, and in
that case y=0 is just too far away. Allocate the value directly next to
the slider instead.
2019-09-09 17:36:25 +02:00
Timm Bäder
80411fb905 scale: Use top/left/bottom/right style classes on value label
Just top/bottom is not enough anymore.

77769a52b3 broke e.g. horizontal scales
with the value on top/bottom, adding too much space.
2019-09-09 17:36:25 +02:00
Timm Bäder
c9241e83dd gl renderer: Remove unused matrix 2019-09-09 17:36:25 +02:00
Timm Bäder
9166b03c42 fixed: Documentation clarifications 2019-09-09 17:36:25 +02:00
Timm Bäder
31efc882db fixed: x/y passed to get_child_position are not optional 2019-09-09 17:36:25 +02:00
Timm Bäder
1db59d1c89 fixedlayout: Don't call the child transform position
It's a full transform and not just a translation these days.
2019-09-09 17:36:25 +02:00
Timm Bäder
afb3715700 linkbutton: Use widget API to set has-toolip
As God intended.
2019-09-09 17:36:24 +02:00
Timm Bäder
6be4279f39 linkbutton: Use proper action name for right-click menu 2019-09-09 17:36:24 +02:00
Timm Bäder
5782871f91 menubutton: Control sensitivity of child button
Instead of the menubutton itself.
2019-09-09 17:36:24 +02:00
Timm Bäder
0e9ac9e64b magnifier: Remove some unused members 2019-09-09 17:36:24 +02:00
Timm Bäder
13df99fd1e docs: Remove styles.txt
The information is all wrong and superseded by the css docs
2019-09-09 17:36:24 +02:00
Timm Bäder
9f62bd1da6 docs: Remove widget_system.txt
Almost all information in here is incorrect or outdated, most of it is
still from gtk2 and GtkObject days.
2019-09-09 17:36:24 +02:00
Timm Bäder
75c1562df0 docs: Remove widget_geometry.txt
The information in that file is all outdated.
2019-09-09 17:36:24 +02:00
Timm Bäder
0821d5b29d widget: Clear up gtk_widget_class_install_property_action docs 2019-09-09 17:36:24 +02:00
Timm Bäder
b3cffc0516 widget: Remove reference to non-existent function
gtk_widget_class_install_stateful_action() does not exist.
2019-09-09 17:36:24 +02:00
Timm Bäder
80a58672d1 widget: Add some missing annotations to gtk_widget_class_query_action 2019-09-09 17:36:24 +02:00
Timm Bäder
18714e25a8 window: Remove useless deprecation guards
gtk_window_present() is not deprecated.
2019-09-09 17:36:24 +02:00
Timm Bäder
b29c30c9d5 cssprovider: Remove unused member from GtkCssScanner 2019-09-09 17:36:24 +02:00
Timm Bäder
d8df197489 cssprovider: Don't lookup on empty css providers
This should not have a huge performance impact, but debugging is easier
if we don't lookup in empty css providers.
2019-09-09 17:36:24 +02:00
Timm Bäder
514e60c1bb cssnode: GtkCssAnimatedStyle->style is always a static style 2019-09-09 17:36:24 +02:00
Timm Bäder
32a256bd03 gtksettings: Remove unused functions & prototypes 2019-09-09 17:36:24 +02:00
Timm Bäder
b9316a404a cssnode: Remove unused struct 2019-09-09 17:36:24 +02:00
Timm Bäder
ea2a3f3e62 cssstyle: Remove unused _add_difference 2019-09-09 17:36:24 +02:00
Timm Bäder
5cd8009c53 stylecontext: Remove leftover function prototypes 2019-09-09 17:36:24 +02:00
Timm Bäder
26aa620efe stylecontext: Stop exporting _resolve_color
Only used in gtkstylecontext.c
2019-09-09 17:36:24 +02:00
Timm Bäder
e0cf6e4775 csscolorvalue: return the initial color value directly 2019-09-09 17:36:24 +02:00
Timm Bäder
df2d43c893 csscolorvalue: Remove unused new_from_rgba() 2019-09-09 17:36:24 +02:00
Timm Bäder
8d6c5ba90e cssstaticstyle: Compute initial/inherit values directly 2019-09-09 17:36:24 +02:00
Timm Bäder
629f528f6d cssinitialvalue: Make _compute public
So we can use it in cases where the class of css value is known to be an
initial one.
2019-09-09 17:36:24 +02:00
Timm Bäder
191e3bc7e1 csslookup: Remove 'relevant' parameter from _init
Unused.
2019-09-09 17:36:24 +02:00
Timm Bäder
ecad4743bd csslookup: Remove 'missing' bitmask
It's almost never useful to have a bitmask here, since it's only used
for the intersection case in gtk_css_style_provider_lookup. However,
even if that returns true, we still need to check every single style
property for being set again in the look afterwards.

Just remove the bitmask.
2019-09-09 17:36:24 +02:00
Timm Bäder
ceb8aedf97 cssanimatedstyle: Keep transition_info_add from recursing
The slowest part of that fuction is the type check for
GtkCssShorthandProperty. Subproperties of shorthand properties never
refer to more shorthand properties however, so we don't want to have the
type check for those.
2019-09-09 17:36:24 +02:00
Timm Bäder
0cf4eb379f csslookup: Remove tautological if expression
A value is always either set or missing.
This was changed in a1f7c459b7, which
removed the ability for partial style computation.
2019-09-09 17:36:24 +02:00
Timm Bäder
f3fdf58ff7 cssstaticstyle: Avoid ref'ing specified value in compute_value
There are alerady _get functions for GtkCssInheritValue and
GtkCssInitialValue, so use those. We can avoid a ref+unref pair this
way.
2019-09-09 17:36:24 +02:00
Timm Bäder
3073e65851 cssprovider: Fix compilation wth VERIFY_TREE set 2019-09-09 17:36:24 +02:00
Timm Bäder
a75529f3c0 cssmatcher: Inline node values into matcher
So we don't have to go through the matcher->node->decl every time
2019-09-09 17:36:24 +02:00
Timm Bäder
75a48aed0b cssanimatedstyle: Make set_animated_value transfer-full 2019-09-09 17:36:24 +02:00
Timm Bäder
a7f23ebe7d cssimage: Use gtk_internal_return_val_*
GtkCssImage is not public and being used in hot paths, e.g. CSS.
2019-09-09 17:36:23 +02:00
Timm Bäder
0f9a02e6f4 gtkprivate: Only define gtk_internal_return_if* for consistency checks
The wanted behavior here is that these are only defined if the buildtype
is debug, i.e. full debugging.
2019-09-09 17:36:23 +02:00
Timm Bäder
4b4b77ca04 cssanimatedstyle: Save animation in array 2019-09-09 17:36:23 +02:00
Timm Bäder
a231648607 cssanimatedstyle: Avoid type check in loop
We can just do the check once as source is not going to change within
the loop.
2019-09-09 17:36:23 +02:00
Timm Bäder
eeb5cd2321 cssanimatedstyle: Avoid unnecessary transition work
No need to do all the transition work if the transition duration will be
0 for all of them.
2019-09-09 17:36:23 +02:00
Timm Bäder
5c705ae9a5 cssrgbavalue: Add & use new_white() 2019-09-09 17:36:23 +02:00
Timm Bäder
19f69f6ac8 cssrgbavalue: Add an opaque white singleton
Used a few hundred times in the widget-factory.
2019-09-09 17:36:23 +02:00
Timm Bäder
ad1340cab4 cssrgbavalue: Add a singleton for transparent colors
The most common background color is no background color.
2019-09-09 17:36:23 +02:00
Timm Bäder
3a3a59c188 cssdimensionvalue: Create a few more common singletons 2019-09-09 17:36:23 +02:00
Timm Bäder
6ed6cc46de cssstaticstyle: Make set_value (transfer-full)
We only call this in one place and we can avoid a ref + unref pair this
way.
2019-09-09 17:36:23 +02:00
Timm Bäder
6837e80d14 css: Avoid more type checks in hot paths 2019-09-09 17:36:23 +02:00
Timm Bäder
4f3e65e745 csspalettevalue: Use simple arrays instead of a hashtable
Use two sorted name/value arrays to save the colors instead of a
hashtable. This makes palette values faster to compare etc.
2019-09-09 17:36:23 +02:00
Timm Bäder
36a1b69a19 cssanimatedstyle: Remove some casts in hot paths
gtk_css_animated_style_create_css_transitions down from 16% to 11%
when repeatedly clicking on a spinbutton button in the widget factory.
2019-09-09 17:36:23 +02:00
Timm Bäder
1f11892de4 bitmask: Add _gtk_allocated_bitmask_to_string 2019-09-09 17:36:23 +02:00
Timm Bäder
1bc8f3ac6e Adwaita: Hack around list button styling
Once again.
2019-09-09 17:36:23 +02:00
Timm Bäder
e62f10d5f0 widget-factory: Add a spinbutton in a list 2019-09-09 17:36:23 +02:00
Timm Bäder
822547dfef spinbutton: Use a box layout 2019-09-09 17:36:23 +02:00
Timm Bäder
c0214cfcc1 menubutton: Add a create_popup_func
Some use cases require a menu button to create the popup on demand.
2019-09-09 17:36:23 +02:00
Timm Bäder
cb6d96d65f menubutton: Remove unused member 2019-09-09 17:36:23 +02:00
Timm Bäder
4cc4868e93 label: Remove "line" from wrap properties
The property names are "wrap" and "wrap-mode", so it doesn't make sense
that the accessors refer to line_wrap and line_wrap_mode.
2019-09-09 17:36:23 +02:00
Timm Bäder
6c90d3a1b6 gsktransform: Fix documentation comment
There is no @m.
2019-09-09 17:36:23 +02:00
Timm Bäder
ffab342fc4 snapshot: Stop exporting _append_node_internal
Unused outside of gtksnapshot.c
2019-09-09 17:36:23 +02:00
Matthias Clasen
1203dc501c popover menubar: Use nested popover menus
Make the popover menubar use nested menus, to
better match the expected behavior of traditional
menus.
2019-09-08 19:02:06 -04:00
Matthias Clasen
3cbf1845a9 Add a timeout for open submenus
When a popover menu has an open submenu,
delay activating another item until after
the pointer is stationary for a little
while. This avoids the need for precise
horizontal motion when moving towards the
submenu.
2019-09-08 19:02:06 -04:00
Matthias Clasen
ea44eade21 Add nesting popover menus
Add a variant of popover menus that are nesting
like traditional menus. This is a better fit for
replacing traditional main menus.
2019-09-08 19:02:06 -04:00
Matthias Clasen
c75a368bab popover: Support vertical aligment
We already support horizontal alignment, and
we should do the same for vertical alignment.
2019-09-08 19:02:06 -04:00
Matthias Clasen
bc8d2add04 widget-factory: Add more submenus
Split the "Checks & Radios" submenu in the menubar
into two, so we can test opening multiple submenus.
2019-09-08 19:02:06 -04:00
Timm Bäder
c53f58e839 Merge branch 'wip/chergert/remove-emit-by-name' into 'master'
texttag: avoid use of g_signal_emit_by_name()

See merge request GNOME/gtk!1088
2019-09-08 07:40:55 +00:00
Piotr Drąg
50543a7948 Update POTFILES.skip 2019-09-07 13:29:47 +02:00
Marek Černocký
f7cd22d5ec Updated Czech translation 2019-09-07 12:10:12 +02:00
Emin Tufan Çetin
b136c77031 Update Turkish translation 2019-09-06 18:50:05 +00:00
Bob Ham
6bfe171058 gtkapplication-dbus: Initialise screensaver-active property
When GtkApplication starts listening to the screensaver's D-Bus
status, the screensaver-active property is not initialised and
applications making use of the property are out of sync until the
first state change.  Any application starting when the screensaver is
active will think it's inactive.

To fix this, we set the property when we first start monitoring the
screensaver.
2019-09-06 14:59:27 +01:00
Christian Hergert
5e49da1d73 textview: optimize linedisplay cache based on number of visible rows
This tries to estimate the number of visible rows in a textview based on
the default text size and then tunes the GtkTextLineDisplayCache to keep
3*n_rows entries in the cache.

This was found imperically to be near the right cache size. In most cases,
this is less than the number of items we cache now. However, in some cases,
such as the "overview map" from GtkSourceView, it allows us to reach a
higher value such as 1000+. This is needed to keep scrolling smooth on
the larger view sizes.

With this patch, a HiDPI system with a GtkSourceView and GtkSourceMap
from the GTK 4 port can perform smooth scrolling simultaneously.
2019-09-05 19:06:35 -07:00
Christian Hergert
cc7ae525ef texttag: avoid use of g_signal_emit_by_name()
This avoids looking up the signal by name and instead uses the saved
signal identifier from gtktexttagtable.c
2019-09-04 19:39:24 -07:00
Matthias Clasen
a29853f53b Merge branch 'wip/chergert/faster-comparison' into 'master'
textlayout: remove use of GtkTextIter in line comparison

See merge request GNOME/gtk!1087
2019-09-04 17:02:06 +00:00
Christian Hergert
7cea21043e textlayout: remove use of GtkTextIter in line comparison
We do not need to create a GtkTextIter to perform the comparison here as
that will require a number of validation steps that are extra work
compared to just discovering the GtkTextLine number directly.
2019-09-04 09:12:54 -07:00
Matthias Clasen
cbdea09c92 Merge branch 'gtk-4-issue2128' into 'master'
[gtk4] wayland: Fix xdg-output v3 support

See merge request GNOME/gtk!1082
2019-09-03 14:38:30 +00:00
Olivier Fourdan
31393704de wayland: Fix xdg-output v3 support
The xdg_output.done event is deprecated in xdg-output v3, so clients
need to rely on the wl_output.done event instead.

However, applying the changes on the fist wl_output.event when using
xdg-output v3 may lead to an incomplete change, as following xdg-output
updates may follow.

Make sure we apply xdg-output events on wl_output.done events with
xdg-output v3.

https://gitlab.gnome.org/GNOME/gtk/issues/2128
2019-09-03 16:13:24 +02:00
nana-4
3eec90cdc0 node editor: Avoid inheriting textview styles
...to its descendant selectors

Without ">", "text" style is propagated to entry in the emoji chooser.

https://gitlab.gnome.org/GNOME/gtk/issues/2061
2019-09-03 01:44:55 +09:00
nana-4
b9d8eb54b7 Adwaita: Don't inherit font style to popover
https://gitlab.gnome.org/GNOME/gtk/issues/2061
2019-09-03 01:43:41 +09:00
nana-4
a2fdb55384 Adwaita: Fix broken osd popover style
Apply %osd to child arrow and contents instead of parent popover.

https://gitlab.gnome.org/GNOME/gtk/issues/2061
2019-09-03 01:34:05 +09:00
Jordi Mas
848a19a013 Update Catalan translation 2019-09-01 08:28:18 +02:00
Ryuta Fujii
98bc89968a Update Japanese translation 2019-08-31 13:45:30 +00:00
Ryuta Fujii
9c0e9e462b Update Japanese translation 2019-08-31 12:31:35 +00:00
Ryuta Fujii
57d762d5ea Update Japanese translation 2019-08-31 12:27:01 +00:00
Changwoo Ryu
9018ce1125 Update Korean translation 2019-08-30 14:10:45 +00:00
Timm Bäder
1b32f5c28b Merge branch 'typo' into 'master'
popover: fix typo in schema string

See merge request GNOME/gtk!1071
2019-08-29 13:56:13 +00:00
Alexandre Franke
0e35e50f8f Update French translation 2019-08-29 12:53:34 +00:00
Alexandre Franke
88b617646a popover: fix typo in schema string 2019-08-29 14:50:20 +02:00
Ask Hjorth Larsen
27fa7eace1 Updated Danish translation of gtk-properties 2019-08-29 12:37:41 +02:00
Ask Hjorth Larsen
ca996e0e85 Updated Danish translation of gtk 2019-08-29 12:37:41 +02:00
Jordi Mas
df683205d9 Update Catalan translation 2019-08-28 19:37:59 +02:00
Benjamin Otte
6905935fd3 Merge branch 'wip/ricotz/issue2107' into 'master'
gsk: Add missing 'transfer full' annotations of instance parameters

Closes #2107

See merge request GNOME/gtk!1065
2019-08-26 17:00:34 +00:00
Rico Tzschichholz
5504c62af9 gsk: Add missing 'transfer full' annotations of instance parameters
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2107
2019-08-26 18:05:17 +02:00
Matthias Clasen
9bb58c3eca Merge branch 'office-runner-crash' into 'master'
Fix a crash in gtk-builder-tool

See merge request GNOME/gtk!1064
2019-08-26 13:50:43 +00:00
Matthias Clasen
c0b8eb30de Fix a crash in gtk-builder-tool
Crash pointed out by Bastien Nocera.

Testcase included.
2019-08-26 15:34:15 +02:00
Changwoo Ryu
8a734f947e Update Korean translation 2019-08-26 11:20:16 +00:00
Timm Bäder
e4904f6644 Merge branch 'doc-typos' into 'master'
Minor typos in the Documentation (a/an)

See merge request GNOME/gtk!1061
2019-08-26 09:18:47 +00:00
Дилян Палаузов
6ded38de2b Minor typos in the Documentation (a/an) 2019-08-25 12:52:46 +00:00
Matthias Clasen
4fa1f459dd Merge branch 'gdkmonitor-x11-manufacturer' into 'master'
gdk: x11: Fill GdkMonitor manufacturer with PNP id from EDID

Closes #1765

See merge request GNOME/gtk!859
2019-08-25 11:58:02 +00:00
Balázs Úr
25644aa6b1 Update Hungarian translation 2019-08-24 20:23:45 +00:00
Anders Jonsson
a3f13f9c58 Update Swedish translation 2019-08-22 09:45:38 +00:00
Emmanuele Bassi
d940d801a4 Merge branch 'build-remove-xiproto-xreply-check-gtk4' into 'master'
Remove NEED_XIPROTO_H_FOR_XREPLY check

See merge request GNOME/gtk!1059
2019-08-21 19:18:17 +00:00
Christoph Reiter
7b0af75a57 Remove NEED_XIPROTO_H_FOR_XREPLY check
It was only defined in the old autotools build to support a >20 year old x11,
https://bugzilla.gnome.org/show_bug.cgi?id=148032
2019-08-21 20:46:30 +02:00
Daniel Mustieles
5329ac6d4b Updated Spanish translation 2019-08-20 12:45:23 +02:00
Daniel Șerbănescu
2b123702cc Update Romanian translation 2019-08-19 11:50:59 +00:00
Daniel Șerbănescu
56c2431ed1 Update Romanian translation 2019-08-19 11:09:45 +00:00
Aurimas Černius
0ed5f939e9 Updated Lithuanian translation 2019-08-18 21:41:16 +03:00
Kukuh Syafaat
f3fa4fcb75 Update Indonesian translation 2019-08-16 09:16:05 +00:00
Asier Sarasua Garmendia
bd35ff61e3 Update Basque translation 2019-08-16 08:01:11 +00:00
Asier Sarasua Garmendia
aa6f3a627f Update Basque translation 2019-08-16 07:55:49 +00:00
Timm Bäder
ee27587428 scale: Add a destroy notify to set_format_value_func
Closes #2098
2019-08-15 17:21:47 +02:00
Timm Bäder
d2f76d689f scaler: Avoid some signal connections
We're mainly using this for icons that will never change contents or
size, and we're using a GtkScaler per such icon when on a hidpi setup,
so just avoid the two signal connections per icon.
2019-08-15 17:13:29 +02:00
Timm Bäder
20cd6cc155 spinbutton: Use gtk_button_new_from_icon_name 2019-08-15 16:23:01 +02:00
Timm Bäder
960e766206 widget: Don't duplicate events to translate coordinates 2019-08-15 16:23:01 +02:00
Timm Bäder
1c9fbe3773 widget: Remove captured event handler code 2019-08-15 16:23:01 +02:00
Timm Bäder
6669ddad09 scrolledwindow: Stop using _gtk_widget_set_captured_event_handler
We can use an event controller with phase = CAPTURE these days.
2019-08-15 16:23:01 +02:00
Daniel Șerbănescu
6e872715ef Update Romanian translation
(cherry picked from commit 1e8d46352e)
2019-08-14 09:07:44 +00:00
Daniel Șerbănescu
dc582b478f Update Romanian translation
(cherry picked from commit 10603f9598)
2019-08-14 06:30:36 +00:00
Matthias Clasen
55839dc508 Merge branch '948-patch-renaming-a-file-can-make-it-to-loose-selection_GTK4' into 'master'
filechooser: keep file selected after being renamed

Closes #948

See merge request GNOME/gtk!1053
2019-08-13 21:18:41 +00:00
Matthias Clasen
6dd23b2bf0 text view: Fix a typo
Pointed out in https://gitlab.gnome.org/GNOME/gtk/issues/2094
2019-08-13 15:16:03 -04:00
Jordi Mas
afd64f3740 Update Catalan translation 2019-08-13 08:40:18 +02:00
Daniel Șerbănescu
a7b6663b33 Update Romanian translation
(cherry picked from commit f9acfa1bd8)
2019-08-13 04:37:32 +00:00
Nelson Benítez León
487e095d24 filechooser: keep file selected after being renamed
Because otherwise when the file list is sorted "by name"
and the new name causes the file to be re-sorted to another
row, the selection stays in the old row which is now
occupied by a different file.

Fixed by keeping track of the renamed file and revealing
it in the "row-changed" signal handler, which gets emitted
after a file is renamed.

Fixes issue #948
2019-08-12 17:32:56 -04:00
Daniel Șerbănescu
b487e8f694 Update Romanian translation 2019-08-12 08:35:22 +00:00
Piotr Drąg
171e3454ad Update Polish translation 2019-08-11 14:37:14 +02:00
Timm Bäder
164ebee129 Adwaita: Style spinbutton up/down children explicitly
Once again to increase the specificty above that of the
"list row button.etc." selector. Makes hovering spinbutton buttons in
lists look normal again.
2019-08-11 10:41:58 +02:00
Timm Bäder
76f2c4f0aa Adwaita: Update .devel headerbar styling
Just pull in the changes from gtk-3-24
2019-08-11 10:30:01 +02:00
Timm Bäder
9999ac1255 range: Avoid a divison by 0
Based on a patch by Blake Latchford

Fixes #618
2019-08-11 10:06:52 +02:00
Daniel Boles
3242174f81 AccelLabel: Add get_accel_closure() accessor
Fixes #875
2019-08-11 09:55:43 +02:00
Timm Bäder
6f1cade817 color chooser: Port checkered pattern drawing from cairo 2019-08-11 09:34:50 +02:00
Timm Bäder
c6961f1b61 range: Use public delay-factory API 2019-08-11 09:34:50 +02:00
Timm Bäder
8c88453816 cellrenderer: Add accessors for {get,set}_is_expande{r,d} 2019-08-11 09:34:50 +02:00
Timm Bäder
0415574acf testsuite: Add another repeat node test case 2019-08-11 09:05:31 +02:00
Timm Bäder
c812e1dc94 Adwaita: Fix hovering modelbutton arrows
This CSS snippet was supposed to only recolor the popover arrow but
ended up also recoloring the > arrow on modelbuttons that show a
submenu. Make the selector more specific.
2019-08-11 09:05:31 +02:00
Timm Bäder
251bf45cf2 iconcache: ref textures
We can't just assume that the pointer we'se using as a cache key will
stay unique forever. The texture might be freed, and a later allocated
texture might have the same addres now, causing the cache to return
incorrect results.
2019-08-11 09:05:31 +02:00
Timm Bäder
13c0a9e27b iconcache: Replace broken debugging code 2019-08-11 09:05:31 +02:00
Timm Bäder
4c70bf6c9c testsuite: Add a repeat node test case 2019-08-11 09:05:31 +02:00
Timm Bäder
2914c360a9 gl renderer: Implement a subset of repeat nodes 2019-08-11 09:05:31 +02:00
Timm Bäder
8d1a2247e0 treeview: Redo tree line drawing using textures
Gets rid of the remaining cairo nodes used for line drawing.
2019-08-11 09:05:28 +02:00
Timm Bäder
4fba7f8c59 treeview: Redo grid line drawing using textures
The cairo pattern in use was simple enough, so just use a 2×1 or 1×2
texture to draw horizontal and vertical grid lines. This avoids a bunch
of cairo nodes (that can't be cached by the renderers).
2019-08-11 09:05:25 +02:00
Timm Bäder
a93745238f snapshot: Annotate child_bounds parameter of push_repeat as nullable 2019-08-10 19:51:45 +02:00
Timm Bäder
b812ff2597 treeview: Shorten destroy() implementation 2019-08-10 19:51:45 +02:00
Timm Bäder
8a51796150 treeview: Remove two _dashes members
Tree lines and grid lines always look the same these days.
2019-08-10 19:51:45 +02:00
Timm Bäder
dd7d171186 treeview: Remove GTK_TREE_VIEW_FOREGROUND_LINE 2019-08-10 19:51:45 +02:00
Timm Bäder
0ac20f978e spinbutton: Remove an unnecessary queue_draw() call 2019-08-10 19:51:45 +02:00
Timm Bäder
0a96c3f062 scale: Properly update when inverted
Just queue_resize()ing the range itself doesn't work as it will just
re-allocate all the child widgets (i.e. just the trough) to its old
position and size.
2019-08-10 19:51:45 +02:00
Timm Bäder
42e6630c3e scale: Make a function shorter 2019-08-10 19:51:45 +02:00
Timm Bäder
1125d08f0d range: Remove outdated comment 2019-08-10 19:51:45 +02:00
Timm Bäder
0544633755 Merge branch 'wip/sadiq/buildable-2080' into 'master'
builderparser: Allow bind-source without bind-property

Closes #2080

See merge request GNOME/gtk!1047
2019-08-10 13:39:47 +00:00
Mohammed Sadiq
a642883e33 Add builder tests for bind-source without bind-property
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2080
2019-08-10 19:03:37 +05:30
Mohammed Sadiq
c1bb699151 builderparser: Allow bind-source without bind-property
This allow users to bind same property of two objects with only
specifing “name” and “bind-source” in UI file.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2080
2019-08-10 19:01:36 +05:30
Daniel Șerbănescu
120cfcc120 Update Romanian translation 2019-08-10 07:25:36 +00:00
Mohammed Sadiq
55af84d359 widget: Fix a typo in documentation 2019-08-10 12:11:13 +05:30
Christian Hergert
4ae362d138 textview: clear cached entries before releasing containers
We want to ensure all of the display cache entries are released in the
normal fashion before releasing the structures so that we can maintain
the invariant that cache_iter will always exist while in the cache.
2019-08-09 12:52:16 -07:00
Timm Bäder
fd201e4df7 treeviewcolumn: Remove cell_area parameter from _cell_get_size
Fixes #297
2019-08-09 17:04:58 +02:00
Timm Bäder
21123a1264 iconhelper: Don't snapshot 0 sized icons
This is happening for me when snapshotting small thumbnails in the file
chooser. The GtkScaler will scale the 1px height/width by 2, resulting
in nothing being drawn at all.
2019-08-09 15:55:38 +02:00
Timm Bäder
87aeec2b63 scale: Fix value widget measurement
Since we set the size request of the label, the later measure()
call would return at least the size we set, making the size only ever
grow.
2019-08-09 14:30:01 +02:00
Timm Bäder
ea5fc348fa scale: Replace format-value signal
There is no reason for this to be a signal, since multiple handlers
don't make sense anyway. It was also broken because the scale needs to
know when a signal handler is added so it can update the value
representation.

Replace the signal with a set_format_value_func function which allows us
to do that.

Fixes #113
2019-08-09 14:30:01 +02:00
Timm Bäder
ebc0d3760f range: remove range_size_request vfunc
It's unneeded in GtkScale and named after the gtk2 size_request function
2019-08-09 14:30:01 +02:00
Timm Bäder
b4a6d69f5d scale: Allocate left marks next to trough 2019-08-09 14:30:01 +02:00
Timm Bäder
1c8b746b42 testscale: Properly call gtk_main_quit 2019-08-09 14:30:01 +02:00
Timm Bäder
05cdce2e8d scale: Fix an uninitialized value 2019-08-09 14:30:01 +02:00
Timm Bäder
509b781079 widget: Avoid a few type checks 2019-08-09 14:30:01 +02:00
Aurimas Černius
c38deef753 Updated Lithuanian translation 2019-08-09 14:21:11 +03:00
Timm Bäder
4b7a6a885d Merge branch 'adwaita-scales-marks-fintune-fix-master' into 'master'
Adwaita: Fix fine-tune mode for scales with marks

Closes #1799

See merge request GNOME/gtk!696
2019-08-08 16:41:04 +00:00
Benjamin Otte
68869a0e0f Merge branch 'wip/gtk-icon-theme-no-svg-loader' into 'master'
gtk/icon-theme: Handle lack of SVG loader gracefully

Closes #2084

See merge request GNOME/gtk!1049
2019-08-08 07:27:10 +00:00
Jonas Ådahl
048957cd49 gtk/icon-theme: Handle lack of SVG loader gracefully
When loading a SVG icon from a gresource file only containing SVG icons,
but without having a SVG loader available in gdk-pixbuf, we would crash
when trying to eventually load the resource. Fix this by gracefully
handling this by simply failing to load the icon, while the first time
it happens, log a warning.

Fixes: https://gitlab.gnome.org/GNOME/gtk/issues/2084
2019-08-08 09:05:30 +02:00
Timm Bäder
434d32bf95 Adwaita: Fix round titlebar button outline radius
Fixes #2073
2019-08-07 18:49:50 +02:00
frederik.feichtmeier
1178a0011a Exclude appmenu titlebuttons 2019-08-07 18:46:50 +02:00
frederik.feichtmeier
0af2e65c80 Make titlebuttons round
- use even sides for the titlebuttons so the result is a circle and not an ellipse
- add maximum border radius
- set min width/height to 0
- adjust margin and padding to match the previous look
2019-08-07 18:46:47 +02:00
Timm Bäder
e8f3b47bf3 gesturelongpress: Add getter/setter for delay-factor 2019-08-07 14:11:00 +02:00
Timm Bäder
8b16e44d26 passwordentry: Fix a documentation comment parameter name 2019-08-07 13:12:57 +02:00
Timm Bäder
002abc6d48 placessidebar: Remove popover using gtk_widget_unparent()
the gtk_widget_destroy() does not work anymore.
2019-08-06 17:39:01 +02:00
Timm Bäder
aca31c3ab6 adwaita: Increase spinbutton button styling specificity
So it trumps the 'toned down' button styling.

Fixes #2012
2019-08-06 17:38:54 +02:00
Priit Laes
f43d344aa3 gdk: x11: Fill GdkMonitor manufacturer with PNP id from EDID
Previously, the manufacturer property of the GdkMonitor was NULL,
and having at least PNP id at GdkMonitor.manufacturer makes it
possible to distinguish between different monitors programmatically.
2019-08-06 09:16:01 +03:00
Matthias Clasen
a3609c3f6d Merge branch 'implement-choices-file-chooser-native-win32-for-gtk-4' into 'master'
Implement choices for GtkFileChooserNativeWin32 [Gtk4]

Closes #1982

See merge request GNOME/gtk!1043
2019-08-05 12:20:06 +00:00
Jordi Mas
ddc74a08be Update Catalan translation 2019-08-05 06:18:53 +02:00
Jor Teron
76614ea5f2 Add Karbi translation 2019-08-04 18:24:49 +00:00
Jor Teron
2eabe21aae Add Karbi translation 2019-08-04 18:22:12 +00:00
Christian Kirbach
72f574a9c0 Update German translation 2019-08-04 16:16:01 +00:00
Luca Bacci
02935afe94 GtkFileChooserNativeWin32: Uninitialize COM at end of thread
GtkFileChooserNativeWin32 is created and shown on a secondary thread.
This thread initializes COM support with CoInitializeEx but does not
finalize it, so we have a leak. Fix that by calling CoUninitialize()
before thread terminates.

See Merge Request !1043
2019-08-04 18:03:37 +02:00
Luca Bacci
234d0443b2 GtkFileChoooserNative: change prepend to append for insertions in choices list
Although slightly less efficient, keeping the order in the choices
list makes it easier for GtkFileChooserNative implementations to
add widgets in the order specified by the application.

See Merge Request !1043
2019-08-04 18:03:21 +02:00
Luca Bacci
822deabdfe Implement choices for GtkFileChooserNativeWin32
See Merge Request !1043
2019-08-04 18:03:05 +02:00
Timm Bäder
b2e94f81cf window: Remove some leftover event code 2019-08-03 14:44:25 +02:00
Timm Bäder
109df77d87 popover: Use GTK_POS_BOTTOM as default position
This has always made a lot more sense.
2019-08-03 14:44:25 +02:00
Timm Bäder
76e3284ca1 colorchooserwidget: Inherit from GtkWidget
No reason for this to be a GtkBox.
2019-08-03 14:44:24 +02:00
Timm Bäder
576504390d supp: Add some more exceptions 2019-08-03 14:44:24 +02:00
Matthias Clasen
660f46fcb1 Merge branch 'glsl-switch' into 'master'
glsl: don't use switch statements

See merge request GNOME/gtk!1036
2019-08-02 16:59:27 +00:00
Matthias Clasen
2bd93c1e9e Merge branch 'wip/sort-icons-by-size' into 'master'
window: sort icons before adding to _NET_WM_ICON

See merge request GNOME/gtk!1038
2019-08-01 23:31:44 +00:00
Ray Strode
1612e38cda window: sort icons before adding to _NET_WM_ICON
When processing the list of icons for a window to add them to
_NET_WM_ICON gdk_x11_surface_set_icon_list only adds as many
icon sizes as will fit within X protocol limits.

It achieves this by keeping a running total of the number of
bytes taken up by icons already processed and bails as soon
as it goes over the limit.

The problem is, one 512x512 icon is already over the limit,
and so no icons will get added at all if the first icon in
list is 512x512.

Indeed, the code seems to assume the list is sorted from smallest
icon to biggest icon.

This commit changes the caller to sort the list.
2019-08-01 16:48:58 -04:00
Jordi Mas
176ab784dc Update Catalan translation 2019-08-01 20:19:06 +02:00
Matthias Clasen
b576aef2b1 Revert "gl: Simplify glyph cache rendering"
This reverts commit 7a3eaad193.

The reason we want to keep using pango here
is that we get hex boxes and similar drawing
features that way.
2019-08-01 00:18:19 -04:00
Elias Aebi
a357995484 glsl: don't use switch statements 2019-07-31 18:48:54 +02:00
Matthias Clasen
5d10100fc0 Merge branch 'glyph-cache-fixes' into 'master'
gl: Glyph cache fixes

See merge request GNOME/gtk!1034
2019-07-31 12:26:16 +00:00
Matthias Clasen
6118dfba74 Add missing includes 2019-07-31 08:04:03 -04:00
Matthias Clasen
d276d2629a gl: Glyph cache fixes
Pass the full location to the glyph cache lookup,
and use the same rounding as cairo does. This makes
the output much closer to the cairo renderer.
2019-07-31 00:03:13 -04:00
Matthias Clasen
e3ee1df456 Add an image comparison utility
This comes in handy sometimes, and we
already have the image diff code.
2019-07-30 14:02:43 -04:00
Daniel Mustieles
2691e4e949 Updated Spanish translation 2019-07-30 09:39:55 +02:00
Timm Bäder
20d7b7f59b widget factory: add a tooltip to a button in a popover 2019-07-30 07:05:45 +02:00
Matthias Clasen
1fcd08d76a Merge branch 'issue2057' into 'master'
Bump wayland-protocols requirements

See merge request GNOME/gtk!1030
2019-07-29 12:17:52 +00:00
Olivier Fourdan
060a9f072c Bump wayland-protocols requirements
The `name` and `description` events were added to `xdg-output` protocol
in version 2 which is part of wayland-protocols 1.14.

In xdg-output-v1 version 3, the `xdg-output.done` event was deprecated
and the `xdg-output.description` event was made mutable, but that
doesn't change the actual events so we do not actually need to require
that version of xdg-output from wayland-protocols 1.18.

Update the wayland-protocols requirement to the bare minimum version,
which is 1.14.

https://gitlab.gnome.org/GNOME/gtk/issues/2057
2019-07-29 12:03:07 +02:00
Matthias Clasen
4a631787bd Merge branch 'subpixel-positioning' into 'master'
Subpixel positioning

See merge request GNOME/gtk!1024
2019-07-28 21:02:31 +00:00
Matthias Clasen
032473fef8 reftest: Exclude flaky tests
These depend on details of text rendering,
and started failing with newer pango.
2019-07-28 16:42:52 -04:00
Matthias Clasen
5dd8801ee5 gl: implement subpixel positioning
Pass the glyph position into the glyph caching functions,
not just the glyph index. This allows us to cache different
images for different subpixel positions.
2019-07-28 16:42:52 -04:00
Matthias Clasen
5c9643b6eb vulkan: implement subpixel positioning
Pass the glyph position into the glyph caching functions,
not just the glyph index. This allows us to cache different
images for different subpixel positions.
2019-07-28 16:42:52 -04:00
Matthias Clasen
4de670b0b4 Turn off metrics hinting
This will be necessary to see the effects of subpixel positioning.
2019-07-28 16:42:52 -04:00
Matthias Clasen
ade40a7a0c Merge branch 'wip/chergert/textview-caching' into 'master'
textlayout: introduce caching for GtkTextLineDisplay

See merge request GNOME/gtk!1025
2019-07-28 20:32:56 +00:00
Christian Hergert
9926e6ebde textlayout: introduce caching for GtkTextLineDisplay
This adds a GtkTextLineDisplayCache which can be used to cache a number
of GtkTextLineDisplay (and thus, PangoLayout) while displaying a view.

It uses a GSequence to track the position of the GtkTextLineDisplay
relative to each other, a MRU to cull the least recently used display,
and and a direct hashtable to lookup display by GtkTextLine.

We only cache lines that are to be displayed (!size_only). We may want to
either create a second collection of "size_only" lines to speed that up,
or determine that it is unnecessary (which is likely the case).
2019-07-28 10:34:15 -07:00
Christian Hergert
b930c5a8a2 textiter: add _gtk_text_iter_same_line()
This is a faster form to compare two text iter to see if they are on the
same line.
2019-07-28 10:34:15 -07:00
Matthias Clasen
7eb5dfd294 inspector: Show the pango backend 2019-07-28 11:39:16 -04:00
Matthias Clasen
8752564fea Remove new attributes from tests
Until we can depend on pango 1.44, these will
fail in ci. Partially reverts f1c7803f80
2019-07-28 11:00:29 -04:00
Matthias Clasen
988fac404a Add pango version checks
Seems the ci does not have pango 1.44 yet.
2019-07-28 10:50:14 -04:00
Matthias Clasen
7a3eaad193 gl: Simplify glyph cache rendering
We are currently using a weird mix of pango and cairo,
but there is no need for us to go through a pango
renderer here; we can just use cairo directly.
2019-07-28 09:54:17 -04:00
Matthias Clasen
3fccb16ca6 gsk: Move text-related test out of ci
These are too sensitive to rendering differences
between renderers to run reliably in ci, but we
still want to keep them around. In particular,
the big glyph tests are useful to exercise the
GL glyph cache.
2019-07-28 09:35:37 -04:00
Timm Bäder
2c38b71ca5 glyph cache: Upload large glyphs in lookup () directly
Instead of relying on a texture id of 0, which can happen for other
reasons, e.g. when the glyph is being scaled too small.

Fixes part of #2046
2019-07-28 12:00:15 +02:00
Timm Bäder
1c93bef0d5 glyph cache: check glyphs for scaled size
We can't rely on just the ink_rect, since that might be without the
scaled applied, which is what ends up on the texture.

Fixes #2046
2019-07-28 10:58:10 +02:00
Timm Bäder
eea76e8cce textview: Remove some unnecessary gtk_widget_show() calls
Widgets are visible by default.
2019-07-28 08:44:45 +02:00
Jordi Mas
3b604331ec Update Catalan translation 2019-07-28 01:05:25 +02:00
Matthias Clasen
92546cf9f7 Merge branch 'overview-recursive-dependancy' into 'master'
overview.xml: The GTK library does not depend on the GTK library

See merge request GNOME/gtk!1026
2019-07-27 21:46:52 +00:00
Piotr Drąg
3c9f9d598b Update Polish translation 2019-07-27 15:20:40 +02:00
Piotr Drąg
ed46053dc9 Update POTFILES.skip 2019-07-27 15:03:47 +02:00
Дилян Палаузов
a3db7437b3 overview.xml: The GTK library does not depend on the GTK library
The documentation stated:

GTK is a library.…  GTK depends on the following libraries:

GTK       The GTK library itself contains widgets, that is, GUI
          components such as GtkButton or GtkTextView.

There is no point in stating, that the GTK library
depends on the GTK library.
2019-07-27 11:59:45 +00:00
Timm Bäder
b2d639b6d9 window: Unroot with old display
Things might rely on the old display being set while unrooting.

Fixes #2052
2019-07-27 07:57:06 +02:00
Matthias Clasen
f1c7803f80 label: Parse new pango attributes
Support allow-breaks and show attributes.
These will be in pango 1.44
2019-07-27 00:02:08 -04:00
Matthias Clasen
c179fce6c7 Merge branch 'xdg-output-v3-gtk4' into 'master'
wayland: Add xdg-output v3 support

See merge request GNOME/gtk!1022
2019-07-26 17:13:39 +00:00
Olivier Fourdan
795899f9d5 wayland: Add xdg-output v3 support
xdg-output v3 marks xdg-output.done as deprecated and compositors are
not required to send that event anymore.

So if the xdg-output version is 3 or higher, simply set the initial
value `xdg_output_done` to TRUE so we don't wait/expect that event
from the compositor.

https://gitlab.gnome.org/GNOME/gtk/issues/2053
2019-07-26 17:32:17 +02:00
Matthias Clasen
88ab3a6942 Merge branch 'wip/no-move-surface' into 'master'
Remove surface moving APIs

See merge request GNOME/gtk!1016
2019-07-26 14:31:49 +00:00
Timm Bäder
58e8dd1c0d gl renderer: Fix dx/dy handling on hidpi
Fixes misplaced error squiggles in the node editor.
2019-07-26 16:27:39 +02:00
Timm Bäder
b8bbf7b63b gl renderer: Rework transform handling
Fix all the ref counting mishaps. Makes hidpi work again and without
memory leaks.
2019-07-26 15:35:06 +02:00
Kukuh Syafaat
05e28fb498 Update Indonesian translation 2019-07-26 11:31:46 +00:00
Kjartan Maraas
c6d9963d1a Update Norwegian Bokmål translation 2019-07-26 09:01:15 +00:00
Daniel Mustieles
2d3a902beb Updated Spanish translation 2019-07-26 09:18:25 +02:00
Matthias Clasen
8b1f3936b6 font rendering demo: Make boxes optional 2019-07-26 00:31:07 -04:00
Matthias Clasen
108ea50179 font rendering demo: Show unrounded extents
This makes more sense.
2019-07-25 23:35:09 -04:00
Matthias Clasen
df1892c052 font rendering: Show ink rect too 2019-07-25 22:06:34 -04:00
Matthias Clasen
0820a79bf5 Improve the font rendering demo
Show the pixel grid, extents, and baseline.
2019-07-25 19:07:12 -04:00
Matthias Clasen
4427bde8a7 Merge branch 'fontrendering-demo' into 'master'
Add a font rendering demo

See merge request GNOME/gtk!1019
2019-07-25 21:06:54 +00:00
Matthias Clasen
dec4db5943 Add a font rendering demo
This renders a magnified version of the text,
to make the effect of various font rendering options
more visible.

It also shows the phases of subpixel rendering,
if you have a recent pango and cairo.
2019-07-25 16:43:22 -04:00
Matthias Clasen
fd7f6ca7ad tests: improve error handling 2019-07-25 13:51:34 -04:00
Matthias Clasen
dea309144b gtk-demo: Fix a crash 2019-07-25 13:51:34 -04:00
Emmanuele Bassi
f1e4efebb7 Merge branch 'gtk-4-add-TCRYPT-options-to-ask-password-dialog' into 'master'
gtkmountoperation: Add TCRYPT options to the ask-password dialog

See merge request GNOME/gtk!263
2019-07-25 10:16:11 +00:00
Jonas Ådahl
0885eb0a7b gdk: Remove gdk_surface_move_resize() API
Windows/surface's aren't supposed to be explicitly moved by any external
part, so don't provide API for doing so. Usage throughout Gdk is
replaced by the corresponding backend variants.
2019-07-25 10:35:43 +02:00
Jonas Ådahl
fc68d1b1e6 gdk: Make backends implement move_to_rect()
The generic layer still does the heavy lifting, leaving the backends
more or less just act as thin wrappers, dealing a bit with global
coordinate transformations. The end goal is to remove explicit surface
moving from the generic gdk layer.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
b329090e69 gdk: Remove gdk_surface_move()
Generic gdk code now uses the internal helper; backends use their own
private implementations when necessary.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
6314ebd435 gdk/surface: Add toplevel_resize vfunc
To separate how toplevels and popups are configured, a first step is to
introduce a resize-only vfunc for backends to implement. It's meant to
only configure toplevel windows, i.e. popups. Currently it's used for
both types, but introducing the resize-only API is a first step.
2019-07-25 10:24:50 +02:00
Jonas Ådahl
b062dea1aa wayland: Cleanup surface configuration
Configuration should happen in response to the xdg_surface.configure
event, not in the events that preceeds it. Do this by making all
configured state pending until the committing "configure" event. Also
split up toplevel vs popup configuration in a more clear way.
2019-07-24 22:42:37 +02:00
Jonas Ådahl
9b561581d5 wayland: Rename gdk_wayland_surface_configure to *_resize
It only issues a resize; configuring should imply more state is
configured, e.g. maximized, etc.
2019-07-24 22:42:37 +02:00
Jonas Ådahl
7f6c31c041 tests: Remove obsolete props from popover2.ui 2019-07-24 22:42:37 +02:00
segfault
97cdf87350 gtkmountoperation: Add TCRYPT options to the ask-password dialog 2019-07-18 20:06:20 +02:00
Alex Monday
afbadc5e1b Adwaita: Fix fine-tune mode for scales with marks
Remove old fine-tune marks style, add margins for fine-tune marks to
compensate trough growth, prevent horizontal fine-tune trough growth in
horizontal direction, prevent vertical fine-tune trough growth in
vertical direction.

Closes https://gitlab.gnome.org/GNOME/gtk/issues/1799
2019-04-01 14:48:45 +05:00
1022 changed files with 127025 additions and 118854 deletions

View File

@@ -12,8 +12,8 @@ stages:
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/master:v6
fedora-x86_64: &fedora-x86_64-defaults
image: registry.gitlab.gnome.org/gnome/gtk/master:v8
stage: build
script:
- bash -x ./.gitlab-ci/test-docker.sh
@@ -33,6 +33,11 @@ fedora-x86_64:
key: "$CI_JOB_NAME"
<<: *cache-paths
fedora-x86_64-staticlibs:
variables:
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
<<: *fedora-x86_64-defaults
.mingw-defaults: &mingw-defaults
stage: build
tags:

View File

@@ -1,7 +1,6 @@
FROM fedora:30
FROM fedora:31
RUN dnf -y install \
hicolor-icon-theme \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
@@ -14,6 +13,7 @@ RUN dnf -y install \
dbus-daemon \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
elfutils-libelf-devel \
fribidi-devel \
gcc \
@@ -32,6 +32,7 @@ RUN dnf -y install \
gstreamer1-plugins-bad-free-devel \
gstreamer1-plugins-base-devel \
gtk-doc \
hicolor-icon-theme \
iso-codes \
itstool \
json-glib-devel \
@@ -52,6 +53,7 @@ RUN dnf -y install \
libxkbcommon-devel \
libXrandr-devel \
libXrender-devel \
libXtst-devel \
libxslt \
mesa-dri-drivers \
mesa-libEGL-devel \

View File

@@ -149,11 +149,11 @@ ul.images li {
<article>
<section>
<div class="summary">
<h3>Summary</h3>
<h3><a name="summary">Summary</a></h3>
<ul>
<li><strong>Total units:</strong> {{ report.total_units }}</li>
<li><strong>Passed:</strong> {{ report.total_successes }}</li>
<li><strong>Failed:</strong> {{ report.total_failures }}</li>
<li><strong>Passed:</strong> <a href="#passed">{{ report.total_successes }}</a></li>
<li><strong>Failed:</strong> <a href="#failures">{{ report.total_failures }}</a></li>
</ul>
</div>
</section>
@@ -161,7 +161,7 @@ ul.images li {
{% for suite_result in report.results_list %}
<section>
<div class="result">
<h3>Suite: {{ suite_result.suite_name }}</h3>
<h3><a name="results">Suite: {{ suite_result.suite_name }}</a></h3>
<ul>
<li><strong>Units:</strong> {{ suite_result.n_units }}</li>
<li><strong>Passed:</strong> {{ suite_result.n_successes }}</li>
@@ -169,7 +169,7 @@ ul.images li {
</ul>
<div class="successes">
<h4>Passed</h4>
<h4><a name="passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
@@ -178,7 +178,7 @@ ul.images li {
{% endfor %}
</ul>
<h4>Skipped</h4>
<h4><a name="skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
@@ -187,10 +187,10 @@ ul.images li {
{% endfor %}
</ul>
<h4>Expected failures</h4>
<h4><a name="expected-fail">Expected failures</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
<li>{{ success.name }} - result: <span class="result xfail">{{ success.result }}</span><br/>
<li><a name="{{ success.name }}">{{ success.name }}</a> - result: <span class="result xfail">{{ success.result }}</span><br/>
{% if success.stdout %}
Output: <pre>{{ success.stdout }}</pre>
{% endif %}
@@ -209,10 +209,10 @@ ul.images li {
</div>
<div class="failures">
<h4>Failed</h4>
<h4><a name="failed">Failed</a></h4>
<ul class="failed">
{% for failure in suite_result.failures if failure.result == 'FAIL' %}
<li>{{ failure.name }} - result: <span class="result fail">{{ failure.result }}</span><br/>
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
{% if failure.stdout %}
Output: <pre>{{ failure.stdout }}</pre>
{% endif %}
@@ -229,10 +229,10 @@ ul.images li {
{% endfor %}
</ul>
<h4>Timed out</h4>
<h4><a name="timed-out">Timed out</a></h4>
<ul class="failed">
{% for failure in suite_result.failures if failure.result == 'TIMEOUT' %}
<li>{{ failure.name }} - result: <span class="result fail">{{ failure.result }}</span><br/>
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
{% if failure.stdout %}
Output: <pre>{{ failure.stdout }}</pre>
{% endif %}

View File

@@ -2,7 +2,7 @@
set -e
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v6"
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v7"
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .

View File

@@ -17,6 +17,7 @@ meson \
-Dbroadway-backend=true \
-Dvulkan=yes \
--werror \
${EXTRA_MESON_FLAGS:-} \
_build $srcdir
unset CCACHE_DISABLE

View File

@@ -33,6 +33,10 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
mingw-w64-$MSYS2_ARCH-shared-mime-info
# https://gitlab.gnome.org/GNOME/gtk/issues/2243
wget "https://gitlab.gnome.org/creiter/gitlab-ci-win32-runner/raw/master/pango/mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
pacman --noconfirm -U "mingw-w64-$MSYS2_ARCH-pango-1.44.7-1-any.pkg.tar.xz"
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"

View File

@@ -174,7 +174,7 @@ maintainers review your contribution.
Each contribution is reviewed by the core developers of the GTK project.
The [CODE-OWNERS](./docs/CODE-OWNERS) document contains the list of core
The [CODEOWNERS](./docs/CODEOWNERS) document contains the list of core
contributors to GTK and the areas for which they are responsible; you
should ensure to receive their review and signoff on your changes.

View File

@@ -185,9 +185,6 @@
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#mesondefine LT_OBJDIR
/* Define if <X11/extensions/XIproto.h> needed for xReply */
#mesondefine NEED_XIPROTO_H_FOR_XREPLY
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#mesondefine NO_MINUS_C_MINUS_O

View File

@@ -419,7 +419,7 @@ demo_application_window_load_state (DemoApplicationWindow *win)
static void
demo_application_window_init (DemoApplicationWindow *window)
{
GtkWidget *menu;
GtkWidget *popover;
window->width = -1;
window->height = -1;
@@ -428,8 +428,8 @@ demo_application_window_init (DemoApplicationWindow *window)
gtk_widget_init_template (GTK_WIDGET (window));
menu = gtk_menu_new_from_model (window->toolmenu);
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (window->menutool), menu);
popover = gtk_popover_menu_new_from_model (window->menutool, window->toolmenu);
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (window->menutool), popover);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries, G_N_ELEMENTS (win_entries),

View File

@@ -43,25 +43,17 @@
<object class="GtkInfoBar" id="infobar">
<property name="visible">0</property>
<property name="hexpand">1</property>
<child internal-child="content_area">
<object class="GtkBox" id="content_area">
<child>
<object class="GtkLabel" id="message">
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkLabel" id="message">
<property name="hexpand">1</property>
</object>
</child>
<child internal-child="action_area">
<object class="GtkBox">
<child>
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">_OK</property>
<property name="use-underline">1</property>
<signal name="clicked" handler="clicked_cb"/>
</object>
</child>
<child type="action">
<object class="GtkButton">
<property name="valign">center</property>
<property name="label" translatable="yes">_OK</property>
<property name="use-underline">1</property>
<signal name="clicked" handler="clicked_cb"/>
</object>
</child>
<layout>

View File

@@ -94,6 +94,7 @@ create_page1 (GtkWidget *assistant)
GtkWidget *box, *label, *entry;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
g_object_set (box, "margin", 12, NULL);
label = gtk_label_new ("You must fill out this entry to continue:");
gtk_container_add (GTK_CONTAINER (box), label);
@@ -115,10 +116,12 @@ create_page2 (GtkWidget *assistant)
{
GtkWidget *box, *checkbutton;
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
g_object_set (box, "margin", 12, NULL);
checkbutton = gtk_check_button_new_with_label ("This is optional data, you may continue "
"even if you do not check this");
gtk_widget_set_valign (checkbutton, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (box), checkbutton);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), box);

View File

@@ -38,7 +38,22 @@ help_activate (GSimpleAction *action,
g_print ("Help not available\n");
}
static void
not_implemented (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
g_print ("Action “%s” not implemented\n", g_action_get_name (G_ACTION (action)));
}
static GActionEntry win_entries[] = {
{ "new", not_implemented, NULL, NULL, NULL },
{ "open", not_implemented, NULL, NULL, NULL },
{ "save", not_implemented, NULL, NULL, NULL },
{ "save-as", not_implemented, NULL, NULL, NULL },
{ "copy", not_implemented, NULL, NULL, NULL },
{ "cut", not_implemented, NULL, NULL, NULL },
{ "paste", not_implemented, NULL, NULL, NULL },
{ "quit", quit_activate, NULL, NULL, NULL },
{ "about", about_activate, NULL, NULL, NULL },
{ "help", help_activate, NULL, NULL, NULL }
@@ -50,8 +65,6 @@ do_builder (GtkWidget *do_widget)
static GtkWidget *window = NULL;
GtkWidget *toolbar;
GActionGroup *actions;
GtkAccelGroup *accel_group;
GtkWidget *item;
if (!window)
{
@@ -59,7 +72,6 @@ do_builder (GtkWidget *do_widget)
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_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -73,44 +85,6 @@ do_builder (GtkWidget *do_widget)
win_entries, G_N_ELEMENTS (win_entries),
window);
gtk_widget_insert_action_group (window, "win", actions);
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
item = (GtkWidget*)gtk_builder_get_object (builder, "new_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_n, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "open_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_o, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "save_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_s, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "quit_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "copy_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_c, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "cut_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_x, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "paste_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_v, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "help_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_F1, 0, GTK_ACCEL_VISIBLE);
item = (GtkWidget*)gtk_builder_get_object (builder, "about_item");
gtk_widget_add_accelerator (item, "activate", accel_group,
GDK_KEY_F7, 0, GTK_ACCEL_VISIBLE);
g_object_set_data_full (G_OBJECT(window), "builder", builder, g_object_unref);
}

View File

@@ -1,551 +0,0 @@
/* Change Display
*
* Demonstrates migrating a window between different displays.
* A display is a mouse and keyboard with some number of
* associated monitors. The neat thing about having multiple
* displays is that they can be on a completely separate
* computers, as long as there is a network connection to the
* computer where the application is running.
*
* Only some of the windowing systems where GTK runs have the
* concept of multiple displays. (The X Window System is the
* main example.) Other windowing systems can only handle one
* keyboard and mouse, and combine all monitors into
* a single display.
*
* This is a moderately complex example, and demonstrates:
*
* - Tracking the currently open displays
*
* - Changing the display for a window
*
* - Letting the user choose a window by clicking on it
*
* - Using GtkListStore and GtkTreeView
*
* - Using GtkDialog
*/
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
/* The ChangeDisplayInfo structure corresponds to a toplevel window and
* holds pointers to widgets inside the toplevel window along with other
* information about the contents of the window.
* This is a common organizational structure in real applications.
*/
typedef struct _ChangeDisplayInfo ChangeDisplayInfo;
struct _ChangeDisplayInfo
{
GtkWidget *window;
GtkSizeGroup *size_group;
GtkTreeModel *display_model;
GdkDisplay *current_display;
};
/* These enumerations provide symbolic names for the columns
* in the two GtkListStore models.
*/
enum
{
DISPLAY_COLUMN_NAME,
DISPLAY_COLUMN_DISPLAY,
DISPLAY_NUM_COLUMNS
};
enum
{
SCREEN_COLUMN_NUMBER,
SCREEN_COLUMN_SCREEN,
SCREEN_NUM_COLUMNS
};
/* Finds the toplevel window under the mouse pointer, if any.
*/
static GtkWidget *
find_toplevel_at_pointer (GdkDisplay *display)
{
GdkSurface *pointer_window;
GtkWidget *widget = NULL;
pointer_window = gdk_device_get_surface_at_position (gtk_get_current_event_device (), NULL, NULL);
if (pointer_window)
widget = GTK_WIDGET (gtk_native_get_for_surface (pointer_window));
return widget;
}
static void
released_cb (GtkGestureClick *gesture,
guint n_press,
gdouble x,
gdouble y,
gboolean *clicked)
{
*clicked = TRUE;
}
/* Asks the user to click on a window, then waits for them click
* the mouse. When the mouse is released, returns the toplevel
* window under the pointer, or NULL, if there is none.
*/
static GtkWidget *
query_for_toplevel (GdkDisplay *display,
const char *prompt)
{
GtkWidget *popup, *label, *frame;
GdkCursor *cursor;
GtkWidget *toplevel = NULL;
GdkDevice *device;
popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_display (GTK_WINDOW (popup), display);
gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
gtk_container_add (GTK_CONTAINER (popup), frame);
label = gtk_label_new (prompt);
g_object_set (label, "margin", 10, NULL);
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_widget_show (popup);
cursor = gdk_cursor_new_from_name ("crosshair", NULL);
device = gtk_get_current_event_device ();
if (gdk_seat_grab (gdk_device_get_seat (device),
gtk_native_get_surface (GTK_NATIVE (popup)),
GDK_SEAT_CAPABILITY_ALL_POINTING,
FALSE, cursor, NULL, NULL, NULL) == GDK_GRAB_SUCCESS)
{
GtkGesture *gesture = gtk_gesture_click_new ();
gboolean clicked = FALSE;
g_signal_connect (gesture, "released",
G_CALLBACK (released_cb), &clicked);
gtk_widget_add_controller (popup, GTK_EVENT_CONTROLLER (gesture));
/* Process events until clicked is set by our button release event handler.
* We pass in may_block=TRUE since we want to wait if there
* are no events currently.
*/
while (!clicked)
g_main_context_iteration (NULL, TRUE);
gdk_seat_ungrab (gdk_device_get_seat (device));
toplevel = find_toplevel_at_pointer (display);
if (toplevel == popup)
toplevel = NULL;
}
g_object_unref (cursor);
gtk_widget_destroy (popup);
return toplevel;
}
/* Prompts the user for a toplevel window to move, and then moves
* that window to the currently selected display
*/
static void
query_change_display (ChangeDisplayInfo *info)
{
GdkDisplay *display = gtk_widget_get_display (info->window);
GtkWidget *toplevel;
toplevel = query_for_toplevel (display,
"Please select the toplevel\n"
"to move to the new display");
if (toplevel)
gtk_window_set_display (GTK_WINDOW (toplevel), info->current_display);
else
gdk_display_beep (display);
}
/* Called when the user clicks on a button in our dialog or
* closes the dialog through the window manager. Unless the
* "Change" button was clicked, we destroy the dialog.
*/
static void
response_cb (GtkDialog *dialog,
gint response_id,
ChangeDisplayInfo *info)
{
if (response_id == GTK_RESPONSE_OK)
query_change_display (info);
else
gtk_widget_destroy (GTK_WIDGET (dialog));
}
/* Called when the user clicks on "Open..." in the display
* frame. Prompts for a new display, and then opens a connection
* to that display.
*/
static void
open_display_cb (GtkWidget *button,
ChangeDisplayInfo *info)
{
GtkWidget *content_area;
GtkWidget *dialog;
GtkWidget *display_entry;
GtkWidget *dialog_label;
gchar *new_screen_name = NULL;
GdkDisplay *result = NULL;
dialog = gtk_dialog_new_with_buttons ("Open Display",
GTK_WINDOW (info->window),
GTK_DIALOG_MODAL,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_OK"), GTK_RESPONSE_OK,
NULL);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
display_entry = gtk_entry_new ();
gtk_entry_set_activates_default (GTK_ENTRY (display_entry), TRUE);
dialog_label =
gtk_label_new ("Please enter the name of\nthe new display\n");
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
gtk_container_add (GTK_CONTAINER (content_area), dialog_label);
gtk_container_add (GTK_CONTAINER (content_area), display_entry);
gtk_widget_grab_focus (display_entry);
while (!result)
{
gint response_id = gtk_dialog_run (GTK_DIALOG (dialog));
if (response_id != GTK_RESPONSE_OK)
break;
new_screen_name = gtk_editable_get_chars (GTK_EDITABLE (display_entry),
0, -1);
if (strcmp (new_screen_name, "") != 0)
{
result = gdk_display_open (new_screen_name);
if (!result)
{
gchar *error_msg =
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);
}
g_free (new_screen_name);
}
}
gtk_widget_destroy (dialog);
}
/* Called when the user clicks on the "Close" button in the
* "Display" frame. Closes the selected display.
*/
static void
close_display_cb (GtkWidget *button,
ChangeDisplayInfo *info)
{
if (info->current_display)
gdk_display_close (info->current_display);
}
/* Called when the selected row in the display list changes.
* Updates info->current_display, then refills the list of
* screens.
*/
static void
display_changed_cb (GtkTreeSelection *selection,
ChangeDisplayInfo *info)
{
GtkTreeModel *model;
GtkTreeIter iter;
if (info->current_display)
g_object_unref (info->current_display);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter,
DISPLAY_COLUMN_DISPLAY, &info->current_display,
-1);
else
info->current_display = NULL;
}
/* This function is used both for creating the "Display" and
* "Screen" frames, since they have a similar structure. The
* caller hooks up the right context for the value returned
* in tree_view, and packs any relevant buttons into button_vbox.
*/
static void
create_frame (ChangeDisplayInfo *info,
const char *title,
GtkWidget **frame,
GtkWidget **tree_view,
GtkWidget **button_vbox)
{
GtkTreeSelection *selection;
GtkWidget *scrollwin;
GtkWidget *hbox;
*frame = gtk_frame_new (title);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
g_object_set (hbox, "margin", 8, NULL);
gtk_container_add (GTK_CONTAINER (*frame), hbox);
scrollwin = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin),
GTK_SHADOW_IN);
gtk_container_add (GTK_CONTAINER (hbox), scrollwin);
*tree_view = gtk_tree_view_new ();
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (*tree_view), FALSE);
gtk_container_add (GTK_CONTAINER (scrollwin), *tree_view);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (*tree_view));
gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
*button_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_container_add (GTK_CONTAINER (hbox), *button_vbox);
if (!info->size_group)
info->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
gtk_size_group_add_widget (GTK_SIZE_GROUP (info->size_group), *button_vbox);
}
/* If we have a stack of buttons, it often looks better if their contents
* are left-aligned, rather than centered. This function creates a button
* and left-aligns it contents.
*/
GtkWidget *
left_align_button_new (const char *label)
{
GtkWidget *button = gtk_button_new_with_mnemonic (label);
GtkWidget *child = gtk_bin_get_child (GTK_BIN (button));
gtk_widget_set_halign (child, GTK_ALIGN_START);
gtk_widget_set_valign (child, GTK_ALIGN_CENTER);
return button;
}
/* Creates the "Display" frame in the main window.
*/
GtkWidget *
create_display_frame (ChangeDisplayInfo *info)
{
GtkWidget *frame;
GtkWidget *tree_view;
GtkWidget *button_vbox;
GtkTreeViewColumn *column;
GtkTreeSelection *selection;
GtkWidget *button;
create_frame (info, "Display", &frame, &tree_view, &button_vbox);
button = left_align_button_new ("_Open...");
g_signal_connect (button, "clicked", G_CALLBACK (open_display_cb), info);
gtk_container_add (GTK_CONTAINER (button_vbox), button);
button = left_align_button_new ("_Close");
g_signal_connect (button, "clicked", G_CALLBACK (close_display_cb), info);
gtk_container_add (GTK_CONTAINER (button_vbox), button);
info->display_model = (GtkTreeModel *)gtk_list_store_new (DISPLAY_NUM_COLUMNS,
G_TYPE_STRING,
GDK_TYPE_DISPLAY);
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->display_model);
column = gtk_tree_view_column_new_with_attributes ("Name",
gtk_cell_renderer_text_new (),
"text", DISPLAY_COLUMN_NAME,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
g_signal_connect (selection, "changed",
G_CALLBACK (display_changed_cb), info);
return frame;
}
/* Called when one of the currently open displays is closed.
* Remove it from our list of displays.
*/
static void
display_closed_cb (GdkDisplay *display,
gboolean is_error,
ChangeDisplayInfo *info)
{
GtkTreeIter iter;
gboolean valid;
for (valid = gtk_tree_model_get_iter_first (info->display_model, &iter);
valid;
valid = gtk_tree_model_iter_next (info->display_model, &iter))
{
GdkDisplay *tmp_display;
gtk_tree_model_get (info->display_model, &iter,
DISPLAY_COLUMN_DISPLAY, &tmp_display,
-1);
if (tmp_display == display)
{
gtk_list_store_remove (GTK_LIST_STORE (info->display_model), &iter);
break;
}
}
}
/* Adds a new display to our list of displays, and connects
* to the "closed" signal so that we can remove it from the
* list of displays again.
*/
static void
add_display (ChangeDisplayInfo *info,
GdkDisplay *display)
{
const gchar *name = gdk_display_get_name (display);
GtkTreeIter iter;
gtk_list_store_append (GTK_LIST_STORE (info->display_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (info->display_model), &iter,
DISPLAY_COLUMN_NAME, name,
DISPLAY_COLUMN_DISPLAY, display,
-1);
g_signal_connect (display, "closed",
G_CALLBACK (display_closed_cb), info);
}
/* Called when a new display is opened
*/
static void
display_opened_cb (GdkDisplayManager *manager,
GdkDisplay *display,
ChangeDisplayInfo *info)
{
add_display (info, display);
}
/* Adds all currently open displays to our list of displays,
* and set up a signal connection so that we'll be notified
* when displays are opened in the future as well.
*/
static void
initialize_displays (ChangeDisplayInfo *info)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
GSList *displays = gdk_display_manager_list_displays (manager);
GSList *tmp_list;
for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
add_display (info, tmp_list->data);
g_slist_free (tmp_list);
g_signal_connect (manager, "display-opened",
G_CALLBACK (display_opened_cb), info);
}
/* Cleans up when the toplevel is destroyed; we remove the
* connections we use to track currently open displays, then
* free the ChangeDisplayInfo structure.
*/
static void
destroy_info (ChangeDisplayInfo *info)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
GSList *displays = gdk_display_manager_list_displays (manager);
GSList *tmp_list;
g_signal_handlers_disconnect_by_func (manager,
display_opened_cb,
info);
for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
g_signal_handlers_disconnect_by_func (tmp_list->data,
display_closed_cb,
info);
g_slist_free (tmp_list);
g_object_unref (info->size_group);
g_object_unref (info->display_model);
if (info->current_display)
g_object_unref (info->current_display);
g_free (info);
}
static void
destroy_cb (GObject *object,
ChangeDisplayInfo **info)
{
destroy_info (*info);
*info = NULL;
}
/* Main entry point. If the dialog for this demo doesn't yet exist, creates
* it. Otherwise, destroys it.
*/
GtkWidget *
do_changedisplay (GtkWidget *do_widget)
{
static ChangeDisplayInfo *info = NULL;
if (!info)
{
GtkWidget *content_area;
GtkWidget *vbox;
GtkWidget *frame;
info = g_new0 (ChangeDisplayInfo, 1);
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);
g_signal_connect (info->window, "response",
G_CALLBACK (response_cb), info);
g_signal_connect (info->window, "destroy",
G_CALLBACK (destroy_cb), &info);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (info->window));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
g_object_set (vbox, "margin", 8, NULL);
gtk_container_add (GTK_CONTAINER (content_area), vbox);
frame = create_display_frame (info);
gtk_container_add (GTK_CONTAINER (vbox), frame);
initialize_displays (info);
gtk_widget_show (info->window);
return info->window;
}
else
{
gtk_widget_destroy (info->window);
return NULL;
}
}

View File

@@ -110,7 +110,7 @@ get_image_paintable (GtkImage *image)
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
return GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info));
return gtk_icon_info_load_icon (icon_info, NULL);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
@@ -119,59 +119,85 @@ get_image_paintable (GtkImage *image)
}
static void
drag_begin (GtkWidget *widget,
GdkDrag *drag,
gpointer data)
drag_begin (GtkDragSource *source,
GdkDrag *drag,
GtkWidget *widget)
{
GdkPaintable *paintable;
paintable = get_image_paintable (GTK_IMAGE (widget));
if (paintable)
{
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
gtk_drag_source_set_icon (source, paintable, -2, -2);
g_object_unref (paintable);
}
}
void
drag_data_get (GtkWidget *widget,
GdkDrag *drag,
GtkSelectionData *selection_data,
guint info,
gpointer data)
static void
get_texture (GValue *value,
gpointer data)
{
GdkPaintable *paintable;
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
paintable = get_image_paintable (GTK_IMAGE (widget));
if (GDK_IS_TEXTURE (paintable))
gtk_selection_data_set_texture (selection_data, GDK_TEXTURE (paintable));
g_value_set_object (value, paintable);
}
static GdkContentProvider *
prepare_drag (GtkDragSource *source,
double x,
double y,
GtkWidget *image)
{
return gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image);
}
static void
drag_data_received (GtkWidget *widget,
GdkDrop *drop,
GtkSelectionData *selection_data,
gpointer data)
got_texture (GObject *source,
GAsyncResult *result,
gpointer data)
{
if (gtk_selection_data_get_length (selection_data) > 0)
{
GdkTexture *texture;
GdkDrop *drop = GDK_DROP (source);
GtkWidget *image = data;
const GValue *value;
GError *error = NULL;
texture = gtk_selection_data_get_texture (selection_data);
gtk_image_set_from_paintable (GTK_IMAGE (data), GDK_PAINTABLE (texture));
g_object_unref (texture);
value = gdk_drop_read_value_finish (drop, result, &error);
if (value)
{
GdkTexture *texture = g_value_get_object (value);
gtk_image_set_from_paintable (GTK_IMAGE (image), GDK_PAINTABLE (texture));
}
else
{
g_print ("Failed to get data: %s\n", error->message);
g_error_free (error);
}
}
static void
copy_image (GtkMenuItem *item,
gpointer data)
static gboolean
drag_drop (GtkDropTarget *dest,
GdkDrop *drop,
int x,
int y,
GtkWidget *widget)
{
GdkClipboard *clipboard;
GdkPaintable *paintable;
if (gdk_drop_has_value (drop, GDK_TYPE_TEXTURE))
{
gdk_drop_read_value_async (drop, GDK_TYPE_TEXTURE, G_PRIORITY_DEFAULT, NULL, got_texture, widget);
return TRUE;
}
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
paintable = get_image_paintable (GTK_IMAGE (data));
return FALSE;
}
static void
copy_image (GSimpleAction *action,
GVariant *value,
gpointer data)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
if (GDK_IS_TEXTURE (paintable))
gdk_clipboard_set_texture (clipboard, GDK_TEXTURE (paintable));
@@ -196,16 +222,12 @@ paste_image_received (GObject *source,
}
static void
paste_image (GtkMenuItem *item,
gpointer data)
paste_image (GSimpleAction *action,
GVariant *value,
gpointer data)
{
GdkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
gdk_clipboard_read_texture_async (clipboard,
NULL,
paste_image_received,
data);
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
gdk_clipboard_read_texture_async (clipboard, NULL, paste_image_received, data);
}
static void
@@ -215,22 +237,23 @@ pressed_cb (GtkGesture *gesture,
double y,
GtkWidget *image)
{
GtkWidget *menu;
GtkWidget *item;
GtkWidget *popover;
GMenu *menu;
GMenuItem *item;
menu = gtk_menu_new ();
menu = g_menu_new ();
item = g_menu_item_new (_("_Copy"), "clipboard.copy");
g_menu_append_item (menu, item);
item = gtk_menu_item_new_with_mnemonic (_("_Copy"));
g_signal_connect (item, "activate", G_CALLBACK (copy_image), image);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = g_menu_item_new (_("_Paste"), "clipboard.paste");
g_menu_append_item (menu, item);
item = gtk_menu_item_new_with_mnemonic (_("_Paste"));
g_signal_connect (item, "activate", G_CALLBACK (paste_image), image);
gtk_widget_show (item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
popover = gtk_popover_menu_new_from_model (image, G_MENU_MODEL (menu));
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
gtk_popover_set_pointing_to (GTK_POPOVER (popover), &(GdkRectangle) { x, y, 1, 1});
gtk_popover_popup (GTK_POPOVER (popover));
g_object_unref (menu);
}
GtkWidget *
@@ -243,6 +266,14 @@ do_clipboard (GtkWidget *do_widget)
GtkWidget *entry, *button;
GtkWidget *image;
GtkGesture *gesture;
GActionEntry entries[] = {
{ "copy", copy_image, NULL, NULL, NULL },
{ "paste", paste_image, NULL, NULL, NULL },
};
GActionGroup *actions;
GtkDragSource *source;
GtkDropTarget *dest;
GdkContentFormats *formats;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
@@ -301,22 +332,21 @@ do_clipboard (GtkWidget *do_widget)
/* Create the first image */
image = gtk_image_new_from_icon_name ("dialog-warning");
gtk_image_set_pixel_size (GTK_IMAGE (image), 48);
gtk_container_add (GTK_CONTAINER (hbox), image);
/* make image a drag source */
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (image);
g_signal_connect (image, "drag-begin",
G_CALLBACK (drag_begin), image);
g_signal_connect (image, "drag-data-get",
G_CALLBACK (drag_data_get), image);
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
/* accept drops on image */
gtk_drag_dest_set (image, GTK_DEST_DEFAULT_ALL,
NULL, GDK_ACTION_COPY);
gtk_drag_dest_add_image_targets (image);
g_signal_connect (image, "drag-data-received",
G_CALLBACK (drag_data_received), image);
formats = gdk_content_formats_new_for_gtype (GDK_TYPE_TEXTURE);
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
gdk_content_formats_unref (formats);
g_signal_connect (dest, "drag-drop", G_CALLBACK (drag_drop), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
/* context menu on image */
gesture = gtk_gesture_click_new ();
@@ -324,30 +354,43 @@ do_clipboard (GtkWidget *do_widget)
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
actions = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
gtk_widget_insert_action_group (image, "clipboard", actions);
g_object_unref (actions);
/* Create the second image */
image = gtk_image_new_from_icon_name ("process-stop");
gtk_image_set_pixel_size (GTK_IMAGE (image), 48);
gtk_container_add (GTK_CONTAINER (hbox), image);
/* make image a drag source */
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (image);
g_signal_connect (image, "drag-begin",
G_CALLBACK (drag_begin), image);
g_signal_connect (image, "drag-data-get",
G_CALLBACK (drag_data_get), image);
source = gtk_drag_source_new ();
g_signal_connect (source, "prepare", G_CALLBACK (prepare_drag), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
/* accept drops on image */
gtk_drag_dest_set (image, GTK_DEST_DEFAULT_ALL,
NULL, GDK_ACTION_COPY);
gtk_drag_dest_add_image_targets (image);
g_signal_connect (image, "drag-data-received",
G_CALLBACK (drag_data_received), image);
formats = gdk_content_formats_new_for_gtype (GDK_TYPE_TEXTURE);
dest = gtk_drop_target_new (formats, GDK_ACTION_COPY);
gdk_content_formats_unref (formats);
g_signal_connect (dest, "drag-drop", G_CALLBACK (drag_drop), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (dest));
/* context menu on image */
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
actions = G_ACTION_GROUP (g_simple_action_group_new ());
g_action_map_add_action_entries (G_ACTION_MAP (actions), entries, G_N_ELEMENTS (entries), image);
gtk_widget_insert_action_group (image, "clipboard", actions);
g_object_unref (actions);
}
if (!gtk_widget_get_visible (window))

View File

@@ -24,7 +24,6 @@ do_cursors (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -104,6 +104,9 @@
<file>gtkfishbowl.c</file>
<file>gtkfishbowl.h</file>
</gresource>
<gresource prefix="/iconscroll">
<file>iconscroll.ui</file>
</gresource>
<gresource prefix="/iconview">
<file>gnome-fs-directory.png</file>
<file>gnome-fs-regular.png</file>
@@ -146,7 +149,6 @@
<file>application_demo.c</file>
<file>assistant.c</file>
<file>builder.c</file>
<file>changedisplay.c</file>
<file>clipboard.c</file>
<file>colorsel.c</file>
<file>combobox.c</file>
@@ -164,8 +166,8 @@
<file>drawingarea.c</file>
<file>dnd.c</file>
<file>editable_cells.c</file>
<file>entry_buffer.c</file>
<file>entry_completion.c</file>
<file>entry_undo.c</file>
<file>expander.c</file>
<file>filtermodel.c</file>
<file>fishbowl.c</file>
@@ -174,10 +176,12 @@
<file>foreigndrawing.c</file>
<file>font_features.c</file>
<file>fontplane.c</file>
<file>fontrendering.c</file>
<file>gestures.c</file>
<file>glarea.c</file>
<file>headerbar.c</file>
<file>hypertext.c</file>
<file>iconscroll.c</file>
<file>iconview.c</file>
<file>iconview_edit.c</file>
<file>images.c</file>
@@ -186,7 +190,6 @@
<file>listbox.c</file>
<file>list_store.c</file>
<file>markup.c</file>
<file>menus.c</file>
<file>modelbutton.c</file>
<file>overlay.c</file>
<file>overlay2.c</file>
@@ -215,6 +218,7 @@
<file>spinner.c</file>
<file>tabs.c</file>
<file>tagged_entry.c</file>
<file>textundo.c</file>
<file>textview.c</file>
<file>textscroll.c</file>
<file>theming_style_classes.c</file>
@@ -281,6 +285,9 @@
<gresource prefix="/fixed">
<file>fixed.css</file>
</gresource>
<gresource prefix="/fontrendering">
<file>fontrendering.ui</file>
</gresource>
<gresource prefix="/org/gtk/Demo4">
<file>icons/16x16/actions/application-exit.png</file>
<file>icons/16x16/actions/document-new.png</file>

View File

@@ -22,6 +22,75 @@
</row>
</data>
</object>
<menu id="menubar">
<submenu>
<attribute name="label" translatable="yes">_File</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_New</attribute>
<attribute name="action">win.new</attribute>
<attribute name="accel">&lt;Primary&gt;n</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Open</attribute>
<attribute name="action">win.open</attribute>
<attribute name="accel">&lt;Primary&gt;o</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Save</attribute>
<attribute name="action">win.save</attribute>
<attribute name="accel">&lt;Primary&gt;s</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Save _As</attribute>
<attribute name="action">win.save-as</attribute>
<attribute name="accel">&lt;Primary&gt;q</attribute>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Quit</attribute>
<attribute name="action">win.quit</attribute>
<attribute name="accel">&lt;Primary&gt;&lt;Shift&gt;s</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Edit</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Copy</attribute>
<attribute name="action">win.copy</attribute>
<attribute name="accel">&lt;Primary&gt;c</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Cut</attribute>
<attribute name="action">win.cut</attribute>
<attribute name="accel">&lt;Primary&gt;x</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Paste</attribute>
<attribute name="action">win.paste</attribute>
<attribute name="accel">&lt;Primary&gt;v</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Help</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">win.help</attribute>
<attribute name="accel">F1</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_About</attribute>
<attribute name="action">win.about</attribute>
<attribute name="accel">F7</attribute>
</item>
</section>
</submenu>
</menu>
<object class="GtkAboutDialog" id="aboutdialog1">
<property name="program-name" translatable="yes">Builder demo</property>
<property name="logo-icon-name" translatable="yes">gtk3-demo</property>
@@ -37,109 +106,8 @@
<object class="GtkBox" id="vbox1">
<property name="orientation">vertical</property>
<child>
<object class="GtkMenuBar" id="menubar1">
<child internal-child="accessible">
<object class="AtkObject" id="a11y-menubar">
<property name="AtkObject::accessible-name">The menubar</property>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="label" translatable="yes">_File</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu">
<child>
<object class="GtkMenuItem" id="new_item">
<property name="label" translatable="yes">_New</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="open_item">
<property name="label" translatable="yes">_Open</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="save_item">
<property name="label" translatable="yes">_Save</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="save_as_item">
<property name="label" translatable="yes">Save _As</property>
<property name="use-underline">1</property>
<accelerator key="s" modifiers="primary | shift-mask" signal="activate"/>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem"/>
</child>
<child>
<object class="GtkMenuItem" id="quit_item">
<property name="label" translatable="yes">_Quit</property>
<property name="use-underline">1</property>
<property name="action-name">win.quit</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="label" translatable="yes">_Edit</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu">
<child>
<object class="GtkMenuItem" id="copy_item">
<property name="label" translatable="yes">_Copy</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="cut_item">
<property name="label" translatable="yes">_Cut</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="paste_item">
<property name="label" translatable="yes">_Paste</property>
<property name="use-underline">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem">
<property name="label" translatable="yes">_Help</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu">
<child>
<object class="GtkMenuItem" id="help_item">
<property name="label" translatable="yes">_Help</property>
<property name="use-underline">1</property>
<property name="action-name">win.help</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="about_item">
<property name="label" translatable="yes">_About</property>
<property name="use-underline">1</property>
<property name="action-name">win.about</property>
</object>
</child>
</object>
</child>
</object>
</child>
<object class="GtkPopoverMenuBar" id="menubar1">
<property name="menu-model">menubar</property>
</object>
</child>
<child>

View File

@@ -129,13 +129,13 @@ demo_tagged_entry_size_allocate (GtkWidget *widget,
baseline);
}
static void
static gboolean
demo_tagged_entry_grab_focus (GtkWidget *widget)
{
DemoTaggedEntry *entry = DEMO_TAGGED_ENTRY (widget);
DemoTaggedEntryPrivate *priv = demo_tagged_entry_get_instance_private (entry);
gtk_widget_grab_focus (priv->entry);
return gtk_widget_grab_focus (priv->entry);
}
static void

View File

@@ -1,6 +1,8 @@
/* Drag-and-Drop
*
* I can't believe its not glade!
*
* Try right-clicking in the window.
*/
#include <glib/gi18n.h>
@@ -92,7 +94,7 @@ deserialize_widget (GtkDemoWidget *demo)
static double pos_x, pos_y;
static void
new_label_cb (GtkMenuItem *item,
new_label_cb (GtkWidget *button,
gpointer data)
{
GtkFixed *fixed = data;
@@ -100,10 +102,12 @@ new_label_cb (GtkMenuItem *item,
widget = gtk_label_new ("Label");
gtk_fixed_put (fixed, widget, pos_x, pos_y);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
new_spinner_cb (GtkMenuItem *item,
new_spinner_cb (GtkWidget *button,
gpointer data)
{
GtkFixed *fixed = data;
@@ -113,33 +117,39 @@ new_spinner_cb (GtkMenuItem *item,
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "demo");
gtk_spinner_start (GTK_SPINNER (widget));
gtk_fixed_put (fixed, widget, pos_x, pos_y);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
copy_cb (GtkWidget *child)
copy_cb (GtkWidget *button, GtkWidget *child)
{
GdkClipboard *clipboard;
GtkDemoWidget *demo;
g_print ("Copy %s\n", G_OBJECT_TYPE_NAME (child));
demo = serialize_widget (child);
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gdk_clipboard_set (clipboard, GTK_TYPE_DEMO_WIDGET, demo);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
delete_cb (GtkWidget *child)
delete_cb (GtkWidget *button, GtkWidget *child)
{
gtk_widget_destroy (child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
cut_cb (GtkWidget *child)
cut_cb (GtkWidget *button, GtkWidget *child)
{
copy_cb (child);
delete_cb (child);
copy_cb (button, child);
delete_cb (button, child);
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
@@ -175,7 +185,7 @@ value_read (GObject *source,
}
static void
paste_cb (GtkWidget *fixed)
paste_cb (GtkWidget *button, GtkWidget *fixed)
{
GdkClipboard *clipboard;
@@ -187,6 +197,8 @@ paste_cb (GtkWidget *fixed)
}
else
g_print ("Don't know how to handle clipboard contents\n");
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
@@ -205,7 +217,7 @@ edit_label_done (GtkWidget *entry, gpointer data)
}
static void
edit_cb (GtkWidget *child)
edit_cb (GtkWidget *button, GtkWidget *child)
{
GtkWidget *fixed = gtk_widget_get_parent (child);
int x, y;
@@ -219,6 +231,7 @@ edit_cb (GtkWidget *child)
g_object_set_data (G_OBJECT (entry), "label", child);
gtk_editable_set_text (GTK_EDITABLE (entry), gtk_label_get_text (GTK_LABEL (child)));
gtk_editable_set_width_chars (GTK_EDITABLE (entry), 12);
g_signal_connect (entry, "activate", G_CALLBACK (edit_label_done), NULL);
gtk_fixed_put (GTK_FIXED (fixed), entry, x, y);
gtk_widget_grab_focus (entry);
@@ -230,6 +243,9 @@ edit_cb (GtkWidget *child)
g_object_get (child, "active", &active, NULL);
g_object_set (child, "active", !active, NULL);
}
if (button)
gtk_popover_popdown (GTK_POPOVER (gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER)));
}
static void
@@ -247,65 +263,65 @@ pressed_cb (GtkGesture *gesture,
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
{
GdkRectangle rect;
GtkWidget *menu;
GtkWidget *box;
GtkWidget *item;
GdkClipboard *clipboard;
pos_x = x;
pos_y = y;
menu = gtk_menu_new ();
item = gtk_menu_item_new_with_label ("New Label");
g_signal_connect (item, "activate", G_CALLBACK (new_label_cb), widget);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("New Spinner");
g_signal_connect (item, "activate", G_CALLBACK (new_spinner_cb), widget);
gtk_container_add (GTK_CONTAINER (menu), item);
menu = gtk_popover_new (widget);
gtk_popover_set_has_arrow (GTK_POPOVER (menu), FALSE);
gtk_popover_set_pointing_to (GTK_POPOVER (menu), &(GdkRectangle){ x, y, 1, 1});
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (menu), box);
item = gtk_separator_menu_item_new ();
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_button_new_with_label ("New Label");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
g_signal_connect (item, "clicked", G_CALLBACK (new_label_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("New Spinner");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
g_signal_connect (item, "clicked", G_CALLBACK (new_spinner_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_menu_item_new_with_label ("Edit");
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Edit");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (edit_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
g_signal_connect (item, "clicked", G_CALLBACK (edit_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_separator_menu_item_new ();
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_menu_item_new_with_label ("Cut");
item = gtk_button_new_with_label ("Cut");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (cut_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Copy");
g_signal_connect (item, "clicked", G_CALLBACK (cut_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Copy");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (copy_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Paste");
g_signal_connect (item, "clicked", G_CALLBACK (copy_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Paste");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
clipboard = gdk_display_get_clipboard (gdk_display_get_default ());
gtk_widget_set_sensitive (item,
gdk_content_formats_contain_gtype (gdk_clipboard_get_formats (clipboard), GTK_TYPE_DEMO_WIDGET));
g_signal_connect_swapped (item, "activate", G_CALLBACK (paste_cb), widget);
gtk_container_add (GTK_CONTAINER (menu), item);
item = gtk_menu_item_new_with_label ("Delete");
g_signal_connect (item, "clicked", G_CALLBACK (paste_cb), widget);
gtk_container_add (GTK_CONTAINER (box), item);
item = gtk_button_new_with_label ("Delete");
gtk_button_set_relief (GTK_BUTTON (item), GTK_RELIEF_NONE);
gtk_widget_set_sensitive (item, child != NULL && child != widget);
g_signal_connect_swapped (item, "activate", G_CALLBACK (delete_cb), child);
gtk_container_add (GTK_CONTAINER (menu), item);
g_signal_connect (item, "clicked", G_CALLBACK (delete_cb), child);
gtk_container_add (GTK_CONTAINER (box), item);
rect.x = x;
rect.y = y;
rect.width = 0;
rect.height = 0;
gtk_menu_popup_at_rect (GTK_MENU (menu),
gtk_native_get_surface (gtk_widget_get_native (widget)),
&rect,
GDK_GRAVITY_NORTH_WEST,
GDK_GRAVITY_NORTH_WEST,
NULL);
return;
gtk_popover_popup (GTK_POPOVER (menu));
}
}
@@ -325,7 +341,7 @@ released_cb (GtkGesture *gesture,
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
{
if (child != NULL && child != widget)
edit_cb (child);
edit_cb (NULL, child);
}
}

View File

@@ -1,28 +1,29 @@
/* Entry/Entry Buffer
/* Entry/Entry Undo
*
* 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.
* GtkEntry can provide basic Undo/Redo support using standard keyboard
* accelerators such as Primary+z to undo and Primary+Shift+z to redo.
* Additionally, Primary+y can be used to redo.
*
* Use gtk_entry_set_enable_undo() to enable undo/redo support.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
GtkWidget *
do_entry_buffer (GtkWidget *do_widget)
do_entry_undo (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *vbox;
GtkWidget *label;
GtkWidget *entry;
GtkEntryBuffer *buffer;
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Buffer");
gtk_window_set_title (GTK_WINDOW (window), "Entry Undo");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
@@ -33,22 +34,13 @@ do_entry_buffer (GtkWidget *do_widget)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"Entries share a buffer. Typing in one is reflected in the other.");
"Use Primary+z or Primary+Shift+z to undo or redo changes");
gtk_container_add (GTK_CONTAINER (vbox), label);
/* Create a buffer */
buffer = gtk_entry_buffer_new (NULL, 0);
/* Create our first entry */
entry = gtk_entry_new_with_buffer (buffer);
/* Create our entry */
entry = gtk_entry_new ();
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
gtk_container_add (GTK_CONTAINER (vbox), entry);
/* Create the second entry */
entry = gtk_entry_new_with_buffer (buffer);
gtk_entry_set_visibility (GTK_ENTRY (entry), FALSE);
gtk_container_add (GTK_CONTAINER (vbox), entry);
g_object_unref (buffer);
}
if (!gtk_widget_get_visible (window))

View File

@@ -52,7 +52,7 @@ do_expander (GtkWidget *do_widget)
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
label = gtk_widget_get_last_child (area);
gtk_label_set_line_wrap (GTK_LABEL (label), FALSE);
gtk_label_set_wrap (GTK_LABEL (label), FALSE);
gtk_widget_set_vexpand (label, FALSE);
expander = gtk_expander_new ("Details:");

View File

@@ -122,7 +122,6 @@ do_filtermodel (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/filtermodel/filtermodel.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -124,7 +124,7 @@ create_label (void)
{
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
gtk_label_set_wrap (GTK_LABEL (w), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
return w;
@@ -226,8 +226,8 @@ set_widget_type (GtkFishbowl *fishbowl,
}
void
next_button_clicked_cb (GtkButton *source,
gpointer user_data)
fishbowl_next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index;
@@ -241,8 +241,8 @@ next_button_clicked_cb (GtkButton *source,
}
void
prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
fishbowl_prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index;
@@ -256,8 +256,8 @@ prev_button_clicked_cb (GtkButton *source,
}
void
changes_toggled_cb (GtkToggleButton *button,
gpointer user_data)
fishbowl_changes_toggled_cb (GtkToggleButton *button,
gpointer user_data)
{
if (gtk_toggle_button_get_active (button))
gtk_button_set_icon_name (GTK_BUTTON (button), "changes-prevent");
@@ -288,12 +288,6 @@ do_fishbowl (GtkWidget *do_widget)
g_type_ensure (GTK_TYPE_FISHBOWL);
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
gtk_builder_add_callback_symbols (builder,
"next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb),
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
"changes_toggled_cb", G_CALLBACK (changes_toggled_cb),
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -15,13 +15,13 @@
<child>
<object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property>
<signal name="clicked" handler="prev_button_clicked_cb" object="bowl" swapped="no"/>
<signal name="clicked" handler="fishbowl_prev_button_clicked_cb" object="bowl" swapped="no"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property>
<signal name="clicked" handler="next_button_clicked_cb" object="bowl" swapped="no"/>
<signal name="clicked" handler="fishbowl_next_button_clicked_cb" object="bowl" swapped="no"/>
</object>
</child>
</object>
@@ -50,7 +50,7 @@
<object class="GtkToggleButton" id="changes_allow">
<property name="icon-name">changes-allow</property>
<property name="relief">none</property>
<signal name="notify::active" handler="changes_toggled_cb"/>
<signal name="notify::active" handler="fishbowl_changes_toggled_cb"/>
</object>
</child>
</object>

View File

@@ -13,7 +13,7 @@
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="tooltip-text">Reset</property>
<signal name="clicked" handler="reset" swapped="no"/>
<signal name="clicked" handler="font_features_reset_features" swapped="no"/>
<child>
<object class="GtkImage">
<property name="icon-name">view-refresh-symbolic</property>
@@ -42,7 +42,7 @@
<property name="receives-default">1</property>
<property name="font">Sans 12</property>
<property name="level">family|style|size|variations|features</property>
<signal name="font-set" handler="font_changed" swapped="no"/>
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
</object>
</child>
<child>
@@ -63,7 +63,7 @@
<object class="GtkComboBox" id="script_lang">
<property name="can-focus">1</property>
<property name="margin-top">10</property>
<signal name="changed" handler="script_changed" swapped="no"/>
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -137,7 +137,7 @@
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
<signal name="activate" handler="stop_edit"/>
<signal name="activate" handler="font_features_stop_edit"/>
<property name="valign">start</property>
<property name="width-chars">50</property>
</object>
@@ -181,7 +181,7 @@
<property name="icon-name">document-edit-symbolic</property>
<property name="halign">end</property>
<property name="valign">end</property>
<signal name="toggled" handler="toggle_edit"/>
<signal name="toggled" handler="font_features_toggle_edit"/>
</object>
</child>
</object>

View File

@@ -15,10 +15,6 @@
#include <pango/pangofc-font.h>
#include <hb.h>
#include <hb-ot.h>
#include <hb-ft.h>
#include <freetype/ftmm.h>
#include <freetype/ftsnames.h>
#include <freetype/ttnameid.h>
#include <glib/gi18n.h>
#include "open-type-layout.h"
@@ -484,7 +480,6 @@ update_script_combo (void)
GtkListStore *store;
hb_font_t *hb_font;
gint i, j, k;
FT_Face ft_face;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
@@ -505,8 +500,7 @@ update_script_combo (void)
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
pango_font = get_pango_font ();
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
hb_font = pango_font_get_hb_font (pango_font);
tags = g_hash_table_new_full (tag_pair_hash, tag_pair_equal, g_free, NULL);
@@ -545,11 +539,8 @@ update_script_combo (void)
}
}
}
hb_face_destroy (hb_face);
}
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
g_hash_table_iter_init (&iter, tags);
@@ -607,7 +598,6 @@ update_features (void)
GtkTreeIter iter;
guint script_index, lang_index;
PangoFont *pango_font;
FT_Face ft_face;
hb_font_t *hb_font;
GList *l;
@@ -632,8 +622,7 @@ update_features (void)
-1);
pango_font = get_pango_font ();
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = hb_ft_font_create (ft_face, NULL);
hb_font = pango_font_get_hb_font (pango_font);
if (hb_font)
{
@@ -715,11 +704,8 @@ update_features (void)
g_free (feat);
}
hb_face_destroy (hb_face);
}
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
}
@@ -800,24 +786,29 @@ axes_equal (gconstpointer v1, gconstpointer v2)
}
static void
add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
add_axis (hb_face_t *hb_face,
hb_ot_var_axis_info_t *ax,
float value,
int i)
{
GtkWidget *axis_label;
GtkWidget *axis_entry;
GtkWidget *axis_scale;
GtkAdjustment *adjustment;
Axis *axis;
char name[20];
unsigned int name_len = 20;
axis_label = gtk_label_new (ax->name);
hb_ot_name_get_utf8 (hb_face, ax->name_id, HB_LANGUAGE_INVALID, &name_len, name);
axis_label = gtk_label_new (name);
gtk_widget_set_halign (axis_label, GTK_ALIGN_START);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (variations_grid), axis_label, 0, i, 1, 1);
adjustment = gtk_adjustment_new ((double)FixedToFloat(value),
(double)FixedToFloat(ax->minimum),
(double)FixedToFloat(ax->maximum),
adjustment = gtk_adjustment_new (value, ax->min_value, ax->max_value,
1.0, 10.0, 0.0);
axis_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_scale_add_mark (GTK_SCALE (axis_scale), (double)FixedToFloat(ax->def), GTK_POS_TOP, NULL);
gtk_scale_add_mark (GTK_SCALE (axis_scale), ax->default_value, GTK_POS_TOP, NULL);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE);
gtk_widget_set_hexpand (axis_scale, TRUE);
gtk_widget_set_size_request (axis_scale, 100, -1);
@@ -842,9 +833,7 @@ add_axis (FT_Var_Axis *ax, FT_Fixed value, int i)
typedef struct {
char *name;
int n_axes;
guint32 *axes;
float *coords;
unsigned int index;
} Instance;
static guint
@@ -870,559 +859,32 @@ free_instance (gpointer data)
Instance *instance = data;
g_free (instance->name);
g_free (instance->axes);
g_free (instance->coords);
g_free (instance);
}
static GHashTable *instances;
typedef struct {
const FT_UShort platform_id;
const FT_UShort encoding_id;
const char fromcode[12];
} FtEncoding;
#define TT_ENCODING_DONT_CARE 0xffff
static const FtEncoding ftEncoding[] = {
{ TT_PLATFORM_APPLE_UNICODE, TT_ENCODING_DONT_CARE, "UTF-16BE" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_ROMAN, "MACINTOSH" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_ID_JAPANESE, "SJIS" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SYMBOL_CS, "UTF-16BE" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, "UTF-16BE" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_SJIS, "SJIS-WIN" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_GB2312, "GB2312" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_BIG_5, "BIG-5" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_WANSUNG, "Wansung" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_JOHAB, "Johab" },
{ TT_PLATFORM_MICROSOFT, TT_MS_ID_UCS_4, "UTF-16BE" },
{ TT_PLATFORM_ISO, TT_ISO_ID_7BIT_ASCII, "ASCII" },
{ TT_PLATFORM_ISO, TT_ISO_ID_10646, "UTF-16BE" },
{ TT_PLATFORM_ISO, TT_ISO_ID_8859_1, "ISO-8859-1" },
};
typedef struct {
const FT_UShort platform_id;
const FT_UShort language_id;
const char lang[8];
} FtLanguage;
#define TT_LANGUAGE_DONT_CARE 0xffff
static const FtLanguage ftLanguage[] = {
{ TT_PLATFORM_APPLE_UNICODE, TT_LANGUAGE_DONT_CARE, "" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ENGLISH, "en" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FRENCH, "fr" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GERMAN, "de" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ITALIAN, "it" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DUTCH, "nl" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SWEDISH, "sv" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SPANISH, "es" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DANISH, "da" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PORTUGUESE, "pt" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_NORWEGIAN, "no" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HEBREW, "he" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAPANESE, "ja" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ARABIC, "ar" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FINNISH, "fi" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREEK, "el" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ICELANDIC, "is" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALTESE, "mt" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TURKISH, "tr" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CROATIAN, "hr" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHINESE_TRADITIONAL, "zh-tw" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_URDU, "ur" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HINDI, "hi" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_THAI, "th" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KOREAN, "ko" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LITHUANIAN, "lt" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_POLISH, "pl" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_HUNGARIAN, "hu" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ESTONIAN, "et" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LETTISH, "lv" },
/* { TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SAAMISK, ??? */
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FAEROESE, "fo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FARSI, "fa" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUSSIAN, "ru" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHINESE_SIMPLIFIED, "zh-cn" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_FLEMISH, "nl" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH, "ga" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ALBANIAN, "sq" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ROMANIAN, "ro" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CZECH, "cs" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SLOVAK, "sk" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SLOVENIAN, "sl" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_YIDDISH, "yi" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SERBIAN, "sr" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MACEDONIAN, "mk" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BULGARIAN, "bg" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UKRAINIAN, "uk" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BYELORUSSIAN, "be" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UZBEK, "uz" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KAZAKH, "kk" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI, "az" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_CYRILLIC_SCRIPT, "az" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_ARABIC_SCRIPT, "ar" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ARMENIAN, "hy" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GEORGIAN, "ka" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MOLDAVIAN, "mo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KIRGHIZ, "ky" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAJIKI, "tg" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TURKMEN, "tk" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN, "mo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN_MONGOLIAN_SCRIPT,"mo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MONGOLIAN_CYRILLIC_SCRIPT, "mo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PASHTO, "ps" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KURDISH, "ku" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KASHMIRI, "ks" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SINDHI, "sd" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TIBETAN, "bo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_NEPALI, "ne" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SANSKRIT, "sa" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MARATHI, "mr" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BENGALI, "bn" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ASSAMESE, "as" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GUJARATI, "gu" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_PUNJABI, "pa" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ORIYA, "or" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAYALAM, "ml" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KANNADA, "kn" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAMIL, "ta" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TELUGU, "te" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SINHALESE, "si" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BURMESE, "my" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_KHMER, "km" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LAO, "lo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_VIETNAMESE, "vi" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_INDONESIAN, "id" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TAGALOG, "tl" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAY_ROMAN_SCRIPT, "ms" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAY_ARABIC_SCRIPT, "ms" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AMHARIC, "am" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TIGRINYA, "ti" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALLA, "om" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SOMALI, "so" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SWAHILI, "sw" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUANDA, "rw" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_RUNDI, "rn" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CHEWA, "ny" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MALAGASY, "mg" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_ESPERANTO, "eo" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_WELSH, "cy" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BASQUE, "eu" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_CATALAN, "ca" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_LATIN, "la" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_QUECHUA, "qu" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GUARANI, "gn" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AYMARA, "ay" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TATAR, "tt" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_UIGHUR, "ug" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_DZONGKHA, "dz" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_JAVANESE, "jw" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SUNDANESE, "su" },
#if 0 /* these seem to be errors that have been dropped */
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC },
#endif
/* The following codes are new as of 2000-03-10 */
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GALICIAN, "gl" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AFRIKAANS, "af" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_BRETON, "br" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_INUKTITUT, "iu" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_SCOTTISH_GAELIC, "gd" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_MANX_GAELIC, "gv" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_IRISH_GAELIC, "ga" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_TONGAN, "to" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREEK_POLYTONIC, "el" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_GREELANDIC, "ik" },
{ TT_PLATFORM_MACINTOSH, TT_MAC_LANGID_AZERBAIJANI_ROMAN_SCRIPT,"az" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_SAUDI_ARABIA, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_IRAQ, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_EGYPT, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_LIBYA, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_ALGERIA, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_MOROCCO, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_TUNISIA, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_OMAN, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_YEMEN, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_SYRIA, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_JORDAN, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_LEBANON, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_KUWAIT, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_UAE, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_BAHRAIN, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_QATAR, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BULGARIAN_BULGARIA, "bg" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CATALAN_SPAIN, "ca" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_TAIWAN, "zh-tw" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_PRC, "zh-cn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_HONG_KONG, "zh-hk" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_SINGAPORE, "zh-sg" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_MACAU, "zh-mo" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CZECH_CZECH_REPUBLIC, "cs" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DANISH_DENMARK, "da" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_GERMANY, "de" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_SWITZERLAND, "de" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_AUSTRIA, "de" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_LUXEMBOURG, "de" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GERMAN_LIECHTENSTEI, "de" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GREEK_GREECE, "el" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_UNITED_STATES, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_UNITED_KINGDOM, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_AUSTRALIA, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_CANADA, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_NEW_ZEALAND, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_IRELAND, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_SOUTH_AFRICA, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_JAMAICA, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_CARIBBEAN, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_BELIZE, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_TRINIDAD, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_ZIMBABWE, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_PHILIPPINES, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_SPAIN_TRADITIONAL_SORT,"es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_MEXICO, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_SPAIN_INTERNATIONAL_SORT,"es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_GUATEMALA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_COSTA_RICA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PANAMA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_DOMINICAN_REPUBLIC,"es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_VENEZUELA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_COLOMBIA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PERU, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_ARGENTINA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_ECUADOR, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_CHILE, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_URUGUAY, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PARAGUAY, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_BOLIVIA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_EL_SALVADOR, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_HONDURAS, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_NICARAGUA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_PUERTO_RICO, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FINNISH_FINLAND, "fi" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_FRANCE, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_BELGIUM, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CANADA, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_SWITZERLAND, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_LUXEMBOURG, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MONACO, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HEBREW_ISRAEL, "he" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HUNGARIAN_HUNGARY, "hu" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ICELANDIC_ICELAND, "is" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ITALIAN_ITALY, "it" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ITALIAN_SWITZERLAND, "it" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_JAPANESE_JAPAN, "ja" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KOREAN_EXTENDED_WANSUNG_KOREA,"ko" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KOREAN_JOHAB_KOREA, "ko" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DUTCH_NETHERLANDS, "nl" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DUTCH_BELGIUM, "nl" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NORWEGIAN_NORWAY_BOKMAL, "no" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NORWEGIAN_NORWAY_NYNORSK, "nn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_POLISH_POLAND, "pl" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PORTUGUESE_BRAZIL, "pt" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PORTUGUESE_PORTUGAL, "pt" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RHAETO_ROMANIC_SWITZERLAND,"rm" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ROMANIAN_ROMANIA, "ro" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MOLDAVIAN_MOLDAVIA, "mo" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RUSSIAN_RUSSIA, "ru" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_RUSSIAN_MOLDAVIA, "ru" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CROATIAN_CROATIA, "hr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SERBIAN_SERBIA_LATIN, "sr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SERBIAN_SERBIA_CYRILLIC, "sr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SLOVAK_SLOVAKIA, "sk" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ALBANIAN_ALBANIA, "sq" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWEDISH_SWEDEN, "sv" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWEDISH_FINLAND, "sv" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_THAI_THAILAND, "th" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TURKISH_TURKEY, "tr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_URDU_PAKISTAN, "ur" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_INDONESIAN_INDONESIA, "id" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UKRAINIAN_UKRAINE, "uk" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BELARUSIAN_BELARUS, "be" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SLOVENE_SLOVENIA, "sl" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ESTONIAN_ESTONIA, "et" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LATVIAN_LATVIA, "lv" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LITHUANIAN_LITHUANIA, "lt" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CLASSIC_LITHUANIAN_LITHUANIA,"lt" },
#ifdef TT_MS_LANGID_MAORI_NEW_ZELAND
/* this seems to be an error that have been dropped */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MAORI_NEW_ZEALAND, "mi" },
#endif
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FARSI_IRAN, "fa" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_VIETNAMESE_VIET_NAM, "vi" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARMENIAN_ARMENIA, "hy" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AZERI_AZERBAIJAN_LATIN, "az" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AZERI_AZERBAIJAN_CYRILLIC, "az" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BASQUE_SPAIN, "eu" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SORBIAN_GERMANY, "wen" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MACEDONIAN_MACEDONIA, "mk" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SUTU_SOUTH_AFRICA, "st" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TSONGA_SOUTH_AFRICA, "ts" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TSWANA_SOUTH_AFRICA, "tn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_VENDA_SOUTH_AFRICA, "ven" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_XHOSA_SOUTH_AFRICA, "xh" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ZULU_SOUTH_AFRICA, "zu" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AFRIKAANS_SOUTH_AFRICA, "af" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GEORGIAN_GEORGIA, "ka" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FAEROESE_FAEROE_ISLANDS, "fo" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HINDI_INDIA, "hi" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALTESE_MALTA, "mt" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SAAMI_LAPONIA, "se" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SCOTTISH_GAELIC_UNITED_KINGDOM,"gd" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IRISH_GAELIC_IRELAND, "ga" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAY_MALAYSIA, "ms" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAY_BRUNEI_DARUSSALAM, "ms" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KAZAK_KAZAKSTAN, "kk" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SWAHILI_KENYA, "sw" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UZBEK_UZBEKISTAN_LATIN, "uz" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_UZBEK_UZBEKISTAN_CYRILLIC, "uz" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TATAR_TATARSTAN, "tt" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BENGALI_INDIA, "bn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PUNJABI_INDIA, "pa" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GUJARATI_INDIA, "gu" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ORIYA_INDIA, "or" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMIL_INDIA, "ta" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TELUGU_INDIA, "te" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KANNADA_INDIA, "kn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MALAYALAM_INDIA, "ml" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ASSAMESE_INDIA, "as" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MARATHI_INDIA, "mr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SANSKRIT_INDIA, "sa" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KONKANI_INDIA, "kok" },
/* new as of 2001-01-01 */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ARABIC_GENERAL, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHINESE_GENERAL, "zh" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_GENERAL, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_WEST_INDIES, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_REUNION, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CONGO, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_SENEGAL, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_CAMEROON, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_COTE_D_IVOIRE, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MALI, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BOSNIAN_BOSNIA_HERZEGOVINA,"bs" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_URDU_INDIA, "ur" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAJIK_TAJIKISTAN, "tg" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YIDDISH_GERMANY, "yi" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KIRGHIZ_KIRGHIZSTAN, "ky" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TURKMEN_TURKMENISTAN, "tk" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MONGOLIAN_MONGOLIA, "mn" },
/* the following seems to be inconsistent;
here is the current "official" way: */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIBETAN_BHUTAN, "bo" },
/* and here is what is used by Passport SDK */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIBETAN_CHINA, "bo" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DZONGHKA_BHUTAN, "dz" },
/* end of inconsistency */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_WELSH_WALES, "cy" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KHMER_CAMBODIA, "km" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LAO_LAOS, "lo" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BURMESE_MYANMAR, "my" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GALICIAN_SPAIN, "gl" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MANIPURI_INDIA, "mni" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SINDHI_INDIA, "sd" },
/* the following one is only encountered in Microsoft RTF specification */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KASHMIRI_PAKISTAN, "ks" },
/* the following one is not in the Passport list, looks like an omission */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KASHMIRI_INDIA, "ks" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NEPALI_NEPAL, "ne" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_NEPALI_INDIA, "ne" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRISIAN_NETHERLANDS, "fy" },
/* new as of 2001-03-01 (from Office Xp) */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_HONG_KONG, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_INDIA, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_MALAYSIA, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_ENGLISH_SINGAPORE, "en" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SYRIAC_SYRIA, "syr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SINHALESE_SRI_LANKA, "si" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_CHEROKEE_UNITED_STATES, "chr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_INUKTITUT_CANADA, "iu" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_AMHARIC_ETHIOPIA, "am" },
#if 0
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMAZIGHT_MOROCCO },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TAMAZIGHT_MOROCCO_LATIN },
#endif
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PASHTO_AFGHANISTAN, "ps" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FILIPINO_PHILIPPINES, "phi" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_DHIVEHI_MALDIVES, "div" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_OROMO_ETHIOPIA, "om" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ETHIOPIA, "ti" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_TIGRIGNA_ERYTHREA, "ti" },
/* New additions from Windows Xp/Passport SDK 2001-11-10. */
/* don't ask what this one means... It is commented out currently. */
#if 0
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GREEK_GREECE2 },
#endif
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_UNITED_STATES, "es" },
/* The following two IDs blatantly violate MS specs by using a */
/* sublanguage >,. */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SPANISH_LATIN_AMERICA, "es" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_NORTH_AFRICA, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_MOROCCO, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FRENCH_HAITI, "fr" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_BENGALI_BANGLADESH, "bn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PUNJABI_ARABIC_PAKISTAN, "ar" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_MONGOLIAN_MONGOLIA_MONGOLIAN,"mn" },
#if 0
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_EDO_NIGERIA },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_FULFULDE_NIGERIA },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IBIBIO_NIGERIA },
#endif
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HAUSA_NIGERIA, "ha" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YORUBA_NIGERIA, "yo" },
/* language codes from, to, are (still) unknown. */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_IGBO_NIGERIA, "ibo" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_KANURI_NIGERIA, "kau" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_GUARANI_PARAGUAY, "gn" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_HAWAIIAN_UNITED_STATES, "haw" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_LATIN, "la" },
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_SOMALI_SOMALIA, "so" },
#if 0
/* Note: Yi does not have a (proper) ISO 639-2 code, since it is mostly */
/* not written (but OTOH the peculiar writing system is worth */
/* studying). */
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_YI_CHINA },
#endif
{ TT_PLATFORM_MICROSOFT, TT_MS_LANGID_PAPIAMENTU_NETHERLANDS_ANTILLES,"pap" },
};
static const char *
FcSfntNameLanguage (FT_SfntName *sname)
{
int i;
FT_UShort platform_id = sname->platform_id;
FT_UShort language_id = sname->language_id;
for (i = 0; i < G_N_ELEMENTS (ftLanguage); i++)
if (ftLanguage[i].platform_id == platform_id &&
(ftLanguage[i].language_id == TT_LANGUAGE_DONT_CARE ||
ftLanguage[i].language_id == language_id))
{
if (ftLanguage[i].lang[0] == '\0')
return NULL;
else
return ftLanguage[i].lang;
}
return NULL;
}
static char *
FcSfntNameTranscode (FT_SfntName *name)
{
int i;
const char *fromcode;
for (i = 0; i < G_N_ELEMENTS (ftEncoding); i++)
if (ftEncoding[i].platform_id == name->platform_id &&
(ftEncoding[i].encoding_id == TT_ENCODING_DONT_CARE ||
ftEncoding[i].encoding_id == name->encoding_id))
break;
if (i == G_N_ELEMENTS (ftEncoding))
return NULL;
fromcode = ftEncoding[i].fromcode;
return g_convert ((const char *)name->string, name->string_len, "UTF-8", fromcode, NULL, NULL, NULL);
}
static char *
get_sfnt_name (FT_Face ft_face,
guint nameid)
{
guint count;
guint i, j;
const char * const *langs = g_get_language_names ();
char *res = NULL;
guint pos = G_MAXUINT;
count = FT_Get_Sfnt_Name_Count (ft_face);
for (i = 0; i < count; i++)
{
FT_SfntName name;
const char *lang;
if (FT_Get_Sfnt_Name (ft_face, i, &name) != 0)
continue;
if (name.name_id != nameid)
continue;
lang = FcSfntNameLanguage (&name);
for (j = 0; j < pos && langs[j]; j++)
{
if (strcmp (lang, langs[j]) == 0)
{
pos = j;
g_free (res);
res = FcSfntNameTranscode (&name);
}
}
if (pos == 0)
break;
}
return res;
}
static gboolean
is_valid_subfamily_id (guint id)
{
return id == 2 || id == 17 || (255 < id && id < 32768);
}
static void
add_instance (FT_Face ft_face,
FT_MM_Var *ft_mm_var,
FT_Var_Named_Style *ns,
GtkWidget *combo,
int pos)
add_instance (hb_face_t *face,
unsigned int index,
GtkWidget *combo,
int pos)
{
Instance *instance;
int i;
hb_ot_name_id_t name_id;
char name[20];
unsigned int name_len = 20;
instance = g_new0 (Instance, 1);
if (is_valid_subfamily_id (ns->strid))
instance->name = get_sfnt_name (ft_face, ns->strid);
if (!instance->name)
instance->name = g_strdup_printf ("Instance %d", pos);
name_id = hb_ot_var_named_instance_get_subfamily_name_id (face, index);
hb_ot_name_get_utf8 (face, name_id, HB_LANGUAGE_INVALID, &name_len, name);
instance->name = g_strdup (name);
instance->index = index;
g_hash_table_add (instances, instance);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
instance->n_axes = ft_mm_var->num_axis;
instance->axes = g_new (guint32, ft_mm_var->num_axis);
instance->coords = g_new (float, ft_mm_var->num_axis);
for (i = 0; i < ft_mm_var->num_axis; i++)
{
instance->axes[i] = ft_mm_var->axis[i].tag;
instance->coords[i] = FixedToFloat(ns->coords[i]);
}
}
static void
@@ -1439,6 +901,13 @@ instance_changed (GtkComboBox *combo)
Instance *instance;
Instance ikey;
int i;
unsigned int coords_length;
float *coords = NULL;
hb_ot_var_axis_info_t *ai = NULL;
unsigned int n_axes;
PangoFont *pango_font = NULL;
hb_font_t *hb_font;
hb_face_t *hb_face;
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
if (text[0] == '\0')
@@ -1452,17 +921,29 @@ instance_changed (GtkComboBox *combo)
goto out;
}
for (i = 0; i < instance->n_axes; i++)
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
hb_face = hb_font_get_face (hb_font);
n_axes = hb_ot_var_get_axis_infos (hb_face, 0, NULL, NULL);
ai = g_new (hb_ot_var_axis_info_t, n_axes);
hb_ot_var_get_axis_infos (hb_face, 0, &n_axes, ai);
coords = g_new (float, n_axes);
hb_ot_var_named_instance_get_design_coords (hb_face,
instance->index,
&coords_length,
coords);
for (i = 0; i < n_axes; i++)
{
Axis *axis;
Axis akey;
guint32 tag;
gdouble value;
tag = instance->axes[i];
value = instance->coords[i];
value = coords[ai[i].axis_index];
akey.tag = tag;
akey.tag = ai[i].tag;
axis = g_hash_table_lookup (axes, &akey);
if (axis)
{
@@ -1474,17 +955,31 @@ instance_changed (GtkComboBox *combo)
out:
g_free (text);
g_clear_object (&pango_font);
g_free (ai);
g_free (coords);
}
static gboolean
matches_instance (FT_Var_Named_Style *instance,
FT_Fixed *coords,
FT_UInt num_coords)
matches_instance (hb_face_t *hb_face,
unsigned int index,
unsigned int n_axes,
float *coords)
{
FT_UInt i;
float *instance_coords;
unsigned int coords_length;
int i;
for (i = 0; i < num_coords; i++)
if (coords[i] != instance->coords[i])
instance_coords = g_new (float, n_axes);
coords_length = n_axes;
hb_ot_var_named_instance_get_design_coords (hb_face,
index,
&coords_length,
instance_coords);
for (i = 0; i < n_axes; i++)
if (instance_coords[i] != coords[i])
return FALSE;
return TRUE;
@@ -1515,14 +1010,31 @@ add_font_plane (int i)
}
}
/* FIXME: This doesn't work if the font has an avar table */
static float
denorm_coord (hb_ot_var_axis_info_t *axis, int coord)
{
float r = coord / 16384.0;
if (coord < 0)
return axis->default_value + r * (axis->default_value - axis->min_value);
else
return axis->default_value + r * (axis->max_value - axis->default_value);
}
static void
update_font_variations (void)
{
GtkWidget *child, *next;
PangoFont *pango_font;
FT_Face ft_face;
FT_MM_Var *ft_mm_var;
FT_Error ret;
PangoFont *pango_font = NULL;
hb_font_t *hb_font;
hb_face_t *hb_face;
unsigned int n_axes;
hb_ot_var_axis_info_t *ai = NULL;
float *design_coords = NULL;
const int *coords;
unsigned int length;
int i;
child = gtk_widget_get_first_child (variations_grid);
while (child != NULL)
@@ -1538,81 +1050,82 @@ update_font_variations (void)
g_hash_table_remove_all (instances);
pango_font = get_pango_font ();
ft_face = pango_fc_font_lock_face (PANGO_FC_FONT (pango_font)),
hb_font = pango_font_get_hb_font (pango_font);
hb_face = hb_font_get_face (hb_font);
ret = FT_Get_MM_Var (ft_face, &ft_mm_var);
if (ret == 0)
n_axes = hb_ot_var_get_axis_infos (hb_face, 0, NULL, NULL);
if (n_axes == 0)
goto done;
ai = g_new0 (hb_ot_var_axis_info_t, n_axes);
design_coords = g_new (float, n_axes);
hb_ot_var_get_axis_infos (hb_face, 0, &n_axes, ai);
coords = hb_font_get_var_coords_normalized (hb_font, &length);
for (i = 0; i < length; i++)
design_coords[i] = denorm_coord (&ai[i], coords[i]);
if (hb_ot_var_get_named_instance_count (hb_face) > 0)
{
unsigned int i;
FT_Fixed *coords;
GtkWidget *label;
GtkWidget *combo;
coords = g_new (FT_Fixed, ft_mm_var->num_axis);
ret = FT_Get_Var_Design_Coordinates (ft_face, ft_mm_var->num_axis, coords);
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (variations_grid), label, 0, -1, 2, 1);
if (ft_mm_var->num_namedstyles > 0)
combo = gtk_combo_box_text_new ();
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
add_instance (hb_face, i, combo, i);
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
{
GtkWidget *label;
GtkWidget *combo;
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (variations_grid), label, 0, -1, 2, 1);
combo = gtk_combo_box_text_new ();
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
gtk_grid_attach (GTK_GRID (variations_grid), combo, 1, -1, 2, 1);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
for (i = 0; i < ft_mm_var->num_namedstyles; i++)
add_instance (ft_face, ft_mm_var, &ft_mm_var->namedstyle[i], combo, i);
for (i = 0; i < ft_mm_var->num_namedstyles; i++)
{
if (matches_instance (&ft_mm_var->namedstyle[i], coords, ft_mm_var->num_axis))
{
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
break;
}
}
instance_combo = combo;
if (matches_instance (hb_face, i, n_axes, design_coords))
{
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
break;
}
}
if (ret == 0)
{
for (i = 0; i < ft_mm_var->num_axis; i++)
add_axis (&ft_mm_var->axis[i], coords[i], i);
gtk_grid_attach (GTK_GRID (variations_grid), combo, 1, -1, 2, 1);
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
instance_combo = combo;
}
add_font_plane (ft_mm_var->num_axis);
}
g_free (coords);
free (ft_mm_var);
}
for (i = 0; i < n_axes; i++)
add_axis (hb_face, &ai[i], design_coords[i], i);
pango_fc_font_unlock_face (PANGO_FC_FONT (pango_font));
g_object_unref (pango_font);
add_font_plane (n_axes);
done:
g_clear_object (&pango_font);
g_free (ai);
g_free (design_coords);
}
static void
font_changed (void)
void
font_features_font_changed (void)
{
update_script_combo ();
update_features ();
update_font_variations ();
}
static void
script_changed (void)
void
font_features_script_changed (void)
{
update_features ();
update_display ();
}
static void
reset_features (void)
void
font_features_reset_features (void)
{
GList *l;
@@ -1657,8 +1170,8 @@ switch_to_label (void)
update_display ();
}
static void
toggle_edit (void)
void
font_features_toggle_edit (void)
{
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (stack)), "label") == 0)
switch_to_entry ();
@@ -1666,8 +1179,8 @@ toggle_edit (void)
switch_to_label ();
}
static void
stop_edit (void)
void
font_features_stop_edit (void)
{
g_signal_emit_by_name (edit_toggle, "clicked");
}
@@ -1682,7 +1195,7 @@ entry_key_press (GtkEventController *controller,
if (keyval == GDK_KEY_Escape)
{
gtk_editable_set_text (GTK_EDITABLE (entry), text);
stop_edit ();
font_features_stop_edit ();
return GDK_EVENT_STOP;
}
@@ -1702,14 +1215,6 @@ do_font_features (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
gtk_builder_add_callback_symbol (builder, "update_display", update_display);
gtk_builder_add_callback_symbol (builder, "font_changed", font_changed);
gtk_builder_add_callback_symbol (builder, "script_changed", script_changed);
gtk_builder_add_callback_symbol (builder, "reset", reset_features);
gtk_builder_add_callback_symbol (builder, "stop_edit", G_CALLBACK (stop_edit));
gtk_builder_add_callback_symbol (builder, "toggle_edit", G_CALLBACK (toggle_edit));
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
label = GTK_WIDGET (gtk_builder_get_object (builder, "label"));
@@ -1723,7 +1228,7 @@ do_font_features (GtkWidget *do_widget)
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
controller = gtk_event_controller_key_new ();
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
g_object_set_data_full (G_OBJECT (entry), "controller", g_object_ref (controller), g_object_unref);
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
gtk_widget_add_controller (entry, controller);
@@ -1826,12 +1331,14 @@ do_font_features (GtkWidget *do_widget)
else
g_hash_table_remove_all (axes);
font_changed ();
font_features_font_changed ();
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_object_unref (builder);
update_display ();
}
if (!gtk_widget_get_visible (window))

View File

@@ -19,8 +19,6 @@
#include "fontplane.h"
#include "gtk.h"
enum {
PROP_0,
PROP_WEIGHT_ADJUSTMENT,

View File

@@ -0,0 +1,287 @@
/* Pango/Font rendering
*
* Demonstrates various aspects of font rendering.
*/
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static GtkWidget *font_button = NULL;
static GtkWidget *entry = NULL;
static GtkWidget *image = NULL;
static GtkWidget *hinting = NULL;
static GtkWidget *hint_metrics = NULL;
static GtkWidget *up_button = NULL;
static GtkWidget *down_button = NULL;
static GtkWidget *text_radio = NULL;
static GtkWidget *show_grid = NULL;
static GtkWidget *show_extents = NULL;
static PangoContext *context;
static int scale = 10;
static void
on_destroy (gpointer data)
{
window = NULL;
}
static void
update_image (void)
{
const char *text;
PangoFontDescription *desc;
PangoLayout *layout;
PangoRectangle ink, pink, logical;
int baseline;
cairo_surface_t *surface;
cairo_t *cr;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf2;
const char *hint;
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
int i;
if (!context)
context = gtk_widget_create_pango_context (image);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
else
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
cairo_font_options_set_hint_style (fopt, hintstyle);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hint_metrics)))
hintmetrics = CAIRO_HINT_METRICS_ON;
else
hintmetrics = CAIRO_HINT_METRICS_OFF;
cairo_font_options_set_hint_metrics (fopt, hintmetrics);
pango_cairo_context_set_font_options (context, fopt);
cairo_font_options_destroy (fopt);
pango_context_changed (context);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_radio)))
{
layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, text, -1);
pango_layout_get_extents (layout, &ink, &logical);
pink = ink;
baseline = pango_layout_get_baseline (layout);
pango_extents_to_pixels (&ink, NULL);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, ink.width + 20, ink.height + 20);
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_move_to (cr, 10, 10);
pango_cairo_show_layout (cr, layout);
cairo_destroy (cr);
g_object_unref (layout);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
g_object_unref (pixbuf);
cairo_surface_destroy (surface);
surface = cairo_image_surface_create_for_data (gdk_pixbuf_get_pixels (pixbuf2),
CAIRO_FORMAT_ARGB32,
gdk_pixbuf_get_width (pixbuf2),
gdk_pixbuf_get_height (pixbuf2),
gdk_pixbuf_get_rowstride (pixbuf2));
cr = cairo_create (surface);
cairo_set_line_width (cr, 1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_grid)))
{
cairo_set_source_rgba (cr, 0.2, 0, 0, 0.2);
for (i = 1; i < ink.height + 20; i++)
{
cairo_move_to (cr, 0, scale * i - 0.5);
cairo_line_to (cr, scale * (ink.width + 20), scale * i - 0.5);
cairo_stroke (cr);
}
for (i = 1; i < ink.width + 20; i++)
{
cairo_move_to (cr, scale * i - 0.5, 0);
cairo_line_to (cr, scale * i - 0.5, scale * (ink.height + 20));
cairo_stroke (cr);
}
}
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (show_extents)))
{
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (logical.x)) - 0.5,
scale * (10 + pango_units_to_double (logical.y)) - 0.5,
scale * pango_units_to_double (logical.width) + 1,
scale * pango_units_to_double (logical.height) + 1);
cairo_stroke (cr);
cairo_move_to (cr, scale * (10 + pango_units_to_double (logical.x)) - 0.5,
scale * (10 + pango_units_to_double (baseline)) - 0.5);
cairo_line_to (cr, scale * (10 + pango_units_to_double (logical.x + logical.width)) + 1,
scale * (10 + pango_units_to_double (baseline)) - 0.5);
cairo_stroke (cr);
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
scale * pango_units_to_double (pink.width) - 1,
scale * pango_units_to_double (pink.height) - 1);
cairo_stroke (cr);
}
cairo_surface_destroy (surface);
cairo_destroy (cr);
}
else
{
PangoLayoutIter *iter;
PangoLayoutRun *run;
PangoGlyphInfo *g;
int i, j;
layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, "aaaa", -1);
pango_layout_get_extents (layout, &ink, &logical);
pango_extents_to_pixels (&logical, NULL);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
iter = pango_layout_get_iter (layout);
run = pango_layout_iter_get_run (iter);
cairo_set_source_rgb (cr, 0, 0, 0);
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[i]);
g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
}
for (j = 0; j < 4; j++)
{
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[i]);
g->geometry.x_offset = i * (PANGO_SCALE / 4);
g->geometry.y_offset = j * (PANGO_SCALE / 4);
}
cairo_move_to (cr, 0, j * logical.height);
pango_cairo_show_layout (cr, layout);
}
cairo_destroy (cr);
pango_layout_iter_free (iter);
g_object_unref (layout);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
g_object_unref (pixbuf);
cairo_surface_destroy (surface);
}
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
pango_font_description_free (desc);
}
static void
update_buttons (void)
{
gtk_widget_set_sensitive (up_button, scale < 32);
gtk_widget_set_sensitive (down_button, scale > 1);
}
static void
scale_up (void)
{
scale += 1;
update_buttons ();
update_image ();
}
static void
scale_down (void)
{
scale -= 1;
update_buttons ();
update_image ();
}
GtkWidget *
do_fontrendering (GtkWidget *do_widget)
{
if (!window)
{
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/fontrendering/fontrendering.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
hinting = GTK_WIDGET (gtk_builder_get_object (builder, "hinting"));
hint_metrics = GTK_WIDGET (gtk_builder_get_object (builder, "hint_metrics"));
text_radio = GTK_WIDGET (gtk_builder_get_object (builder, "text_radio"));
show_grid = GTK_WIDGET (gtk_builder_get_object (builder, "show_grid"));
show_extents = GTK_WIDGET (gtk_builder_get_object (builder, "show_extents"));
g_signal_connect (up_button, "clicked", G_CALLBACK (scale_up), NULL);
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_grid, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
update_image ();
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="scale_adj">
<property name="upper">24</property>
<property name="step-increment">1</property>
<property name="page-increment">4</property>
</object>
<object class="GtkWindow" id="window">
<property name="default-width">600</property>
<property name="default-height">300</property>
<property name="title">Font rendering</property>
<child>
<object class="GtkGrid">
<property name="margin-top">10</property>
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Text</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="text">Fonts render</property>
<layout>
<property name="left-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="margin-start">10</property>
<property name="label">Font</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<layout>
<property name="left-attach">3</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<child>
<object class="GtkLabel">
<property name="label">Hint Metrics</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="active">1</property>
<child>
<object class="GtkLabel">
<property name="label">Show Extents</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<child>
<object class="GtkLabel">
<property name="label">Show Grid</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<style>
<class name="circular"/>
</style>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="left-attach">6</property>
</layout>
</object>
</child>
<child>
<object class="GtkBox">
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkRadioButton" id="text_radio">
<property name="draw-indicator">0</property>
<property name="label">Text</property>
</object>
</child>
<child>
<object class="GtkRadioButton" id="grid_radio">
<property name="draw-indicator">0</property>
<property name="label">Grid</property>
<property name="group">text_radio</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column-span">7</property>
</layout>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="propagate-natural-height">1</property>
<property name="shadow-type">in</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkPicture" id="image">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="can-shrink">0</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="column-span">7</property>
</layout>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -414,7 +414,7 @@ draw_menubar (GtkWidget *widget,
frame_context = get_style (NULL, "frame");
border_context = get_style (frame_context, "border");
/* This information is taken from the GtkMenuBar docs, see "CSS nodes" */
/* This information is taken from the GtkPopoverMenuBar docs, see "CSS nodes" */
menubar_context = get_style (NULL, "menubar");
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
menuitem_context = get_style (menubar_context, "menuitem");
@@ -829,7 +829,6 @@ draw_spinbutton (GtkWidget *widget,
GtkStyleContext *down_context;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GdkPixbuf *pixbuf;
GdkTexture *texture;
gint icon_width, icon_height, icon_size;
gint button_width;
@@ -857,26 +856,22 @@ draw_spinbutton (GtkWidget *widget,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL);
texture = gdk_texture_new_for_pixbuf (pixbuf);
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL));
g_object_unref (icon_info);
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (up_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
g_object_unref (texture);
gtk_style_context_get (down_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL);
texture = gdk_texture_new_for_pixbuf (pixbuf);
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL));
g_object_unref (icon_info);
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (down_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (pixbuf);
g_object_unref (texture);
g_object_unref (down_context);

View File

@@ -94,9 +94,12 @@ drawing_area_draw (GtkDrawingArea *area,
cairo_pattern_t *pat;
cairo_matrix_t matrix;
gdouble angle, scale;
gdouble x_center, y_center;
gtk_gesture_get_bounding_box_center (GTK_GESTURE (zoom), &x_center, &y_center);
cairo_get_matrix (cr, &matrix);
cairo_matrix_translate (&matrix, width / 2, height / 2);
cairo_matrix_translate (&matrix, x_center, y_center);
cairo_save (cr);

View File

@@ -241,7 +241,7 @@ realize (GtkWidget *widget)
fragment_path = "/glarea/glarea-gl.fs.glsl";
}
init_buffers (&position_buffer, NULL);
init_buffers (NULL, &position_buffer);
init_shaders (vertex_path, fragment_path, &program, &mvp_location);
}

View File

@@ -41,6 +41,7 @@ show_page (GtkTextBuffer *buffer,
gtk_text_buffer_set_text (buffer, "", 0);
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
gtk_text_buffer_begin_irreversible_action (buffer);
if (page == 1)
{
gtk_text_buffer_insert (buffer, &iter, "Some text to show that simple ", -1);
@@ -73,6 +74,7 @@ show_page (GtkTextBuffer *buffer,
"so that related items of information are connected.\n", -1);
insert_link (buffer, &iter, "Go back", 1);
}
gtk_text_buffer_end_irreversible_action (buffer);
}
/* Looks at all tags covering the position of iter in the text view,
@@ -258,6 +260,7 @@ do_hypertext (GtkWidget *do_widget)
gtk_widget_add_controller (view, controller);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_enable_undo (buffer, TRUE);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),

229
demos/gtk-demo/iconscroll.c Normal file
View File

@@ -0,0 +1,229 @@
/* Benchmark/Scrolling
*
* This demo scrolls a view with various content.
*/
#include <gtk/gtk.h>
static guint tick_cb;
static GtkAdjustment *hadjustment;
static GtkAdjustment *vadjustment;
static GtkWidget *window = NULL;
static GtkWidget *scrolledwindow;
static int selected;
#define N_WIDGET_TYPES 4
static int hincrement = 5;
static int vincrement = 5;
static gboolean
scroll_cb (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer data)
{
double value;
value = gtk_adjustment_get_value (vadjustment);
if (value + vincrement <= gtk_adjustment_get_lower (vadjustment) ||
(value + vincrement >= gtk_adjustment_get_upper (vadjustment) - gtk_adjustment_get_page_size (vadjustment)))
vincrement = - vincrement;
gtk_adjustment_set_value (vadjustment, value + vincrement);
value = gtk_adjustment_get_value (hadjustment);
if (value + hincrement <= gtk_adjustment_get_lower (hadjustment) ||
(value + hincrement >= gtk_adjustment_get_upper (hadjustment) - gtk_adjustment_get_page_size (hadjustment)))
hincrement = - hincrement;
gtk_adjustment_set_value (hadjustment, value + hincrement);
return G_SOURCE_CONTINUE;
}
extern GtkWidget *create_icon (void);
static void
populate_icons (void)
{
GtkWidget *grid;
int top, left;
grid = gtk_grid_new ();
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
g_object_set (grid, "margin", 10, NULL);
gtk_grid_set_row_spacing (GTK_GRID (grid), 10);
gtk_grid_set_column_spacing (GTK_GRID (grid), 10);
for (top = 0; top < 100; top++)
for (left = 0; left < 15; left++)
gtk_grid_attach (GTK_GRID (grid), create_icon (), left, top, 1, 1);
hincrement = 0;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), grid);
}
static char *content;
static gsize content_len;
extern void fontify (GtkTextBuffer *buffer);
static void
populate_text (gboolean hilight)
{
GtkWidget *textview;
GtkTextBuffer *buffer;
if (!content)
{
GBytes *bytes;
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
content = g_bytes_unref_to_data (bytes, &content_len);
}
buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_set_text (buffer, content, (int)content_len);
if (hilight)
fontify (buffer);
textview = gtk_text_view_new ();
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
hincrement = 0;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), textview);
}
static void
populate_image (void)
{
GtkWidget *image;
if (!content)
{
GBytes *bytes;
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
content = g_bytes_unref_to_data (bytes, &content_len);
}
image = gtk_picture_new_for_resource ("/sliding_puzzle/portland-rose.jpg");
gtk_picture_set_can_shrink (GTK_PICTURE (image), FALSE);
hincrement = 5;
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (scrolledwindow), image);
}
static void
set_widget_type (int type)
{
if (tick_cb)
gtk_widget_remove_tick_callback (window, tick_cb);
if (gtk_bin_get_child (GTK_BIN (scrolledwindow)))
gtk_container_remove (GTK_CONTAINER (scrolledwindow),
gtk_bin_get_child (GTK_BIN (scrolledwindow)));
selected = type;
switch (selected)
{
case 0:
gtk_window_set_title (GTK_WINDOW (window), "Scrolling icons");
populate_icons ();
break;
case 1:
gtk_window_set_title (GTK_WINDOW (window), "Scrolling plain text");
populate_text (FALSE);
break;
case 2:
gtk_window_set_title (GTK_WINDOW (window), "Scrolling complex text");
populate_text (TRUE);
break;
case 3:
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a big image");
populate_image ();
break;
default:
g_assert_not_reached ();
}
tick_cb = gtk_widget_add_tick_callback (window, scroll_cb, NULL, NULL);
}
void
iconscroll_next_clicked_cb (GtkButton *source,
gpointer user_data)
{
int new_index;
if (selected + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = selected + 1;
set_widget_type (new_index);
}
void
iconscroll_prev_clicked_cb (GtkButton *source,
gpointer user_data)
{
int new_index;
if (selected - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected - 1;
set_widget_type (new_index);
}
GtkWidget *
do_iconscroll (GtkWidget *do_widget)
{
if (!window)
{
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/iconscroll/iconscroll.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
scrolledwindow = GTK_WIDGET (gtk_builder_get_object (builder, "scrolledwindow"));
gtk_widget_realize (window);
hadjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "hadjustment"));
vadjustment = GTK_ADJUSTMENT (gtk_builder_get_object (builder, "vadjustment"));
set_widget_type (0);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="resizable">0</property>
<property name="default-width">500</property>
<property name="default-height">500</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="show-title-buttons">1</property>
<child>
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property>
<signal name="clicked" handler="iconscroll_prev_clicked_cb"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property>
<signal name="clicked" handler="iconscroll_next_clicked_cb"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
<property name="hscrollbar-policy">never</property>
<property name="hadjustment">
<object class="GtkAdjustment" id="hadjustment"/>
</property>
<property name="vadjustment">
<object class="GtkAdjustment" id="vadjustment"/>
</property>
</object>
</child>
</object>
</interface>

View File

@@ -68,7 +68,7 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_INFO);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_INFO");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
@@ -80,7 +80,7 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_WARNING);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_WARNING");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
@@ -94,9 +94,10 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_QUESTION);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_QUESTION");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
gtk_info_bar_set_default_response (GTK_INFO_BAR (bar), GTK_RESPONSE_OK);
button = gtk_toggle_button_new_with_label ("Question");
g_object_bind_property (bar, "revealed", button, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
@@ -106,7 +107,7 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_ERROR);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_ERROR");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);
@@ -119,7 +120,7 @@ do_infobar (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (vbox), bar);
gtk_info_bar_set_message_type (GTK_INFO_BAR (bar), GTK_MESSAGE_OTHER);
label = gtk_label_new ("This is an info bar with message type GTK_MESSAGE_OTHER");
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_container_add (GTK_CONTAINER (gtk_info_bar_get_content_area (GTK_INFO_BAR (bar))), label);

View File

@@ -18,6 +18,10 @@
#include "language-names.h"
#ifndef ISO_CODES_PREFIX
#define ISO_CODES_PREFIX "/usr"
#endif
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
@@ -202,7 +206,7 @@ languages_variant_init (const char *variant)
else
g_warning ("Failed to load '%s': %s\n", filename, error->message);
g_free (error);
g_clear_error (&error);
g_free (filename);
g_free (buf);
}

View File

@@ -1,19 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkMenu" id="menu1">
<child>
<object class="GtkMenuItem" id="menuitem1">
<property name="label" translatable="yes">Email message</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem2">
<property name="label" translatable="yes">Embed message</property>
<property name="use-underline">1</property>
</object>
</child>
</object>
<menu id="menu1">
<section>
<item>
<attribute name="label" translatable="yes">Email message</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Embed message</attribute>
</item>
</section>
</menu>
<template class="GtkMessageRow" parent="GtkListBoxRow">
<child>
<object class="GtkGrid" id="grid1">
@@ -171,7 +167,7 @@
<object class="GtkMenuButton" id="more-button">
<property name="can-focus">1</property>
<property name="receives-default">1</property>
<property name="popup">menu1</property>
<property name="menu-model">menu1</property>
<property name="relief">none</property>
<property name="label" translatable="yes">More...</property>
</object>

View File

@@ -487,7 +487,7 @@ parse_chars (gchar *text,
}
/* While not as cool as c-mode, this will do as a quick attempt at highlighting */
static void
void
fontify (GtkTextBuffer *source_buffer)
{
GtkTextIter start_iter, next_iter, tmp_iter;
@@ -639,7 +639,7 @@ display_nothing (const char *resource)
str = g_strdup_printf ("The lazy GTK developers forgot to add a way to display the resource '%s'", resource);
widget = gtk_label_new (str);
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
gtk_label_set_wrap (GTK_LABEL (widget), TRUE);
g_free (str);
@@ -748,6 +748,9 @@ load_file (const gchar *demoname,
source_buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_begin_irreversible_action (info_buffer);
gtk_text_buffer_begin_irreversible_action (source_buffer);
resource_filename = g_strconcat ("/sources/", filename, NULL);
bytes = g_resources_lookup_data (resource_filename, 0, &err);
g_free (resource_filename);
@@ -880,9 +883,11 @@ load_file (const gchar *demoname,
fontify (source_buffer);
gtk_text_buffer_end_irreversible_action (source_buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (source_view), source_buffer);
g_object_unref (source_buffer);
gtk_text_buffer_end_irreversible_action (info_buffer);
gtk_text_view_set_buffer (GTK_TEXT_VIEW (info_view), info_buffer);
g_object_unref (info_buffer);
}
@@ -998,32 +1003,6 @@ row_activated_cb (GtkWidget *tree_view,
run_example_for_row (window, model, &iter);
}
static void
start_cb (GtkMenuItem *item, GtkWidget *scrollbar)
{
GtkAdjustment *adj;
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
}
static void
end_cb (GtkMenuItem *item, GtkWidget *scrollbar)
{
GtkAdjustment *adj;
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
}
static gboolean
scrollbar_popup (GtkWidget *scrollbar, GtkWidget *menu)
{
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
return TRUE;
}
static void
activate (GApplication *app)
{
@@ -1032,23 +1011,12 @@ activate (GApplication *app)
GtkWidget *widget;
GtkTreeModel *model;
GtkTreeIter iter;
GError *error = NULL;
GtkWidget *sw;
GtkWidget *scrollbar;
GtkWidget *menu;
GtkWidget *item;
static GActionEntry win_entries[] = {
{ "run", activate_run, NULL, NULL, NULL }
};
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/ui/main.ui", &error);
if (error != NULL)
{
g_critical ("%s", error->message);
exit (1);
}
builder = gtk_builder_new_from_resource ("/ui/main.ui");
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), window);
@@ -1064,21 +1032,6 @@ activate (GApplication *app)
treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
sw = (GtkWidget *)gtk_builder_get_object (builder, "source-scrolledwindow");
scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (sw));
menu = gtk_menu_new ();
item = gtk_menu_item_new_with_label ("Start");
g_signal_connect (item, "activate", G_CALLBACK (start_cb), scrollbar);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
item = gtk_menu_item_new_with_label ("End");
g_signal_connect (item, "activate", G_CALLBACK (end_cb), scrollbar);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
g_signal_connect (scrollbar, "popup-menu", G_CALLBACK (scrollbar_popup), menu);
load_file (gtk_demos[0].name, gtk_demos[0].filename);
populate_model (model);

View File

@@ -29,8 +29,10 @@ source_toggled (GtkToggleButton *button)
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_begin_irreversible_action (buffer);
gtk_text_buffer_delete (buffer, &start, &end);
gtk_text_buffer_insert_markup (buffer, &start, markup, -1);
gtk_text_buffer_end_irreversible_action (buffer);
g_free (markup);
gtk_stack_set_visible_child_name (GTK_STACK (stack), "formatted");
@@ -106,11 +108,15 @@ do_markup (GtkWidget *do_widget)
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_begin_irreversible_action (buffer);
gtk_text_buffer_insert_markup (buffer, &iter, markup, -1);
gtk_text_buffer_end_irreversible_action (buffer);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view2));
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_begin_irreversible_action (buffer);
gtk_text_buffer_insert (buffer, &iter, markup, -1);
gtk_text_buffer_end_irreversible_action (buffer);
g_bytes_unref (bytes);

View File

@@ -1,147 +0,0 @@
/* Menus
*
* There are several widgets involved in displaying menus. The
* GtkMenuBar widget is a menu bar, which normally appears horizontally
* at the top of an application, but can also be layed out vertically.
* The GtkMenu widget is the actual menu that pops up. Both GtkMenuBar
* and GtkMenu are subclasses of GtkMenuShell; a GtkMenuShell contains
* menu items (GtkMenuItem). Each menu item contains text and/or images
* and can be selected by the user.
*
* There are several kinds of menu item, including plain GtkMenuItem,
* GtkCheckMenuItem which can be checked/unchecked, GtkRadioMenuItem
* which is a check menu item that's in a mutually exclusive group,
* GtkSeparatorMenuItem which is a separator bar, GtkTearoffMenuItem
* which allows a GtkMenu to be torn off, and GtkImageMenuItem which
* can place a GtkImage or other widget next to the menu text.
*
* 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.
*/
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <stdio.h>
static GtkWidget *
create_menu (gint depth)
{
GtkWidget *menu;
GtkRadioMenuItem *last_item;
char buf[32];
int i, j;
if (depth < 1)
return NULL;
menu = gtk_menu_new ();
last_item = NULL;
for (i = 0, j = 1; i < 5; i++, j++)
{
GtkWidget *menu_item;
sprintf (buf, "item %2d - %d", depth, j);
menu_item = gtk_radio_menu_item_new_with_label_from_widget (NULL, buf);
gtk_radio_menu_item_join_group (GTK_RADIO_MENU_ITEM (menu_item), last_item);
last_item = GTK_RADIO_MENU_ITEM (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
gtk_widget_show (menu_item);
if (i == 3)
gtk_widget_set_sensitive (menu_item, FALSE);
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_item), create_menu (depth - 1));
}
return menu;
}
static void
change_orientation (GtkWidget *button,
GtkWidget *menubar)
{
GtkWidget *parent;
GtkOrientation orientation;
parent = gtk_widget_get_parent (menubar);
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), 1 - orientation);
}
static GtkWidget *window = NULL;
GtkWidget *
do_menus (GtkWidget *do_widget)
{
GtkWidget *box;
GtkWidget *box1;
GtkWidget *box2;
GtkWidget *button;
if (!window)
{
GtkWidget *menubar;
GtkWidget *menu;
GtkWidget *menuitem;
GtkAccelGroup *accel_group;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Menus");
g_signal_connect (window, "destroy",
G_CALLBACK(gtk_widget_destroyed), &window);
accel_group = gtk_accel_group_new ();
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (window), box);
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (box), box1);
menubar = gtk_menu_bar_new ();
gtk_widget_set_hexpand (menubar, TRUE);
gtk_container_add (GTK_CONTAINER (box1), menubar);
menu = create_menu (2);
menuitem = gtk_menu_item_new_with_label ("test\nline2");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
menuitem = gtk_menu_item_new_with_label ("foo");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
menuitem = gtk_menu_item_new_with_label ("bar");
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_container_add (GTK_CONTAINER (box1), box2);
button = gtk_button_new_with_label ("Flip");
g_signal_connect (button, "clicked",
G_CALLBACK (change_orientation), menubar);
gtk_container_add (GTK_CONTAINER (box2), button);
button = gtk_button_new_with_label ("Close");
g_signal_connect_swapped (button, "clicked",
G_CALLBACK(gtk_widget_destroy), window);
gtk_container_add (GTK_CONTAINER (box2), button);
gtk_window_set_default_widget (GTK_WINDOW (window), button);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -4,7 +4,6 @@ demos = files([
'application_demo.c',
'assistant.c',
'builder.c',
'changedisplay.c',
'clipboard.c',
'colorsel.c',
'combobox.c',
@@ -22,17 +21,19 @@ demos = files([
'drawingarea.c',
'dnd.c',
'editable_cells.c',
'entry_buffer.c',
'entry_completion.c',
'entry_undo.c',
'expander.c',
'filtermodel.c',
'fishbowl.c',
'fixed.c',
'fontrendering.c',
'foreigndrawing.c',
'gestures.c',
'glarea.c',
'headerbar.c',
'hypertext.c',
'iconscroll.c',
'iconview.c',
'iconview_edit.c',
'images.c',
@@ -42,7 +43,6 @@ demos = files([
'flowbox.c',
'list_store.c',
'markup.c',
'menus.c',
'modelbutton.c',
'overlay.c',
'overlay2.c',
@@ -71,6 +71,7 @@ demos = files([
'tabs.c',
'tagged_entry.c',
'textmask.c',
'textundo.c',
'textview.c',
'textscroll.c',
'themes.c',

View File

@@ -378,7 +378,7 @@
378|GTK+ and friends|GTKtoolkit|#GNUStep gets #GTK+ theming http://is.gd/95vHl more at http://is.gd/95wt8|1267029498|0||0|1
379|GTK+ and friends|GTKtoolkit|GTK+ 2.19.6 released: http://mail.gnome.org/archives/gtk-devel-list/2010-February/msg00050.html #gtk|1266966985|0||0|0
380|GTK+ and friends|GTKtoolkit|Did you know that #GTK+ is the official toolkit for the #LiMo software stack? http://bit.ly/cuEdHx|1266925406|0||0|0
381|GTK+ and friends|GTKtoolkit|@lmedinas publishes a #javascript #example on how to put an status icon with #Gtk+ http://bit.ly/9py1uC Thanks a lot Luis!|1266886644|0||1|1
381|GTK+ and friends|GTKtoolkit|@lmedinas publishes a #javascript #example on how to put a status icon with #Gtk+ http://bit.ly/9py1uC Thanks a lot Luis!|1266886644|0||1|1
382|GTK+ and friends|GTKtoolkit|♺ @ebassi: I should really finish up the GDom API as well|1266880653|0||0|0
383|GTK+ and friends|GTKtoolkit|♺ @ebassi: I hope to work on this for the next GIO release, and the GTK+ side for 3.0|1266880641|0||0|0
384|GTK+ and friends|GTKtoolkit|♺ @ebassi: just updated the ApplicationClass design wiki page with the stuff @Cwiiis did for Mx - http://bit.ly/cfAOJk|1266880559|0||0|0

View File

@@ -14,8 +14,8 @@
#include <gtk/gtk.h>
static void
tool_clicked (GtkButton *button)
void
modelbutton_tool_clicked (GtkButton *button)
{
gboolean active;
@@ -40,8 +40,6 @@ do_modelbutton (GtkWidget *do_widget)
GActionGroup *actions;
builder = gtk_builder_new_from_resource ("/modelbutton/modelbutton.ui");
gtk_builder_add_callback_symbol (builder, "tool_clicked", G_CALLBACK (tool_clicked));
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -14,34 +14,19 @@
<child>
<object class="GtkMenuButton">
<property name="popover">thing_a</property>
<child>
<object class="GtkLabel">
<property name="label">Color</property>
<property name="hexpand">1</property>
</object>
</child>
<property name="label">Color</property>
</object>
</child>
<child>
<object class="GtkMenuButton">
<property name="popover">thing_b</property>
<child>
<object class="GtkLabel">
<property name="label">Flavors</property>
<property name="hexpand">1</property>
</object>
</child>
<property name="label">Flavors</property>
</object>
</child>
<child>
<object class="GtkMenuButton">
<property name="popover">thing_c</property>
<child>
<object class="GtkLabel">
<property name="label">Tools</property>
<property name="hexpand">1</property>
</object>
</child>
<property name="label">Tools</property>
</object>
</child>
</object>
@@ -57,7 +42,6 @@
<property name="action-name">win.color</property>
<property name="action-target">&apos;red&apos;</property>
<property name="text">Red</property>
<property name="inverted">1</property>
</object>
</child>
<child>
@@ -65,7 +49,6 @@
<property name="action-name">win.color</property>
<property name="action-target">&apos;green&apos;</property>
<property name="text">Green</property>
<property name="inverted">1</property>
</object>
</child>
<child>
@@ -73,7 +56,6 @@
<property name="action-name">win.color</property>
<property name="action-target">&apos;blue&apos;</property>
<property name="text">Blue</property>
<property name="inverted">1</property>
</object>
</child>
</object>
@@ -119,21 +101,21 @@
<object class="GtkModelButton">
<property name="text">Hammer</property>
<property name="role">check</property>
<signal name="clicked" handler="tool_clicked"/>
<signal name="clicked" handler="modelbutton_tool_clicked"/>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Screwdriver</property>
<property name="role">check</property>
<signal name="clicked" handler="tool_clicked"/>
<signal name="clicked" handler="modelbutton_tool_clicked"/>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Drill</property>
<property name="role">check</property>
<signal name="clicked" handler="tool_clicked"/>
<signal name="clicked" handler="modelbutton_tool_clicked"/>
</object>
</child>
</object>

View File

@@ -6,7 +6,7 @@
* GTK uses for videos. This allows treating the icon like a
* regular video, so we can for example attach controls to it.
*
* After all, what good is an media_stream if one cannot pause
* After all, what good is a media_stream if one cannot pause
* it.
*/

View File

@@ -69,7 +69,6 @@ do_revealer (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/revealer/revealer.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -18,7 +18,6 @@ do_scale (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/scale/scale.ui");
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -75,11 +75,11 @@
<property name="adjustment">adjustment2</property>
<property name="hexpand">1</property>
<marks>
<mark value="0" position="bottom"/>
<mark value="1" position="bottom"/>
<mark value="2" position="bottom"/>
<mark value="3" position="bottom"/>
<mark value="4" position="bottom"/>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>
<mark value="2" position="bottom"></mark>
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
</marks>
<accessibility>
<relation type="labelled-by" target="label_marks"/>
@@ -115,11 +115,11 @@
<relation type="labelled-by" target="label_discrete"/>
</accessibility>
<marks>
<mark value="0" position="bottom"/>
<mark value="1" position="bottom"/>
<mark value="2" position="bottom"/>
<mark value="3" position="bottom"/>
<mark value="4" position="bottom"/>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>
<mark value="2" position="bottom"></mark>
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
</marks>
<layout>
<property name="left-attach">1</property>

View File

@@ -25,44 +25,44 @@ show_shortcuts (GtkWidget *window,
g_object_unref (builder);
}
static void
builder_shortcuts (GtkWidget *window)
void
shortcuts_builder_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-builder", NULL);
}
static void
gedit_shortcuts (GtkWidget *window)
void
shortcuts_gedit_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-gedit", NULL);
}
static void
clocks_shortcuts (GtkWidget *window)
void
shortcuts_clocks_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-clocks", NULL);
}
static void
clocks_shortcuts_stopwatch (GtkWidget *window)
void
shortcuts_clocks_shortcuts_stopwatch (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-clocks", "stopwatch");
}
static void
boxes_shortcuts (GtkWidget *window)
void
shortcuts_boxes_shortcuts (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", NULL);
}
static void
boxes_shortcuts_wizard (GtkWidget *window)
void
shortcuts_boxes_shortcuts_wizard (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", "wizard");
}
static void
boxes_shortcuts_display (GtkWidget *window)
void
shortcuts_boxes_shortcuts_display (GtkWidget *window)
{
show_shortcuts (window, "shortcuts-boxes", "display");
}
@@ -86,16 +86,6 @@ do_shortcuts (GtkWidget *do_widget)
GtkBuilder *builder;
builder = gtk_builder_new_from_resource ("/shortcuts/shortcuts.ui");
gtk_builder_add_callback_symbols (builder,
"builder_shortcuts", G_CALLBACK (builder_shortcuts),
"gedit_shortcuts", G_CALLBACK (gedit_shortcuts),
"clocks_shortcuts", G_CALLBACK (clocks_shortcuts),
"clocks_shortcuts_stopwatch", G_CALLBACK (clocks_shortcuts_stopwatch),
"boxes_shortcuts", G_CALLBACK (boxes_shortcuts),
"boxes_shortcuts_wizard", G_CALLBACK (boxes_shortcuts_wizard),
"boxes_shortcuts_display", G_CALLBACK (boxes_shortcuts_display),
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -10,43 +10,43 @@
<child>
<object class="GtkButton">
<property name="label">Builder</property>
<signal name="clicked" handler="builder_shortcuts" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_builder_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">GEdit</property>
<signal name="clicked" handler="gedit_shortcuts" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_gedit_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Clocks - All</property>
<signal name="clicked" handler="clocks_shortcuts" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_clocks_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Clocks - Stopwatch</property>
<signal name="clicked" handler="clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_clocks_shortcuts_stopwatch" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Boxes</property>
<signal name="clicked" handler="boxes_shortcuts" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_boxes_shortcuts" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Boxes - Wizard</property>
<signal name="clicked" handler="boxes_shortcuts_wizard" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_boxes_shortcuts_wizard" swapped="1" object="window1"/>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Boxes - Display</property>
<signal name="clicked" handler="boxes_shortcuts_display" swapped="1" object="window1"/>
<signal name="clicked" handler="shortcuts_boxes_shortcuts_display" swapped="1" object="window1"/>
</object>
</child>
</object>

View File

@@ -54,10 +54,7 @@ do_sidebar (GtkWidget *do_widget)
stack = gtk_stack_new ();
gtk_stack_set_transition_type (GTK_STACK (stack), GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN);
gtk_stack_sidebar_set_stack (GTK_STACK_SIDEBAR (sidebar), GTK_STACK (stack));
/* Separator between sidebar and stack */
widget = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
gtk_container_add (GTK_CONTAINER(box), widget);
gtk_widget_set_hexpand (stack, TRUE);
gtk_container_add (GTK_CONTAINER (box), stack);
@@ -66,6 +63,7 @@ do_sidebar (GtkWidget *do_widget)
if (i == 0)
{
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
gtk_style_context_add_class (gtk_widget_get_style_context (widget), "icon-dropshadow");
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
}
else

View File

@@ -11,9 +11,9 @@
#include <math.h>
#include <stdlib.h>
static gint
hex_spin_input (GtkSpinButton *spin_button,
gdouble *new_val)
gint
spinbutton_hex_spin_input (GtkSpinButton *spin_button,
gdouble *new_val)
{
const gchar *buf;
gchar *err;
@@ -28,8 +28,8 @@ hex_spin_input (GtkSpinButton *spin_button,
return TRUE;
}
static gint
hex_spin_output (GtkSpinButton *spin_button)
gint
spinbutton_hex_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
gchar *buf;
@@ -48,9 +48,9 @@ hex_spin_output (GtkSpinButton *spin_button)
return TRUE;
}
static gint
time_spin_input (GtkSpinButton *spin_button,
gdouble *new_val)
gint
spinbutton_time_spin_input (GtkSpinButton *spin_button,
gdouble *new_val)
{
const gchar *text;
gchar **str;
@@ -87,8 +87,8 @@ time_spin_input (GtkSpinButton *spin_button,
return TRUE;
}
static gint
time_spin_output (GtkSpinButton *spin_button)
gint
spinbutton_time_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
gchar *buf;
@@ -121,9 +121,9 @@ static gchar *month[12] = {
"December"
};
static gint
month_spin_input (GtkSpinButton *spin_button,
gdouble *new_val)
gint
spinbutton_month_spin_input (GtkSpinButton *spin_button,
gdouble *new_val)
{
gint i;
gchar *tmp1, *tmp2;
@@ -150,8 +150,8 @@ month_spin_input (GtkSpinButton *spin_button,
return TRUE;
}
static gint
month_spin_output (GtkSpinButton *spin_button)
gint
spinbutton_month_spin_output (GtkSpinButton *spin_button)
{
GtkAdjustment *adjustment;
gdouble value;
@@ -191,15 +191,6 @@ do_spinbutton (GtkWidget *do_widget)
GtkWidget *label;
builder = gtk_builder_new_from_resource ("/spinbutton/spinbutton.ui");
gtk_builder_add_callback_symbols (builder,
"hex_spin_input", G_CALLBACK (hex_spin_input),
"hex_spin_output", G_CALLBACK (hex_spin_output),
"time_spin_input", G_CALLBACK (time_spin_input),
"time_spin_output", G_CALLBACK (time_spin_output),
"month_spin_input", G_CALLBACK (month_spin_input),
"month_spin_output", G_CALLBACK (month_spin_output),
NULL);
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -83,8 +83,8 @@
<property name="halign">start</property>
<property name="width-chars">4</property>
<property name="adjustment">hex_adjustment</property>
<signal name="input" handler="hex_spin_input"/>
<signal name="output" handler="hex_spin_output"/>
<signal name="input" handler="spinbutton_hex_spin_input"/>
<signal name="output" handler="spinbutton_hex_spin_output"/>
<property name="wrap">1</property>
<layout>
<property name="left-attach">1</property>
@@ -119,8 +119,8 @@
<property name="halign">start</property>
<property name="width-chars">5</property>
<property name="adjustment">time_adjustment</property>
<signal name="input" handler="time_spin_input"/>
<signal name="output" handler="time_spin_output"/>
<signal name="input" handler="spinbutton_time_spin_input"/>
<signal name="output" handler="spinbutton_time_spin_output"/>
<property name="wrap">1</property>
<layout>
<property name="left-attach">1</property>
@@ -154,8 +154,8 @@
<object class="GtkSpinButton" id="month_spin">
<property name="halign">start</property>
<property name="width-chars">9</property>
<signal name="input" handler="month_spin_input"/>
<signal name="output" handler="month_spin_output"/>
<signal name="input" handler="spinbutton_month_spin_input"/>
<signal name="output" handler="spinbutton_month_spin_output"/>
<property name="adjustment">month_adjustment</property>
<property name="wrap">1</property>
<property name="update-policy">if-valid</property>

View File

@@ -18,7 +18,6 @@ do_stack (GtkWidget *do_widget)
GtkBuilder *builder;
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_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

71
demos/gtk-demo/textundo.c Normal file
View File

@@ -0,0 +1,71 @@
/* Text View/Undo and Redo
*
* The GtkTextView supports undo and redo through the use of a
* GtkTextBuffer. You can enable or disable undo support using
* gtk_text_buffer_set_enable_undo().
*
* Use Primary+Z to undo and Primary+Shift+Z or Primary+Y to
* redo previously undone operations.
*/
#include <gtk/gtk.h>
#include <stdlib.h> /* for exit() */
GtkWidget *
do_textundo (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *view;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkTextIter iter;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
gtk_window_set_title (GTK_WINDOW (window), "TextView Undo");
view = gtk_text_view_new ();
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_enable_undo (buffer, TRUE);
/* this text cannot be undone */
gtk_text_buffer_begin_irreversible_action (buffer);
gtk_text_buffer_get_start_iter (buffer, &iter);
gtk_text_buffer_insert (buffer, &iter,
"Type to add more text.\n"
"Use Primary+Z to undo and Primary+Shift+Z to redo a previously undone action.\n"
"\n",
-1);
gtk_text_buffer_end_irreversible_action (buffer);
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 (window), sw);
gtk_container_add (GTK_CONTAINER (sw), view);
}
if (!gtk_widget_get_visible (window))
{
gtk_widget_show (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

View File

@@ -128,24 +128,23 @@ insert_text (GtkTextBuffer *buffer)
{
GtkTextIter iter;
GtkTextIter start, end;
GdkPixbuf *pixbuf;
GdkTexture *texture;
GtkIconTheme *icon_theme;
icon_theme = gtk_icon_theme_get_default ();
pixbuf = gtk_icon_theme_load_icon (icon_theme,
"gtk3-demo",
32,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL);
g_assert (pixbuf);
texture = gdk_texture_new_for_pixbuf (pixbuf);
texture = GDK_TEXTURE (gtk_icon_theme_load_icon (icon_theme,
"gtk3-demo",
32,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL));
g_assert (texture);
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.
*/
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
gtk_text_buffer_begin_irreversible_action (buffer);
gtk_text_buffer_insert (buffer, &iter,
"The text widget can display text with all kinds of nifty attributes. "
"It also supports multiple views of the same buffer; this demo is "
@@ -379,7 +378,8 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_get_bounds (buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (buffer, "word_wrap", &start, &end);
g_object_unref (pixbuf);
gtk_text_buffer_end_irreversible_action (buffer);
g_object_unref (texture);
}

View File

@@ -6,236 +6,235 @@
<object class="GtkHeaderBar" id="header">
<property name="show-title-buttons">1</property>
<child type="end">
<object class="GtkLabel" id="fps">
</object>
<object class="GtkLabel" id="fps"/>
</child>
</object>
</child>
<child>
<object class="GtkGrid" id="grid">
<property name="margin">10</property>
<property name="row-spacing">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="show-arrow">0</property>
<style>
<class name="primary-toolbar"/>
</style>
<object class="GtkGrid" id="grid">
<property name="margin">10</property>
<property name="row-spacing">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find</property>
<property name="is-important">1</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkEntry" id="entry1">
<property name="can-focus">1</property>
<property name="width-chars">10</property>
<property name="invisible-char">•</property>
<property name="placeholder-text" translatable="yes">Search...</property>
<property name="secondary-icon-name">edit-find-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkSwitch" id="switch1">
<property name="can-focus">1</property>
<property name="valign">center</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="valign">center</property>
<property name="halign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">And I&apos;m another button</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">This is a button party!</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">go-up-symbolic</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">10</property>
<child>
<object class="GtkButton">
<property name="label">Plain</property>
<property name="halign">end</property>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="show-arrow">0</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find</property>
<property name="is-important">1</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkEntry" id="entry1">
<property name="can-focus">1</property>
<property name="width-chars">10</property>
<property name="invisible-char">•</property>
<property name="placeholder-text" translatable="yes">Search...</property>
<property name="secondary-icon-name">edit-find-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkSwitch" id="switch1">
<property name="can-focus">1</property>
<property name="valign">center</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Destructive</property>
<object class="GtkBox">
<property name="valign">center</property>
<property name="halign">center</property>
<style>
<class name="destructive-action"/>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Hi, I am a button</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">And I&apos;m another button</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">This is a button party!</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Suggested</property>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="suggested-action"/>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">go-up-symbolic</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">10</property>
<child>
<object class="GtkButton">
<property name="label">Plain</property>
<property name="halign">end</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Destructive</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
<child>
<object class="GtkButton">
<property name="label">Suggested</property>
<style>
<class name="suggested-action"/>
</style>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -2,6 +2,7 @@
<interface>
<object class="GtkGrid" id="grid">
<property name="row-spacing">10</property>
<property name="margin">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
@@ -92,6 +93,7 @@
<child>
<object class="GtkSwitch" id="switch1">
<property name="can-focus">1</property>
<property name="valign">center</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>

View File

@@ -285,7 +285,7 @@ user-trash=The icon for the user's “Trash” place in the file system
user-trash-full=The icon for the user's “Trash” in the file system, when there are items in the “Trash” waiting for disposal or recovery
emblem-system=The icon used as an emblem for directories that contain system libraries, settings, and data
avatar-default=The generic avatar icon, which is used to represent a user that doesn't have a personalized avatar
emblem-synchronizing=The icon used as an emblem to indicate that a a synchronizing operation is in process
emblem-synchronizing=The icon used as an emblem to indicate that a synchronizing operation is in process
emblem-shared=The icon used as an emblem for files and directories that are shared to other users
help-browser=The icon used for the desktop's help browsing application

View File

@@ -5,9 +5,6 @@
#include <gtk/gtk.h>
/* Drag 'n Drop */
static const char *target_table[] = {
"text/uri-list"
};
typedef struct
{
@@ -76,27 +73,11 @@ search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
gtk_tree_model_filter_refilter (win->filter_model);
}
static GdkPixbuf *
get_icon (GtkWidget *image, const gchar *name, gint size)
{
GtkIconInfo *info;
GtkStyleContext *context;
GdkPixbuf *pixbuf;
context = gtk_widget_get_style_context (image);
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, size, 0);
pixbuf = gtk_icon_info_load_symbolic_for_context (info, context, NULL, NULL);
g_object_unref (info);
return pixbuf;
}
static void
set_image (GtkWidget *image, const gchar *name, gint size)
{
gtk_image_set_from_icon_name (GTK_IMAGE (image), name);
gtk_image_set_pixel_size (GTK_IMAGE (image), size);
gtk_drag_source_set_icon_name (image, name);
}
static void
@@ -362,78 +343,107 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
gtk_list_box_unselect_all (GTK_LIST_BOX (win->context_list));
}
static void
get_image_data (GtkWidget *widget,
GdkDrag *drag,
GtkSelectionData *selection,
guint target_info,
gpointer data)
static GdkPaintable *
get_image_paintable (GtkImage *image)
{
GtkWidget *image;
const gchar *name;
gint size;
GdkPixbuf *pixbuf;
const gchar *icon_name;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
int size;
image = gtk_bin_get_child (GTK_BIN (widget));
name = gtk_image_get_icon_name (GTK_IMAGE (image));
size = gtk_image_get_pixel_size (GTK_IMAGE (image));
pixbuf = get_icon (image, name, size);
gtk_selection_data_set_pixbuf (selection, pixbuf);
g_object_unref (pixbuf);
switch (gtk_image_get_storage_type (image))
{
case GTK_IMAGE_PAINTABLE:
return g_object_ref (gtk_image_get_paintable (image));
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
size = gtk_image_get_pixel_size (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size,
GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
return gtk_icon_info_load_icon (icon_info, NULL);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
return NULL;
}
}
static void
get_scalable_image_data (GtkWidget *widget,
GdkDrag *drag,
GtkSelectionData *selection,
guint target_info,
gpointer data)
drag_begin (GtkDragSource *source,
GdkDrag *drag,
GtkWidget *widget)
{
gchar *uris[2];
GtkIconInfo *info;
GtkWidget *image;
GFile *file;
const gchar *name;
GdkPaintable *paintable;
image = gtk_bin_get_child (GTK_BIN (widget));
name = gtk_image_get_icon_name (GTK_IMAGE (image));
paintable = get_image_paintable (GTK_IMAGE (widget));
if (paintable)
{
int w, h;
w = gdk_paintable_get_intrinsic_width (paintable);
h = gdk_paintable_get_intrinsic_height (paintable);
gtk_drag_source_set_icon (source, paintable, w, h);
g_object_unref (paintable);
}
}
static void
get_texture (GValue *value,
gpointer data)
{
GdkPaintable *paintable = get_image_paintable (GTK_IMAGE (data));
if (GDK_IS_TEXTURE (paintable))
g_value_set_object (value, paintable);
}
static void
get_file (GValue *value,
gpointer data)
{
const char *name;
GtkIconInfo *info;
GFile *file;
name = gtk_image_get_icon_name (GTK_IMAGE (data));
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, -1, 0);
file = g_file_new_for_path (gtk_icon_info_get_filename (info));
uris[0] = g_file_get_uri (file);
uris[1] = NULL;
gtk_selection_data_set_uris (selection, uris);
g_free (uris[0]);
g_object_unref (info);
g_value_set_object (value, file);
g_object_unref (file);
g_object_unref (info);
}
static void
setup_image_dnd (GtkWidget *image)
{
gtk_drag_source_set (image, GDK_BUTTON1_MASK, NULL, GDK_ACTION_COPY);
gtk_drag_source_add_image_targets (image);
g_signal_connect (image, "drag-data-get", G_CALLBACK (get_image_data), NULL);
GdkContentProvider *content;
GtkDragSource *source;
source = gtk_drag_source_new ();
content = gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image);
gtk_drag_source_set_content (source, content);
g_object_unref (content);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
}
static void
setup_scalable_image_dnd (GtkWidget *image)
{
GtkWidget *parent;
GdkContentFormats *targets;
GdkContentProvider *content;
GtkDragSource *source;
parent = gtk_widget_get_parent (image);
targets = gdk_content_formats_new (target_table, G_N_ELEMENTS (target_table));
gtk_drag_source_set (parent, GDK_BUTTON1_MASK,
targets,
GDK_ACTION_COPY);
gdk_content_formats_unref (targets);
source = gtk_drag_source_new ();
content = gdk_content_provider_new_with_callback (G_TYPE_FILE, get_file, image);
gtk_drag_source_set_content (source, content);
g_object_unref (content);
g_signal_connect (parent, "drag-data-get", G_CALLBACK (get_scalable_image_data), NULL);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (source));
}
static void
@@ -443,8 +453,7 @@ icon_browser_window_init (IconBrowserWindow *win)
gtk_widget_init_template (GTK_WIDGET (win));
list = gdk_content_formats_new (NULL, 0);
list = gtk_content_formats_add_text_targets (list);
list = gdk_content_formats_new_for_gtype (G_TYPE_STRING);
gtk_icon_view_enable_model_drag_source (GTK_ICON_VIEW (win->list),
GDK_BUTTON1_MASK,
list,
@@ -456,7 +465,6 @@ icon_browser_window_init (IconBrowserWindow *win)
setup_image_dnd (win->image3);
setup_image_dnd (win->image4);
setup_image_dnd (win->image5);
setup_image_dnd (win->image6);
setup_scalable_image_dnd (win->image6);
win->contexts = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, context_free);

View File

@@ -26,9 +26,9 @@
static const char *css =
"textview.editor {"
" color: rgb(192, 197, 206);"
" caret-color: white;"
" caret-color: currentColor;"
"}"
"textview.editor text {"
"textview.editor > text {"
" background-color: rgb(43, 48, 59);"
"}"
;

View File

@@ -1003,6 +1003,9 @@ populate_flowbox (GtkWidget *flowbox)
while ((name = g_dir_read_name (dir)) != NULL)
{
if (g_str_has_suffix (name, ".xml"))
continue;
filename = g_build_filename (location, name, NULL);
file = g_file_new_for_path (filename);
stream = G_INPUT_STREAM (g_file_read (file, NULL, &error));
@@ -1017,7 +1020,7 @@ populate_flowbox (GtkWidget *flowbox)
bd = g_new (BackgroundData, 1);
bd->flowbox = flowbox;
bd->filename = filename;
gdk_pixbuf_new_from_stream_at_scale_async (stream, 110, 110, TRUE, NULL,
gdk_pixbuf_new_from_stream_at_scale_async (stream, 110, 110, TRUE, NULL,
background_loaded_cb, bd);
}
@@ -1050,27 +1053,6 @@ row_activated (GtkListBox *box, GtkListBoxRow *row)
}
}
static void
set_accel (GtkApplication *app, GtkWidget *widget)
{
GtkWidget *accel_label;
const gchar *action;
gchar **accels;
guint key;
GdkModifierType mods;
accel_label = gtk_bin_get_child (GTK_BIN (widget));
g_assert (GTK_IS_ACCEL_LABEL (accel_label));
action = gtk_actionable_get_action_name (GTK_ACTIONABLE (widget));
accels = gtk_application_get_accels_for_action (app, action);
gtk_accelerator_parse (accels[0], &key, &mods);
gtk_accel_label_set_accel (GTK_ACCEL_LABEL (accel_label), key, mods);
g_strfreev (accels);
}
typedef struct
{
GtkTextView tv;
@@ -1603,14 +1585,14 @@ reset_icon_size (GtkWidget *iv)
gtk_widget_queue_resize (iv);
}
static gchar *
scale_format_value_blank (GtkScale *scale, gdouble value)
static char *
scale_format_value_blank (GtkScale *scale, double value, gpointer user_data)
{
return g_strdup (" ");
}
static gchar *
scale_format_value (GtkScale *scale, gdouble value)
static char *
scale_format_value (GtkScale *scale, double value, gpointer user_data)
{
return g_strdup_printf ("%0.*f", 1, value);
}
@@ -1649,7 +1631,7 @@ set_up_context_popover (GtkWidget *widget,
GtkWidget *popover = gtk_popover_menu_new_from_model (widget, model);
GtkGesture *gesture;
g_object_set (popover, "has-arrow", FALSE, NULL);
gtk_popover_set_has_arrow (GTK_POPOVER (popover), FALSE);
gesture = gtk_gesture_click_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
g_signal_connect (gesture, "pressed", G_CALLBACK (clicked_cb), popover);
@@ -1660,6 +1642,7 @@ static void
activate (GApplication *app)
{
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkWindow *window;
GtkWidget *widget;
GtkWidget *widget2;
@@ -1712,23 +1695,25 @@ activate (GApplication *app)
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory4/widget-factory.ui");
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
gtk_builder_add_callback_symbol (builder, "on_record_button_toggled", (GCallback)on_record_button_toggled);
gtk_builder_add_callback_symbol (builder, "on_page_combo_changed", (GCallback)on_page_combo_changed);
gtk_builder_add_callback_symbol (builder, "on_range_from_changed", (GCallback)on_range_from_changed);
gtk_builder_add_callback_symbol (builder, "on_range_to_changed", (GCallback)on_range_to_changed);
gtk_builder_add_callback_symbol (builder, "tab_close_cb", (GCallback)tab_close_cb);
gtk_builder_add_callback_symbol (builder, "increase_icon_size", (GCallback)increase_icon_size);
gtk_builder_add_callback_symbol (builder, "decrease_icon_size", (GCallback)decrease_icon_size);
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
gtk_builder_add_callback_symbol (builder, "scale_format_value", (GCallback)scale_format_value);
gtk_builder_add_callback_symbol (builder, "scale_format_value_blank", (GCallback)scale_format_value_blank);
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
gtk_builder_connect_signals (builder, NULL);
builder = gtk_builder_new ();
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
"on_entry_icon_release", (GCallback)on_entry_icon_release,
"on_scale_button_value_changed", (GCallback)on_scale_button_value_changed,
"on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip,
"on_record_button_toggled", (GCallback)on_record_button_toggled,
"on_page_combo_changed", (GCallback)on_page_combo_changed,
"on_range_from_changed", (GCallback)on_range_from_changed,
"on_range_to_changed", (GCallback)on_range_to_changed,
"tab_close_cb", (GCallback)tab_close_cb,
"increase_icon_size", (GCallback)increase_icon_size,
"decrease_icon_size", (GCallback)decrease_icon_size,
"reset_icon_size", (GCallback)reset_icon_size,
"osd_frame_pressed", (GCallback)osd_frame_pressed,
NULL);
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
gtk_builder_add_from_resource (builder, "/org/gtk/WidgetFactory4/widget-factory.ui", NULL);
window = (GtkWindow *)gtk_builder_get_object (builder, "window");
gtk_application_add_window (GTK_APPLICATION (app), window);
@@ -1857,13 +1842,6 @@ activate (GApplication *app)
g_object_set_data (G_OBJECT (widget2), "range_to_spin", widget3);
g_object_set_data (G_OBJECT (widget), "print_button", widget4);
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "quitmenuitem")));
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "deletemenuitem")));
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "searchmenuitem")));
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "darkmenuitem")));
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "aboutmenuitem")));
set_accel (GTK_APPLICATION (app), GTK_WIDGET (gtk_builder_get_object (builder, "bgmenuitem")));
widget2 = (GtkWidget *)gtk_builder_get_object (builder, "tooltextview");
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbutton1");
@@ -1945,6 +1923,12 @@ activate (GApplication *app)
widget = (GtkWidget *)gtk_builder_get_object (builder, "extra_info_entry");
g_timeout_add (100, (GSourceFunc)pulse_it, widget);
widget = (GtkWidget *)gtk_builder_get_object (builder, "scale3");
gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value, NULL, NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "scale4");
gtk_scale_set_format_value_func (GTK_SCALE (widget), scale_format_value_blank, NULL, NULL);
widget = (GtkWidget *)gtk_builder_get_object (builder, "box_for_context");
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
set_up_context_popover (widget, model);

View File

@@ -598,10 +598,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="label" translatable="yes">checkbutton</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
@@ -666,8 +662,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<layout>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
@@ -740,7 +736,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="active">1</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
@@ -971,11 +966,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="adjustment">adjustment3</property>
<property name="restrict-to-fill-level">0</property>
<marks>
<mark value="0" position="bottom"/>
<mark value="1" position="bottom"/>
<mark value="2" position="bottom"/>
<mark value="3" position="bottom"/>
<mark value="4" position="bottom"/>
<mark value="0" position="bottom"></mark>
<mark value="1" position="bottom"></mark>
<mark value="2" position="bottom"></mark>
<mark value="3" position="bottom"></mark>
<mark value="4" position="bottom"></mark>
</marks>
</object>
</child>
@@ -1019,7 +1014,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="halign">end</property>
<signal name="format-value" handler="scale_format_value"/>
</object>
</child>
<child>
@@ -1033,7 +1027,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="fill-level">75</property>
<property name="digits">-1</property>
<property name="halign">start</property>
<signal name="format-value" handler="scale_format_value_blank"/>
</object>
</child>
</object>
@@ -1577,7 +1570,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="icon-name">org.gtk.WidgetFactory4</property>
<property name="pixel-size">256</property>
<style>
<class name="icon-dropshadow" />
<class name="icon-dropshadow"/>
</style>
</object>
</property>
@@ -1728,15 +1721,11 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="icon-name">object-select-symbolic</property>
<object class="GtkSpinButton">
<property name="adjustment">adjustment1</property>
<property name="hexpand">1</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="opacity">0</property>
</object>
</child>
</object>
@@ -1825,253 +1814,6 @@ microphone-sensitivity-medium-symbolic</property>
<property name="menu-model">menu_bar_model</property>
</object>
</child>
<child>
<object class="GtkMenuBar">
<child>
<object class="GtkMenuItem" id="menuitem1">
<property name="label" translatable="yes">File</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu" id="menu1">
<child>
<object class="GtkMenuItem" id="menuitem101">
<property name="label" translatable="yes">_New</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem102">
<property name="label" translatable="yes">_Open</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem103">
<property name="label" translatable="yes">_Save</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem104">
<property name="label" translatable="yes">Save _As</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem1"/>
</child>
<child>
<object class="GtkMenuItem" id="quitmenuitem">
<property name="label" translatable="yes">_Quit</property>
<property name="use-underline">1</property>
<property name="action-name">app.quit</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem2">
<property name="label" translatable="yes">Edit</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu" id="menu2">
<child>
<object class="GtkMenuItem" id="menuitem106">
<property name="label" translatable="yes">Cu_t</property>
<property name="can-focus">1</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem107">
<property name="label" translatable="yes">_Copy</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem108">
<property name="label" translatable="yes">_Paste</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="deletemenuitem">
<property name="label" translatable="yes">_Delete</property>
<property name="use-underline">1</property>
<property name="action-name">win.delete</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="searchmenuitem">
<property name="label" translatable="yes">_Search</property>
<property name="use-underline">1</property>
<property name="action-name">win.search</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="togglesmenuitem">
<property name="label">Checks &amp; Radios</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu" id="togglessubmenu">
<child>
<object class="GtkCheckMenuItem" id="checkmenuitem1">
<property name="label">_Check</property>
<property name="active">1</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="checkmenuitem2">
<property name="label">_Check</property>
<property name="active">1</property>
<property name="sensitive">0</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="checkmenuitem3">
<property name="label">_Check</property>
<property name="inconsistent">1</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="checkmenuitem4">
<property name="label">_Check</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="checkmenuitem5">
<property name="label">_Check</property>
<property name="sensitive">0</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="checkmenuitem6">
<property name="label">_Check</property>
<property name="inconsistent">1</property>
<property name="sensitive">0</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkSeparatorMenuItem" id="separatormenuitem"/>
</child>
<child>
<object class="GtkRadioMenuItem" id="radiomenuitem1">
<property name="label">_Radio</property>
<property name="active">1</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="radiomenuitem2">
<property name="label">_Radio</property>
<property name="active">1</property>
<property name="sensitive">0</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="radiomenuitem3">
<property name="label">_Radio</property>
<property name="inconsistent">1</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="radiomenuitem4">
<property name="label">_Radio</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="radiomenuitem5">
<property name="label">_Radio</property>
<property name="sensitive">0</property>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkRadioMenuItem" id="radiomenuitem6">
<property name="label">_Radio</property>
<property name="inconsistent">1</property>
<property name="sensitive">0</property>
<property name="use-underline">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem3">
<property name="label" translatable="yes">View</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu" id="view-menu">
<child>
<object class="GtkCheckMenuItem" id="darkmenuitem">
<property name="label">_Dark theme</property>
<property name="use-underline">1</property>
<property name="action-name">win.dark</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="toolbarmenuitem">
<property name="label">_Toolbar</property>
<property name="active">1</property>
<property name="use-underline">1</property>
<property name="action-name">win.toolbar</property>
</object>
</child>
<child>
<object class="GtkCheckMenuItem" id="statusbarmenuitem">
<property name="label">_Statusbar</property>
<property name="active">1</property>
<property name="use-underline">1</property>
<property name="action-name">win.statusbar</property>
</object>
</child>
<child>
<object class="GtkMenuItem" id="bgmenuitem">
<property name="label">_Select Background</property>
<property name="use-underline">1</property>
<property name="action-name">win.background</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="menuitem4">
<property name="label" translatable="yes">Help</property>
<property name="use-underline">1</property>
<child type="submenu">
<object class="GtkMenu" id="menu3">
<child>
<object class="GtkMenuItem" id="aboutmenuitem">
<property name="label" translatable="yes">_About</property>
<property name="use-underline">1</property>
<property name="action-name">app.about</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolbar" id="toolbar">
<child>
@@ -2120,7 +1862,7 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkInfoBar" id="infobar">
<property name="visible">0</property>
<property name="show-close-button">1</property>
<child internal-child="content_area">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel">
@@ -2131,9 +1873,11 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="shadow-type">in</property>
<property name="vexpand">1</property>
<child>
<object class="MyTextView" id="text3">
@@ -2147,6 +1891,9 @@ microphone-sensitivity-medium-symbolic</property>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkStatusbar" id="statusbar"/>
</child>
@@ -2437,11 +2184,9 @@ microphone-sensitivity-medium-symbolic</property>
<property name="spacing">10</property>
<child>
<object class="GtkBox">
<property name="halign">fill</property>
<property name="spacing">6</property>
<child>
<object class="GtkBox" id="lockbox">
<property name="halign">fill</property>
<property name="hexpand">1</property>
<property name="spacing">6</property>
<child>
@@ -2518,9 +2263,6 @@ microphone-sensitivity-medium-symbolic</property>
<object class="GtkMenuButton">
<property name="icon-name">view-more-symbolic</property>
<property name="popover">new_style_menu</property>
<!--
<property name="menu-model">new_style_menu_model</property>
-->
</object>
</child>
</object>
@@ -3355,10 +3097,6 @@ bad things might happen.</property>
<accessibility>
<relation type="label-for" target="open_popover_entry"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
</child>
<child>
@@ -3370,7 +3108,6 @@ bad things might happen.</property>
<relation type="label-for" target="open_popover_textview"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
@@ -3405,7 +3142,6 @@ bad things might happen.</property>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="column-span">2</property>
</layout>
</object>
@@ -3435,6 +3171,7 @@ bad things might happen.</property>
<property name="halign">end</property>
<property name="icon-name">emblem-system-symbolic</property>
<property name="menu-model">gear_menu</property>
<property name="tooltip-text">This is a menu button</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
@@ -3443,7 +3180,6 @@ bad things might happen.</property>
</child>
<child>
<object class="GtkButton" id="open_popover_button">
<property name="halign">fill</property>
<property name="label">_Open</property>
<property name="use-underline">1</property>
<property name="sensitive">0</property>
@@ -3492,7 +3228,7 @@ bad things might happen.</property>
<property name="autohide">0</property>
<child>
<object class="GtkLabel">
<property name="label">You're in too deep!</property>
<property name="label">You&apos;re in too deep!</property>
<accessibility>
<role type="static"/>
</accessibility>
@@ -3503,7 +3239,6 @@ bad things might happen.</property>
<property name="autohide">0</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel">
<property name="label">Hidden gems:</property>
@@ -3523,222 +3258,246 @@ bad things might happen.</property>
</object>
</child>
</object>
<object class="GtkPopoverMenu" id="new_style_menu">
<object class="GtkPopover" id="new_style_menu">
<child>
<object class="GtkBox">
<property name="name">main</property>
<property name="orientation">vertical</property>
<object class="GtkStack">
<child>
<object class="GtkBox">
<property name="halign">fill</property>
<style>
<class name="circular-buttons"/>
</style>
<child>
<object class="GtkModelButton">
<property name="icon"><object class="GThemedIcon"><property name="name">printer-symbolic</property></object></property>
<property name="iconic">1</property>
<property name="action-name">app.print</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<style>
<class name="circular"/>
</style>
<object class="GtkStackPage">
<property name="name">main</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<style>
<class name="circular-buttons"/>
</style>
<child>
<object class="GtkModelButton">
<property name="icon">
<object class="GThemedIcon">
<property name="name">printer-symbolic</property>
</object>
</property>
<property name="iconic">1</property>
<property name="action-name">app.print</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon">
<object class="GThemedIcon">
<property name="name">emblem-shared-symbolic</property>
</object>
</property>
<property name="iconic">1</property>
<property name="action-name">app.share</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<style>
<class name="circular"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Open in New Window</property>
<property name="action-name">app.open-in</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkBox">
<style>
<class name="inline-buttons"/>
</style>
<child>
<object class="GtkLabel" id="cut_copy_paste_filler"/>
</child>
<child>
<object class="GtkLabel">
<property name="label">Edit</property>
<property name="xalign">0</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon">
<object class="GThemedIcon">
<property name="name">edit-cut-symbolic</property>
</object>
</property>
<property name="iconic">1</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon">
<object class="GThemedIcon">
<property name="name">edit-copy-symbolic</property>
</object>
</property>
<property name="iconic">1</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon">
<object class="GThemedIcon">
<property name="name">edit-paste-symbolic</property>
</object>
</property>
<property name="iconic">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Pin</property>
<property name="action-name">app.pin</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Select Labels…</property>
<property name="action-name">app.labels</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Share…</property>
<property name="action-name">app.share</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Basement</property>
<property name="menu-name">basement</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Large</property>
<property name="action-name">app.size</property>
<property name="action-target">&apos;large&apos;</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Medium</property>
<property name="action-name">app.size</property>
<property name="action-target">&apos;medium&apos;</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Small</property>
<property name="action-name">app.size</property>
<property name="action-target">&apos;small&apos;</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Move to Trash</property>
<property name="action-name">win.delete</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon"><object class="GThemedIcon"><property name="name">emblem-shared-symbolic</property></object></property>
<property name="iconic">1</property>
<property name="action-name">app.share</property>
<property name="hexpand">1</property>
<property name="halign">center</property>
<style>
<class name="circular"/>
</style>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">basement</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton">
<property name="text">Basement</property>
<property name="role">title</property>
<property name="menu-name">main</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Berk</property>
<property name="action-name">app.berk</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Broni</property>
<property name="action-name">app.broni</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Drutt</property>
<property name="action-name">app.drutt</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">The Thing Upstairs</property>
<property name="action-name">app.upstairs</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Open in New Window</property>
<property name="action-name">app.open-in</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkBox">
<style>
<class name="inline-buttons"/>
</style>
<child>
<object class="GtkLabel" id="cut_copy_paste_filler">
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Edit</property>
<property name="xalign">0</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon"><object class="GThemedIcon"><property name="name">edit-cut-symbolic</property></object></property>
<property name="iconic">1</property>
<property name="relief">none</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon"><object class="GThemedIcon"><property name="name">edit-copy-symbolic</property></object></property>
<property name="iconic">1</property>
<property name="relief">none</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="icon"><object class="GThemedIcon"><property name="name">edit-paste-symbolic</property></object></property>
<property name="iconic">1</property>
<property name="relief">none</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Pin</property>
<property name="action-name">app.pin</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Select Labels…</property>
<property name="action-name">app.labels</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Share…</property>
<property name="action-name">app.share</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Basement</property>
<property name="menu-name">basement</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Large</property>
<property name="action-name">app.size</property>
<property name="action-target">'large'</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Medium</property>
<property name="action-name">app.size</property>
<property name="action-target">'medium'</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Small</property>
<property name="action-name">app.size</property>
<property name="action-target">'small'</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Move to Trash</property>
<property name="action-name">win.delete</property>
<property name="indicator-size-group">main-indicators</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="name">basement</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkModelButton">
<property name="text">Basement</property>
<property name="role">title</property>
<property name="menu-name">main</property>
</object>
</child>
<child>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Berk</property>
<property name="action-name">app.berk</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Broni</property>
<property name="action-name">app.broni</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">Drutt</property>
<property name="action-name">app.drutt</property>
<property name="indicator-size-group">basement-indicators</property>
</object>
</child>
<child>
<object class="GtkModelButton">
<property name="text">The Thing Upstairs</property>
<property name="action-name">app.upstairs</property>
<property name="indicator-size-group">basement-indicators</property>
</property>
</object>
</child>
</object>
</child>
</object>
<object class="GtkSizeGroup" id="main-indicators">
<property name="mode">horizontal</property>
<widgets>
<widget name="cut_copy_paste_filler"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="basement-indicators">
<property name="mode">horizontal</property>
</object>
<object class="GtkSizeGroup" id="basement-indicators"/>
<menu id="new_style_menu_model">
<section>
<attribute name="display-hint">circular-buttons</attribute>
@@ -3828,10 +3587,10 @@ bad things might happen.</property>
</item>
</section>
<section>
<item>
<attribute name="label" translatable="yes">Move to Trash</attribute>
<attribute name="action">win.delete</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Move to Trash</attribute>
<attribute name="action">win.delete</attribute>
</item>
</section>
</menu>
<menu id="new_style_context_menu_model">
@@ -3945,7 +3704,7 @@ bad things might happen.</property>
</section>
<section>
<submenu>
<attribute name="label" translatable="yes">Checks &amp; Radios</attribute>
<attribute name="label" translatable="yes">C_hecks</attribute>
<section>
<item>
<attribute name="label" translatable="yes">Check</attribute>
@@ -3969,6 +3728,9 @@ bad things might happen.</property>
<attribute name="hidden-when">action-missing</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Radios</attribute>
<section>
<item>
<attribute name="label" translatable="yes">Radio</attribute>
@@ -4019,14 +3781,13 @@ bad things might happen.</property>
<attribute name="action">win.background</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_Help</attribute>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
</item>
<item>
<attribute name="label" translatable="yes">About</attribute>
<attribute name="action">app.about</attribute>
</item>
</submenu>
</menu>
</interface>

View File

@@ -192,8 +192,8 @@ gdk_surface_is_destroyed
gdk_surface_is_visible
gdk_surface_is_viewable
gdk_surface_get_state
gdk_surface_iconify
gdk_surface_deiconify
gdk_surface_minimize
gdk_surface_unminimize
gdk_surface_stick
gdk_surface_unstick
gdk_surface_maximize
@@ -544,8 +544,6 @@ GdkSeatCapabilities
GdkGrabStatus
GdkSeatGrabPrepareFunc
gdk_seat_get_display
gdk_seat_grab
gdk_seat_ungrab
gdk_seat_get_capabilities
gdk_seat_get_pointer
gdk_seat_get_keyboard
@@ -789,8 +787,6 @@ gdk_drop_get_type
</SECTION>
<SECTION>
<INCLUDE>gdk/gdkx.h</INCLUDE>
<TITLE>X Window System Interaction</TITLE>
<FILE>x_interaction</FILE>
GDK_SURFACE_XID
GDK_DISPLAY_XDISPLAY
@@ -941,8 +937,6 @@ gdk_surface_impl_x11_get_type
</SECTION>
<SECTION>
<INCLUDE>gdk/gdkwayland.h</INCLUDE>
<TITLE>Wayland Interaction</TITLE>
<FILE>wayland_interaction</FILE>
gdk_wayland_seat_get_wl_seat
gdk_wayland_device_get_wl_keyboard

View File

@@ -30,6 +30,7 @@ GskRenderNodeType
gsk_render_node_get_node_type
gsk_render_node_draw
GskSerializationError
GskParseErrorFunc
gsk_render_node_serialize
gsk_render_node_deserialize
gsk_render_node_write_to_file

View File

@@ -314,8 +314,8 @@
be connected to an action just by setting the ::action-name
property. If the action has a parameter, you will also need
to set the ::action-target property.
Widgets that implement GtkAction include GtkSwitch, GtkButton,
GtkMenuItem and their respective subclasses.
Widgets that implement GtkActionable include GtkSwitch, GtkButton,
and their respective subclasses.
</para>
<para>

View File

@@ -76,10 +76,10 @@ How to compile GTK itself
</para>
<para>
Several environment variables are useful to pass to set before
running configure. <envar>CPPFLAGS</envar> contains options to
pass to the C compiler, and is used to tell the compiler where
to look for include files. The <envar>LDFLAGS</envar> variable
is used in a similar fashion for the linker. Finally the
running <application>meson</application>. <envar>CPPFLAGS</envar>
contains options to pass to the C compiler, and is used to tell
the compiler where to look for include files. The <envar>LDFLAGS</envar>
variable is used in a similar fashion for the linker. Finally the
<envar>PKG_CONFIG_PATH</envar> environment variable contains
a search path that <command>pkg-config</command> (see below)
uses when looking for files describing how to compile
@@ -106,6 +106,61 @@ How to compile GTK itself
export LD_LIBRARY_PATH PATH
</programlisting>
</refsect1>
<refsect1 id="build-types">
<title>Build types</title>
<para>Meson has different build types, exposed by the <literal>buildtype</literal>
configuration option. GTK enables and disables functionality depending on
the build type used when calling <application>meson</application> to
configure the build.</para>
<formalpara>
<title><systemitem>debug</systemitem> and <systemitem>debugoptimized</systemitem></title>
<para>
GTK will enable debugging code paths in both the
<literal>debug</literal> and <literal>debugoptimized</literal>
build types. Builds with <literal>buildtype</literal> set
to <literal>debug</literal> will additionally enable
consistency checks on the internal state of the toolkit.
</para>
<para>
It is recommended to use the <literal>debug</literal> or
<literal>debugoptimized</literal> build types when developing
GTK itself. Additionally, <literal>debug</literal> builds of
GTK are recommended for profiling and debugging GTK applications,
as they include additional validation of the internal state.
</para>
<para>
The <literal>debugoptimized</literal> build type is the
default for GTK if no build type is specified when calling
<application>meson</application>
</para>
</formalpara>
<formalpara>
<title><systemitem>release</systemitem></title>
<para>
The <literal>release</literal> build type will disable
debugging code paths and additional run time safeties, like
checked casts for object instances.
</para>
</formalpara>
<para>
The <literal>plain</literal> build type provided by Meson
should only be used when packaging GTK, and it's expected
that packagers will provide their own compiler flags when
building GTK. See the previous section for the list of
environment variables to be used to define compiler and
linker flags.
</para>
</refsect1>
<refsect1 id="dependencies">
<title>Dependencies</title>
<para>
@@ -283,184 +338,181 @@ How to compile GTK itself
See <xref linkend="gtk-resources"/> for more information.
</para>
</refsect1>
<refsect1 id="extra-configuration-options">
<title>Extra Configuration Options</title>
<refsect1 id="extra-configuration-options">
<title>Extra Configuration Options</title>
<para>
In addition to the normal options provided by Meson, GTK defines
various arguments that modify what should be built.
<cmdsynopsis>
<command>meson</command>
<sbr/>
<group>
<arg choice="plain">-Dx11-backend=true</arg>
<arg choice="plain">-Dx11-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dwayland-backend=true</arg>
<arg choice="plain">-Dwayland-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dbroadway-backend=true</arg>
<arg choice="plain">-Dbroadway-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dwin32-backend=true</arg>
<arg choice="plain">-Dwin32-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dquartz-backend=true</arg>
<arg choice="plain">-Dquartz-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dmedia=gstreamer</arg>
<arg choice="plain">-Dmedia=ffmpeg</arg>
<arg choice="plain">-Dmedia=all</arg>
<arg choice="plain">-Dmedia=none</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dvulkan=yes</arg>
<arg choice="plain">-Dvulkan=no</arg>
<arg choice="plain">-Dvulkan=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dxinerama=yes</arg>
<arg choice="plain">-Dxinerama=no</arg>
<arg choice="plain">-Dxinerama=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dcloudproviders=true</arg>
<arg choice="plain">-Dcloudproviders=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dprint-backends=all</arg>
<arg choice="plain">-Dprint-backends=none</arg>
<arg choice="plain">-Dprint-backends=cups,lpr,...</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dcolord=yes</arg>
<arg choice="plain">-Dcolord=no</arg>
<arg choice="plain">-Dcolord=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dgtk_doc=true</arg>
<arg choice="plain">-Dgtk_doc=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dman-pages=true</arg>
<arg choice="plain">-Dman-pages=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dintrospection=true</arg>
<arg choice="plain">-Dintrospection=false</arg>
</group>
</cmdsynopsis>
</para>
<formalpara>
<title><systemitem>xinerama</systemitem></title>
<para>
In addition to the normal options provided by Meson, GTK defines
various arguments that modify what should be built.
<cmdsynopsis>
<command>meson</command>
<sbr/>
<group>
<arg choice="plain">-Dx11-backend=true</arg>
<arg choice="plain">-Dx11-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dwayland-backend=true</arg>
<arg choice="plain">-Dwayland-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dbroadway-backend=true</arg>
<arg choice="plain">-Dbroadway-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dwin32-backend=true</arg>
<arg choice="plain">-Dwin32-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dquartz-backend=true</arg>
<arg choice="plain">-Dquartz-backend=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dmedia=gstreamer</arg>
<arg choice="plain">-Dmedia=ffmpeg</arg>
<arg choice="plain">-Dmedia=all</arg>
<arg choice="plain">-Dmedia=none</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dvulkan=yes</arg>
<arg choice="plain">-Dvulkan=no</arg>
<arg choice="plain">-Dvulkan=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dxinerama=yes</arg>
<arg choice="plain">-Dxinerama=no</arg>
<arg choice="plain">-Dxinerama=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dcloudproviders=true</arg>
<arg choice="plain">-Dcloudproviders=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dprint-backends=all</arg>
<arg choice="plain">-Dprint-backends=none</arg>
<arg choice="plain">-Dprint-backends=cups,lpr,...</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dcolord=yes</arg>
<arg choice="plain">-Dcolord=no</arg>
<arg choice="plain">-Dcolord=auto</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dgtk_doc=true</arg>
<arg choice="plain">-Dgtk_doc=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dman-pages=true</arg>
<arg choice="plain">-Dman-pages=false</arg>
</group>
<sbr/>
<group>
<arg choice="plain">-Dintrospection=true</arg>
<arg choice="plain">-Dintrospection=false</arg>
</group>
</cmdsynopsis>
By default GTK will try to link against the Xinerama libraries
if they are found. This options can be used to explicitly control
whether Xinerama should be used.
</para>
</formalpara>
<formalpara>
<title><systemitem>xinerama</systemitem></title>
<formalpara>
<title><systemitem>gtk_doc</systemitem> and
<systemitem>man-pages</systemitem></title>
<para>
By default GTK will try to link against the Xinerama libraries
if they are found. This options can be used to explicitly control
whether Xinerama should be used.
</para>
</formalpara>
<para>
The <application>gtk-doc</application> package is
used to generate the reference documentation included
with GTK. By default support for <application>gtk-doc</application>
is disabled because it requires various extra dependencies
to be installed. If you have
<application>gtk-doc</application> installed and
are modifying GTK, you may want to enable
<application>gtk-doc</application> support by passing
in <systemitem>gtk_doc</systemitem>.
</para>
<para>
Additionally, some tools provided by GTK have their own
manual pages generated using a similar set of dependencies;
if you have <application>xsltproc</application> then you
can generate manual pages by passing <systemitem>man-pages</systemitem>
when configuring the build.
</para>
</formalpara>
<formalpara>
<title><systemitem>gtk_doc</systemitem> and
<systemitem>man-pages</systemitem></title>
<formalpara>
<title><systemitem>print-backends</systemitem></title>
<para>
The <application>gtk-doc</application> package is
used to generate the reference documentation included
with GTK. By default support for <application>gtk-doc</application>
is disabled because it requires various extra dependencies
to be installed. If you have
<application>gtk-doc</application> installed and
are modifying GTK, you may want to enable
<application>gtk-doc</application> support by passing
in <systemitem>gtk_doc</systemitem>.
</para>
<para>
Additionally, some tools provided by GTK have their own
manual pages generated using a similar set of dependencies;
if you have <application>xsltproc</application> then you
can generate manual pages by passing <systemitem>man-pages</systemitem>
when configuring the build.
</para>
</formalpara>
<para>
By default, GTK will try to build various print backends if
their dependencies are found. This option can be used to
explicitly control which print backends should be built.
</para>
</formalpara>
<formalpara>
<title><systemitem>print-backends</systemitem></title>
<formalpara>
<title><systemitem>x11-backend</systemitem>,
<systemitem>win32-backend</systemitem>,
<systemitem>quartz-backend</systemitem>,
<systemitem>broadway-backend</systemitem> and
<systemitem>wayland-backend</systemitem></title>
<para>
By default, GTK will try to build various print backends if
their dependencies are found. This option can be used to
explicitly control which print backends should be built.
</para>
</formalpara>
<para>
Enable specific backends for GDK. If none of these options
are given, the Wayland backend will be enabled by default,
if the platform is Linux; the X11 backend will also be enabled
by default, unless the platform is Windows, in which case the
default is win32, or the platform is macOS, in which case the
default is quartz. If any backend is explicitly enabled or disabled,
no other platform will be enabled automatically.
</para>
</formalpara>
<formalpara>
<title><systemitem>x11-backend</systemitem>,
<systemitem>win32-backend</systemitem>,
<systemitem>quartz-backend</systemitem>,
<systemitem>broadway-backend</systemitem> and
<systemitem>wayland-backend</systemitem></title>
<formalpara>
<title><systemitem>introspection</systemitem></title>
<para>
Enable specific backends for GDK. If none of these options
are given, the Wayland backend will be enabled by default,
if the platform is Linux; the X11 backend will also be enabled
by default, unless the platform is Windows, in which case the
default is win32, or the platform is macOS, in which case the
default is quartz. If any backend is explicitly enabled or disabled,
no other platform will be enabled automatically.
</para>
</formalpara>
<para>
Allows to disable building introspection support. This is option
is mainly useful for shortening turnaround times on developer
systems. Installed builds of GTK should always have introspection
support.
</para>
</formalpara>
<formalpara>
<title><systemitem>introspection</systemitem></title>
<formalpara>
<title><systemitem>build-tests</systemitem>,
<systemitem>install-tests</systemitem>,
<systemitem>demos</systemitem></title>
<para>
Allows to disable building introspection support. This is option
is mainly useful for shortening turnaround times on developer
systems. Installed builds of GTK should always have introspection
support.
</para>
</formalpara>
<para>
By default, GTK will build quite a few tests and demos.
While these are useful on a developer system, they are not
needed when GTK is built e.g. for a flatpak runtime. These
options allow to disable building tests and demos.
</para>
</formalpara>
<formalpara>
<title><systemitem>build-tests</systemitem>,
<systemitem>install-tests</systemitem>,
<systemitem>demos</systemitem></title>
<para>
By default, GTK will build quite a few tests and demos.
While these are useful on a developer system, they are not
needed when GTK is built e.g. for a flatpak runtime. These
options allow to disable building tests and demos.
</para>
</formalpara>
</refsect1>
</refsect1>
</refentry>
<!-- Local Variables: -->
<!-- sgml-parent-document: ("gtk-docs.sgml" "chapter" "refentry") -->
<!-- End: -->

View File

@@ -224,10 +224,3 @@
</refsect1>
</refentry>
<!--
Local variables:
mode: xml
sgml-parent-document: ("gtk-docs.sgml" "book" "part" "refentry")
End:
-->

View File

@@ -364,10 +364,3 @@
</glossdef>
</glossentry>
</glossary>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("gtk-docs.sgml" "book" "glossary")
End:
-->

View File

@@ -22,8 +22,8 @@
<title>GTK Overview</title>
<xi:include href="overview.xml"/>
<xi:include href="xml/getting_started.xml"/>
<xi:include href="resources.sgml" />
<xi:include href="xml/question_index.sgml" />
<xi:include href="resources.xml" />
<xi:include href="xml/question_index.xml" />
<xi:include href="xml/drawing-model.xml" />
<xi:include href="xml/input-handling.xml" />
<xi:include href="xml/actions.xml" />
@@ -49,11 +49,16 @@
<xi:include href="xml/gtkmaplistmodel.xml" />
<xi:include href="xml/gtkslicelistmodel.xml" />
<xi:include href="xml/gtksortlistmodel.xml" />
<xi:include href="xml/gtktreelistmodel.xml" />
<xi:include href="xml/gtkselectionmodel.xml" />
<xi:include href="xml/gtknoselection.xml" />
<xi:include href="xml/gtksingleselection.xml" />
</chapter>
<chapter id="Trees">
<xi:include href="xml/gtktreelistrow.xml" />
<xi:include href="xml/gtktreelistmodel.xml" />
</chapter>
<chapter id="Application">
<title>Application support</title>
<xi:include href="xml/gtkapplication.xml" />
@@ -65,11 +70,13 @@
<title>Interface builder</title>
<xi:include href="xml/gtkbuilder.xml" />
<xi:include href="xml/gtkbuildable.xml" />
<xi:include href="xml/gtkbuilderscope.xml" />
</chapter>
<chapter id="WindowWidgets">
<title>Windows</title>
<xi:include href="xml/gtkroot.xml" />
<xi:include href="xml/gtknative.xml" />
<xi:include href="xml/gtkwindow.xml" />
<xi:include href="xml/gtkdialog.xml" />
<xi:include href="xml/gtkmessagedialog.xml" />
@@ -148,7 +155,6 @@
<xi:include href="xml/gtkscalebutton.xml" />
<xi:include href="xml/gtkvolumebutton.xml" />
<xi:include href="xml/gtklockbutton.xml" />
<xi:include href="xml/gtkmodelbutton.xml" />
</chapter>
<chapter id="NumericEntry">
@@ -167,7 +173,7 @@
<chapter id="TextWidgetObjects">
<title>Multiline Text Editor</title>
<xi:include href="xml/text_widget.sgml" />
<xi:include href="xml/text_widget.xml" />
<xi:include href="xml/gtktextiter.xml" />
<xi:include href="xml/gtktextmark.xml" />
<xi:include href="xml/gtktextbuffer.xml" />
@@ -178,7 +184,7 @@
<chapter id="TreeWidgetObjects">
<title>Tree, List and Icon Grid Widgets</title>
<xi:include href="xml/tree_widget.sgml" />
<xi:include href="xml/tree_widget.xml" />
<xi:include href="xml/gtktreemodel.xml" />
<xi:include href="xml/gtktreeselection.xml" />
<xi:include href="xml/gtktreeviewcolumn.xml" />
@@ -211,12 +217,6 @@
<title>Menus, Combo Box, Toolbar</title>
<xi:include href="xml/gtkcombobox.xml" />
<xi:include href="xml/gtkcomboboxtext.xml" />
<xi:include href="xml/gtkmenu.xml" />
<xi:include href="xml/gtkmenubar.xml" />
<xi:include href="xml/gtkmenuitem.xml" />
<xi:include href="xml/gtkradiomenuitem.xml" />
<xi:include href="xml/gtkcheckmenuitem.xml" />
<xi:include href="xml/gtkseparatormenuitem.xml" />
<xi:include href="xml/gtktoolshell.xml" />
<xi:include href="xml/gtktoolbar.xml" />
<xi:include href="xml/gtktoolitem.xml" />
@@ -305,7 +305,6 @@
<xi:include href="xml/gtkwidget.xml" />
<xi:include href="xml/gtkcontainer.xml" />
<xi:include href="xml/gtkbin.xml" />
<xi:include href="xml/gtkmenushell.xml" />
<xi:include href="xml/gtkrange.xml" />
<xi:include href="xml/gtkimcontext.xml" />
<xi:include href="xml/gtknativedialog.xml" />
@@ -345,6 +344,13 @@
<xi:include href="xml/gtkpadcontroller.xml" />
</chapter>
<chapter>
<title>Data exchange, clipboards and Drag-and-Drop</title>
<xi:include href="xml/gtkdragsource.xml"/>
<xi:include href="xml/gtkdragicon.xml"/>
<xi:include href="xml/gtkdroptarget.xml"/>
</chapter>
</part>
<part id="gtkbase">
@@ -353,7 +359,6 @@
<xi:include href="xml/gtkfeatures.xml" />
<xi:include href="xml/gtkaccelgroup.xml" />
<xi:include href="xml/gtkaccelmap.xml" />
<xi:include href="xml/gtkdnd.xml" />
<xi:include href="xml/gtksettings.xml" />
<xi:include href="xml/gtkbindings.xml" />
<xi:include href="xml/gtkenums.xml" />
@@ -406,12 +411,12 @@
<part id="platform-support">
<title>GTK Platform Support</title>
<xi:include href="building.sgml" />
<xi:include href="xml/compiling.sgml" />
<xi:include href="running.sgml" />
<xi:include href="x11.sgml" />
<xi:include href="windows.sgml" />
<xi:include href="osx.sgml" />
<xi:include href="building.xml" />
<xi:include href="xml/compiling.xml" />
<xi:include href="running.xml" />
<xi:include href="x11.xml" />
<xi:include href="windows.xml" />
<xi:include href="osx.xml" />
<xi:include href="broadway.xml" />
<xi:include href="wayland.xml" />
</part>

View File

@@ -136,6 +136,7 @@ gtk_accel_map_get_type
GtkAccelLabel
gtk_accel_label_new
gtk_accel_label_set_accel_closure
gtk_accel_label_get_accel_closure
gtk_accel_label_get_accel_widget
gtk_accel_label_set_accel_widget
gtk_accel_label_get_accel_width
@@ -212,7 +213,6 @@ gtk_adjustment_get_type
<TITLE>GtkAssistant</TITLE>
GtkAssistant
GtkAssistantPage
GtkAssistantClass
gtk_assistant_new
gtk_assistant_get_page
gtk_assistant_get_pages
@@ -257,7 +257,6 @@ gtk_assistant_get_type
<FILE>gtkaspectframe</FILE>
<TITLE>GtkAspectFrame</TITLE>
GtkAspectFrame
GtkAspectFrameClass
gtk_aspect_frame_new
gtk_aspect_frame_set
<SUBSECTION Standard>
@@ -340,11 +339,34 @@ GTK_CENTER_BOX_GET_CLASS
gtk_center_box_get_type
</SECTION>
<SECTION>
<FILE>gtkcenterlayout</FILE>
<TITLE>GtkCenterLayout</TITLE>
GtkCenterLayout
gtk_center_layout_new
gtk_center_layout_set_start_widget
gtk_center_layout_set_center_widget
gtk_center_layout_set_end_widget
gtk_center_layout_get_start_widget
gtk_center_layout_get_center_widget
gtk_center_layout_get_end_widget
gtk_center_layout_set_baseline_position
gtk_center_layout_get_baseline_position
<SUBSECTION Private>
GTK_TYPE_CENTER_layout
GTK_CENTER_LAYOUT
GTK_CENTER_LAYOUT_CLASS
GTK_IS_CENTER_LAYOUT
GTK_IS_CENTER_LAYOUT_CLASS
GTK_CENTER_LAYOUT_GET_CLASS
<SUBSECTION Private>
gtk_center_layout_get_type
</SECTION>
<SECTION>
<FILE>gtklistbox</FILE>
<TITLE>GtkListBox</TITLE>
GtkListBox
GtkListBoxClass
GtkListBoxRow
GtkListBoxRowClass
GtkListBoxFilterFunc
@@ -440,12 +462,23 @@ GTK_TYPE_SELECTION_MODEL
gtk_selection_model_get_type
</SECTION>
<SECTION>
<FILE>gtknoselection</FILE>
<TITLE>GtkNoSelection</TITLE>
GtkNoSelection
gtk_no_selection_new
gtk_no_selection_get_model
<SUBSECTION Private>
gtk_no_selection_get_type
</SECTION>
<SECTION>
<FILE>gtksingleselection</FILE>
<TITLE>GtkSingleSelection</TITLE>
GtkSingleSelection
GTK_INVALID_LIST_POSITION
gtk_single_selection_new
gtk_single_selection_get_model
gtk_single_selection_get_selected
gtk_single_selection_set_selected
gtk_single_selection_get_selected_item
@@ -480,19 +513,41 @@ GTK_BUILDABLE_CLASS
GTK_BUILDABLE_GET_IFACE
</SECTION>
<SECTION>
<FILE>gtkbuilderscope</FILE>
<TITLE>GtkBuilderScope</TITLE>
gtk_builder_cscope_new
gtk_builder_cscope_add_callback_symbol
gtk_builder_cscope_add_callback_symbols
gtk_builder_cscope_lookup_callback_symbol
<SUBSECTION Standard>
GTK_BUILDER_SCOPE
GTK_IS_BUILDER_SCOPE
GTK_TYPE_BUILDER_SCOPE
GTK_BUILDER_SCOPE_INTERFACE
GTK_IS_BUILDER_SCOPE_INTERFACE
GTK_BUILDER_SCOPE_GET_INTERFACE
GTK_BUILDER_CSCOPE
GTK_IS_BUILDER_CSCOPE
GTK_TYPE_BUILDER_CSCOPE
GTK_BUILDER_CSCOPE_CLASS
GTK_IS_BUILDER_CSCOPE_CLASS
GTK_BUILDER_CSCOPE_GET_CLASS
<SUBSECTION Private>
gtk_builder_scope_get_type
gtk_builder_cscope_get_type
</SECTION>
<SECTION>
<FILE>gtkbuilder</FILE>
<TITLE>GtkBuilder</TITLE>
GtkBuilder
GtkBuilderConnectFunc
GtkBuilderError
gtk_builder_new
gtk_builder_new_from_file
gtk_builder_new_from_resource
gtk_builder_new_from_string
gtk_builder_add_callback_symbol
gtk_builder_add_callback_symbols
gtk_builder_lookup_callback_symbol
gtk_builder_create_closure
gtk_builder_add_from_file
gtk_builder_add_from_resource
gtk_builder_add_from_string
@@ -503,12 +558,12 @@ gtk_builder_extend_with_template
gtk_builder_get_object
gtk_builder_get_objects
gtk_builder_expose_object
gtk_builder_connect_signals
gtk_builder_connect_signals_full
gtk_builder_set_current_object
gtk_builder_get_current_object
gtk_builder_set_scope
gtk_builder_get_scope
gtk_builder_set_translation_domain
gtk_builder_get_translation_domain
gtk_builder_set_application
gtk_builder_get_application
gtk_builder_get_type_from_name
gtk_builder_value_from_string
gtk_builder_value_from_string_type
@@ -525,7 +580,6 @@ GTK_BUILDER_GET_CLASS
<SUBSECTION Private>
gtk_builder_get_type
gtk_builder_error_quark
GtkBuilderPrivate
</SECTION>
<SECTION>
@@ -620,34 +674,6 @@ GTK_CHECK_BUTTON_GET_CLASS
gtk_check_button_get_type
</SECTION>
<SECTION>
<FILE>gtkcheckmenuitem</FILE>
GtkCheckMenuItem
GtkCheckMenuItemClass
<TITLE>GtkCheckMenuItem</TITLE>
gtk_check_menu_item_new
gtk_check_menu_item_new_with_label
gtk_check_menu_item_new_with_mnemonic
gtk_check_menu_item_get_active
gtk_check_menu_item_set_active
gtk_check_menu_item_toggled
gtk_check_menu_item_get_inconsistent
gtk_check_menu_item_set_inconsistent
gtk_check_menu_item_set_draw_as_radio
gtk_check_menu_item_get_draw_as_radio
<SUBSECTION Standard>
GTK_CHECK_MENU_ITEM
GTK_IS_CHECK_MENU_ITEM
GTK_TYPE_CHECK_MENU_ITEM
GTK_CHECK_MENU_ITEM_CLASS
GTK_IS_CHECK_MENU_ITEM_CLASS
GTK_CHECK_MENU_ITEM_GET_CLASS
<SUBSECTION Private>
GtkCheckMenuItemPrivate
gtk_check_menu_item_get_type
</SECTION>
<SECTION>
<FILE>gtkcolorbutton</FILE>
<TITLE>GtkColorButton</TITLE>
@@ -846,6 +872,8 @@ gtk_editable_get_width_chars
gtk_editable_set_width_chars
gtk_editable_get_max_width_chars
gtk_editable_set_max_width_chars
gtk_editable_get_enable_undo
gtk_editable_set_enable_undo
<SUBSECTION>
gtk_editable_install_properties
gtk_editable_init_delegate
@@ -1073,7 +1101,6 @@ gtk_entry_completion_get_type
<FILE>gtkexpander</FILE>
<TITLE>GtkExpander</TITLE>
GtkExpander
GtkExpanderClass
gtk_expander_new
gtk_expander_new_with_mnemonic
gtk_expander_set_expanded
@@ -1220,7 +1247,6 @@ GtkFileChooserDialogPrivate
<FILE>gtkfilechooserwidget</FILE>
<TITLE>GtkFileChooserWidget</TITLE>
GtkFileChooserWidget
GtkFileChooserWidgetClass
gtk_file_chooser_widget_new
<SUBSECTION Standard>
GTK_FILE_CHOOSER_WIDGET
@@ -1238,7 +1264,6 @@ GtkFileChooserWidgetPrivate
<FILE>gtkfilechooserbutton</FILE>
<TITLE>GtkFileChooserButton</TITLE>
GtkFileChooserButton
GtkFileChooserButtonClass
gtk_file_chooser_button_new
gtk_file_chooser_button_new_with_dialog
gtk_file_chooser_button_get_title
@@ -1414,7 +1439,6 @@ gtk_font_chooser_get_type
<FILE>gtkfontchooserwidget</FILE>
<TITLE>GtkFontChooserWidget</TITLE>
GtkFontChooserWidget
GtkFontChooserWidgetClass
gtk_font_chooser_widget_new
<SUBSECTION Standard>
@@ -1434,7 +1458,6 @@ gtk_font_chooser_widget_get_type
<FILE>gtkfontchooserdialog</FILE>
<TITLE>GtkFontChooserDialog</TITLE>
GtkFontChooserDialog
GtkFontChooserDialogClass
gtk_font_chooser_dialog_new
<SUBSECTION Standard>
@@ -1683,8 +1706,8 @@ gtk_label_set_yalign
gtk_label_set_ellipsize
gtk_label_set_width_chars
gtk_label_set_max_width_chars
gtk_label_set_line_wrap
gtk_label_set_line_wrap_mode
gtk_label_set_wrap
gtk_label_set_wrap_mode
gtk_label_set_lines
gtk_label_get_layout_offsets
gtk_label_get_mnemonic_keyval
@@ -1704,8 +1727,8 @@ gtk_label_get_width_chars
gtk_label_get_max_width_chars
gtk_label_get_label
gtk_label_get_layout
gtk_label_get_line_wrap
gtk_label_get_line_wrap_mode
gtk_label_get_wrap
gtk_label_get_wrap_mode
gtk_label_get_lines
gtk_label_get_mnemonic_widget
gtk_label_get_selection_bounds
@@ -1739,7 +1762,6 @@ GtkLabelSelectionInfo
<FILE>gtklinkbutton</FILE>
<TITLE>GtkLinkButton</TITLE>
GtkLinkButton
GtkLinkButtonClass
gtk_link_button_new
gtk_link_button_new_with_label
gtk_link_button_get_uri
@@ -1780,78 +1802,15 @@ GTK_MAP_LIST_MODEL_GET_CLASS
gtk_map_list_model_get_type
</SECTION>
<SECTION>
<FILE>gtkmenu</FILE>
<TITLE>GtkMenu</TITLE>
GtkMenu
gtk_menu_new
gtk_menu_new_from_model
gtk_menu_reorder_child
gtk_menu_popup_at_rect
gtk_menu_popup_at_widget
gtk_menu_popup_at_pointer
gtk_menu_set_accel_group
gtk_menu_get_accel_group
gtk_menu_set_accel_path
gtk_menu_get_accel_path
gtk_menu_set_monitor
gtk_menu_get_monitor
gtk_menu_place_on_monitor
gtk_menu_set_reserve_toggle_size
gtk_menu_get_reserve_toggle_size
<SUBSECTION>
gtk_menu_popdown
gtk_menu_reposition
gtk_menu_get_active
gtk_menu_set_active
gtk_menu_attach_to_widget
gtk_menu_detach
gtk_menu_get_attach_widget
gtk_menu_get_for_attach_widget
GtkMenuDetachFunc
<SUBSECTION Standard>
GTK_MENU
GTK_IS_MENU
GTK_TYPE_MENU
GTK_MENU_CLASS
GTK_IS_MENU_CLASS
GTK_MENU_GET_CLASS
<SUBSECTION Private>
GtkMenuPrivate
gtk_menu_get_type
</SECTION>
<SECTION>
<FILE>gtkmenubar</FILE>
<TITLE>GtkMenuBar</TITLE>
GtkMenuBar
gtk_menu_bar_new
gtk_menu_bar_new_from_model
<SUBSECTION Standard>
GTK_MENU_BAR
GTK_IS_MENU_BAR
GTK_TYPE_MENU_BAR
GTK_MENU_BAR_CLASS
GTK_IS_MENU_BAR_CLASS
GTK_MENU_BAR_GET_CLASS
<SUBSECTION Private>
GtkMenuBarPrivate
gtk_menu_bar_get_type
</SECTION>
<SECTION>
<FILE>gtkmenubutton</FILE>
<TITLE>GtkMenuButton</TITLE>
GtkMenuButton
gtk_menu_button_new
gtk_menu_button_set_popup
gtk_menu_button_get_popup
gtk_menu_button_set_popover
gtk_menu_button_get_popover
gtk_menu_button_set_menu_model
gtk_menu_button_get_menu_model
gtk_menu_button_set_use_popover
gtk_menu_button_get_use_popover
GtkArrowType
gtk_menu_button_set_direction
gtk_menu_button_get_direction
@@ -1865,6 +1824,8 @@ gtk_menu_button_set_relief
gtk_menu_button_get_relief
gtk_menu_button_popup
gtk_menu_button_popdown
GtkMenuButtonCreatePopupFunc
gtk_menu_button_set_create_popup_func
<SUBSECTION Standard>
GTK_TYPE_MENU_BUTTON
GTK_MENU_BUTTON
@@ -1877,72 +1838,6 @@ GtkMenuButtonPrivate
gtk_menu_button_get_type
</SECTION>
<SECTION>
<FILE>gtkmenuitem</FILE>
<TITLE>GtkMenuItem</TITLE>
GtkMenuItem
GtkMenuItemClass
gtk_menu_item_new
gtk_menu_item_new_with_label
gtk_menu_item_new_with_mnemonic
gtk_menu_item_get_label
gtk_menu_item_set_label
gtk_menu_item_get_use_underline
gtk_menu_item_set_use_underline
gtk_menu_item_set_submenu
gtk_menu_item_get_submenu
gtk_menu_item_set_accel_path
gtk_menu_item_get_accel_path
gtk_menu_item_select
gtk_menu_item_deselect
gtk_menu_item_activate
gtk_menu_item_toggle_size_request
gtk_menu_item_toggle_size_allocate
gtk_menu_item_get_reserve_indicator
gtk_menu_item_set_reserve_indicator
<SUBSECTION Standard>
GTK_MENU_ITEM
GTK_IS_MENU_ITEM
GTK_TYPE_MENU_ITEM
GTK_MENU_ITEM_CLASS
GTK_IS_MENU_ITEM_CLASS
GTK_MENU_ITEM_GET_CLASS
<SUBSECTION Private>
GtkMenuItemPrivate
gtk_menu_item_get_type
</SECTION>
<SECTION>
<FILE>gtkmenushell</FILE>
<TITLE>GtkMenuShell</TITLE>
GtkMenuShell
gtk_menu_shell_append
gtk_menu_shell_prepend
gtk_menu_shell_insert
gtk_menu_shell_deactivate
gtk_menu_shell_select_item
gtk_menu_shell_select_first
gtk_menu_shell_deselect
gtk_menu_shell_activate_item
gtk_menu_shell_cancel
gtk_menu_shell_set_take_focus
gtk_menu_shell_get_take_focus
gtk_menu_shell_get_selected_item
gtk_menu_shell_get_parent_shell
gtk_menu_shell_bind_model
GtkMenuDirectionType
<SUBSECTION Standard>
GTK_MENU_SHELL
GTK_IS_MENU_SHELL
GTK_TYPE_MENU_SHELL
GTK_MENU_SHELL_CLASS
GTK_IS_MENU_SHELL_CLASS
GTK_MENU_SHELL_GET_CLASS
<SUBSECTION Private>
GtkMenuShellPrivate
gtk_menu_shell_get_type
</SECTION>
<SECTION>
<FILE>gtkmessagedialog</FILE>
<TITLE>GtkMessageDialog</TITLE>
@@ -2205,31 +2100,6 @@ GtkRadioButtonPrivate
gtk_radio_button_get_type
</SECTION>
<SECTION>
<FILE>gtkradiomenuitem</FILE>
<TITLE>GtkRadioMenuItem</TITLE>
GtkRadioMenuItem
gtk_radio_menu_item_new
gtk_radio_menu_item_new_with_label
gtk_radio_menu_item_new_with_mnemonic
gtk_radio_menu_item_new_from_widget
gtk_radio_menu_item_new_with_label_from_widget
gtk_radio_menu_item_new_with_mnemonic_from_widget
gtk_radio_menu_item_set_group
gtk_radio_menu_item_get_group
gtk_radio_menu_item_join_group
<SUBSECTION Standard>
GTK_RADIO_MENU_ITEM
GTK_IS_RADIO_MENU_ITEM
GTK_TYPE_RADIO_MENU_ITEM
GTK_RADIO_MENU_ITEM_CLASS
GTK_IS_RADIO_MENU_ITEM_CLASS
GTK_RADIO_MENU_ITEM_GET_CLASS
<SUBSECTION Private>
GtkRadioMenuItemPrivate
gtk_radio_menu_item_get_type
</SECTION>
<SECTION>
<FILE>gtkrange</FILE>
<TITLE>GtkRange</TITLE>
@@ -2431,7 +2301,6 @@ gtk_scrollbar_get_type
<FILE>gtkscrolledwindow</FILE>
<TITLE>GtkScrolledWindow</TITLE>
GtkScrolledWindow
GtkScrolledWindowClass
gtk_scrolled_window_new
gtk_scrolled_window_get_hadjustment
gtk_scrolled_window_set_hadjustment
@@ -2483,7 +2352,6 @@ GtkScrolledWindowPrivate
<FILE>gtksearchbar</FILE>
<TITLE>GtkSearchBar</TITLE>
GtkSearchBar
GtkSearchBarClass
gtk_search_bar_new
gtk_search_bar_connect_entry
gtk_search_bar_get_search_mode
@@ -2538,23 +2406,6 @@ gtk_separator_get_type
GtkSeparatorPrivate
</SECTION>
<SECTION>
<FILE>gtkseparatormenuitem</FILE>
<TITLE>GtkSeparatorMenuItem</TITLE>
GtkSeparatorMenuItem
GtkSeparatorMenuItemClass
gtk_separator_menu_item_new
<SUBSECTION Standard>
GTK_SEPARATOR_MENU_ITEM
GTK_SEPARATOR_MENU_ITEM_CLASS
GTK_SEPARATOR_MENU_ITEM_GET_CLASS
GTK_IS_SEPARATOR_MENU_ITEM
GTK_IS_SEPARATOR_MENU_ITEM_CLASS
GTK_TYPE_SEPARATOR_MENU_ITEM
<SUBSECTION Private>
gtk_separator_menu_item_get_type
</SECTION>
<SECTION>
<FILE>gtksettings</FILE>
<TITLE>GtkSettings</TITLE>
@@ -2562,11 +2413,6 @@ GtkSettings
GtkSettingsValue
gtk_settings_get_default
gtk_settings_get_for_display
gtk_rc_property_parse_color
gtk_rc_property_parse_enum
gtk_rc_property_parse_flags
gtk_rc_property_parse_requisition
gtk_rc_property_parse_border
gtk_settings_reset_property
<SUBSECTION Standard>
GtkSettingsClass
@@ -2837,6 +2683,18 @@ gtk_text_buffer_begin_user_action
gtk_text_buffer_end_user_action
gtk_text_buffer_add_selection_clipboard
gtk_text_buffer_remove_selection_clipboard
gtk_text_buffer_get_can_undo
gtk_text_buffer_get_can_redo
gtk_text_buffer_get_enable_undo
gtk_text_buffer_set_enable_undo
gtk_text_buffer_get_max_undo_levels
gtk_text_buffer_set_max_undo_levels
gtk_text_buffer_undo
gtk_text_buffer_redo
gtk_text_buffer_begin_irreversible_action
gtk_text_buffer_end_irreversible_action
gtk_text_buffer_begin_user_action
gtk_text_buffer_end_user_action
<SUBSECTION Standard>
GTK_TEXT_BUFFER
@@ -3042,10 +2900,8 @@ gtk_text_view_get_line_at_y
gtk_text_view_get_line_yrange
gtk_text_view_get_iter_at_location
gtk_text_view_get_iter_at_position
gtk_text_view_buffer_to_surface_coords
gtk_text_view_buffer_to_window_coords
gtk_text_view_window_to_buffer_coords
gtk_text_view_set_border_window_size
gtk_text_view_get_border_window_size
gtk_text_view_forward_display_line
gtk_text_view_backward_display_line
gtk_text_view_forward_display_line_end
@@ -3057,8 +2913,10 @@ GtkTextChildAnchor
gtk_text_child_anchor_new
gtk_text_child_anchor_get_widgets
gtk_text_child_anchor_get_deleted
gtk_text_view_add_child_in_window
gtk_text_view_move_child
gtk_text_view_get_gutter
gtk_text_view_set_gutter
gtk_text_view_add_overlay
gtk_text_view_move_overlay
gtk_text_view_set_wrap_mode
gtk_text_view_get_wrap_mode
gtk_text_view_set_editable
@@ -3222,9 +3080,8 @@ gtk_tool_item_get_orientation
gtk_tool_item_get_toolbar_style
gtk_tool_item_get_text_alignment
gtk_tool_item_get_text_orientation
gtk_tool_item_retrieve_proxy_menu_item
gtk_tool_item_get_proxy_menu_item
gtk_tool_item_set_proxy_menu_item
gtk_tool_item_set_overflow_text
gtk_tool_item_get_overflow_text
gtk_tool_item_rebuild_menu
gtk_tool_item_toolbar_reconfigured
gtk_tool_item_get_text_size_group
@@ -3246,7 +3103,6 @@ GtkToolItemPrivate
<FILE>gtkseparatortoolitem</FILE>
<TITLE>GtkSeparatorToolItem</TITLE>
GtkSeparatorToolItem
GtkSeparatorToolItemClass
gtk_separator_tool_item_new
gtk_separator_tool_item_set_draw
gtk_separator_tool_item_get_draw
@@ -3298,10 +3154,9 @@ GtkToolButtonPrivate
<FILE>gtkmenutoolbutton</FILE>
<TITLE>GtkMenuToolButton</TITLE>
GtkMenuToolButton
GtkMenuToolButtonClass
gtk_menu_tool_button_new
gtk_menu_tool_button_set_menu
gtk_menu_tool_button_get_menu
gtk_menu_tool_button_set_popover
gtk_menu_tool_button_get_popover
gtk_menu_tool_button_set_arrow_tooltip_text
gtk_menu_tool_button_set_arrow_tooltip_markup
@@ -3380,6 +3235,29 @@ GTK_TOOLTIP
gtk_tooltip_get_type
</SECTION>
<SECTION>
<FILE>gtktreelistrow</FILE>
<TITLE>GtkTreeListRow</TITLE>
gtk_tree_list_row_get_item
gtk_tree_list_row_set_expanded
gtk_tree_list_row_get_expanded
gtk_tree_list_row_is_expandable
gtk_tree_list_row_get_position
gtk_tree_list_row_get_depth
gtk_tree_list_row_get_children
gtk_tree_list_row_get_parent
gtk_tree_list_row_get_child_row
<SUBSECTION Standard>
GTK_TREE_LIST_ROW
GTK_IS_TREE_LIST_ROW
GTK_TYPE_TREE_LIST_ROW
GTK_TREE_LIST_ROW_CLASS
GTK_IS_TREE_LIST_ROW_CLASS
GTK_TREE_LIST_ROW_GET_CLASS
<SUBSECTION Private>
gtk_tree_list_row_get_type
</SECTION>
<SECTION>
<FILE>gtktreelistmodel</FILE>
<TITLE>GtkTreeListModel</TITLE>
@@ -3393,18 +3271,6 @@ gtk_tree_list_model_set_autoexpand
gtk_tree_list_model_get_autoexpand
gtk_tree_list_model_get_child_row
gtk_tree_list_model_get_row
<SUBSECTION>
gtk_tree_list_row_get_item
gtk_tree_list_row_set_expanded
gtk_tree_list_row_get_expanded
gtk_tree_list_row_is_expandable
gtk_tree_list_row_get_position
gtk_tree_list_row_get_depth
gtk_tree_list_row_get_children
gtk_tree_list_row_get_parent
gtk_tree_list_row_get_child_row
<SUBSECTION Standard>
GTK_TREE_LIST_MODEL
GTK_IS_TREE_LIST_MODEL
@@ -3412,14 +3278,7 @@ GTK_TYPE_TREE_LIST_MODEL
GTK_TREE_LIST_MODEL_CLASS
GTK_IS_TREE_LIST_MODEL_CLASS
GTK_TREE_LIST_MODEL_GET_CLASS
GTK_TREE_LIST_ROW
GTK_IS_TREE_LIST_ROW
GTK_TYPE_TREE_LIST_ROW
GTK_TREE_LIST_ROW_CLASS
GTK_IS_TREE_LIST_ROW_CLASS
GTK_TREE_LIST_ROW_GET_CLASS
<SUBSECTION Private>
gtk_tree_list_model_get_type
gtk_tree_list_row_get_type
</SECTION>
@@ -3565,7 +3424,6 @@ gtk_tree_model_filter_get_type
<FILE>gtktreeselection</FILE>
<TITLE>GtkTreeSelection</TITLE>
GtkTreeSelection
GtkTreeSelectionClass
GtkTreeSelectionFunc
GtkTreeSelectionForeachFunc
gtk_tree_selection_set_mode
@@ -3767,7 +3625,6 @@ gtk_tree_view_column_get_type
<TITLE>GtkTreeView</TITLE>
GtkTreeView
GtkTreeViewDropPosition
GtkTreeViewPrivate
GtkTreeViewColumnDropFunc
GtkTreeViewMappingFunc
GtkTreeViewSearchEqualFunc
@@ -3842,9 +3699,6 @@ gtk_tree_view_get_search_equal_func
gtk_tree_view_set_search_equal_func
gtk_tree_view_get_search_entry
gtk_tree_view_set_search_entry
GtkTreeViewSearchPositionFunc
gtk_tree_view_get_search_position_func
gtk_tree_view_set_search_position_func
gtk_tree_view_get_fixed_height_mode
gtk_tree_view_set_fixed_height_mode
gtk_tree_view_get_hover_selection
@@ -3883,7 +3737,6 @@ gtk_tree_view_get_type
<FILE>gtkcellview</FILE>
<TITLE>GtkCellView</TITLE>
GtkCellView
GtkCellViewClass
gtk_cell_view_new
gtk_cell_view_new_with_context
gtk_cell_view_new_with_text
@@ -4031,7 +3884,6 @@ GtkCellAreaContextPrivate
<FILE>gtkcellareabox</FILE>
<TITLE>GtkCellAreaBox</TITLE>
GtkCellAreaBox
GtkCellAreaBoxClass
gtk_cell_area_box_new
gtk_cell_area_box_pack_start
gtk_cell_area_box_pack_end
@@ -4311,7 +4163,6 @@ gtk_list_store_get_type
<FILE>gtkviewport</FILE>
<TITLE>GtkViewport</TITLE>
GtkViewport
GtkViewportClass
gtk_viewport_new
gtk_viewport_set_shadow_type
gtk_viewport_get_shadow_type
@@ -4617,7 +4468,7 @@ gtk_widget_class_bind_template_child_internal_private
gtk_widget_class_bind_template_child_full
gtk_widget_class_bind_template_callback
gtk_widget_class_bind_template_callback_full
gtk_widget_class_set_connect_func
gtk_widget_class_set_template_scope
<SUBSECTION>
gtk_widget_observe_children
@@ -4685,8 +4536,8 @@ gtk_window_set_default_widget
gtk_window_present
gtk_window_present_with_time
gtk_window_close
gtk_window_iconify
gtk_window_deiconify
gtk_window_minimize
gtk_window_unminimize
gtk_window_stick
gtk_window_unstick
gtk_window_maximize
@@ -5150,62 +5001,20 @@ GTK_TYPE_SELECTION_DATA
gtk_selection_data_get_type
</SECTION>
<SECTION>
<FILE>gtkdnd</FILE>
<TITLE>Drag and Drop</TITLE>
GtkDestDefaults
GtkDragResult
<SUBSECTION Destination Side>
gtk_drag_dest_set
gtk_drag_dest_unset
gtk_drag_dest_find_target
gtk_drag_dest_get_target_list
gtk_drag_dest_set_target_list
gtk_drag_dest_add_text_targets
gtk_drag_dest_add_image_targets
gtk_drag_dest_add_uri_targets
gtk_drag_dest_set_track_motion
gtk_drag_dest_get_track_motion
gtk_drag_get_data
gtk_drag_get_source_widget
gtk_drag_highlight
gtk_drag_unhighlight
<SUBSECTION Source Side>
gtk_drag_begin
gtk_drag_cancel
gtk_drag_set_icon_widget
gtk_drag_set_icon_paintable
gtk_drag_set_icon_name
gtk_drag_set_icon_gicon
gtk_drag_set_icon_default
gtk_drag_check_threshold
gtk_drag_source_set
gtk_drag_source_set_icon_name
gtk_drag_source_set_icon_gicon
gtk_drag_source_set_icon_paintable
gtk_drag_source_unset
gtk_drag_source_set_target_list
gtk_drag_source_get_target_list
gtk_drag_source_add_text_targets
gtk_drag_source_add_image_targets
gtk_drag_source_add_uri_targets
</SECTION>
<SECTION>
<FILE>gtkbindings</FILE>
<TITLE>Bindings</TITLE>
GtkBindingSet
GtkBindingEntry
GtkBindingSignal
GtkBindingArg
gtk_binding_set_new
gtk_binding_set_by_class
gtk_binding_set_find
gtk_bindings_activate
gtk_bindings_activate_event
gtk_binding_set_activate
gtk_binding_entry_add_action
gtk_binding_entry_add_action_variant
GtkBindingCallback
gtk_binding_entry_add_callback
gtk_binding_entry_add_signal
gtk_binding_entry_add_signal_from_string
gtk_binding_entry_skip
@@ -5240,7 +5049,6 @@ GtkIconSize
<TITLE>GtkIconTheme</TITLE>
GtkIconInfo
GtkIconTheme
GtkIconThemeClass
GtkIconLookupFlags
GTK_ICON_THEME_ERROR
GtkIconThemeError
@@ -5263,17 +5071,13 @@ gtk_icon_theme_lookup_by_gicon
gtk_icon_theme_lookup_by_gicon_for_scale
gtk_icon_theme_load_icon
gtk_icon_theme_load_icon_for_scale
gtk_icon_theme_list_contexts
gtk_icon_theme_list_icons
gtk_icon_theme_get_icon_sizes
gtk_icon_theme_get_example_icon_name
gtk_icon_theme_rescan_if_needed
gtk_icon_info_new_for_pixbuf
gtk_icon_info_get_base_size
gtk_icon_info_get_base_scale
gtk_icon_info_get_filename
gtk_icon_info_load_icon
gtk_icon_info_load_texture
gtk_icon_info_load_icon_async
gtk_icon_info_load_icon_finish
gtk_icon_info_load_symbolic
@@ -5777,7 +5581,6 @@ gtk_print_job_get_type
<FILE>gtkpagesetupunixdialog</FILE>
<TITLE>GtkPageSetupUnixDialog</TITLE>
GtkPageSetupUnixDialog
GtkPageSetupUnixDialogClass
gtk_page_setup_unix_dialog_new
gtk_page_setup_unix_dialog_set_page_setup
gtk_page_setup_unix_dialog_get_page_setup
@@ -5988,7 +5791,6 @@ gtk_grid_get_type
<SECTION>
<FILE>gtkswitch</FILE>
GtkSwitch
GtkSwitchClass
gtk_switch_new
gtk_switch_set_active
gtk_switch_get_active
@@ -6038,7 +5840,6 @@ GTK_IS_APP_CHOOSER_ONLINE_PK_CLASS
<FILE>gtkappchooserbutton</FILE>
<TITLE>GtkAppChooserButton</TITLE>
GtkAppChooserButton
GtkAppChooserButtonClass
gtk_app_chooser_button_new
gtk_app_chooser_button_append_custom_item
gtk_app_chooser_button_append_separator
@@ -6067,7 +5868,6 @@ gtk_app_chooser_button_get_type
<FILE>gtkappchooserdialog</FILE>
<TITLE>GtkAppChooserDialog</TITLE>
GtkAppChooserDialog
GtkAppChooserDialogClass
gtk_app_chooser_dialog_new
gtk_app_chooser_dialog_new_for_content_type
gtk_app_chooser_dialog_get_widget
@@ -6091,7 +5891,6 @@ gtk_app_chooser_dialog_get_type
<FILE>gtkappchooserwidget</FILE>
<TITLE>GtkAppChooserWidget</TITLE>
GtkAppChooserWidget
GtkAppChooserWidgetClass
gtk_app_chooser_widget_new
gtk_app_chooser_widget_set_show_default
gtk_app_chooser_widget_get_show_default
@@ -6123,7 +5922,6 @@ gtk_app_chooser_widget_get_type
<FILE>gtklockbutton</FILE>
<TITLE>GtkLockButton</TITLE>
GtkLockButton
GtkLockButtonClass
gtk_lock_button_new
gtk_lock_button_get_permission
@@ -6145,7 +5943,6 @@ GtkLockButtonPrivate
<FILE>gtkoverlay</FILE>
<TITLE>GtkOverlay</TITLE>
GtkOverlay
GtkOverlayClass
gtk_overlay_new
gtk_overlay_add_overlay
@@ -6195,7 +5992,6 @@ gtk_color_chooser_get_type
<FILE>gtkcolorchooserwidget</FILE>
<TITLE>GtkColorChooserWidget</TITLE>
GtkColorChooserWidget
GtkColorChooserWidgetClass
gtk_color_chooser_widget_new
<SUBSECTION Standard>
@@ -6355,7 +6151,6 @@ gtk_stack_switcher_get_type
<FILE>gtkrevealer</FILE>
<TITLE>GtkRevealer</TITLE>
GtkRevealer
GtkRevealerClass
gtk_revealer_new
gtk_revealer_get_reveal_child
gtk_revealer_set_reveal_child
@@ -6462,15 +6257,11 @@ gtk_popover_set_pointing_to
gtk_popover_get_pointing_to
gtk_popover_set_position
gtk_popover_get_position
GtkPopoverConstraint
gtk_popover_set_constrain_to
gtk_popover_get_constrain_to
gtk_popover_set_autohide
gtk_popover_get_autohide
gtk_popover_set_has_arrow
gtk_popover_get_has_arrow
gtk_popover_set_default_widget
gtk_popover_get_default_widget
<SUBSECTION Standard>
GTK_TYPE_POPOVER
GTK_IS_POPOVER
@@ -6490,18 +6281,14 @@ gtk_popover_get_type
<FILE>gtkpopovermenu</FILE>
<TITLE>GtkPopoverMenu</TITLE>
GtkPopoverMenu
gtk_popover_menu_new
gtk_popover_menu_new_from_model
gtk_popover_menu_add_submenu
gtk_popover_menu_open_submenu
gtk_popover_menu_set_menu_model
gtk_popover_menu_get_menu_model
<SUBSECTION Standard>
GTK_TYPE_POPOVER_MENU
GTK_IS_POPOVER_MENU
GTK_IS_POPOVER_MENU_CLASS
GTK_POPOVER_MENU
GTK_POPOVER_MENU_CLASS
GTK_POPOVER_MENU_GET_CLASS
<SUBSECTION Private>
gtk_popover_menu_get_type
@@ -6524,20 +6311,6 @@ GTK_POPOVER_MENU_BAR
gtk_popover_menu_bar_get_type
</SECTION>
<SECTION>
<FILE>gtkmodelbutton</FILE>
<TITLE>GtkModelButton</TITLE>
GtkModelButton
GtkButtonRole
gtk_model_button_new
<SUBSECTION Standard>
GTK_TYPE_MODEL_BUTTON
GTK_MODEL_BUTTON
GTK_IS_MODEL_BUTTON
<SUBSECTION Private>
gtk_model_button_get_type
</SECTION>
<SECTION>
<FILE>gtkeventcontroller</FILE>
<TITLE>GtkEventController</TITLE>
@@ -6675,6 +6448,8 @@ GtkEventControllerMotion
gtk_event_controller_motion_new
gtk_event_controller_motion_get_pointer_origin
gtk_event_controller_motion_get_pointer_target
gtk_event_controller_motion_contains_pointer
gtk_event_controller_motion_is_pointer
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_MOTION
@@ -6699,6 +6474,8 @@ gtk_event_controller_key_forward
gtk_event_controller_key_get_group
gtk_event_controller_key_get_focus_origin
gtk_event_controller_key_get_focus_target
gtk_event_controller_key_contains_focus
gtk_event_controller_key_is_focus
<SUBSECTION Standard>
GTK_TYPE_EVENT_CONTROLLER_KEY
@@ -6737,6 +6514,8 @@ gtk_gesture_drag_get_type
<TITLE>GtkGestureLongPress</TITLE>
GtkGestureLongPress
gtk_gesture_long_press_new
gtk_gesture_long_press_set_delay_factor
gtk_gesture_long_press_get_delay_factor
<SUBSECTION Standard>
GTK_TYPE_GESTURE_LONG_PRESS
@@ -7239,8 +7018,8 @@ gtk_fixed_layout_new
<SUBSECTION>
GtkFixedLayoutChild
gtk_fixed_layout_child_set_position
gtk_fixed_layout_child_get_position
gtk_fixed_layout_child_set_transform
gtk_fixed_layout_child_get_transform
<SUBSECTION Standard>
GTK_TYPE_FIXED_LAYOUT
@@ -7369,3 +7148,69 @@ gtk_constraint_guide_get_max_size
GTK_TYPE_CONSTRAINT_GUIDE
gtk_constraint_guide_get_tyoe
</SECTION>
<SECTION>
<FILE>gtkdragsource</FILE>
GtkDragSource
gtk_drag_source_new
gtk_drag_source_set_content
gtk_drag_source_get_content
gtk_drag_source_set_actions
gtk_drag_source_get_actions
gtk_drag_source_set_icon
gtk_drag_source_drag_cancel
gtk_drag_source_get_drag
gtk_drag_check_threshold
<SUBSECTION Standard>
GTK_TYPE_DRAG_SOURCE
GTK_DRAG_SOURCE
GTK_DRAG_SOURCE_CLASS
GTK_IS_DRAG_SOURCE
GTK_IS_DRAG_SOURCE_CLASS
GTK_DRAG_SOURCE_GET_CLASS
<SUBSECTION Private>
gtk_drag_source_get_type
</SECTION>
<SECTION>
<FILE>gtkdroptarget</FILE>
GtkDropTarget
gtk_drop_target_new
gtk_drop_target_set_formats
gtk_drop_target_get_formats
gtk_drop_target_set_actions
gtk_drop_target_get_actions
gtk_drop_target_get_drop
gtk_drop_target_find_mimetype
gtk_drop_target_read_selection
gtk_drop_target_read_selection_finish
gtk_drag_highlight
gtk_drag_unhighlight
<SUBSECTION Standard>
GTK_TYPE_DROP_TARGET
GTK_DROP_TARGET
GTK_DROP_TARGET_CLASS
GTK_IS_DROP_TARGET
GTK_IS_DROP_TARGET_CLASS
GTK_DROP_TARGET_GET_CLASS
<SUBSECTION Private>
gtk_drop_target_get_type
</SECTION>
<SECTION>
<FILE>gtkdragicon</FILE>
GtkDragIcon
gtk_drag_icon_new_for_drag
gtk_drag_icon_set_from_paintable
<SUBSECTION Standard>
GTK_TYPE_DRAG_ICON
GTK_DRAG_ICON
GTK_DRAG_ICON_CLASS
GTK_IS_DRAG_ICON
GTK_IS_DRAG_ICON_CLASS
GTK_DRAG_ICON_GET_CLASS
<SUBSECTION Private>
gtk_drag_icon_get_type
</SECTION>

View File

@@ -49,7 +49,7 @@
files for icon themes.
</para>
<para>
It expects to be given the <replaceable>PATH</replaceable> to a icon theme
It expects to be given the <replaceable>PATH</replaceable> to an icon theme
directory containing an <filename>index.theme</filename>, e.g.
<filename>/usr/share/icons/hicolor</filename>, and writes a
<filename>icon-theme.cache</filename> containing cached information about

View File

@@ -22,7 +22,9 @@ gtk_bin_get_type
gtk_bin_layout_get_type
gtk_box_get_type
gtk_box_layout_get_type
gtk_builder_cscope_get_type
gtk_builder_get_type
gtk_builder_scope_get_type
gtk_buildable_get_type
gtk_button_get_type
gtk_calendar_get_type
@@ -42,7 +44,6 @@ gtk_cell_renderer_text_get_type
gtk_cell_renderer_toggle_get_type
gtk_cell_view_get_type
gtk_check_button_get_type
gtk_check_menu_item_get_type
gtk_color_button_get_type
gtk_color_chooser_get_type
gtk_color_chooser_dialog_get_type
@@ -56,7 +57,10 @@ gtk_constraint_target_get_type
gtk_container_get_type
gtk_css_provider_get_type
gtk_dialog_get_type
gtk_drag_icon_get_type
gtk_drag_source_get_type
gtk_drawing_area_get_type
gtk_drop_target_get_type
gtk_editable_get_type
gtk_entry_buffer_get_type
gtk_entry_completion_get_type
@@ -72,8 +76,10 @@ gtk_file_chooser_dialog_get_type
gtk_file_chooser_get_type
gtk_file_chooser_widget_get_type
gtk_file_filter_get_type
gtk_filter_list_model_get_type
gtk_fixed_get_type
gtk_fixed_layout_get_type
gtk_flatten_list_model_get_type
gtk_flow_box_get_type
gtk_flow_box_child_get_type
gtk_font_button_get_type
@@ -111,18 +117,16 @@ gtk_list_store_get_type
gtk_list_box_get_type
gtk_list_box_row_get_type
gtk_lock_button_get_type
gtk_map_list_model_get_type
gtk_media_controls_get_type
gtk_media_file_get_type
gtk_media_stream_get_type
gtk_menu_bar_get_type
gtk_menu_button_get_type
gtk_menu_get_type
gtk_menu_item_get_type
gtk_menu_shell_get_type
gtk_menu_tool_button_get_type
gtk_message_dialog_get_type
gtk_model_button_get_type
gtk_mount_operation_get_type
gtk_native_get_type
gtk_no_selection_get_type
gtk_notebook_get_type
gtk_notebook_page_get_type
gtk_orientable_get_type
@@ -146,7 +150,6 @@ gtk_print_settings_get_type
@DISABLE_ON_W32@gtk_print_unix_dialog_get_type
gtk_progress_bar_get_type
gtk_radio_button_get_type
gtk_radio_menu_item_get_type
gtk_radio_tool_button_get_type
gtk_range_get_type
gtk_recent_manager_get_type
@@ -161,7 +164,6 @@ gtk_search_bar_get_type
gtk_search_entry_get_type
gtk_selection_model_get_type
gtk_separator_get_type
gtk_separator_menu_item_get_type
gtk_separator_tool_item_get_type
gtk_settings_get_type
gtk_shortcut_label_get_type
@@ -171,7 +173,9 @@ gtk_shortcuts_group_get_type
gtk_shortcuts_shortcut_get_type
gtk_single_selection_get_type
gtk_size_group_get_type
gtk_slice_list_model_get_type
gtk_snapshot_get_type
gtk_sort_list_model_get_type
gtk_spin_button_get_type
gtk_spinner_get_type
gtk_stack_get_type
@@ -198,6 +202,8 @@ gtk_tool_button_get_type
gtk_tool_item_get_type
gtk_tree_drag_dest_get_type
gtk_tree_drag_source_get_type
gtk_tree_list_model_get_type
gtk_tree_list_row_get_type
gtk_tree_model_filter_get_type
gtk_tree_model_get_type
gtk_tree_model_sort_get_type

View File

@@ -1,4 +1,6 @@
private_headers = [
'imm-extra.h',
'gtkbitmaskprivateimpl.h',
'gdkpixbufutilsprivate.h',
'gtkaccelgroupprivate.h',
'gtkaccelmapprivate.h',
@@ -15,7 +17,6 @@ private_headers = [
'gtkbuttonprivate.h',
'gtkcellareaboxcontextprivate.h',
'gtkcheckbuttonprivate.h',
'gtkcheckmenuitemprivate.h',
'gtkcolorchooserprivate.h',
'gtkcoloreditorprivate.h',
'gtkcolorplaneprivate.h',
@@ -35,6 +36,7 @@ private_headers = [
'gtkcssarrayvalueprivate.h',
'gtkcssbgsizevalueprivate.h',
'gtkcssbordervalueprivate.h',
'gtkcssboxesprivate.h',
'gtkcsscalcvalueprivate.h',
'gtkcsscolorvalueprivate.h',
'gtkcsscornervalueprivate.h',
@@ -46,7 +48,6 @@ private_headers = [
'gtkcssfontfeaturesvalueprivate.h',
'gtkcssfontvariationsvalueprivate.h',
'gtkcssiconthemevalueprivate.h',
'gtkcssimagebuiltinprivate.h',
'gtkcssimagecrossfadeprivate.h',
'gtkcssimagefallbackprivate.h',
'gtkcssimageiconthemeprivate.h',
@@ -95,7 +96,6 @@ private_headers = [
'gtkcsswidgetnodeprivate.h',
'gtkcsswin32sizevalueprivate.h',
'gtkdialogprivate.h',
'gtkdndprivate.h',
'gtkentryprivate.h',
'gtkeventcontrollerlegacyprivate.h',
'gtkeventcontrollerprivate.h',
@@ -135,9 +135,6 @@ private_headers = [
'gtkmagnifierprivate.h',
'gtkmediafileprivate.h',
'gtkmenubuttonprivate.h',
'gtkmenuitemprivate.h',
'gtkmenuprivate.h',
'gtkmenushellprivate.h',
'gtkmodulesprivate.h',
'gtkmountoperationprivate.h',
'gtknativedialogprivate.h',
@@ -178,8 +175,10 @@ private_headers = [
'gtktextchildprivate.h',
'gtktextdisplayprivate.h',
'gtktexthandleprivate.h',
'gtktexthistoryprivate.h',
'gtktextiterprivate.h',
'gtktextlayoutprivate.h',
'gtktextlinedisplaycacheprivate.h',
'gtktextmarkprivate.h',
'gtktexttagprivate.h',
'gtktextviewprivate.h',
@@ -342,8 +341,8 @@ images = [
content_files = [
'actions.xml',
'broadway.xml',
'building.sgml',
'compiling.sgml',
'building.xml',
'compiling.xml',
'css-overview.xml',
'css-properties.xml',
'drawing-model.xml',
@@ -361,31 +360,31 @@ content_files = [
'input-handling.xml',
'migrating-2to4.xml',
'migrating-3to4.xml',
'osx.sgml',
'other_software.sgml',
'osx.xml',
'other_software.xml',
'overview.xml',
'question_index.sgml',
'resources.sgml',
'running.sgml',
'text_widget.sgml',
'tree_widget.sgml',
'question_index.xml',
'resources.xml',
'running.xml',
'text_widget.xml',
'tree_widget.xml',
'visual_index.xml',
'wayland.xml',
'windows.sgml',
'x11.sgml',
'windows.xml',
'x11.xml',
]
expand_content_files = [
'actions.xml',
'compiling.sgml',
'compiling.xml',
'drawing-model.xml',
'glossary.xml',
'input-handling.xml',
'migrating-2to4.xml',
'migrating-3to4.xml',
'question_index.sgml',
'text_widget.sgml',
'tree_widget.sgml',
'question_index.xml',
'text_widget.xml',
'tree_widget.xml',
]
types_conf = configuration_data()

View File

@@ -305,6 +305,18 @@
</para>
</section>
<section>
<title>Stop using grabs</title>
<para>
GTK 4 no longer provides the gdk_device_grab() or gdk_seat_grab() apis.
</para>
<para>
If you need to dismiss a popup when the user clicks outside (a common
use for grabs), you can use the GdkSurface #GdkSurface:autohide property instead.
GtkPopover also has a #GtkPopover:autohide property.
</para>
</section>
<section>
<title>Adapt to coordinate API changes</title>
<para>
@@ -673,7 +685,7 @@
<section>
<title>Adapt to changes in the API of GtkEntry, GtkSearchEntry and GtkSpinButton</title>
<para>
The GtkEditable has been made more useful, and the core functionality of
The GtkEditable interface has been made more useful, and the core functionality of
GtkEntry has been broken out as a GtkText widget. GtkEntry, GtkSearchEntry,
GtkSpinButton and the new GtkPasswordEntry now use a GtkText widget internally
and implement GtkEditable. In particular, this means that it is no longer
@@ -813,6 +825,115 @@
</para>
</section>
<section>
<title>GtkEntryBuffer ::deleted-text has changed</title>
<para>
To allow signal handlers to access the deleted text before it
has been deleted #GtkEntryBuffer::deleted-text has changed from
%G_SIGNAL_RUN_FIRST to %G_SIGNAL_RUN_LAST. The default handler
removes the text from the #GtkEntryBuffer.
</para>
<para>
To adapt existing code, use g_signal_connect_after() or
%G_CONNECT_AFTER when using g_signal_connect_data() or
g_signal_connect_object().
</para>
</section>
<section>
<title>The "iconified" window state has been renamed to "minimized"</title>
<para>
The <literal>GDK_SURFACE_STATE_ICONIFIED</literal> value of the
#GdkSurfaceState enumeration is now %GDK_SURFACE_STATE_MINIMIZED.
</para>
<para>
The #GdkSurface functions <function>gdk_surface_iconify()</function>
and <function>gdk_surface_deiconify()</function> have been renamed to
gdk_surface_minimize() and gdk_surface_unminimize(), respectively.
</para>
<para>
The corresponding #GtkWindow functions <function>gtk_window_iconify()</function>
and <function>gtk_window_deiconify()</function> have been renamed
to gtk_window_minimize() and gtk_window_unminimize(), respectively.
</para>
<para>
The behavior of the minimization and unminimization operations have
not been changed, and they still require support from the underlying
windowing system.
</para>
</section>
<section>
<title>GtkMenu, GtkMenuBar and GtkMenuItem are gone</title>
<para>
These widgets were heavily relying on X11-centric concepts such as
override-redirect windows and grabs, and were hard to adjust to other
windowing systems.
</para>
<para>
Menus can already be replaced using GtkPopoverMenu in GTK 3. Additionally,
GTK 4 introduces GtkPopoverMenuBar to replace menubars. These new widgets
can only be constructed from menu models, so the porting effort involves
switching to menu models and actions.
</para>
<para>
Since menus are gone, GtkMenuButton and GtkMenuToolButton also lost their
ability to show menus, and need to be used with popovers in GTK 4.
</para>
</section>
<section>
<title>GtkToolbar overflow handling has changed</title>
<para>
The handling of overflow in toolbars has been simplified.
Instead of creating a proxy menuitem and setting it with
gtk_tool_item_set_proxy_menu_item(), you simply provide
a label for the overflow menu with gtk_tool_item_set_overflow_text().
GTK will figure out itself whether to create a check- or
radioitem as proxy.
</para>
</section>
<section>
<title>Stop using custom tooltip windows</title>
<para>
Tooltips no longer use GtkWindows in GTK 4, and it is no longer
possible to provide a custom window for tooltips. Replacing the content
of the tooltip with a custom widget is still possible, with
gtk_tooltip_set_custom().
</para>
</section>
<section>
<title>Switch to the new DND api</title>
<para>
The source-side DND apis in GTK 4 have been changed to use an event controller, #GtkDragSource.
</para>
<para>
Instead of calling gtk_drag_source_set() and connecting to #GtkWidget signals, you create
a #GtkDragSource object, attach it to the widget with gtk_widget_add_controller(), and connect
to #GtkDragSource signals. Instead of calling gtk_drag_begin() on a widget to start a drag
manually, call gdk_drag_begin().
</para>
<para>
The ::drag-data-get signal has been replaced by the #GtkDragSource::prepare signal, which
returns a #GdkContentProvider for the drag operation.
</para>
<para>
The destination-side DND apis in GTK 4 have also been changed to use and event controller,
#GTkDropTarget.
</para>
<para>
Instead of calling gtk_drag_dest_set() and connecting to #GtkWidget signals, you create
a #GtkDropTarget object, attach it to the widget with gtk_widget_add_controller(), and
connect to #GtkDropTarget signals.
</para>
<para>
The ::drag-motion signal has been renamed to #GtkDragSource::accept, and instead of
::drag-data-received, you need to use async read methods on the #GdkDrop object, such
as gdk_drop_read_value_async() or gdk_drop_read_text_async().
</para>
</section>
</section>
</chapter>

View File

@@ -11,7 +11,10 @@ GTK is released under the GNU Library General Public License
applications. GTK has a C-based object-oriented architecture that
allows for maximum flexibility. Bindings for many other languages have
been written, including C++, Objective-C, Guile/Scheme, Perl, Python,
TOM, Ada95, Free Pascal, and Eiffel.
TOM, Ada95, Free Pascal, and Eiffel. The GTK library itself contains
<firstterm>widgets</firstterm>, that is, GUI components such as GtkButton
or GtkTextView.
</para>
<para>
GTK depends on the following libraries:
@@ -105,14 +108,6 @@ and rendering it using different rendering APIs. GSK provides renderers
for OpenGL, Vulkan and cairo.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GTK</term>
<listitem><para>
The GTK library itself contains <firstterm>widgets</firstterm>,
that is, GUI components such as GtkButton or GtkTextView.
</para></listitem>
</varlistentry>
</variablelist>
</para>
</partintro>

View File

@@ -112,6 +112,16 @@ multiple bytes in UTF-8, and the two-character sequence "\r\n" is also
considered a line separator.
</para>
<para>
Text buffers support undo and redo if gtk_text_buffer_set_undo_enabled()
has been set to %TRUE. Use gtk_text_buffer_undo() or gtk_text_buffer_redo()
to perform the necessary action. Note that these operations are ignored if
the buffer is not editable. Developers may want some operations to not be
undoable. To do this, wrap your changes in
gtk_text_buffer_begin_irreversible_action() and
gtk_text_buffer_end_irreversible_action().
</para>
</refsect1>

View File

@@ -162,9 +162,6 @@
<link linkend="GtkPaned">
<inlinegraphic fileref="panes.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkMenuBar">
<inlinegraphic fileref="menubar.png" format="PNG"></inlinegraphic>
</link>
<link linkend="GtkToolbar">
<inlinegraphic fileref="toolbar.png" format="PNG"></inlinegraphic>
</link>

View File

@@ -138,7 +138,7 @@ url="http://www.freedesktop.org/standards/">convention</ulink>.
<para>
GTK has functions for asking the window manager to do various things;
see for example <link
linkend="gtk-window-iconify">gtk_window_iconify()</link> or <link
linkend="gtk-window-minimize">gtk_window_minimize()</link> or <link
linkend="gtk-window-maximize">gtk_window_maximize()</link> or <link
linkend="gtk-window-set-decorated">gtk_window_set_decorated()</link>.
Keep in mind that most window managers <emphasis>will</emphasis> ignore

View File

@@ -1,97 +0,0 @@
HANDLING WIDGET STYLES
======================
A widget gets created with a default style.
The global default style can be affected by gtk_widget_set_default_style()
and can be queried by gtk_widget_get_default_style().
The initial style that is assigned to a widget as default style upon
creation can be affected by wrapping the widget's creation as follows:
gtk_widget_push_style (my_style);
widget = gtk_type_new (gtk_button_get_type ());
gtk_widget_pop_style ();
There are certain functions to affect widget styles after a widget's
creation:
gtk_widget_set_style ()
Save the default style and set a user style.
This will override a previously set user style or
previously set rc styles.
gtk_widget_reset_rc_styles ()
Descends through a widget hierarchy and sets the rc style
on all widgets that don't have a user style set.
gtk_widget_ensure_style ()
Ensure that the widget either has a user style set, or an rc lookup
has been performed.
gtk_rc_get_style ()
Return an rc style for a widget if there is one.
gtk_widget_set_name ()
Change widget name, and perform a new rc lookup if no user style
is set.
gtk_widget_realize ()
Besides realizing the widget this function will:
- perform an rc lookup if necessary,
- attach a widget's style.
gtk_widget_get_style ()
Return a widgets style, this function will perform an rc lookup
if necessary.
gtk_widget_set_parent ()
This function will perform rc lookups recursively for all widgets
that do not have a user style set.
gtk_style_copy ()
This function can be used to copy a widget's style.
The style can subsequently be changed (e.g., by modifications to the
red/green/blue values of a certain color) and then be applied to the
widget via gtk_widget_set_style().
GtkWidget::style_set
This signal will be emitted for a widget once its style changes with
an additional argument previous_style which will hold the widget->style
value from a previous emission.
The initial emission of this signal is guaranteed to happen prior
to any GtkWidget::size_request emission, and will have the previous_style
argument set to NULL.
The GtkWidgetClass implements a default handler for this signal that
will set the widget's window's background of widgets that provide their
own windows according to the new style.
Derived widgets need to override this default handler, if:
- their size requisition depends on the current style.
(e.g., on the style's fonts)
- they set the background of widget->window to something other than.
style->bg. (e.g., GtkListItem)
- the widget provides windows other than widget->window.
- the widget has any other stored dependencies on the style.
Flag indications:
!GTK_RC_STYLE && !GTK_USER_STYLE:
The widget has its default style set, no rc lookup has been
performed, the widget has not been size requested yet and is
therefore not yet realized.
GTK_USER_STYLE:
GTK_RC_STYLE is not set.
The widget has a user style assigned, and its default style has been
saved.
GTK_RC_STYLE:
GTK_USER_STYLE is not set.
If the widget has a saved default style, it has been assigned an
rc style. If the widget does not have a saved default style, it still
has its default style but an rc lookup has already been performed.
- Tim Janik <timj@gimp.org>
1998/02/27

View File

@@ -152,8 +152,8 @@ create_menu_button (void)
image = gtk_image_new ();
gtk_image_set_from_icon_name (GTK_IMAGE (image), "emblem-system-symbolic");
gtk_container_add (GTK_CONTAINER (widget), image);
menu = gtk_menu_new ();
gtk_menu_button_set_popup (GTK_MENU_BUTTON (widget), menu);
menu = gtk_popover_new (NULL);
gtk_menu_button_set_popover (GTK_MENU_BUTTON (widget), menu);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_container_add (GTK_CONTAINER (vbox), widget);
@@ -800,32 +800,6 @@ create_toolbar (void)
return new_widget_info ("toolbar", widget, SMALL);
}
static WidgetInfo *
create_menubar (void)
{
GtkWidget *widget, *vbox, *item;
widget = gtk_menu_bar_new ();
item = gtk_menu_item_new_with_mnemonic ("_File");
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
item = gtk_menu_item_new_with_mnemonic ("_Edit");
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
item = gtk_menu_item_new_with_mnemonic ("_Help");
gtk_menu_shell_append (GTK_MENU_SHELL (widget), item);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
gtk_widget_set_halign (widget, GTK_ALIGN_FILL);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_container_add (GTK_CONTAINER (vbox), widget);
gtk_container_add (GTK_CONTAINER (vbox),
gtk_label_new ("Menu Bar"));
return new_widget_info ("menubar", vbox, SMALL);
}
static WidgetInfo *
create_message_dialog (void)
{
@@ -1438,7 +1412,6 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_image ());
retval = g_list_prepend (retval, create_label ());
retval = g_list_prepend (retval, create_link_button ());
retval = g_list_prepend (retval, create_menubar ());
retval = g_list_prepend (retval, create_message_dialog ());
retval = g_list_prepend (retval, create_notebook ());
retval = g_list_prepend (retval, create_panes ());

View File

@@ -6,7 +6,7 @@ anyone who hopes to work with the code in the future.
HOW THE GTKTREEVIEW CALCULATES SIZE:
====================================
When the view is given a new model, the first thing it does is walk
through the model at the top level, creating an GtkRBNode for each
through the model at the top level, creating a GtkRBNode for each
element of the model. Each node has a height of 0. The RBTree is kept
updated as the models structure changes. Additionally, the user can
expand, collapse, and select rows at this stage. The RBTree is accurate

View File

@@ -1,836 +0,0 @@
This file is some notes about how different widgets are drawn.
=============
GtkMenu
=============
+----------------------------------------------------------------------------+
| A |
| +------------------------------------------------------------------------+ |
| |############################# C ########################################| |
| |# D #| |
| |# +-------------------------------------------------------------------+#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | Item 1 |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# +-------------------------------------------------------------------+#| |
| |# +-------------------------------------------------------------------+#| |
| |# | |#| |
| |# | |#| |
|A|B | |B|A|
| |# | Item 2 |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# +-------------------------------------------------------------------+#| |
| |# [...] #| |
| |# +-------------------------------------------------------------------+#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | Item n |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# | |#| |
| |# +-------------------------------------------------------------------+#| |
| |# D #| |
| |############################# C ########################################| |
| +------------------------------------------------------------------------| |
| A |
+----------------------------------------------------------------------------+
A: GtkContainer::border_width
B: xthickness
C: ythickness
D: vertical_padding
=============
GtkMenuItem
=============
+----------------------------------------------------------------------------+
| A |
| +------------------------------------------------------------------------+ |
| |############################# C ########################################| |
| |#+-+------------+--+-------------------------------+--+-------------+-+#| |
| |#| |\\\\\\\\\\\\| | /|\ |**| | |#| |
| |#| |<------E------>| | |**| G | |#| |
| |#| |\\\\\\\\\\\\| | | |**| | |#| |
| |#| |\\\\\\\\\\\\| | | |**| >> | |#| |
| |#| |\\\\\\\\\\\\| | | |**| >>>> | |#| |
| |#| |\\\\\\\\\\\\| | | |**| >>>>>> | |#| |
|A|B|D|\\\\\\\\\\\\| F| Child G |*H| >>>>>>>> |D|B|A|
| |#| |\\\\\\\\\\\\| | | |**| >>>>>> | |#| |
| |#| |\\\\\\\\\\\\| | | |**| >>>> | |#| |
| |#| |\\\\\\\\\\\\| | | |**| >> | |#| |
| |#| |\\\\\\\\\\\\| | | |**| | |#| |
| |#| |\\\\\\\\\\\\| | | |**| | |#| |
| |#| |\\\\\\\\\\\\| | \|/ |**| | |#| |
| |#+-+------------+--+-------------------------------+--+-------------+-+#| |
| |############################# C ########################################| |
| +------------------------------------------------------------------------+ |
| A |
+----------------------------------------------------------------------------+
A: GtkContainer:border_width
B: xthickness
C: ythickness
D: horizontal_padding
E: toggle_size
F: toggle_spacing
G: Requested height of child (also used for width of arrow
H: arrow_spacing spacing (when the item has a non-vertical submenu)
=============
GtkOptionMenu:
=============
Geometry parameters
Style properties
GtkWidget::interior_focus = TRUE
GtkWidget::focus_width = 1
GtkWidget::focus_padding = 0
GtkOptionMenu::indicator_size = { 7, 13 }
GtkOptionMenu::indicator_spacing = { 7, 5, 2, 2 }
Properties
GtkContainer::border_width = 0
#defines
CHILD_LEFT_SPACING = 5
CHILD_RIGHT_SPACING = 1
CHILD_TOP_SPACING = 1
CHILD_BOTTOM_SPACING = 1
I) interior_focus = TRUE
+--------------------------------------------------+
+ A |
| +----------------------------------------------+ |
| |\\\\\\\\\\\\\\\\\\\\ H ///////////////////////| |
| |\+------------------------------------------+/| |
| |\| C |/| |
| |\| +------------------------------+ |/| |
| |\| |################ D ###########| L |/| |
| |\| |#+--------------------------+#| |/| |
| |\| |#| K |#| |/| |
| |\| |#| +----------------------+ |#| +-----+ |/| |
| |\| |#| | | |#| | /#\ | |/| |
| |\| |#| | | |#| | === | |/| |
|A|B|C|D|E| Child |F|D|G| IxJ |O|B|A|
| |/| |#| | | |#| | === | |\| |
| |/| |#| | | |#| | \#/ | |\| |
| |/| |#| +----------------------+ |#| +-----+ |\| |
| |/| |#| M |#| |\| |
| |/| |#+---------------------------#| |\| |
| |/| |################ D ###########| N |\| |
| |/| +------------------------------+ |\| |
| |/| C |\| |
| |/+------------------------------------------+\| |
| |//////////////////// H \\\\\\\\\\\\\\\\\\\\\\\| |
| +----------------------------------------------+ |
| A |
+--------------------------------------------------+
A: GtkContainer::border_width
B: xthickness
C: GtkWidget::focus_pad
D: GtkWidget::focus_width
E: CHILD_LEFT_SPACING
F: CHILD_RIGHT_SPACING
G: GtkOptionMenu::indicator_spacing::left
H: ythickness
I: GtkOptionMenu::indicator_size::width
J: GtkOptionMenu::indicator_size::height
K: CHILD_TOP_SPACING
L: GtkOptionMenu::indicator_spacing::top + GtkWidget::focus_width + GtkWidget::focus_pad + CHILD_TOP_SPACING
M: CHILD_BOTTOM_SPACING
N: GtkOptionMenu::indicator_spacing::bottom + GtkWidget::focus_width + GtkWidget::focus_pad + CHILD_BOTTOM_SPACING
O: GtkOptionMenu::indicator_spacing::right
II) interior_focus = FALSE
+--------------------------------------------------+
+ A |
| +----------------------------------------------+ |
| |#################### B #######################| |
| |#+------------------------------------------+#| |
| |#| C |#| |
| |#| +--------------------------------------+ |#| |
| |#| |\\\\\\\\\\\\\\\\ H ///////////////////| |#| |
| |#| |\+----------------------------------+/| |#| |
| |#| |\| K L |/| |#| |
| |#| |\| +----------------------+ +-----+ |/| |#| |
| |#| |\| | | | /#\ | |/| |#| |
| |#| |\| | | | === | |/| |#| |
|A|B|C|D|E| Child |F| IxJ |G|D|C|B|A|
| |#| |/| | | | === | |\| |#| |
| |#| |/| | | | \#/ | |\| |#| |
| |#| |/| +----------------------+ +-----+ |\| |#| |
| |#| |/| M N |\| |#| |
| |#| |/+----------------------------------+\| |#| |
| |#| |//////////////// H \\\\\\\\\\\\\\\\\\\| |#| |
| |#| +--------------------------------------+ |#| |
| |#| C |#| |
| |#+------------------------------------------+#| |
| |#################### B #######################| |
| +----------------------------------------------+ |
| A |
+--------------------------------------------------+
A: GtkContainer::border_width
B: GtkWidget::focus_width
C: GtkWidget::focus_padding
D: xthickness
E: CHILD_LEFT_SPACING
F: CHILD_RIGHT_SPACING + GtkOptionMenu::indicator_spacing::left
G: GtkOptionMenu::indicator_spacing::right
H: ythickness
I: GtkOptionMenu::indicator_size::width
J: GtkOptionMenu::indicator_size::height
K: CHILD_TOP_SPACING
L: CHILD_TOP_SPACING + GtkOptionMenu::indicator_spacing::top
M: CHILD_BOTTOM_SPACING
N: CHILD_BOTTOM_SPACING + GtkOptionMenu::indicator_spacing::bottom
III) interior_focus = FALSE, !HAVE_FOCUS
+--------------------------------------------------+
+ A |
| +----------------------------------------------+ |
| |\\\\\\\\\\\\\\\\\\\\ H ///////////////////////| |
| |\+------------------------------------------+/| |
| |\| |/| |
| |\| |/| |
| |\| |/| |
| |\| |/| |
| |\| K L |/| |
| |\| +----------------------+ +-----+ |/| |
| |\| | | | /#\ | |/| |
| |\| | | | === | |/| |
|A|D| E| Child |F| IxJ |G |D|A|
| |/| | | | === | |\| |
| |/| | | | \#/ | |\| |
| |/| +----------------------+ +-----+ |\| |
| |/| M N |\| |
| |/| |\| |
| |/| |\| |
| |/| |\| |
| |/| |\| |
| |/+------------------------------------------+\| |
| |//////////////////// H \\\\\\\\\\\\\\\\\\\\\\\| |
| +----------------------------------------------+ |
| A |
+--------------------------------------------------+
A: GtkContainer::border_width
B: GtkWidget::focus_width
C: GtkWidget::focus_padding
D: xthickness
E: CHILD_LEFT_SPACING + GtkWidget::focus_width + GtkWidget::focus_padding
F: CHILD_RIGHT_SPACING + GtkOptionMenu::in+icator_spacing::left
G: GtkOptionMenu::indicator_spacing::right + GtkWidget::focus_width + GtkWidget::focus_padding
H: ythickness
I: GtkOptionMenu::indicator_size::width
J: GtkOptionMenu::indicator_size::height
K: CHILD_TOP_SPACING + GtkWidget::focus_width + GtkWidget::focus_padding
L: CHILD_TOP_SPACING + GtkOptionMenu::indicator_spacing::top + GtkWidget::focus_width + GtkWidget::focus_padding
M: CHILD_BOTTOM_SPACING + GtkWidget::focus_width + GtkWidget::focus_padding
N: CHILD_BOTTOM_SPACING + GtkOptionMenu::indicator_spacing::bottom + GtkWidget::focus_width + GtkWidget::focus_padding
=====================
GtkButton
=====================
NOTE: Due to a bug that is basically unfixable in a sufficiently compatible
NOTE: way, the button gives the space requested for focus_width and
NOTE: focus_padding to the child (in addition to the space requested by
NOTE: the child), if the button is !CAN_FOCUS.
Style properties
GtkWidget::interior_focus = TRUE
GtkWidget::focus_width = 1
GtkWidget::focus_padding = 0
GtkButton::default_border = { 1, 1, 1, 1 };
GtkButton::default_outside_border = { 0, 0, 0, 0 };
GtkButton::child_displacement_x = 0;
GtkButton::child_displacement_y = 0;
Properties
GtkContainer::border_width = 0
#defines
CHILD_SPACING 1
I) HAS_DEFAULT && (!GtkWidget::interior-focus || !HAVE_FOCUS)
+----------------------------------------------+
| A |
| +------------------------------------------+ |
| |@@@@@@@@@@@@@@@@@@@ I @@@@@@@@@@@@@@@@@@@@| |
| |@+--------------------------------------+@| |
| |@|\\\\\\\\\\\\\\\\\ J //////////////////|@| |
| |@|\+----------------------------------+/|@| |
| |@|\| E |/|@| |
| |@|\| +------------------------------+ |/|@| |
| |@|\| |############# F ##############| |/|@| |
| |@|\| |#+--------------------------+#| |/|@| |
| |@|\| |#| L |#| |/|@| |
| |@|\| |#| +----------------------+ |#| |/|@| |
| |@|\| |#| | | |#| |/|@| |
| |@|\| |#| | | |#| |/|@| |
|A|B|D|E|F|G| Child |M|F|E|D|C|A|
| |@|/| |#| | | |#| |\|@| |
| |@|/| |#| | | |#| |\|@| |
| |@|/| |#| +----------------------+ |#| |\|@| |
| |@|/| |#| N |#| |\|@| |
| |@|/| |#+--------------------------+#| |\|@| |
| |@|/| |############# F ##############| |\|@| |
| |@|/| +------------------------------+ |\|@| |
| |@|/| E |\|@| |
| |@|/+----------------------------------+\|@| |
| |@|///////////////// J \\\\\\\\\\\\\\\\\\|@| |
| |@+--------------------------------------+@| |
| |@@@@@@@@@@@@@@@@@@@ K @@@@@@@@@@@@@@@@@@@@| |
| +------------------------------------------+ |
| A |
+----------------------------------------------+
A: GtkContainer::border-width
B: GtkButton::default-border::left
C: GtkButton::default-border::right
D: xthickness
E: GtkWidget::focus-padding
F: GtkWidget::focus-line-width
G: CHILD_SPACING + (depressed ? GtkButton::child-displacement-x : 0)
I: GtkButton::default-border::top
J: ythickness
K: GtkButton::default-border::bottom
L: CHILD_SPACING + (depressed ? GtkButton::child-displacement-y : 0)
M: CHILD_SPACING - (depressed ? GtkButton::child-displacement-x : 0)
N: CHILD_SPACING - (depressed ? GtkButton::child-displacement-y : 0)
II) !HAS_DEFAULT && (!GtkWidget::interior-focus || !HAVE_FOCUS)
+----------------------------------------------+
| |
| I |
| |
| +--------------------------------------+ |
| |\\\\\\\\\\\\\\\\\ J //////////////////| |
| |\+----------------------------------+/| |
| |\| E |/| |
| |\| +------------------------------+ |/| |
| |\| |############# F ##############| |/| |
| |\| |#+--------------------------+#| |/| |
| |\| |#| L |#| |/| |
| |\| |#| +----------------------+ |#| |/| |
| |\| |#| | | |#| |/| |
| |\| |#| | | |#| |/| |
| B |D|E|F|G| Child |M|F|E|D| C |
| |/| |#| | | |#| |\| |
| |/| |#| | | |#| |\| |
| |/| |#| +----------------------+ |#| |\| |
| |/| |#| N |#| |\| |
| |/| |#+--------------------------+#| |\| |
| |/| |############# F ##############| |\| |
| |/| +------------------------------+ |\| |
| |/| E |\| |
| |/+----------------------------------+\| |
| |///////////////// J \\\\\\\\\\\\\\\\\\| |
| +--------------------------------------+ |
| |
| K |
| |
+----------------------------------------------+
a) CAN_DEFAULT
B: GtkContainer::border-width + GtkButton::default-outside-border::left
C: GtkContainer::border-width + GtkButton::default-outside-border::right
D: xthickness
E: GtkWidget::focus-padding
F: GtkWidget::focus-line-width
G: CHILD_SPACING + (depressed ? GtkButton::child-displacement-x : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::left
I: GtkContainer::border-width + GtkButton::default-outside-border::top
J: ythickness
K: GtkContainer::border-width + GtkButton::default-outside-border::bottom
L: CHILD_SPACING + (depressed ? GtkButton::child-displacement-y : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::top
M: CHILD_SPACING - (depressed ? GtkButton::child-displacement-x : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::right
N: CHILD_SPACING - (depressed ? GtkButton::child-displacement-y : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::bottom
b) !CAN_DEFAULT
B: GtkContainer::border-width
C: GtkContainer::border-width
D: xthickness
E: GtkWidget::focus-padding
F: GtkWidget::focus-line-width
G: CHILD_SPACING + (depressed ? GtkButton::child-displacement-x : 0)
I: GtkContainer::border-width
J: ythickness
K: GtkContainer::border-width
L: CHILD_SPACING + (depressed ? GtkButton::child-displacement-y : 0)
M: CHILD_SPACING - (depressed ? GtkButton::child-displacement-x : 0)
N: CHILD_SPACING - (depressed ? GtkButton::child-displacement-y : 0)
III) HAS_DEFAULT && (GtkWidget::interior-focus && HAVE_FOCUS)
+----------------------------------------------+
| A |
| +------------------------------------------+ |
| |@@@@@@@@@@@@@@@@@@@ I @@@@@@@@@@@@@@@@@@@@| |
| |@+--------------------------------------+@| |
| |@|################# F ##################|@| |
| |@|#+----------------------------------+#|@| |
| |@|#| E |#|@| |
| |@|#| +------------------------------+ |#|@| |
| |@|#| |\\\\\\\\\\\\\ J //////////////| |#|@| |
| |@|#| |\+--------------------------+/| |#|@| |
| |@|#| |\| L |/| |#|@| |
| |@|#| |\| +----------------------+ |/| |#|@| |
| |@|#| |\| | | |/| |#|@| |
| |@|#| |\| | | |/| |#|@| |
|A|B|F|E|D|G| Child |M|D|E|F|C|A|
| |@|#| |/| | | |\| |#|@| |
| |@|#| |/| | | |\| |#|@| |
| |@|#| |/| +----------------------+ |\| |#|@| |
| |@|#| |/| N |\| |#|@| |
| |@|#| |/+--------------------------+\| |#|@| |
| |@|#| |///////////// J \\\\\\\\\\\\\\| |#|@| |
| |@|#| +------------------------------+ |#|@| |
| |@|#| E |#|@| |
| |@|#+----------------------------------+#|@| |
| |@|################# F ##################|@| |
| |@+--------------------------------------+@| |
| |@@@@@@@@@@@@@@@@@@@ K @@@@@@@@@@@@@@@@@@@@| |
| +------------------------------------------+ |
| A |
+----------------------------------------------+
A: GtkContainer::border-width
B: GtkButton::default-border::left
C: GtkButton::default-border::right
D: xthickness
E: GtkWidget::focus-padding
F: GtkWidget::focus-line-width
G: CHILD_SPACING + (depressed ? GtkButton::child-displacement-x : 0)
I: GtkButton::default-border::top
J: ythickness
K: GtkButton::default-border::bottom
L: CHILD_SPACING + (depressed ? GtkButton::child-displacement-y : 0)
M: CHILD_SPACING - (depressed ? GtkButton::child-displacement-x : 0)
N: CHILD_SPACING - (depressed ? GtkButton::child-displacement-y : 0)
IV) !HAS_DEFAULT && (GtkWidget::interior-focus && HAVE_FOCUS)
+----------------------------------------------+
| |
| I |
| |
| +--------------------------------------+ |
| |################# J ##################| |
| |#+----------------------------------+#| |
| |#| E |#| |
| |#| +------------------------------+ |#| |
| |#| |\\\\\\\\\\\\\ F //////////////| |#| |
| |#| |\+--------------------------+/| |#| |
| |#| |\| L |/| |#| |
| |#| |\| +----------------------+ |/| |#| |
| |#| |\| | | |/| |#| |
| |#| |\| | | |/| |#| |
| B |D|E|F|G| Child |M|F|E|D| C |
| |#| |/| | | |\| |#| |
| |#| |/| | | |\| |#| |
| |#| |/| +----------------------+ |\| |#| |
| |#| |/| N |\| |#| |
| |#| |/+--------------------------+\| |#| |
| |#| |///////////// F \\\\\\\\\\\\\\| |#| |
| |#| +------------------------------+ |#| |
| |#| E |#| |
| |#+----------------------------------+#| |
| |################# J ##################| |
| +--------------------------------------+ |
| |
| K |
| |
+----------------------------------------------+
a) CAN_DEFAULT
B: GtkContainer::border-width + GtkButton::default-outside-border::left
C: GtkContainer::border-width + GtkButton::default-outside-border::right
D: xthickness
E: GtkWidget::focus-padding
F: GtkWidget::focus-line-width
G: CHILD_SPACING + (depressed ? GtkButton::child-displacement-x : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::left
I: GtkContainer::border-width + GtkButton::default-outside-border::top
J: ythickness
K: GtkContainer::border-width + GtkButton::default-outside-border::bottom
L: CHILD_SPACING + (depressed ? GtkButton::child-displacement-y : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::top
M: CHILD_SPACING - (depressed ? GtkButton::child-displacement-x : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::right
N: CHILD_SPACING - (depressed ? GtkButton::child-displacement-y : 0) +
(GtkButton::default-outside-border - GtkButton::default-outside-border)::bottom
b) !CAN_DEFAULT
B: GtkContainer::border-width
C: GtkContainer::border-width
D: xthickness
E: GtkWidget::focus-padding
F: GtkWidget::focus-line-width
G: CHILD_SPACING + (depressed ? GtkButton::child-displacement-x : 0)
I: GtkContainer::border-width
J: ythickness
K: GtkContainer::border-width
L: CHILD_SPACING + (depressed ? GtkButton::child-displacement-y : 0)
M: CHILD_SPACING - (depressed ? GtkButton::child-displacement-x : 0)
N: CHILD_SPACING - (depressed ? GtkButton::child-displacement-y : 0)
======================
GtkCheckButton
======================
Note: This is the draw_indicator=TRUE case; draw_indicator=FALSE
is like GtkButton)
Style properties
GtkWidget::interior_focus = TRUE
GtkWidget::focus_width = 1
GtkWidget::focus_padding = 0
GtkButton::indicator-size = 13
GtkButton::indicator-spacing = 2
Properties
GtkContainer::border_width = 0
#defines
CHILD_SPACING 1
interior_focus
+-------------------------------------------+
| F |
| G +------------------------+ |
| |########### D ##########| |
| +------------+ |#+--------------------+#| |
| | | |#| E |#| |
| | | |#| +----------------+ |#| |
| | | |#| | | |#| |
|A| BxB |C|D|E| Child |E|#|F|
| | | |#| | | |#| |
| | | |#| +----------------+ |#| |
| | | |#| E |#| |
| +------------+ |#+--------------------+#| |
| |########### D ##########| |
| G +------------------------+ |
| F |
+-------------------------------------------+
A: GtkContainer::border-width + GtkCheckButton::indicator-spacing
B: GtkCheckButton::indicator-size
C: 2 * GtkCheckButton::indicator-spacing
D: GtkWidget::focus-line-width
E: GtkWidget::focus-padding
F: GtkContainer::border-width
G: GtkConainer::border-width + GtkCheckButton::indicator-spacing
!interior_focus
+-------------------------------------------+
| A |
| +---------------------------------------+ |
| |################ D ####################| |
| |#+-----------------------------------+#| |
| |#| G E |#| |
| |#| +------------+ +---------------+ |#| |
| |#| | | | | |#| |
| |#| | | | | |#| |
|A|D|F| BxB |C | Child |E|D|A|
| |#| | | | | |#| |
| |#| | | | | |#| |
| |#| +------------+ +---------------+ |#| |
| |#| G E |#| |
| |#+-----------------------------------+#| |
| |################ D ####################| |
| +---------------------------------------+ |
| A |
+-------------------------------------------+
A: GtkContainer::border-width
B: GtkCheckButton::indicator-size
C: 2 * GtkCheckButton::indicator-spacing
D: GtkWidget::focus-line-width
E: GtkWidget::focus-padding
F: GtkWidget::focus-padding + GtkCheckButton::indicator-spacing
G: GtkWidget::focus-padding + GtkCheckButton::indicator-spacing
===============
GtkEntry
===============
Style properties
GtkWidget::interior_focus = TRUE
GtkWidget::focus_width = 1
GtkWidget::focus_padding = 0
Properties
GtkContainer::border_width = 0
#defines
INNER_BORDER 2
interior_focus
+--------------------------------------+
|\\\\\\\\\\\\\\\\\ B //////////////////|
|\+----------------------------------+/|
|\| D |/|
|\| +------------------------------+ |/|
|\| | | |/|
|\| | | |/|
|A|D| |D|A|
|\| | | |/|
|\| | | |/|
|\| +------------------------------+ |/|
|\| D |/|
|\+----------------------------------+/|
|///////////////// B \\\\\\\\\\\\\\\\\/|
+--------------------------------------+
A: xthickness
B: ythickness
D: INNER_BORDER
!interior_focus
+------------------------------------------+
|####################C#####################|
|#+--------------------------------------+#|
|#|\\\\\\\\\\\\\\\\\ B //////////////////|#|
|#|\+----------------------------------+/|#|
|#|\| D |/|#|
|#|\| +------------------------------+ |/|#|
|#|\| | | |/|#|
|#|\| | | |/|#|
|C|A|D| |D|A|C|
|#|\| | | |/|#|
|#|\| | | |/|#|
|#|\| +------------------------------+ |/|#|
|#|\| D |/|#|
|#|\+----------------------------------+/|#|
|#|///////////////// B \\\\\\\\\\\\\\\\\/|#|
|#+--------------------------------------+#|
|####################C#####################|
+------------------------------------------+
A: xthickness
B: ythickness
C: GtkWidget::focus-line-width
D: INNER_BORDER + (HAVE_FOCUS ? 0 : GtkWidget::focus-line-width
Note - effect here for !interior_focus is that bevel moves in
by focus-line-width when entry gains focus
===============
GtkExpander
===============
Style properties
GtkWidget::focus_line_width
GtkWidget::focus_padding
GtkExpander::expander_size
GtkExpander::expander_spacing
Properties
GtkContainer::border_width
GtkExpander::spacing
if (GTK_WIDGET_VISIBLE (bin->child) && interior_focus)
+-------------------------------------+
| A |
| +---------+-----------------------+ |
| | C |##########E############| |
| | +-----+ |#+-------------------+#| |
| | | | |#| F |#| |
| | | | |#| +---------------+ |#| |
|A|C| BxB |C|E|F| label_widget |F|E|A|
| | | | |#| +---------------+ |#| |
| | | | |#| F |#| |
| | +-----+ |#+-------------------+#| |
| | C |##########E############| |
| +---------+-----------------------+ |
| | D | |
| +---------------------------------+ |
| | | |
| | | |
| | | |
|A| bin->child |A|
| | | |
| | | |
| | | |
| +---------------------------------+ |
| A |
+-------------------------------------+
A: GtkContainer::border_width
B: GtkExpander::expander_size
C: GtkExpander::expander_spacing
D: GtkExpander::spacing
E: GtkWidget::focus_line_width
F: GtkWidget::focus_padding
if (GTK_WIDGET_VISIBLE (bin->child) && !interior_focus)
+-------------------------------------------+
| A |
| +---------------------------------------+ |
| |##################E####################| |
| |#+-----------------------------------+#| |
| |#| F |#| |
| |#| +---------+---------------------+ |#| |
| |#| | C | | |#| |
| |#| | +-----+ | | |#| |
|A|E|F|C| BxB |C| label_widget |F|E|A|
| |#| | +-----+ | | |#| |
| |#| | C | | |#| |
| |#| +---------+---------------------+ |#| |
| |#| F |#| |
| |#+-----------------------------------+#| |
| |##################E####################| |
| +---------------------------------------+ |
| | D | |
| +---------------------------------------+ |
| | | |
| | | |
| | | |
|A| bin->child |A|
| | | |
| | | |
| | | |
| +---------------------------------------+ |
| A |
+-------------------------------------------+
A: GtkContainer::border_width
B: GtkExpander::expander_size
C: GtkExpander::expander_spacing
D: GtkExpander::spacing
E: GtkWidget::focus_line_width
F: GtkWidget::focus_padding
if (!GTK_WIDGET_VISIBLE (bin->child) && interior_focus)
+-------------------------------------+
| A |
| +---------+-----------------------+ |
| | C |##########E############| |
| | +-----+ |#+-------------------+#| |
| | | | |#| F |#| |
| | | | |#| +---------------+ |#| |
|A|C| BxB |C|E|F| label_widget |F|E|A|
| | | | |#| +---------------+ |#| |
| | | | |#| F |#| |
| | +-----+ |#+-------------------+#| |
| | C |##########E############| |
| +---------+-----------------------+ |
| A |
+-------------------------------------+
A: GtkContainer::border_width
B: GtkExpander::expander_size
C: GtkExpander::expander_spacing
E: GtkWidget::focus_line_width
F: GtkWidget::focus_padding
if (!GTK_WIDGET_VISIBLE (bin->child) && !interior_focus)
+-------------------------------------------+
| A |
| +---------------------------------------+ |
| |##################E####################| |
| |#+-----------------------------------+#| |
| |#| F |#| |
| |#| +---------+---------------------+ |#| |
| |#| | C | | |#| |
| |#| | +-----+ | | |#| |
|A|E|F|C| BxB |C| label_widget |F|E|A|
| |#| | +-----+ | | |#| |
| |#| | C | | |#| |
| |#| +---------+---------------------+ |#| |
| |#| F |#| |
| |#+-----------------------------------+#| |
| |##################E####################| |
| +---------------------------------------+ |
| A |
+-------------------------------------------+
A: GtkContainer::border_width
B: GtkExpander::expander_size
C: GtkExpander::expander_spacing
E: GtkWidget::focus_line_width
F: GtkWidget::focus_padding

View File

@@ -1,500 +0,0 @@
Notes about the inner workings of the widget system of GTK
==========================================================
This file contains some notes as to how the widget system does
and should work. It consists of three parts:
I) A description of the meaning of the various flags
II) A list of invariants about the states of the widgets.
(Throughout this document, we refer to the states of the
widgets by referring to the flags for GtkWidget)
III) Some notes about the ways that a widget changes states
IV) A list of responsibilities of various widget signals when
the states change.
Any action necessary to maintain the invariants in II which is not
explicitly mentioned in IV), is the responsibility of the core GTK
code, which is roughly defined as:
gtkobject.c
gtkwidget.c
gtkcontainer.c
gtkmain.c
gtksignal.c
Section II is mostly of interest to those maintaining GTK, the
other sections may also be interesting to people writing
new widgets.
Main outline:
- Owen Taylor <owt1@cornell.edu>
1998/02/03
Flag descriptions:
- Tim Janik <timj@gimp.org>
1998/02/04
I. Flags
--------
GtkObject:
GTK_DESTROYED:
This flagged is set for a GtkObject right before its
destruction code is executed. Its main use is the
prevention of multiple destruction invocations.
GTK_FLOATING:
This flag reflects the fact that the holder of the
initial reference count is unknown. Refer to refcounting.txt
for further details.
GTK_RESERVED_1:
GTK_RESERVED_2:
Reserved flags.
GtkWidget, public flags:
GTK_TOPLEVEL:
Widgets without a real parent, as there are GtkWindows and
GtkMenus have this flag set throughout their lifetime.
Toplevel widgets always contain their own GdkSurface.
GTK_NO_WINDOW:
This flag is indicative for a widget that does not provide
its own GdkSurface. Visible action (e.g. drawing) is performed
on the parent's GdkSurface.
GTK_REALIZED:
Set by gtk_widget_realize, unset by gtk_widget_unrealize.
Relies on ((widget->parent && widget->parent->window)
|| GTK_WIDGET_TOPLEVEL (widget));
Means: widget has an associated GdkSurface (XWindow).
GTK_MAPPED:
Set by gtk_widget_map, unset by gtk_widget_unmap.
May only be set if GTK_WIDGET_REALIZED (widget).
Means: gdk_surface_show() has been called on the widgets window(s).
GTK_VISIBLE:
Set by gtk_widget_show.
Implies that a widget will be flagged GTK_MAPPED as soon as its
parent is mapped.
!GTK_VISIBLE:
Set by gtk_widget_hide.
Implies that a widget is not onscreen, therefore !GTK_MAPPED.
GTK_CHILD_VISIBLE
Set by gtk_widget_set_child_visible, and if FALSE indicates that
the widget should not be mapped even if the parent is mapped
and visible. Containers like GtkNotebook use this flag.
A private flag, not a public flag, so if you need to check
this flag, you should call gtk_widget_get_child_visible().
(Should be very rarely necessary.)
GTK_SENSITIVE:
Set and unset by gtk_widget_set_sensitive.
The sensitivity of a widget determines whether it will receive
certain events (e.g. button or key presses). One premise for
the widgets sensitivity is to have GTK_SENSITIVE set.
GTK_PARENT_SENSITIVE:
Set and unset by gtk_widget_set_sensitive operations on the
parents of the widget.
This is the second premise for the widgets sensitivity. Once
it has GTK_SENSITIVE and GTK_PARENT_SENSITIVE set, its state is
effectively sensitive. This is expressed (and can be examined) by
the GTK_WIDGET_IS_SENSITIVE macro.
GTK_CAN_FOCUS:
There are no directly corresponding functions for setting/unsetting
this flag, but it can be affected by the GtkWidget::has_focus argument
via gtk_widget_set_arg.
This flag determines whether a widget is able to handle focus grabs.
GTK_HAS_FOCUS:
This flag will be set by gtk_widget_grab_focus for widgets that also
have GTK_CAN_FOCUS set. The flag will be unset once another widget
grabs the focus.
GTK_CAN_DEFAULT:
GTK_HAS_DEFAULT:
These two flags are mostly equal in functionality to their *_FOCUS
counterparts, but for the default widget.
GTK_HAS_GRAB:
Set by gtk_grab_add, unset by gtk_grab_remove.
Means: widget is in the grab_widgets stack, and will be the preferred
one for receiving events other than ones of cosmetic value.
GTK_BASIC:
The GTK_BASIC flag is an attempt at making a distinction
between widgets that handle user input e.g. key/button presses
and those that don't. Subsequent parent<->child relation ships
of non `basic' widgets should be avoided. The checking for
this is currently not properly enforced in the code. For
example GtkButton is a non `basic' widget, that will therefore
disallow to act as a container for another GtkButton. Now the
gnit is, one can add a GtkHBox (which is a `basic' widget) to
the first button, and put the second into the box.
GTK_RESERVED_3:
GTK_RC_STYLE:
This flag indicates that its style has been looked up through
the rc mechanism. It does not imply that the widget actually
had a style defined through the rc mechanism.
GtkWidget, private flags:
GTK_USER_STYLE:
A widget is flagged to have a user style, once gtk_widget_set_style
has been invoked for it. The use of this flag is to tell widgets
which share a global user style from the ones which got a certain
style assign from outside the toolkit.
GTK_RESIZE_PENDING:
First, this is only valid for GtkContainers.
[some of the code should move to gtkcontainer.c therefore]
Relies on GTK_WIDGET_REALIZED(widget)
[this is not really enforced throughout the code, but should
be. it only requires a few checks for GTK_WIDGET_REALIZED and
minor changes to gtk_widget_unrealize, we can then remove the check
in gtk_widget_real_destroy]
Means: there is an idle handler waiting for the container to
resize it.
GTK_RESIZE_NEEDED:
Relies on GTK_WIDGET_REALIZED(widget)
[this is not really enforced throughout the code, but should
be. once this is done special checking in gtk_widget_real_destroy
can be avoided]
Means: a widget has been added to the resize_widgets list of
its _toplevel_ container (keep this in mind for GtkViewport).
Remark: this flag is also used internally by gtkwindow.c during
the evaluation of resizing worthy widgets.
GTK_LEAVE_PENDING:
A widget is flagged as such if there is a leave_notify event
pending for it. It will receive this event regardless of a grab
through another widget or its current sensitivity.
[this should be made relying on GTK_REALIZED]
GTK_HAS_SHAPE_MASK:
Set by gtk_widget_shape_combine_mask if a widget got a shape mask
assigned (making use of the X11 shaped window extension).
GTK_IN_REPARENT:
During the act of reparentation widgets which are already
realized and will be added to an already realized parent need
to have this flag set to prevent natural unrealization on the
process of getting unparented.
GTK_NEED_REQUEST:
This flag is set if the widget doesn't have an up to date
requisition. If this flag is set, we must actually emit ::size-request
when gtk_widget_size_request() is called. Otherwise, we can
simply widget->requisition. We keep track of this all the time
however, widgets with this flag set are only added to the resize
queue if they are viewable.
GTK_NEED_ALLOCATION:
This flag is set if the widget doesn't have an up to date
allocation. If this flag is set, we must actually emit ::size-allocate
when gtk_widget_size_allocate() is called, even if the new allocation
is the same as the current allocation.
Related Macros:
GTK_WIDGET_DRAWABLE:
This macro examines whether a widget is flagged as GTK_WIDGET_VISIBLE
and GTK_WIDGET_MAPPED.
Means: it _makes sense_ to draw in a widgets window.
GTK_WIDGET_IS_SENSITIVE:
This macro tells the real sensitivity state of a widget. It returns
whether both the widget and all its parents are in sensitive state.
II. Invariants:
---------------
This section describes various constraints on the states of
the widget:
In the following
A => B means if A is true, than B is true
A <=> B means A is true, if and only if B is true
(equivalent to A => B and A <= B)
1) GTK_WIDGET_DESTROYED (widget) => !GTK_WIDGET_REALIZED (widget)
=> !GTK_WIDGET_VISIBLE (widget)
[ The latter is not currently in place, but it should be ]
2) GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_REALIZED (widget)
3) if GTK_WIDGET_TOPLEVEL (widget):
GTK_WIDGET_VISIBLE (widget) <=> GTK_WIDGET_MAPPED (widget)
4) if !GTK_WIDGET_TOPLEVEL (widget):
widget->parent && GTK_WIDGET_REALIZED (widget->parent) <=>
GTK_WIDGET_REALIZED (widget)
5) if !GTK_WIDGET_TOPLEVEL (widget):
GTK_WIDGET_MAPPED (widget) => GTK_WIDGET_VISIBLE (widget)
=> GTK_WIDGET_CHILD_VISIBLE (widget)
=> GTK_WIDGET_REALIZED (widget)
widget->parent && GTK_WIDGET_MAPPED (widget->parent) &&
GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_CHILD_VISIBLE
<=> GTK_WIDGET_MAPPED (widget)
Note:, the definition
[ GTK_WIDGET_DRAWABLE = GTK_WIDGET_VISIBLE && GTK_WIDGET_MAPPED
is made in gtkwidget.h, but by 3) and 5),
GTK_WIDGET_MAPPED => GTK_WIDGET_VISIBLE
]
6) GTK_REDRAW_PENDING => GTK_WIDGET_REALIZED
GTK_RESIZE_PENDING => "
GTK_LEAVE_PENDING => "
GTK_RESIZE_NEEDED => "
III. How states are changed:
----------------------------
How can the user control the state of a widget:
-----------------------------------------------
(In the following, set flag means set the flag, do appropriate
actions, and enforce above invariants)
gtk_widget_show:
if !GTK_DESTROYED sets GTK_VISIBLE
gtk_widget_hide:
if !GTK_VISIBLE for widget
gtk_widget_destroy:
sets GTK_DESTROYED
For a top-level widget
gtk_widget_realize:
if !GTK_DESTROYED sets GTK_REALIZED
- Calling gtk_widget_realize when the widget is not a descendant
of a toplevel is an ERROR.
gtk_container_add (container, widget) [ and container-specific variants ]
Sets widget->parent
gtk_container_remove (container, widget)
unsets widget->parent
gtk_widget_reparent (widget, new_parent)
Equivalent to removing widget from old parent and adding it to
the new parent, except that the widget will not be temporarily
unrealized if both the old parent and the new parent are realized.
gtk_widget_unrealize
gtk_widget_map
gtk_widget_unmap
These functions are not meant to be used by applications - they
are used only by GTK and widgets to enforce invariants on the
state.
When The X window corresponding to a GTK window is destroyed:
-------------------------------------------------------------
gtk_widget_destroy is called (as above).
IV. Responsibilities of widgets
--------------------------------
Adding to a container
---------------------
When a widget is added to a container, the container:
1) calls gtk_widget_set_parent_surface (widget, window) if
the widget is being added to something other than container->window
2) calls gtk_widget_set_parent (widget, container)
Removing from a container
-------------------------
When a widget is removed to a container, the container:
1) Calls gtk_widget_unparent (widget)
2) Queues a resize.
Notes:
gtk_widget_unparent unrealizes the widget except in the
special case GTK_IN_REPARENT is set.
At widget creation
------------------
Widgets are created in an unrealized state.
1) The widget should allocate and initialize needed data structures
The Realize signal
------------------
When a widget receives the "realize" signal it should:
NO_WINDOW widgets: (probably OK to use default handler)
1) set the realized flag
2) set widget->window
widget->window = gtk_widget_get_parent_surface (widget);
g_object_ref (widget->window);
3) attach the widget's style
widget->style = gtk_style_attach (widget->style, widget->window);
widget with window(s)
1) set the REALIZED flag
2) create windows with the parent obtained from
gtk_widget_get_parent_surface (widget);
3) attach the widget's style
4) set the background color for the new window based on the style
The Map signal
--------------
1) Set the MAPPED flag
2) If the widget has any windows, gdk_surface_show those windows
3) call gtk_widget_map for all child widgets that are
VISIBLE, CHILD_VISIBLE and !MAPPED. (A widget will only
be !CHILD_VISIBLE if the container set it that way, so
most containers will not have to check this.)
3) Do any other functions related to putting the widget onscreen.
(for instance, showing extra popup windows...)
The Unmap signal
----------------
When a widget receives the unmap signal, it must:
1) If the widget has a window, gdk_surface_hide that window,
2) If the widget does not have a window, unmap all child widgets
3) Do any other functions related to taking the widget offscreen
(for instance, removing popup windows...)
4) Unset GTK_MAPPED
The Unrealize signal
--------------------
When a widget receives the unrealize signal, it must
1) For any windows other than widget->window do:
gdk_surface_set_user_data (window, NULL);
gdk_surface_destroy (window);
2) Call the parent's unrealize handler
The Widget class unrealize handler will take care of unrealizing
all children if necessary. [should this be made consistent with
unmap???]
The Destroy Signal
------------------
Commentary:
The destroy signal probably shouldn't exist at all. A widget
should merely be unrealized and removed from its parent
when the user calls gtk_widget_destroy or a GDK_DESTROY event
is received. However, a large body of code depends on
getting a definitive signal when a widget goes away.
That could be put in the finalization step, but, especially
with language bindings, the cleanup step may need to refer
back to the widget. (To use gtk_widget_get_data, for instance)
If it does so via a pointer in a closure (natural for
Scheme, or Perl), then the finalization procedure will never
be called.
Also, if we made that the finalization step, we would have
to propagate the GDK_DESTROY event in any case, since it is
at that point at which user-visible actions need to be taken.
When a widget receives the destroy signal, it must:
1) If the widget "owns" any widgets other than its child
widgets, (for instance popup windows) it should
call gtk_widget_destroy () for them.
2) Call the parent class's destroy handler.
The "destroy" signal will only be received once. A widget
will never receive any other signals after the destroy
signal (but see the section on "Finalize" below)
The widget must handle calls to all publically accessible
functions in an innocuous manner even after a "destroy"
signal. (A widget can assume that it will not be realized
after a "destroy" signal is received, which may simplify
handling this requirement)
The Finalize Pseudo-signal
--------------------------
The finalize pseudo-signal is received after all references
to the widget have been removed. The finalize callback
cannot make any GTK calls with the widget as a parameter.
1) Free any memory allocated by the widget. (But _not_
the widget structure itself.
2) Call the parent class's finalize signal
A note on chaining "destroy" signals and finalize signals:
---------------------------------------------------------
This is done by code like:
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
It may not be completely obvious why this works. Note
that parent_class is a static variable on a per-class
basis. So say: we have
GtkFoo <- GtkBar <- GtkWidget <-GtkObject
And that Foo, Widget, and Object all have destructors, but
not Bar.
Then gtk_foo_destroy will call gtk_widget_destroy (because
it was not overridden in the Bar class structure) and
gtk_widget_destroy will call gtk_object_destroy because
the parent_class variable referenced by gtk_foo_destroy is the
static variable in gtkwidget.c: GtkObjectClass.

View File

@@ -25,8 +25,8 @@
#ifndef __GDK_BROADWAY_CURSOR_H__
#define __GDK_BROADWAY_CURSOR_H__
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkbroadway.h> can be included directly."
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/broadway/gdkbroadway.h> can be included directly."
#endif
#include <gdk/gdk.h>
@@ -40,7 +40,7 @@ G_BEGIN_DECLS
#define GDK_IS_BROADWAY_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_CURSOR))
#define GDK_BROADWAY_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_CURSOR, GdkBroadwayCursorClass))
#ifdef GDK_COMPILATION
#ifdef GTK_COMPILATION
typedef struct _GdkBroadwayCursor GdkBroadwayCursor;
#else
typedef GdkCursor GdkBroadwayCursor;

View File

@@ -18,15 +18,15 @@
#ifndef __GDK_BROADWAY_DISPLAY_H__
#define __GDK_BROADWAY_DISPLAY_H__
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkbroadway.h> can be included directly."
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/broadway/gdkbroadway.h> can be included directly."
#endif
#include <gdk/gdk.h>
G_BEGIN_DECLS
#ifdef GDK_COMPILATION
#ifdef GTK_COMPILATION
typedef struct _GdkBroadwayDisplay GdkBroadwayDisplay;
#else
typedef GdkDisplay GdkBroadwayDisplay;

View File

@@ -20,8 +20,8 @@
#ifndef __GDK_BROADWAY_DISPLAY_MANAGER_H__
#define __GDK_BROADWAY_DISPLAY_MANAGER_H__
#if !defined(__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkbroadway.h> can be included directly."
#if !defined(__GDKBROADWAY_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/broadway/gdkbroadway.h> can be included directly."
#endif
#include <gdk/gdk.h>
@@ -31,7 +31,7 @@ G_BEGIN_DECLS
#define GDK_TYPE_BROADWAY_DISPLAY_MANAGER (gdk_broadway_display_manager_get_type ())
#define GDK_BROADWAY_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_DISPLAY_MANAGER, GdkBroadwayDisplayManager))
#ifdef GDK_COMPILATION
#ifdef GTK_COMPILATION
typedef struct _GdkBroadwayDisplayManager GdkBroadwayDisplayManager;
#else
typedef GdkDisplayManager _GdkBroadwayDisplayManager;

View File

@@ -22,8 +22,8 @@
#ifndef __GDK_BROADWAY_MONITOR_H__
#define __GDK_BROADWAY_MONITOR_H__
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkbroadway.h> can be included directly."
#if !defined (__GDKBROADWAY_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gdk/broadway/gdkbroadway.h> can be included directly."
#endif
#include <gdk/gdkmonitor.h>

View File

@@ -36,7 +36,7 @@ G_BEGIN_DECLS
#define GDK_IS_BROADWAY_SURFACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_SURFACE))
#define GDK_BROADWAY_SURFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_SURFACE, GdkBroadwaySurfaceClass))
#ifdef GDK_COMPILATION
#ifdef GTK_COMPILATION
typedef struct _GdkBroadwaySurface GdkBroadwaySurface;
#else
typedef GdkSurface GdkBroadwaySurface;

View File

@@ -98,7 +98,9 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
GdkBroadwaySurface *toplevel = l->data;
if (toplevel->maximized)
gdk_surface_move_resize (GDK_SURFACE (toplevel), 0, 0, msg->width, msg->height);
gdk_broadway_surface_move_resize (GDK_SURFACE (toplevel),
0, 0,
msg->width, msg->height);
}
}

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