Commit Graph

54517 Commits

Author SHA1 Message Date
Benjamin Otte
29111a16d4 widget: Cache the render node
This requires a bunch of refactorings:

1. Don't pass the current clip region to gtk_widget_snapshot()
   so we don't create full widget contents
3. Have a widget->priv->draw_needed that we invalidate on every
   queue_draw() call and set on every snapshot()
2. In queue_draw(), walk the widget chain to invalidate the
   render nodes of all parents
2018-04-05 14:56:38 +02:00
Benjamin Otte
271820b677 rendernode: Add gsk_render_node_diff()
... and gsk_render_node_can_diff(). Those are vfuncs to compute a region
containing all the pixels that differ between the two nodes.

This is just the plumbing that chains into node classes. No node
implements it yet.
2018-04-05 14:56:38 +02:00
Matthias Clasen
dcdd95bbc8 font button: fix compiler warnings
A PangoLanguage is not a string.
2018-04-05 06:23:14 -04:00
Benjamin Otte
7c60f939ee Merge branch 'text-changed-delete-4' into 'master'
gtkentryaccessible: Fix text-changed::delete length

See merge request GNOME/gtk!100
2018-04-04 18:19:08 +00:00
Benjamin Otte
572a23b136 Merge branch 'textview-delete-4' into 'master'
gtktextviewaccessible: update cursor position after text suppression

See merge request GNOME/gtk!102
2018-04-04 18:18:49 +00:00
Samuel Thibault
a1f206b802 gtktextviewaccessible: update cursor position after text suppression
delete_range_cb is set to be called before the text suppression done by
the gtktextlayout (otherwise it does not work properly). But at that
point the cursor position is not yet up to date.  We thus need to move
the accessibility cursor notification to after the actual text
suppression, by using another callback.

This fixes cursor position in brltty screen reading.

(cherry picked from commit fa6994d033)
2018-04-04 18:26:55 +02:00
Samuel Thibault
8c8cb2bb12 gtkentryaccessible: Fix text-changed::delete length
The second parameter of the text-changed::delete event is to be the length,
not the end position.  This fixes spurious text removals in brltty
screen reading.

(cherry picked from commit 209f908a03)
2018-04-04 17:59:31 +02:00
Daniel Boles
67360c9d00 GLArea: Remove wrong transfer annotation on new()
Like other widgets, this returns a floating reference, so
(transfer full) is wrong. Just omit the annotation as others do,
thus implying (transfer none).

Close https://gitlab.gnome.org/GNOME/gtk/issues/156
2018-04-04 12:02:21 +01:00
Lionel Landwerlin
faceaec20a imwayland: destroy objects only if it matches our manager object
Should fix one of the crash from #129.
2018-04-03 19:11:09 +02:00
Matthias Clasen
bd9debe048 font chooser: Remove some dead code
This is leftover code from already removed debug spew.
2018-04-02 17:46:41 -04:00
Matthias Clasen
ec66c32def font button: Fix a crash
Since we are now storing the language as a PangoLanguage,
we must not free it anymore.
2018-04-02 17:45:48 -04:00
Matthias Clasen
5a68ac27cf font chooser: Make the language property writable
This is meant as an input to the font chooser.
We don't want the user to select a language, but
rather have fonts presented as they would work for
the current language. Therefore, do away with the
lang/script combo on the tweak page.
2018-04-02 13:37:53 -04:00
Chun-wei Fan
464943e5a6 gtk, demos: Fix builds without HarfBuzz and PangoFT
Really exclude the portions in the gtkfontchooserwidget.c that are built
when HarfBuzz and PangoFT2 are built, and update the Meson files to
exclude such sources as well from the main GTK SO/DLL and from the
gtk4-demo program.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:15:18 +08:00
Chun-wei Fan
bca4a78f07 testsuite/gsk/test-render-nodes.c: Avoid VLA usage
Just #define N as 5, instead of using a const int, which is not enough
to justify that as non-VLA usage.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:14:55 +08:00
Chun-wei Fan
a4c0395343 [gtk|demos/gtk-demo]/language-names.c: Fix build on non-GCC/CLang
Remove g_auto*() usage from these sources and use the traditional
g_free(), as g_auto*() are GCCisms (or CLangisms).

Also, don't include unistd.h unconditionally and stop including
langinfo.h and dirent.h, since they seem to be unused.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:13:27 +08:00
Chun-wei Fan
19ce520c2d build: Fix linking demos on Visual Studio
The demos are now built as GUI programs, which will require the presence
of WinMain() on Visual Studio builds, unless we specify the entry point.

Pass the /entry:mainCRTStartup linker flag on Visual Studio builds for
the demo programs so that they can link properly.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-02 19:11:50 +08:00
Matthias Clasen
d0e46d257c font chooser: Add examples for font features
For some font features, we can figure out affected
glyphs, and show before/after. For some others, we
hardcode typical sequences.

Still to do: figure out how to find ligatures and
show them.
2018-04-01 19:36:54 -04:00
Matthias Clasen
63a7d99d25 widget-factory: Enable all details in the font chooser
We want to see this here.
2018-04-01 19:36:54 -04:00
Piotr Drąg
1764673cff Update POTFILES.in 2018-04-01 15:00:07 +02:00
Руслан Ижбулатов
9e76a6055a W32: Link GTK to pangowin32
Needed for pango_win32_font_logfont() from gtkimcontextime.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2018-04-01 10:35:02 +00:00
LRN
eec0bd2fa9 Merge branch 'lrn/issue-147' into 'master'
Fix cursor handling in GTK4 on W32

Closes #147

See merge request GNOME/gtk!92
2018-04-01 10:33:43 +00:00
Rico Tzschichholz
f2937f8c45 Fix some g-i annotation warnings 2018-04-01 09:15:08 +02:00
Matthias Clasen
6b3091856b Enable variations and features for font explorer 2018-03-31 21:31:11 -04:00
Matthias Clasen
ad814509a4 font chooser: Align level value names
In the backport, I used the plural for variations, and that
is a better name, so use it here too.
2018-03-31 21:02:51 -04:00
Matthias Clasen
17693a2820 font chooser: Align property defaults
Set the default font chooser level to the same value we use
in the backports, to preserve font chooser behavior.
2018-03-31 21:02:51 -04:00
Matthias Clasen
8fb30a6a7b Font chooser: Hide tweak button sometimes
When there is no chance of tweaking anything, don't
show a tweak button.
2018-03-31 21:02:51 -04:00
Matthias Clasen
d15a29c876 Defeat compiler optimization
We always want to call both update functions here, and
the compiler unhelpfully optimizes out the second call
if the first one returns TRUE.
2018-03-31 21:02:51 -04:00
Timm Bäder
0f28f0ee39 GskRenderer: Remove outdated documentation comment
All render node trees are immutable
2018-03-31 14:45:03 +02:00
Timm Bäder
d9136fb944 snapshot: Plug memory leak when collecting rounded clip nodes 2018-03-31 14:45:03 +02:00
Timm Bäder
08296b8aee gl renderer: Don't highlight cairo nodes as fallback 2018-03-31 14:45:01 +02:00
Daniel Boles
db22398361 ProgressBar: Drop leftover "superimposed" mention
This was missed from the commit that dropped other mentions to the
previous ability to superimpose text.

https://bugzilla.gnome.org/show_bug.cgi?id=748784
2018-03-31 12:28:12 +01:00
Nelson Benítez León
d9b8acfced appchooserwidget: search text using g_str_match_string()
so we match on diacritics (eg. accented letters) and also
search on text tokens. As a plus we also reduce code size.

https://bugzilla.gnome.org/show_bug.cgi?id=745128
2018-03-31 13:48:30 +05:00
Timm Bäder
0fdd061bf5 togglebutton: Remove priv pointer 2018-03-30 23:15:04 +02:00
Timm Bäder
b2f04be04c popover: Remove priv pointer 2018-03-30 23:15:04 +02:00
Timm Bäder
809fdaa3e4 shaderbuilder: Insert newlines directly after defines
Instead of doing that in the loop in the last interation, we can just do
it after the loop.
2018-03-30 23:15:04 +02:00
Timm Bäder
f6330846c9 gl renderer: Remover unused mask uniform 2018-03-30 23:15:04 +02:00
Timm Bäder
badada9cf8 shader builder: Remove unused members 2018-03-30 23:15:04 +02:00
Timm Bäder
be3a42b7b1 shader builder: Reuse GString for shader code 2018-03-30 23:15:04 +02:00
Timm Bäder
66d5a4f752 widget: Fix snapshot condition
Of course, we only need to snapshot if both width and height > 0,
otherwise the result is invisible.
2018-03-30 23:15:04 +02:00
Timm Bäder
60acbd1090 entrybuffer: Remove priv pointer 2018-03-30 23:15:04 +02:00
Timm Bäder
7d61aad12c menubar: Don't crash when cycling through menubars 2018-03-30 23:15:04 +02:00
Matthias Clasen
f78598dd9b Merge branch 'im-wayland-reset' into 'master'
wayland: Don't emit signals if nothing changed

See merge request GNOME/gtk!83
2018-03-30 20:14:40 +00:00
Benjamin Otte
2f3cf6227a fishbowl: Make stats tracking work somewhat with broken X servers
Broken X servers being the ones that don't support NET_WM_TIMINGS (ie
every WM but mutter and XWayland).
2018-03-30 18:58:33 +02:00
Benjamin Otte
89f6a4ede4 demos: Improve frame rate tracking for fishbowl demo
We now properly use GdkFrameTimings and can therefor check for dropping
even a single frame in the history (of 16 frames or 1/4 of a second).
Once that happens, we immediately stop adding new items to the bowl.

A side effect is that the number of icons is now a *lot* smaller.
2018-03-30 16:51:09 +02:00
Benjamin Otte
c13fff8adb x11: Always request frame updates
This ensures that the frame clock gets updated with correct presentation
times even if nothing was drawn.

This is necessary for benchmarking but would also be relevant for videos
that want to sync to the frame clock but draw frames a lot less.
2018-03-30 16:50:54 +02:00
Benjamin Otte
7201e63120 x11: Make the frame clock work in GL and Vulkan 2018-03-30 16:50:28 +02:00
Руслан Ижбулатов
795572710c GDK W32: Remember surface cursor, implicit surface grab
This commit ensures that each GdkSurface impl remembers the
cursor that GDK sets for it, and that this cursor is set
each time WM_SETCURSOR is called for that sufrace's HWND.
This is needed because W32, unlike X, has no per-window cursors -
the cursor on W32 is a global resource, and we need to keep track
of which cursor should be set when pointer is over which surface
ourselves (WM_SETCURSOR exists exactly for this reason).

This commit also makes GDK remember the surface that has an implicit
grab (since implicit grabs are gone from the upper levels of the toolkit),
and ensures that crossing events are correctly synthesized and the grab
is broken when surface focus changes. This fixes a bug where opening
a new window (by clicking something in some other, pre-existing window)
will make that new window not get any mouse input due to the fact
that the mouse-button-down event from that click caused an implicit
grab on the pre-existing window, and that grab was not released afterward.
2018-03-29 23:59:31 +00:00
Руслан Ижбулатов
a82d67bb7d GDK W32: Use the new cursor class
This makes all the code use the new cursor class instead of
raw HCURSOR handles.
2018-03-29 23:59:23 +00:00
Руслан Ижбулатов
d8da6d38db GDK W32: New cursor class
Instead of now-unused GdkWin32Cursor class (a subclass of GdkCursor),
add a stand-alone GdkWin32HCursor class that is a wrapper around
HCURSOR handle.

On creation it's given a display instance, a HCURSOR handle and a boolean
that indicates whether the HCURSOR handle can or cannot be destroyed
(this depends on how the handle was obtained).
That information is stored in a hash table inside the GdkWin32Display
singleton, each entry of that table has reference count.
When the GdkWin32HCursor object is finalized, it reduces the reference
count on the table entry in the GdkWin32Display. When it's created,
it either adds such an entry or refs an existing one.
This way two pieces of code (or the same piece of code called
multiple times) that independently obtain the same HCURSOR from the OS
will get to different GdkWin32HCursor instances, but GdkWin32Display
will know that both use the same handle.

Once the reference count reaches 0 on the table entry, it is freed
and the handle (if destroyable) is put on the destruction list,
and an idle destruction function is queued.

If the same handle is once again registered for use before the
idle destructior is invoked (this happens, for example, when
an old cursor is destroyed and then replaced with a new one),
the handle gets removed from the destruction list.

The destructor just calls DestroyCursor() on each handle, calling
SetCursor(NULL) before doing that when the handle is in use.
This ensures that SetCursor(NULL) (which will cause cursor to disappear,
which is bad by itself, and which will also cause flickering if the
cursor is set to a non-NULL again shortly afterward)
is almost never called, unless GTK messes up and keeps using a cursor
beyond its lifetime.

This scheme also ensures that non-destructable cursors are not destroyed.

It's also possible to call _gdk_win32_display_hcursor_ref()
and _gdk_win32_display_hcursor_unref() manually instead of creating
GdkWin32HCursor objects, but that is not recommended.
2018-03-29 23:59:14 +00:00
Daniel Boles
70198e21ee themes: Make disabled Expander arrow look disabled
If GtkExpander:sensitive was FALSE, the arrow still got the normal fg
colour, which made it look clickable, in contrast to the adjacent label.
Fix this by adding selectors to catch the applicable :disabled states.

Note: Needing these may indicate an oops in generic styles elsewhere,
but I couldn’t see any, so let’s just get it looking right for now.

Close https://gitlab.gnome.org/GNOME/gtk/issues/146
2018-03-29 21:23:50 +01:00