Compare commits

..

42 Commits

Author SHA1 Message Date
Matthias Clasen
1af40af3cb path: Special-case rects and circles
Write out the commands for rects and circles in a special
way (without whitespace), and add code in the parser to
recognize this, so we can successfully round-trip these
through the SVG path format.

Tests included.
2020-11-28 12:26:36 -05:00
Matthias Clasen
a62d6b992f path: Fix serialization for circles
The svg A can not do a full circle, since it is a two point
parametrization - if the start and end point are the same,
it draws nothing. So, use two arcs.
2020-11-28 12:09:47 -05:00
Matthias Clasen
0d5c270dd4 path: Implement gsk_path_parse
Implement the SVG path syntax to read back the strings
that we generate when serializing paths. The tests for
this code are taken from librsvg.

This includes an elliptical arc implementation according
to the SVG spec. The code is mostly taken from librsvg,
but pretty directly follows the SVG spec implementation
notes. We don't export this, since the parametrization
is inconvenient. We do want an arc_to API, but
these are not the arcs we are looking for.
2020-11-28 12:09:47 -05:00
Matthias Clasen
69d6eb73e7 path: Implement SVG arcs
This is elliptical arc implementation according to the SVG spec.
The code is mostly taken from librsvg, but pretty directly
follows the SVG spec implementation notes.

We don't export this, since the parametrization is inconvenient.
We do want an arc_to API, but these are not the arcs we are
looking for.

It will be used in parsing SVG path syntax.
2020-11-28 12:09:47 -05:00
Matthias Clasen
9885525c9f gsk: Implement parsing fill and stroke nodes
Make serialization and deserialization work for stroke and
fill nodes.
2020-11-28 11:40:32 -05:00
Benjamin Otte
c82080ccea WIP: path: Add conic curves
So far this just adds the API, if you use it, you'll get lots of
g_warnings().
2020-11-28 07:35:55 +01:00
Benjamin Otte
91923c29da path: Add GSK_CIRCLE_POINT_INIT() to initialize points on the circle
This is just splitting out a commonly done operation into a macro.
2020-11-28 07:35:55 +01:00
Benjamin Otte
d62c987f63 xxx: split builder 2020-11-28 07:35:55 +01:00
Benjamin Otte
bd206429eb pathbuilder: Redo semantics for starting curves
We now always have a "current point" which is either the last point an
operation was made to, or (0, 0) if no drawing operation has
been made yet.

Adding a contour of any kind to the builder will always update the
current point to that contour's end point.
2020-11-28 07:35:55 +01:00
Benjamin Otte
42c7490b05 path: Split GskPathBuilder into its own file
... and add missing API docs.
2020-11-28 07:35:55 +01:00
Benjamin Otte
11dbab714a testsuite: Add a test using get_point() and get_closest_point() 2020-11-28 07:35:55 +01:00
Benjamin Otte
47defabe0c testsuite: Add a test for get_point() 2020-11-28 07:35:55 +01:00
Benjamin Otte
8cd1f2bf08 testsuite: Update create_random_path()
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
   With 10% chance, create a "weird" path like the empty one or only
   points or things like that.
   Otherwise create a bunch of contours, with 2/3 a standard contour,
   with 1/3 a predetermined one.
2020-11-28 07:35:55 +01:00
Benjamin Otte
2aab906174 gtk-demo: Add cute maze demo 2020-11-28 07:35:55 +01:00
Benjamin Otte
52ca3fa73f testsuite: Add tests for gsk_path_measure_get_closest_point() 2020-11-28 07:35:55 +01:00
Benjamin Otte
188c435549 path: Add gsk_path_measure_get_closest_point()
... and gsk_path_measure_get_closest_point_full().

Those 2 functions allow finding the closest point on a path to a given
point.
2020-11-28 07:35:55 +01:00
Benjamin Otte
73269f9601 spline: Use Skia's tolerance checks
This avoids measuring being too far off (it's still off, but it's less
than a percent now.
2020-11-28 05:55:52 +01:00
Benjamin Otte
bf5473e78a xxx: demo 2020-11-28 05:55:52 +01:00
Benjamin Otte
f7da082a88 testsuite: Add tests for gsk_path_measure_add_segment() 2020-11-28 05:55:52 +01:00
Benjamin Otte
cca39077b3 gtk-demo: Add a text-on-path demo 2020-11-28 04:00:16 +01:00
Benjamin Otte
c5a6848b2c xxx: path_fill demo 2020-11-28 04:00:16 +01:00
Benjamin Otte
2a41ad7bd6 path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2020-11-28 04:00:16 +01:00
Matthias Clasen
c2375809fc path: Add gsk_path_add_circle()
Adds a circle contour, too.
2020-11-28 04:00:16 +01:00
Benjamin Otte
25b0ed1911 pathmeasure: Implement support for beziers
Instead of treating bezier curves as lines, we properly decompose them
into line segments now so that we can treat those as lines.
2020-11-28 04:00:16 +01:00
Benjamin Otte
549bcceb42 path: Implement gsk_path_to_cairo() using foreach() 2020-11-28 04:00:16 +01:00
Benjamin Otte
fd5f54df15 path: Add gsk_path_foreach() 2020-11-28 04:00:16 +01:00
Benjamin Otte
b94382e9d2 path: Collect flags
We don't need them yet, but maybe later.
2020-11-28 04:00:16 +01:00
Benjamin Otte
a017ebf944 testsuite: Add path tests 2020-11-28 04:00:16 +01:00
Benjamin Otte
e102c52964 pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2020-11-28 04:00:16 +01:00
Benjamin Otte
e3cec72cce path: Add gsk_path_builder_add_path() 2020-11-28 04:00:16 +01:00
Benjamin Otte
626ba8716d gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2020-11-28 04:00:16 +01:00
Benjamin Otte
7deaf6b648 path: Change data structure for standard path
Instead of the Cairo method and imitating cairo_path_data_t, use the
Skia method and keep points and operations separate.

That way we get a points array that includes the starting point -
because it's always the end point of the previous operation.
2020-11-28 04:00:16 +01:00
Benjamin Otte
026c0ed347 popover: Use fill and stroke nodes instead of Cairo
... to render the arrow.

The arrow should really be turned into a real thing - maybe an icon?
2020-11-28 04:00:16 +01:00
Benjamin Otte
87a09e07fd snapshot: Add gtk_snapshot_push_stroke() 2020-11-28 04:00:16 +01:00
Benjamin Otte
68ac24ef65 gsk: Add GskStrokeNode 2020-11-28 04:00:16 +01:00
Benjamin Otte
6ce05c23f1 gsk: Add GskStroke
It's unused in this commit. This just prepares the new object.
2020-11-28 04:00:16 +01:00
Benjamin Otte
3f77e0455d demos: Add a simple demo filling a path 2020-11-28 04:00:16 +01:00
Benjamin Otte
1eacc48580 snapshot: Add gtk_snapshot_push_fill() 2020-11-28 04:00:16 +01:00
Benjamin Otte
21d19fddbd gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2020-11-28 04:00:16 +01:00
Benjamin Otte
7daf99a1c8 gsk: Add GskPath 2020-11-28 04:00:16 +01:00
Benjamin Otte
5c9a8f69e5 listview: Use the correct scroll policy
Use the horizontal policy for horizontal decisions, not the vertical
one.

This broke in 0011ce949c.
2020-11-25 15:50:48 +01:00
Benjamin Otte
fbe3f2e581 docs: Put render nodes in their own sections 2020-11-25 15:50:46 +01:00
320 changed files with 30746 additions and 27663 deletions

View File

@@ -56,12 +56,6 @@ If the issue includes a crash, you should also include:
0. the eventual warnings printed on the terminal
0. a backtrace, obtained with tools such as GDB or LLDB
It is fine to include screenshots of screen recordings to demonstrate
an issue that is best to understand visually, but please don't just
dump screen recordings without further details into issues. It is
essential that the problem is described in enough detail to reproduce
it without watching a video.
For small issues, such as:
- spelling/grammar fixes in the documentation

138
NEWS
View File

@@ -1,141 +1,3 @@
Overview of Changes in GTK 4.0
==============================
* Fix problems with synthetic motion events affecting frame rates
* Fix problems with implicit grabs affecting widget states
* Fix problems with zoom mode on scales getting stuck
* Fix submenu closing by outside clicks
* Rename GtkWindow:fullscreen to :fullscreened to help
language bindings
* Bump the soname. Stable GTK 4 releases use libgtk-4.0.so.1.xxxx.y
* Adwaita:
- Reduce hover transition effects in lists
- Special-case header buttons
* Demos:
- Remove NoDisplay from desktop files
- Autoplay the video in widget-factory
* Translation updates:
Catalan
Norwegian Bokmål
Polish
Spanish
Swedish
Romanian
Ukrainian
Overview of Changes in 3.99.5
=============================
* Accessibility:
- Map presentation role according to Core-AAM
- Use presentation role for spacers in list views
- Set proper roles, relations and descriptions on more widgets
- Expand the documentation
- Use a single GTK_A11Y environment variable and document it
- Serveral memory leak and crash fixes
- Initialize AT contexts lazily
- Improve the API for storing lists in relations
- Implement more of the Component interface
- Implement the Cache interface
- Implement ScrollSubstringTo for GtkTextView
* Introspection:
- Add many missing annotations to APIs
- In particular, nullability annotation fixes for rust
* Touch support:
- Fix issues with text handles
- Fix interaction between touch scrolling and focus
- Fix active state updates for touch events
- Allow pressing buttons with multiple fingers
* GtkScrolledWindow:
- Accumulate velocity with kinetic scrolling
* GtkSearchEntry:
- Use a better clear icon
* GtkTreeView:
- Remove the deprecated GtkCellRendererClass.get_size vfunc
* GtkBuilder:
- Be stricter about <requires>
- Make gtk-builder-tool simplify update <requires>
* GtkFileChooser:
- Remove GtkFileChooserButton
* GtkWindow:
- Replace gtk_window_get_size with gtk_window_get_default_size
- Add maximized and fullscreen properties
* Make the inspector available in non-debug builds
* CSS:
- Support conic gradients
* Adwaita:
- Round all window corners
- Round submenus
- Remove the 'chin' on menus
- Industrial style menuitems
- Improved tooltip styling
- Unified sidebar styles
- Dark prelight
- Don't backdrop labels
* GSK:
- Rename render node apis from peek to get
* Make GLES work in the absence of GL_ARB_timer_query
* Rework the way size allocation is integrated in the
frame cycle
* Wayland:
- Support gtk_shell1 version 3 (startup notification
and activation)
- Implmement minimization
* OS X:
- Mostly working GL renderer
- Search engine updates
- Fix rendering artifacts with hover transitions
- Fix kinetic scrolling deceleration
* Windows:
- Fix key event generation, making text input work
* Documentation:
- Add missing enumerations, symbols and types
- Lots of smaller fixes
* Demos:
- Make the constraints demo more useful
- Make search more obvious
- Add a suggestion entry demo
- Consistency improvements
- Use native file choosers
- Drop 'devel' styling
* Translation updates:
Belarusian
Catalan
Polish
Spanish
Swedish
Ukrainian
Overview of Changes in 3.99.4
=============================

View File

@@ -49,12 +49,10 @@ In order to build GTK you will need:
You will also need various dependencies, based on the platform you are
building for:
- a C++ compiler
- [GLib](https://download.gnome.org/sources/glib)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection)
- [Cairo](https://www.cairographics.org)
- cairo-gobject
- [Pango](https://download.gnome.org/sources/pango)
- [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene)
@@ -79,12 +77,6 @@ If you are building the Wayland backend, you will also need:
- Wayland-cursor
- Wayland-EGL
If you are building the developer documentation, you will also need:
- gtk-doc
- the DocBook xsl stylesheets
- pandoc
Once you have all the necessary dependencies, you can build GTK by using
Meson:

View File

@@ -8,16 +8,14 @@ constraint_editor_sources = [
]
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
'constraint-editor.gresource.xml',
source_dir: '.',
)
'constraint-editor.gresource.xml',
source_dir: '.')
executable('gtk4-constraint-editor',
sources: [ constraint_editor_sources, constraint_editor_resources, ],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)
constraint_editor_sources, constraint_editor_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: false)

View File

@@ -67,7 +67,7 @@ vec2 raySphere(vec3 ro, vec3 rd, vec4 sphere) {
return vec2(t0, t1);
}
float noize1(vec2 p) {
float noise1(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
@@ -81,7 +81,7 @@ float noize1(vec2 p) {
return h*0.25;
}
float noize2(vec2 p) {
float noise2(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
@@ -114,7 +114,7 @@ float height(vec2 p, float dd, int mx) {
int i = 0;
for (; i < 4;++i) {
float nn = a*noize2(p);
float nn = a*noise2(p);
s += nn;
d += abs(a);
p += o;
@@ -130,7 +130,7 @@ float height(vec2 p, float dd, int mx) {
mx = int(mix(float(4), float(mx), step(rdd, far)));
for (; i < mx; ++i) {
float nn = a*noize1(p);
float nn = a*noise1(p);
s += nn;
d += abs(a);
p += o;

View File

@@ -465,7 +465,7 @@ demo_application_window_size_allocate (GtkWidget *widget,
baseline);
if (!window->maximized && !window->fullscreen)
gtk_window_get_default_size (GTK_WINDOW (window), &window->width, &window->height);
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
}
static void

View File

@@ -319,6 +319,9 @@
<file>paintable_svg.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>path_fill.c</file>
<file>path_maze.c</file>
<file>path_text.c</file>
<file>peg_solitaire.c</file>
<file>pickers.c</file>
<file>printing.c</file>
@@ -403,6 +406,9 @@
<gresource prefix="/fontrendering">
<file>fontrendering.ui</file>
</gresource>
<gresource prefix="/path_text">
<file>path_text.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

@@ -97,9 +97,9 @@ demo3_widget_size_allocate (GtkWidget *widget,
/* Since we are not using a layout manager (who would do this
* for us), we need to allocate a size for our menu by calling
* gtk_popover_present().
* gtk_native_check_resize().
*/
gtk_popover_present (GTK_POPOVER (self->menu));
gtk_native_check_resize (GTK_NATIVE (self->menu));
}
static void

View File

@@ -142,39 +142,16 @@ load_file (GtkStringList *list,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkStringList *stringlist)
file_selected_cb (GtkWidget *button,
GtkStringList *stringlist)
{
gtk_native_dialog_hide (dialog);
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
if (response == GTK_RESPONSE_ACCEPT)
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
load_file (stringlist, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
file_open_cb (GtkWidget *button,
GtkStringList *stringlist)
{
GtkFileChooserNative *dialog;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
GtkWidget *
@@ -212,8 +189,8 @@ do_listview_words (GtkWidget *do_widget)
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
open_button = gtk_button_new_with_mnemonic ("_Open");
g_signal_connect (open_button, "clicked", G_CALLBACK (file_open_cb), stringlist);
open_button = gtk_file_chooser_button_new ("_Open", GTK_FILE_CHOOSER_ACTION_OPEN);
g_signal_connect (open_button, "file-set", G_CALLBACK (file_selected_cb), stringlist);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), open_button);
gtk_window_set_titlebar (GTK_WINDOW (window), header);

View File

@@ -28,16 +28,6 @@
<property name="label" translatable="yes">Run</property>
</object>
</child>
<child>
<object class="GtkToggleButton">
<property name="icon-name">edit-find-symbolic</property>
<property name="valign">center</property>
<property name="active" bind-source="searchbar" bind-property="search-mode-enabled" bind-flags="bidirectional|sync-create"/>
<accessibility>
<property name="label" translatable="yes">Search</property>
</accessibility>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>

View File

@@ -68,6 +68,9 @@ demos = files([
'paintable_mediastream.c',
'panes.c',
'password_entry.c',
'path_fill.c',
'path_maze.c',
'path_text.c',
'peg_solitaire.c',
'pickers.c',
'printing.c',
@@ -100,33 +103,31 @@ demos = files([
gtkdemo_deps = [ libgtk_dep, ]
extra_demo_sources = files([
'main.c',
'fontify.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'gtkshaderbin.c',
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c',
'demochild.c',
'demolayout.c',
'demowidget.c',
'demo2layout.c',
'singular_value_decomposition.c',
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
'suggestionentry.c',
])
extra_demo_sources = files(['main.c',
'fontify.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'gtkshaderbin.c',
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c',
'demochild.c',
'demolayout.c',
'demowidget.c',
'demo2layout.c',
'singular_value_decomposition.c',
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
'suggestionentry.c'])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files(['font_features.c'])
@@ -149,17 +150,14 @@ endif
gtkdemo_args = [ '-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED', ]
demos_h = custom_target('gtk4 demo header',
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
)
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ])
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
)
'demo.gresource.xml',
source_dir: '.')
# Use a subset of compiler flags
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
@@ -168,30 +166,30 @@ foreach flag: common_cflags
endforeach
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
demos, demos_h, extra_demo_sources, gtkdemo_resources,
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
executable('gtk4-demo-application',
sources: ['application.c', gtkdemo_resources],
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
'application.c', gtkdemo_resources,
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# desktop file

View File

@@ -7,3 +7,4 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -13,46 +13,19 @@
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkPicture *picture)
file_set (GtkFileChooserButton *button,
GtkWidget *picture)
{
gtk_native_dialog_hide (dialog);
GFile *file;
GdkPaintable *paintable;
if (response == GTK_RESPONSE_ACCEPT)
{
GFile *file;
GdkPaintable *paintable;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
g_object_unref (paintable);
g_object_unref (file);
}
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
gtk_native_dialog_destroy (dialog);
}
static void
show_file_open (GtkWidget *button,
GtkPicture *picture)
{
GtkFileFilter *filter;
GtkFileChooserNative *dialog;
dialog = gtk_file_chooser_native_new ("Open node file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
g_object_unref (paintable);
g_object_unref (file);
}
static GtkWidget *window;
@@ -62,6 +35,7 @@ do_paintable_svg (GtkWidget *do_widget)
{
GtkWidget *header;
GtkWidget *picture;
GtkFileFilter *filter;
GtkWidget *button;
GFile *file;
GdkPaintable *paintable;
@@ -75,14 +49,17 @@ do_paintable_svg (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "PaintableSVG");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
button = gtk_button_new_with_mnemonic ("_Open");
button = gtk_file_chooser_button_new ("Select an SVG file", GTK_FILE_CHOOSER_ACTION_OPEN);
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (button), filter);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
picture = gtk_picture_new ();
gtk_picture_set_can_shrink (GTK_PICTURE (picture), TRUE);
gtk_widget_set_size_request (picture, 16, 16);
g_signal_connect (button, "clicked", G_CALLBACK (show_file_open), picture);
g_signal_connect (button, "file-set", G_CALLBACK (file_set), picture);
gtk_window_set_child (GTK_WINDOW (window), picture);

303
demos/gtk-demo/path_fill.c Normal file
View File

@@ -0,0 +1,303 @@
/* Path/Fill
*
* This demo shows how to use PangoCairo to draw text with more than
* just a single color.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "paintable.h"
#define GTK_TYPE_PATH_PAINTABLE (gtk_path_paintable_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathPaintable, gtk_path_paintable, GTK, PATH_PAINTABLE, GObject)
struct _GtkPathPaintable
{
GObject parent_instance;
int width;
int height;
GskPath *path;
GdkPaintable *background;
};
struct _GtkPathPaintableClass
{
GObjectClass parent_class;
};
static int
gtk_path_paintable_get_intrinsic_width (GdkPaintable *paintable)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
if (self->background)
return MAX (gdk_paintable_get_intrinsic_width (self->background), self->width);
else
return self->width;
}
static int
gtk_path_paintable_get_intrinsic_height (GdkPaintable *paintable)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
if (self->background)
return MAX (gdk_paintable_get_intrinsic_height (self->background), self->height);
else
return self->height;
}
static void
gtk_path_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
#if 0
gtk_snapshot_push_fill (snapshot, self->path, GSK_FILL_RULE_WINDING);
#else
GskStroke *stroke = gsk_stroke_new (4.0);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gsk_stroke_free (stroke);
#endif
if (self->background)
{
gdk_paintable_snapshot (self->background, snapshot, width, height);
}
else
{
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
(GskColorStop[8]) {
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
},
8);
}
gtk_snapshot_pop (snapshot);
}
static GdkPaintableFlags
gtk_path_paintable_get_flags (GdkPaintable *paintable)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
if (self->background)
return gdk_paintable_get_flags (self->background);
else
return GDK_PAINTABLE_STATIC_CONTENTS | GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_path_paintable_paintable_init (GdkPaintableInterface *iface)
{
iface->get_intrinsic_width = gtk_path_paintable_get_intrinsic_width;
iface->get_intrinsic_height = gtk_path_paintable_get_intrinsic_height;
iface->snapshot = gtk_path_paintable_snapshot;
iface->get_flags = gtk_path_paintable_get_flags;
}
/* When defining the GType, we need to implement the GdkPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkPathPaintable, gtk_path_paintable, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_path_paintable_paintable_init))
/* Here's the boilerplate for the GObject declaration.
* We don't need to do anything special here, because we keep no
* data of our own.
*/
static void
gtk_path_paintable_class_init (GtkPathPaintableClass *klass)
{
}
static void
gtk_path_paintable_init (GtkPathPaintable *self)
{
}
/* And finally, we add a simple constructor.
* It is declared in the header so that the other examples
* can use it.
*/
GdkPaintable *
gtk_path_paintable_new (GskPath *path,
GdkPaintable *background,
int width,
int height)
{
GtkPathPaintable *self;
self = g_object_new (GTK_TYPE_PATH_PAINTABLE, NULL);
self->path = path;
self->background = background;
if (self->background)
{
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gdk_paintable_invalidate_contents), self);
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gdk_paintable_invalidate_size), self);
}
self->width = width;
self->height = height;
return GDK_PAINTABLE (self);
}
void
gtk_path_paintable_set_path (GtkPathPaintable *self,
GskPath *path)
{
g_clear_pointer (&self->path, gsk_path_unref);
self->path = gsk_path_ref (path);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
}
static GskPath *
create_hexagon (GtkWidget *widget)
{
GskPathBuilder *builder;
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder, 120, 0);
gsk_path_builder_line_to (builder, 360, 0);
gsk_path_builder_line_to (builder, 480, 208);
gsk_path_builder_line_to (builder, 360, 416);
gsk_path_builder_line_to (builder, 120, 416);
gsk_path_builder_line_to (builder, 0, 208);
gsk_path_builder_close (builder);
return gsk_path_builder_free_to_path (builder);
}
static GskPath *
create_path_from_text (GtkWidget *widget)
{
cairo_surface_t *surface;
cairo_t *cr;
cairo_path_t *path;
PangoLayout *layout;
PangoFontDescription *desc;
GskPath *result;
surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
cr = cairo_create (surface);
layout = gtk_widget_create_pango_layout (widget, "Pango power!\nPango power!\nPango power!");
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path_flat (cr);
result = gsk_path_new_from_cairo (path);
cairo_path_destroy (path);
g_object_unref (layout);
cairo_destroy (cr);
cairo_surface_destroy (surface);
return result;
}
static gboolean
update_path (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer measure)
{
float progress = gdk_frame_clock_get_frame_time (frame_clock) % (60 * G_USEC_PER_SEC) / (float) (30 * G_USEC_PER_SEC);
GskPathBuilder *builder;
GskPath *path;
graphene_point_t pos;
graphene_vec2_t tangent;
builder = gsk_path_builder_new ();
gsk_path_measure_add_segment (measure,
builder,
progress > 1 ? (progress - 1) * gsk_path_measure_get_length (measure) : 0.0,
(progress < 1 ? progress : 1.0) * gsk_path_measure_get_length (measure));
gsk_path_measure_get_point (measure,
(progress > 1 ? (progress - 1) : progress) * gsk_path_measure_get_length (measure),
&pos,
&tangent);
gsk_path_builder_move_to (builder, pos.x + 5 * graphene_vec2_get_x (&tangent), pos.y + 5 * graphene_vec2_get_y (&tangent));
gsk_path_builder_line_to (builder, pos.x + 3 * graphene_vec2_get_y (&tangent), pos.y + 3 * graphene_vec2_get_x (&tangent));
gsk_path_builder_line_to (builder, pos.x - 3 * graphene_vec2_get_y (&tangent), pos.y - 3 * graphene_vec2_get_x (&tangent));
gsk_path_builder_close (builder);
path = gsk_path_builder_free_to_path (builder);
gtk_path_paintable_set_path (GTK_PATH_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget))),
path);
gsk_path_unref (path);
return G_SOURCE_CONTINUE;
}
GtkWidget *
do_path_fill (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *picture;
GdkPaintable *paintable;
GtkMediaStream *stream;
GskPath *path;
graphene_rect_t bounds;
GskPathMeasure *measure;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Path Fill");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
#if 0
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
#else
stream = gtk_nuclear_media_stream_new ();
#endif
gtk_media_stream_play (stream);
gtk_media_stream_set_loop (stream, TRUE);
path = create_hexagon (window);
path = create_path_from_text (window);
gsk_path_get_bounds (path, &bounds);
paintable = gtk_path_paintable_new (path,
GDK_PAINTABLE (stream),
bounds.origin.x + bounds.size.width,
bounds.origin.y + bounds.size.height);
picture = gtk_picture_new_for_paintable (paintable);
measure = gsk_path_measure_new (path);
gtk_widget_add_tick_callback (picture, update_path, measure, (GDestroyNotify) gsk_path_measure_unref);
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
gtk_picture_set_can_shrink (GTK_PICTURE (picture), FALSE);
g_object_unref (paintable);
gtk_window_set_child (GTK_WINDOW (window), picture);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

338
demos/gtk-demo/path_maze.c Normal file
View File

@@ -0,0 +1,338 @@
/* Path/Maze
*
* This demo shows how to use a GskPath to create a maze and use
* gsk_path_measure_get_closest_point() to check the mouse stays
* on the path.
*
* It also shows off the performance of GskPath (or not) as this
* is a rather complex path.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "paintable.h"
#define MAZE_GRID_SIZE 20
#define MAZE_STROKE_SIZE_ACTIVE (MAZE_GRID_SIZE - 4)
#define MAZE_STROKE_SIZE_INACTIVE (MAZE_GRID_SIZE - 12)
#define MAZE_WIDTH 31
#define MAZE_HEIGHT 21
#define GTK_TYPE_MAZE (gtk_maze_get_type ())
G_DECLARE_FINAL_TYPE (GtkMaze, gtk_maze, GTK, MAZE, GtkWidget)
struct _GtkMaze
{
GtkWidget parent_instance;
int width;
int height;
GskPath *path;
GskPathMeasure *measure;
GdkPaintable *background;
gboolean active;
};
struct _GtkMazeClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (GtkMaze, gtk_maze, GTK_TYPE_WIDGET)
static void
gtk_maze_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkMaze *self = GTK_MAZE (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = self->width;
else
*minimum = *natural = self->height;
}
static void
gtk_maze_snapshot (GtkWidget *widget,
GdkSnapshot *snapshot)
{
GtkMaze *self = GTK_MAZE (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskStroke *stroke;
stroke = gsk_stroke_new (MAZE_STROKE_SIZE_INACTIVE);
if (self->active)
gsk_stroke_set_line_width (stroke, MAZE_STROKE_SIZE_ACTIVE);
gsk_stroke_set_line_join (stroke, GSK_LINE_JOIN_ROUND);
gsk_stroke_set_line_cap (stroke, GSK_LINE_CAP_ROUND);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gsk_stroke_free (stroke);
if (self->background)
{
gdk_paintable_snapshot (self->background, snapshot, width, height);
}
else
{
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
(GskColorStop[8]) {
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
},
8);
}
gtk_snapshot_pop (snapshot);
}
static void
gtk_maze_dispose (GObject *object)
{
GtkMaze *self = GTK_MAZE (object);
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
if (self->background)
{
g_signal_handlers_disconnect_matched (self->background, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
g_clear_object (&self->background);
}
G_OBJECT_CLASS (gtk_maze_parent_class)->dispose (object);
}
static void
gtk_maze_class_init (GtkMazeClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_maze_dispose;
widget_class->measure = gtk_maze_measure;
widget_class->snapshot = gtk_maze_snapshot;
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkMaze *self)
{
if (!self->active)
return;
if (gsk_path_measure_get_closest_point (self->measure, &GRAPHENE_POINT_INIT (x, y), NULL) <= MAZE_STROKE_SIZE_ACTIVE / 2.0f)
return;
self->active = FALSE;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkMaze *self)
{
if (!self->active)
{
self->active = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
static void
gtk_maze_init (GtkMaze *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->active = TRUE;
}
static void
gtk_maze_set_path (GtkMaze *self,
GskPath *path)
{
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
self->path = gsk_path_ref (path);
self->measure = gsk_path_measure_new (path);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
GtkWidget *
gtk_maze_new (GskPath *path,
GdkPaintable *background,
int width,
int height)
{
GtkMaze *self;
self = g_object_new (GTK_TYPE_MAZE, NULL);
gtk_maze_set_path (self, path);
gsk_path_unref (path);
self->background = background;
if (self->background)
{
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gtk_widget_queue_draw), self);
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gtk_widget_queue_resize), self);
}
self->width = width;
self->height = height;
return GTK_WIDGET (self);
}
static void
add_point_to_maze (GtkBitset *maze,
GskPathBuilder *builder,
guint x,
guint y)
{
gboolean set[4] = { };
guint dir;
gtk_bitset_add (maze, y * MAZE_WIDTH + x);
while (TRUE)
{
set[0] = set[0] || x == 0 || gtk_bitset_contains (maze, y * MAZE_WIDTH + x - 1);
set[1] = set[1] || y == 0 || gtk_bitset_contains (maze, (y - 1) * MAZE_WIDTH + x);
set[2] = set[2] || x + 1 == MAZE_WIDTH || gtk_bitset_contains (maze, y * MAZE_WIDTH + x + 1);
set[3] = set[3] || y + 1 == MAZE_HEIGHT || gtk_bitset_contains (maze, (y + 1) * MAZE_WIDTH + x);
if (set[0] && set[1] && set[2] && set[3])
return;
do
{
dir = g_random_int_range (0, 4);
}
while (set[dir]);
switch (dir)
{
case 0:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x - 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x - 1, y);
break;
case 1:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y - 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x, y - 1);
break;
case 2:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 1.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x + 1, y);
break;
case 3:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 1.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x, y + 1);
break;
default:
g_assert_not_reached ();
break;
}
}
}
static GskPath *
create_path_for_maze (GtkWidget *widget)
{
GskPathBuilder *builder;
GtkBitset *maze;
builder = gsk_path_builder_new ();
maze = gtk_bitset_new_empty ();
/* make sure the outer lines are unreachable:
* Set the full range, then remove the center again. */
gtk_bitset_add_range (maze, 0, MAZE_WIDTH * MAZE_HEIGHT);
gtk_bitset_remove_rectangle (maze, MAZE_WIDTH + 1, MAZE_WIDTH - 2, MAZE_HEIGHT - 2, MAZE_WIDTH);
/* Fill the maze */
add_point_to_maze (maze, builder, MAZE_WIDTH / 2, MAZE_HEIGHT / 2);
/* Add start and stop lines */
gsk_path_builder_move_to (builder, 1.5 * MAZE_GRID_SIZE, -0.5 * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, 1.5 * MAZE_GRID_SIZE, 1.5 * MAZE_GRID_SIZE);
gsk_path_builder_move_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT - 1.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT + 0.5) * MAZE_GRID_SIZE);
gtk_bitset_unref (maze);
return gsk_path_builder_free_to_path (builder);
}
GtkWidget *
do_path_maze (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *maze;
GtkMediaStream *stream;
GskPath *path;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
#if 0
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
#else
stream = gtk_nuclear_media_stream_new ();
#endif
gtk_media_stream_play (stream);
gtk_media_stream_set_loop (stream, TRUE);
path = create_path_for_maze (window);
maze = gtk_maze_new (path,
GDK_PAINTABLE (stream),
MAZE_WIDTH * MAZE_GRID_SIZE,
MAZE_HEIGHT * MAZE_GRID_SIZE);
gtk_window_set_child (GTK_WINDOW (window), maze);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

590
demos/gtk-demo/path_text.c Normal file
View File

@@ -0,0 +1,590 @@
/* Path/Text
*
* This demo shows how to use GskPath to animate a path along another path.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_PATH_WIDGET (gtk_path_widget_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWidget, gtk_path_widget, GTK, PATH_WIDGET, GtkWidget)
#define POINT_SIZE 8
enum {
PROP_0,
PROP_TEXT,
PROP_EDITABLE,
N_PROPS
};
struct _GtkPathWidget
{
GtkWidget parent_instance;
char *text;
gboolean editable;
graphene_point_t points[4];
guint active_point;
float line_closest;
GskPath *line_path;
GskPathMeasure *line_measure;
GskPath *text_path;
GdkPaintable *background;
};
struct _GtkPathWidgetClass
{
GtkWidgetClass parent_class;
};
static GParamSpec *properties[N_PROPS] = { NULL, };
G_DEFINE_TYPE (GtkPathWidget, gtk_path_widget, GTK_TYPE_WIDGET)
static GskPath *
create_path_from_text (GtkWidget *widget,
const char *text)
{
cairo_surface_t *surface;
cairo_t *cr;
cairo_path_t *path;
PangoLayout *layout;
PangoFontDescription *desc;
GskPath *result;
surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
cr = cairo_create (surface);
layout = gtk_widget_create_pango_layout (widget, text);
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
cairo_move_to (cr, 0, - pango_layout_get_baseline (layout) / (double) PANGO_SCALE);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path_flat (cr);
result = gsk_path_new_from_cairo (path);
cairo_path_destroy (path);
g_object_unref (layout);
cairo_destroy (cr);
cairo_surface_destroy (surface);
return result;
}
typedef struct
{
GskPathMeasure *measure;
GskPathBuilder *builder;
double scale;
} GtkPathTransform;
static void
gtk_path_transform_point (GskPathMeasure *measure,
const graphene_point_t *pt,
float scale,
graphene_point_t *res)
{
graphene_vec2_t tangent;
gsk_path_measure_get_point (measure, pt->x * scale, res, &tangent);
res->x -= pt->y * scale * graphene_vec2_get_y (&tangent);
res->y += pt->y * scale * graphene_vec2_get_x (&tangent);
}
static gboolean
gtk_path_transform_op (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
float weight,
gpointer data)
{
GtkPathTransform *transform = data;
switch (op)
{
case GSK_PATH_MOVE:
{
graphene_point_t res;
gtk_path_transform_point (transform->measure, &pts[0], transform->scale, &res);
gsk_path_builder_move_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_LINE:
{
graphene_point_t res;
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res);
gsk_path_builder_line_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_CURVE:
{
graphene_point_t res[3];
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res[0]);
gtk_path_transform_point (transform->measure, &pts[2], transform->scale, &res[1]);
gtk_path_transform_point (transform->measure, &pts[3], transform->scale, &res[2]);
gsk_path_builder_curve_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, res[2].x, res[2].y);
}
break;
case GSK_PATH_CONIC:
{
graphene_point_t res[2];
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res[0]);
gtk_path_transform_point (transform->measure, &pts[2], transform->scale, &res[1]);
gsk_path_builder_conic_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, weight);
}
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (transform->builder);
break;
default:
g_assert_not_reached();
return FALSE;
}
return TRUE;
}
static GskPath *
gtk_path_transform (GskPathMeasure *measure,
GskPath *path)
{
GtkPathTransform transform = { measure, gsk_path_builder_new () };
graphene_rect_t bounds;
gsk_path_get_bounds (path, &bounds);
if (bounds.origin.x + bounds.size.width > 0)
transform.scale = gsk_path_measure_get_length (measure) / (bounds.origin.x + bounds.size.width);
else
transform.scale = 1.0f;
gsk_path_foreach (path, gtk_path_transform_op, &transform);
return gsk_path_builder_free_to_path (transform.builder);
}
static void
gtk_path_widget_clear_text_path (GtkPathWidget *self)
{
g_clear_pointer (&self->text_path, gsk_path_unref);
}
static void
gtk_path_widget_clear_paths (GtkPathWidget *self)
{
gtk_path_widget_clear_text_path (self);
g_clear_pointer (&self->line_path, gsk_path_unref);
g_clear_pointer (&self->line_measure, gsk_path_measure_unref);
}
static void
gtk_path_widget_create_text_path (GtkPathWidget *self)
{
GskPath *path;
gtk_path_widget_clear_text_path (self);
if (self->line_measure == NULL)
return;
path = create_path_from_text (GTK_WIDGET (self), self->text);
self->text_path = gtk_path_transform (self->line_measure, path);
gsk_path_unref (path);
}
static void
gtk_path_widget_create_paths (GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
GskPathBuilder *builder;
gtk_path_widget_clear_paths (self);
if (width <= 0 || height <= 0)
return;
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder,
self->points[0].x * width, self->points[0].y * height);
gsk_path_builder_curve_to (builder,
self->points[1].x * width, self->points[1].y * height,
self->points[2].x * width, self->points[2].y * height,
self->points[3].x * width, self->points[3].y * height);
self->line_path = gsk_path_builder_free_to_path (builder);
self->line_measure = gsk_path_measure_new (self->line_path);
gtk_path_widget_create_text_path (self);
}
static void
gtk_path_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
GTK_WIDGET_CLASS (gtk_path_widget_parent_class)->size_allocate (widget, width, height, baseline);
gtk_path_widget_create_paths (self);
}
static void
gtk_path_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskPath *path;
GskStroke *stroke;
gsize i;
/* frosted glass the background */
gtk_snapshot_push_blur (snapshot, 100);
gdk_paintable_snapshot (self->background, snapshot, width, height);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 0.6 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the text */
if (self->text_path)
{
gtk_snapshot_push_fill (snapshot, self->text_path, GSK_FILL_RULE_WINDING);
gdk_paintable_snapshot (self->background, snapshot, width, height);
/* ... with an emboss effect */
stroke = gsk_stroke_new (2.0);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT(1, 1));
gtk_snapshot_push_stroke (snapshot, self->text_path, stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 0.2 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gsk_stroke_free (stroke);
gtk_snapshot_pop (snapshot);
gtk_snapshot_pop (snapshot);
}
if (self->editable)
{
GskPathBuilder *builder;
/* draw the control line */
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, self->line_path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the points */
builder = gsk_path_builder_new ();
for (i = 0; i < 4; i++)
{
gsk_path_builder_add_circle (builder, &GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), POINT_SIZE);
}
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_path_unref (path);
}
if (self->line_closest >= 0)
{
GskPathBuilder *builder;
graphene_point_t closest;
builder = gsk_path_builder_new ();
gsk_path_measure_get_point (self->line_measure, self->line_closest, &closest, NULL);
gsk_path_builder_add_circle (builder, &closest, POINT_SIZE);
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_path_unref (path);
}
}
static void
gtk_path_widget_set_text (GtkPathWidget *self,
const char *text)
{
if (g_strcmp0 (self->text, text) == 0)
return;
g_free (self->text);
self->text = g_strdup (text);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
}
static void
gtk_path_widget_set_editable (GtkPathWidget *self,
gboolean editable)
{
if (self->editable == editable)
return;
self->editable = editable;
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EDITABLE]);
}
static void
gtk_path_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
gtk_path_widget_set_text (self, g_value_get_string (value));
break;
case PROP_EDITABLE:
gtk_path_widget_set_editable (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
g_value_set_string (value, self->text);
break;
case PROP_EDITABLE:
g_value_set_boolean (value, self->editable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_dispose (GObject *object)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
gtk_path_widget_clear_paths (self);
G_OBJECT_CLASS (gtk_path_widget_parent_class)->dispose (object);
}
static void
gtk_path_widget_class_init (GtkPathWidgetClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_path_widget_dispose;
object_class->set_property = gtk_path_widget_set_property;
object_class->get_property = gtk_path_widget_get_property;
widget_class->size_allocate = gtk_path_widget_allocate;
widget_class->snapshot = gtk_path_widget_snapshot;
properties[PROP_TEXT] =
g_param_spec_string ("text",
"text",
"Text transformed along a path",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_EDITABLE] =
g_param_spec_boolean ("editable",
"editable",
"If the path can be edited by the user",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
drag_begin (GtkGestureDrag *gesture,
double x,
double y,
GtkPathWidget *self)
{
graphene_point_t mouse = GRAPHENE_POINT_INIT (x, y);
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
gsize i;
for (i = 0; i < 4; i++)
{
if (graphene_point_distance (&GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), &mouse, NULL, NULL) <= POINT_SIZE)
{
self->active_point = i;
break;
}
}
if (i == 4)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
return;
}
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
drag_update (GtkGestureDrag *drag,
double offset_x,
double offset_y,
GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
double start_x, start_y;
gtk_gesture_drag_get_start_point (drag, &start_x, &start_y);
self->points[self->active_point] = GRAPHENE_POINT_INIT ((start_x + offset_x) / width,
(start_y + offset_y) / height);
self->points[self->active_point].x = CLAMP (self->points[self->active_point].x, 0, 1);
self->points[self->active_point].y = CLAMP (self->points[self->active_point].y, 0, 1);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkPathWidget *self)
{
gsk_path_measure_get_closest_point_full (self->line_measure,
&GRAPHENE_POINT_INIT (x, y),
INFINITY,
&self->line_closest,
NULL, NULL, NULL);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkPathWidget *self)
{
self->line_closest = -1;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
gtk_path_widget_init (GtkPathWidget *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
g_signal_connect (controller, "drag-end", G_CALLBACK (drag_update), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "enter", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->line_closest = -1;
self->points[0] = GRAPHENE_POINT_INIT (0.1, 0.9);
self->points[1] = GRAPHENE_POINT_INIT (0.3, 0.1);
self->points[2] = GRAPHENE_POINT_INIT (0.7, 0.1);
self->points[3] = GRAPHENE_POINT_INIT (0.9, 0.9);
self->background = GDK_PAINTABLE (gdk_texture_new_from_resource ("/sliding_puzzle/portland-rose.jpg"));
gtk_path_widget_set_text (self, "It's almost working");
}
GtkWidget *
gtk_path_widget_new (void)
{
GtkPathWidget *self;
self = g_object_new (GTK_TYPE_PATH_WIDGET, NULL);
return GTK_WIDGET (self);
}
GtkWidget *
do_path_text (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (GTK_TYPE_PATH_WIDGET);
builder = gtk_builder_new_from_resource ("/path_text/path_text.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Text along a Path</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="edit-toggle">
<property name="icon-name">document-edit-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<child>
<object class="GtkEntry" id="text">
<property name="text">Through the looking glass</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPathWidget" id="view">
<property name="editable" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<property name="text" bind-source="text" bind-property="text" bind-flags="sync-create"></property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,8 +1,9 @@
/* Pickers
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
* #Keywords: GtkColorChooser, GtkFontChooser, GtkFileChooser,
* #Keywords: GtkApplicationChooser
*
* These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts, directories and applications.
* They allow to select colors, fonts, files, directories and applications.
*
* This demo shows both the default appearance for these dialogs,
* as well as some of the customizations that are possible.
@@ -62,6 +63,9 @@ do_pickers (GtkWidget *do_widget)
if (!window)
{
char *dir;
GFile *file;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -119,14 +123,55 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_attach (GTK_GRID (table), picker, 2, 1, 1, 1);
label = gtk_label_new ("File:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN);
dir = g_get_current_dir ();
file = g_file_new_for_path (dir);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (picker), file, NULL);
g_object_unref (file);
g_free (dir);
gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (picker),
"choice",
"Encoding",
(const char *[]) { "option1", "option2", NULL },
(const char *[]) { "UTF-8", "Other Encoding", NULL });
gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (picker), "choice", "option1");
gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (picker),
"check",
"Read backwards",
NULL, NULL);
gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (picker), "check", "false");
gtk_grid_attach (GTK_GRID (table), picker, 2, 2, 1, 1);
label = gtk_label_new ("Folder:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
picker = gtk_file_chooser_button_new ("Pick a Folder",
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
label = gtk_label_new ("Mail:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), label, 0, 4, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 4, 1, 1);
}
if (!gtk_widget_get_visible (window))

View File

@@ -474,7 +474,7 @@ suggestion_entry_size_allocate (GtkWidget *widget,
gtk_widget_set_size_request (self->popup, gtk_widget_get_allocated_width (GTK_WIDGET (self)), -1);
gtk_widget_queue_resize (self->popup);
gtk_popover_present (GTK_POPOVER (self->popup));
gtk_native_check_resize (GTK_NATIVE (self->popup));
}
static gboolean

View File

@@ -1,6 +1,6 @@
/* Benchmark/Themes
*
* This demo continuously switches themes, like some of you.
* This demo switches themes like a maniac, like some of you.
*
* Warning: This demo involves rapidly flashing changes and may
* be hazardous to photosensitive viewers.

View File

@@ -10,11 +10,11 @@
static GtkWidget *window = NULL;
static void
open_dialog_response_cb (GtkNativeDialog *dialog,
int response,
GtkWidget *video)
open_dialog_response_cb (GtkWidget *dialog,
int response,
GtkWidget *video)
{
gtk_native_dialog_hide (dialog);
gtk_widget_hide (dialog);
if (response == GTK_RESPONSE_ACCEPT)
{
@@ -25,30 +25,32 @@ open_dialog_response_cb (GtkNativeDialog *dialog,
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
gtk_window_destroy (GTK_WINDOW (dialog));
}
static void
open_clicked_cb (GtkWidget *button,
GtkWidget *video)
{
GtkFileChooserNative *dialog;
GtkWidget *dialog;
GtkFileFilter *filter;
dialog = gtk_file_chooser_native_new ("Select a video",
dialog = gtk_file_chooser_dialog_new ("Select a video",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
"_Cancel", GTK_RESPONSE_CANCEL,
"_Open", GTK_RESPONSE_ACCEPT,
NULL);
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "video/*");
gtk_file_filter_set_name (filter, "Video");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
g_object_unref (filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_widget_show (dialog);
}
static void

View File

@@ -7,25 +7,25 @@ iconbrowser_sources = [
]
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
'iconbrowser.gresource.xml',
source_dir: '.',
)
'iconbrowser.gresource.xml',
source_dir: '.')
executable('gtk4-icon-browser',
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
iconbrowser_sources, iconbrowser_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# desktop file

View File

@@ -7,3 +7,4 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -6,25 +6,25 @@ node_editor_sources = [
]
node_editor_resources = gnome.compile_resources('node_editor_resources',
'node-editor.gresource.xml',
source_dir: '.',
)
'node-editor.gresource.xml',
source_dir: '.')
executable('gtk4-node-editor',
sources: [node_editor_sources, node_editor_resources],
dependencies: libgtk_dep,
include_directories: confinc,
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)
node_editor_sources, node_editor_resources,
dependencies: libgtk_dep,
include_directories: confinc,
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
link_args: extra_demo_ldflags,
install: false)
# icons, don't install them until we decide to install gtk4-node-editor
#icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
#foreach size: ['scalable', 'symbolic']
# install_subdir('data/' + size, install_dir: icontheme_dir)
# install_subdir('data/' + size,
# install_dir: icontheme_dir
# )
#endforeach

View File

@@ -23,7 +23,7 @@ The **container** node is a special node that allows specifying a list of child
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bottom | `<node>` | color { } | always |
| bottom | `<node>` | color { color: #AF0; } | always |
| mode | `<blend-mode>` | normal | non-default |
| top | `<node>` | color { } | always |
@@ -48,22 +48,7 @@ Creates a node like `gsk_blur_node_new()` with the given properties.
Creates a node like `gsk_border_node_new()` with the given properties.
For the color and width properties, the values follow the typical CSS order
of top, right, bottom, left. If the last/left value isn't given, the 2nd/right
value is used. If the 3rd/bottom value isn't given, the 1st/top value is used.
And if the 2nd/right value also isn't given, the 1st/top value is used for
every 4 values.
### cairo
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | none | always |
| pixels | `<url>` | none | non-default |
| script | `<url>` | none | non-default |
The pixels are a base64-encoded data url of png data. The script is
a base64-encoded data url of a cairo script.
For the color and width properties, the values follow the typical CSS order of top, right, bottom, left. If the last/left value isn't given, the 2nd/right value is used. If the 3rd/bottom value isn't given, the 1st/top value is used. And if the 2nd/right value also isn't given, the 1st/top value is used for every 4 values.
### clip
@@ -74,9 +59,7 @@ a base64-encoded data url of a cairo script.
Creates a node like `gsk_clip_node_new()` with the given properties.
As an extension, this node allows specifying a rounded rectangle for the
clip property. If that rectangle is indeed rounded, a node like
`gsk_rounded_clip_node_new()` will be created instead.
As an extension, this node allows specifying a rounded rectangle for the clip property. If that rectangle is indeed rounded, a node like `gsk_rounded_clip_node_new()` will be created instead.
### color
@@ -87,8 +70,7 @@ clip property. If that rectangle is indeed rounded, a node like
Creates a node like `gsk_color_node_new()` with the given properties.
The color is chosen as an error pink so it is visible while also reminding
people to change it.
The color is chosen as an error pink so it is visible while also reminding people to change it.
### color-matrix
@@ -100,21 +82,7 @@ people to change it.
Creates a node like `gsk_color_matrix_node_new()` with the given properties.
The matrix property accepts a <transform> for compatibility purposes, but you
should be aware that the allowed values are meant to be used on 3D transformations,
so their naming might appear awkward. However, it is always possible to use the
matrix3d() production to specify all 16 values individually.
### conic-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25, 25 | always |
| rotation | `<number>` | 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
The matrix property accepts a <transform> for compatibility purposes, but you should be aware that the allowed values are meant to be used on 3D transformations, so their naming might appear awkward. However, it is always possible to use the matrix3d() production to specify all 16 values individually.
### cross-fade
@@ -122,7 +90,7 @@ Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
| -------- | ---------------- | ---------------------- | ----------- |
| end | `<node>` | color { } | always |
| mode | `<number>` | 0.5 | non-default |
| start | `<node>` | color { } | always |
| start | `<node>` | color { color: #AF0; } | always |
Creates a node like `gsk_cross_fade_node_new()` with the given properties.
@@ -153,8 +121,8 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| start | `<point>` | 0 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
@@ -181,57 +149,16 @@ Creates a node like `gsk_transform_node_new()` with the given properties.
Creates a node like `gsk_outset_shadow_node_new()` with the given properties.
### radial-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
### repeat
| property | syntax | default | printed |
| ----------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
Creates a node like `gsk_repeat_node_new()` with the given properties.
### repeating-linear-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_repeating_linear_gradient_node_new()` with the given
properties.
### repeating radial-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_repeating_radial_gradient_node_new()` with the given
properties.
### rounded-clip
| property | syntax | default | printed |
@@ -261,8 +188,7 @@ Creates a node like `gsk_shadow_node_new()` with the given properties.
Creates a node like `gsk_text_node_new()` with the given properties.
If the given font does not exist or the given glyphs are invalid for the given
font, an error node will be returned.
If the given font does not exist or the given glyphs are invalid for the given font, an error node will be returned.
### texture
@@ -273,9 +199,7 @@ font, an error node will be returned.
Creates a node like `gsk_texture_node_new()` with the given properties.
The default texture is a 10x10 checkerboard with the top left and bottom right
5x5 being in the color #FF00CC and the other part being transparent. A possible
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
The default texture is a 10x10 checkerboard with the top left and bottom right 5x5 being in the color #FF00CC and the other part being transparent. A possible representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
`.
### transform
@@ -287,19 +211,3 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
Creates a node like `gsk_transform_node_new()` with the given properties.
### glshader
| property | syntax | default | printed |
| ---------- | ------------------ | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| sourcecode | `<string>` | "" | always |
| args | `<uniform values>` | none | non-default |
| child1 | `<node>` | none | non-default |
| child2 | `<node>` | none | non-default |
| child3 | `<node>` | none | non-default |
| child4 | `<node>` | none | non-default |
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
The `args` must match the uniforms of simple types declared in that shader,
in order and comma-separated. The `child` properties must match the sampler
uniforms in the shader.

View File

@@ -1,12 +1,11 @@
executable('gtk4-print-editor',
sources: ['print-editor.c'],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
['print-editor.c'],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# desktop file
install_data('org.gtk.PrintEditor4.desktop', install_dir: gtk_applicationsdir)
@@ -18,5 +17,7 @@ install_data('org.gtk.PrintEditor4.appdata.xml', install_dir: gtk_appdatadir)
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach

View File

@@ -7,3 +7,4 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -1,19 +1,17 @@
# demos/widget-factory
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.',
)
'widget-factory.gresource.xml',
source_dir: '.')
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
'widget-factory.c', widgetfactory_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
# desktop file
install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
@@ -22,7 +20,9 @@ install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size, install_dir: icontheme_dir)
install_subdir('data/' + size,
install_dir: icontheme_dir
)
endforeach
# appdata

View File

@@ -7,3 +7,4 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -878,6 +878,9 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="use-alpha">1</property>
</object>
</child>
<child>
<object class="GtkFileChooserButton" id="filechooserbutton1"/>
</child>
<child>
<object class="GtkLinkButton" id="linkbutton1">
<property name="label" translatable="yes">link button</property>
@@ -1072,7 +1075,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="autoplay">1</property>
<property name="autoplay">0</property>
<property name="loop">1</property>
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
</object>

View File

@@ -70,8 +70,3 @@ gtk/inspector @otte @matthiasc
# Layout managers
gtk/gtklayout* @ebassi
gtk/gtkconstraint* @ebassi
# Accessibility
gtk/gtkaccessible*.[ch] @ebassi
gtk/gtkatcontext*.[ch] @ebassi
gtk/a11y @ebassi

View File

@@ -1,3 +1,4 @@
<INCLUDE>gdk/gdk.h</INCLUDE>
<SECTION>
@@ -10,11 +11,6 @@ GDK_WINDOWING_WIN32
GDK_WINDOWING_MACOS
GDK_WINDOWING_WAYLAND
<SUBSECTION>
GDK_MAJOR_VERSION
GDK_MICRO_VERSION
GDK_MINOR_VERSION
<SUBSECTION>
GDK_VERSION_4_0
GDK_VERSION_MIN_REQUIRED
@@ -28,9 +24,6 @@ GDK_TYPE_GRAB_STATUS
GDK_TYPE_STATUS
GdkStatus
GDKVAR
GDK_EXTERN_VAR
_GDK_EXTERN
GDK_DECLARE_INTERNAL_TYPE
gdk_axis_use_get_type
gdk_byte_order_get_type
gdk_crossing_mode_get_type
@@ -196,7 +189,6 @@ gdk_surface_create_cairo_context
<SUBSECTION>
gdk_surface_queue_render
gdk_surface_get_frame_clock
gdk_surface_request_layout
<SUBSECTION>
gdk_surface_set_cursor
@@ -204,6 +196,7 @@ gdk_surface_get_cursor
gdk_surface_set_input_region
gdk_surface_get_width
gdk_surface_get_height
gdk_surface_set_shadow_width
gdk_surface_get_device_position
GdkModifierType
GDK_MODIFIER_MASK
@@ -375,7 +368,6 @@ gdk_device_tool_get_hardware_id
gdk_device_tool_get_axes
<SUBSECTION Standard>
GDK_TYPE_AXIS_FLAGS
GDK_TYPE_AXIS_USE
GDK_TYPE_EXTENSION_MODE
GDK_TYPE_INPUT_MODE
@@ -448,7 +440,6 @@ gdk_seat_capabilities_get_type
<FILE>events</FILE>
GdkEvent
GdkEventType
GdkKeymapKey
GdkKeyMatch
GdkTouchpadGesturePhase
GdkScrollDirection
@@ -484,14 +475,10 @@ gdk_event_get_axis
gdk_event_get_history
gdk_event_get_pointer_emulated
gdk_event_triggers_context_menu
GdkButtonEvent
gdk_button_event_get_button
GdkScrollEvent
gdk_scroll_event_get_direction
gdk_scroll_event_get_deltas
gdk_scroll_event_is_stop
GdkMotionEvent
GdkKeyEvent
gdk_key_event_get_keyval
gdk_key_event_get_keycode
gdk_key_event_get_consumed_modifiers
@@ -500,31 +487,23 @@ gdk_key_event_get_level
gdk_key_event_is_modifier
gdk_key_event_matches
gdk_key_event_get_match
GdkFocusEvent
gdk_focus_event_get_in
gdk_touch_event_get_emulating_pointer
GdkCrossingEvent
gdk_crossing_event_get_mode
gdk_crossing_event_get_detail
gdk_crossing_event_get_focus
GdkGrabBrokenEvent
gdk_grab_broken_event_get_grab_surface
gdk_grab_broken_event_get_implicit
GdkDeleteEvent
GdkDNDEvent
gdk_dnd_event_get_drop
GdkTouchEvent
GdkTouchpadEvent
gdk_configure_event_get_size
gdk_touchpad_event_get_gesture_phase
gdk_touchpad_event_get_n_fingers
gdk_touchpad_event_get_deltas
gdk_touchpad_event_get_pinch_angle_delta
gdk_touchpad_event_get_pinch_scale
GdkPadEvent
gdk_pad_event_get_axis_value
gdk_pad_event_get_button
gdk_pad_event_get_group_mode
GdkProximityEvent
<SUBSECTION>
gdk_events_get_angle
@@ -532,7 +511,6 @@ gdk_events_get_center
gdk_events_get_distance
<SUBSECTION Standard>
GDK_EVENT
GDK_TYPE_EVENT
GDK_TYPE_EVENT_MASK
GDK_TYPE_EVENT_TYPE
@@ -540,24 +518,11 @@ GDK_TYPE_CROSSING_MODE
GDK_TYPE_SCROLL_DIRECTION
GDK_TYPE_NOTIFY_TYPE
GDK_IS_EVENT
GDK_IS_EVENT_TYPE
GDK_TYPE_BUTTON_EVENT
GDK_TYPE_CROSSING_EVENT
GDK_TYPE_DELETE_EVENT
GDK_TYPE_DND_EVENT
GDK_TYPE_FOCUS_EVENT
GDK_TYPE_GRAB_BROKEN_EVENT
GDK_TYPE_KEY_EVENT
GDK_TYPE_MOTION_EVENT
GDK_TYPE_PAD_EVENT
GDK_TYPE_PROXIMITY_EVENT
GDK_TYPE_SCROLL_EVENT
GDK_TYPE_TOUCH_EVENT
GDK_TYPE_TOUCHPAD_EVENT
gdk_event_get_type
gdk_event_sequence_get_type
gdk_button_event_get_type
gdk_configure_event_get_type
gdk_crossing_event_get_type
gdk_delete_event_get_type
gdk_dnd_event_get_type
@@ -675,7 +640,6 @@ GdkToplevelSize
gdk_toplevel_size_get_bounds
gdk_toplevel_size_set_size
gdk_toplevel_size_set_min_size
gdk_toplevel_size_set_shadow_width
<SUBSECTION Standard>
GDK_TYPE_TOPLEVEL_SIZE
gdk_toplevel_size_get_type
@@ -863,14 +827,11 @@ gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_display_set_surface_scale
gdk_x11_display_get_glx_version
gdk_x11_display_get_primary_monitor
gdk_x11_display_get_screen
gdk_x11_monitor_get_output
gdk_x11_monitor_get_workarea
gdk_x11_screen_get_screen_number
gdk_x11_screen_get_xscreen
gdk_x11_screen_get_window_manager_name
gdk_x11_screen_get_monitor_output
gdk_x11_screen_lookup_visual
gdk_x11_screen_supports_net_wm_hint
gdk_x11_screen_get_number_of_desktops
gdk_x11_screen_get_current_desktop
@@ -885,9 +846,9 @@ gdk_x11_surface_set_utf8_property
gdk_x11_surface_set_frame_sync_enabled
gdk_x11_surface_set_group
gdk_x11_surface_get_group
gdk_x11_surface_set_skip_pager_hint
gdk_x11_surface_set_skip_taskbar_hint
gdk_x11_surface_set_urgency_hint
gdk_x11_keymap_get_group_for_state
gdk_x11_keymap_key_is_modifier
gdk_x11_visual_get_xvisual
gdk_x11_get_xatom_by_name_for_display
gdk_x11_get_xatom_name_for_display
gdk_x11_set_sm_client_id
@@ -940,18 +901,29 @@ GDK_X11_DRAG_CONTEXT_CLASS
GDK_IS_X11_DRAG_CONTEXT
GDK_IS_X11_DRAG_CONTEXT_CLASS
GDK_X11_DRAG_CONTEXT_GET_CLASS
GDK_TYPE_X11_KEYMAP
GDK_X11_KEYMAP
GDK_X11_KEYMAP_CLASS
GDK_IS_X11_KEYMAP
GDK_IS_X11_KEYMAP_CLASS
GDK_X11_KEYMAP_GET_CLASS
GDK_TYPE_X11_GL_CONTEXT
GDK_X11_GL_CONTEXT
GDK_X11_GL_CONTEXT_CLASS
GDK_IS_X11_GL_CONTEXT
GDK_IS_X11_GL_CONTEXT_CLASS
GDK_TYPE_X11_DRAG
GDK_X11_DRAG
GDK_IS_X11_DRAG
GDK_IS_X11_DRAG_CLASS
GDK_TYPE_X11_MONITOR
GDK_X11_MONITOR
GDK_IS_X11_MONITOR
GDK_TYPE_X11_SCREEN
GDK_X11_SCREEN
GDK_X11_SCREEN_CLASS
GDK_IS_X11_SCREEN
GDK_IS_X11_SCREEN_CLASS
GDK_X11_SCREEN_GET_CLASS
GDK_TYPE_X11_VISUAL
GDK_X11_VISUAL
GDK_X11_VISUAL_CLASS
GDK_IS_X11_VISUAL
GDK_IS_X11_VISUAL_CLASS
GDK_X11_VISUAL_GET_CLASS
GDK_TYPE_X11_SURFACE
GDK_X11_SURFACE
GDK_X11_SURFACE_CLASS
@@ -969,10 +941,9 @@ gdk_x11_device_xi_get_type
gdk_x11_display_get_type
gdk_x11_display_manager_get_type
gdk_x11_drag_context_get_type
gdk_x11_drag_get_type
gdk_x11_gl_context_get_type
gdk_x11_monitor_get_type
gdk_x11_keymap_get_type
gdk_x11_screen_get_type
gdk_x11_visual_get_type
gdk_x11_surface_get_type
gdk_surface_impl_x11_get_type
</SECTION>
@@ -987,6 +958,7 @@ gdk_wayland_display_query_registry
gdk_wayland_display_set_cursor_theme
gdk_wayland_display_get_startup_notification_id
gdk_wayland_display_set_startup_notification_id
gdk_wayland_display_query_registry
<SUBSECTION Device>
gdk_wayland_seat_get_wl_seat
@@ -1036,12 +1008,8 @@ GDK_IS_WAYLAND_SURFACE_CLASS
gdk_wayland_device_get_type
gdk_wayland_display_get_type
gdk_wayland_display_manager_get_type
gdk_wayland_gl_context_get_type
gdk_wayland_monitor_get_type
gdk_wayland_popup_get_type
gdk_wayland_seat_get_type
gdk_wayland_surface_get_type
gdk_wayland_toplevel_get_type
</SECTION>
<SECTION>
@@ -1203,10 +1171,6 @@ GdkCairoContext
gdk_cairo_context_cairo_create
<SUBSECTION Standard>
GDK_CAIRO_CONTEXT
GDK_IS_CAIRO_CONTEXT
GDK_TYPE_CAIRO_CONTEXT
GDK_CAIRO_ERROR
gdk_cairo_context_get_type
</SECTION>
@@ -1226,11 +1190,6 @@ gdk_vulkan_context_get_queue
gdk_vulkan_context_get_queue_family_index
<SUBSECTION Standard>
GDK_VULKAN_CONTEXT
GDK_IS_VULKAN_CONTEXT
GDK_TYPE_VULKAN_CONTEXT
GDK_RENDERING_VULKAN
GDK_VULKAN_ERROR
gdk_vulkan_context_get_type
gdk_vulkan_error_quark
gdk_vulkan_strerror

View File

@@ -1,22 +1,21 @@
private_headers = [
'gdk-autocleanup.h',
'gdkintl.h',
'gdkmarshalers.h',
'gdkkeysyms.h',
'gdkinternals.h',
'gdk-private.h',
'gdkapplaunchcontextprivate.h',
'gdkcairocontextprivate.h',
'gdkcairoprivate.h',
'gdkclipboardprivate.h',
'gdkcontentformatsprivate.h',
'gdkcontentproviderprivate.h',
'gdkcursorprivate.h',
'gdkdebug.h',
'gdkdevicepadprivate.h',
'gdkdeviceprivate.h',
'gdkdevicepadprivate.h',
'gdkdevicetoolprivate.h',
'gdkdisplaymanagerprivate.h',
'gdkdisplayprivate.h',
'gdkdndprivate.h',
'gdkdragprivate.h',
'gdkdragsurfaceprivate.h',
'gdkdrawcontextprivate.h',
'gdkdropprivate.h',
'gdkeventsprivate.h',
@@ -24,17 +23,12 @@ private_headers = [
'gdkframeclockprivate.h',
'gdkglcontextprivate.h',
'gdkgltextureprivate.h',
'gdkinternals.h',
'gdkintl.h',
'gdkkeysprivate.h',
'gdkkeysyms.h',
'gdkmarshalers.h',
'gdkmemorytextureprivate.h',
'gdkmonitorprivate.h',
'gdkmemorytextureprivate.h',
'gdkpipeiostreamprivate.h',
'gdkpopupprivate.h',
'gdkprofilerprivate.h',
'gdkrgbaprivate.h',
'gdkscreenprivate.h',
'gdkseatdefaultprivate.h',
'gdkseatprivate.h',
@@ -43,71 +37,22 @@ private_headers = [
'gdksurfaceprivate.h',
'gdktextureprivate.h',
'gdktoplevelprivate.h',
'gdktoplevelsizeprivate.h',
'gdkvulkancontextprivate.h',
'filetransferportalprivate.h',
'gdkconstructor.h',
'keyname-table.h',
# gdk/x11
'gdkasync.h',
'gdkcairocontext-x11.h',
'gdkclipboard-x11.h',
'gdkdevice-xi2-private.h',
'gdkdevicemanagerprivate-core.h',
'gdkdisplay-x11.h',
'gdkeventsource.h',
'gdkeventtranslator.h',
'gdkglcontext-x11.h',
'gdkkeys-x11.h',
'gdkmonitor-x11.h',
'gdkprivate-x11.h',
'gdkscreen-x11.h',
'gdkselectioninputstream-x11.h',
'gdkselectionoutputstream-x11.h',
'gdksurface-x11.h',
'gdktextlistconverter-x11.h',
'gdkvisual-x11.h',
'gdkvulkancontext-x11.h',
'gdkx-autocleanups.h',
'MwmUtil.h',
'xsettings-client.h',
# gdk/wayland
'gdkcairocontext-wayland.h',
'gdkclipboard-wayland.h',
'gdkdevice-wayland-private.h',
'gdkdisplay-wayland.h',
'gdkglcontext-wayland.h',
'gdkmonitor-wayland.h',
'gdkprimary-wayland.h',
'gdkprivate-wayland.h',
'gdkseat-wayland.h',
'gdksurface-wayland.h',
'gdkvulkancontext-wayland.h',
'wm-button-layout-translation.h',
'x11/gdkprivate-x11.h',
'x11/gdkeventsource.h',
'gtk-primary-selection-client-protocol.h',
'gtk-shell-client-protocol.h',
'idle-inhibit-unstable-v1-client-protocol.h',
'keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h',
'pointer-gestures-unstable-v1-client-protocol.h',
'primary-selection-unstable-v1-client-protocol.h',
'server-decoration-client-protocol.h',
'tablet-unstable-v2-client-protocol.h',
'xdg-foreign-unstable-v1-client-protocol.h',
'xdg-shell-unstable-v6-client-protocol.h',
'xdg-output-unstable-v1-client-protocol.h',
'xdg-shell-client-protocol.h',
'xdg-shell-unstable-v6-client-protocol.h',
'wayland-cursor.h',
'os-compatibility.h',
'xcursor.h',
'broadway',
'wayland/cursor',
'macos',
'win32',
'quartz',
'broadway',
'mir'
]
images = [
@@ -162,26 +107,22 @@ if get_option('gtk_doc')
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gdk4',
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
],
html_assets: images,
install: true,
)
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
],
html_assets: images,
install: true)
endif

View File

@@ -23,6 +23,13 @@
<xi:include href="xml/GskGLShader.xml" />
</reference>
<part id="paths">
<title>Paths</title>
<xi:include href="xml/GskPath.xml" />
<xi:include href="xml/GskPathBuilder.xml" />
<xi:include href="xml/GskStroke.xml" />
</part>
<index id="api-index-full">
<title>Index of all symbols</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>

View File

@@ -20,40 +20,6 @@ GSK_TYPE_RENDERER
GskRendererClass
gsk_renderer_get_type
GSK_TYPE_SCALING_FILTER
GSK_BROADWAY_RENDERER
GSK_BROADWAY_RENDERER_CLASS
GSK_BROADWAY_RENDERER_GET_CLASS
GSK_IS_BROADWAY_RENDERER
GSK_IS_BROADWAY_RENDERER_CLASS
GSK_TYPE_BROADWAY_RENDERER
GskBroadwayRenderer
GskBroadwayRendererClass
GSK_CAIRO_RENDERER
GSK_CAIRO_RENDERER_CLASS
GSK_CAIRO_RENDERER_GET_CLASS
GSK_IS_CAIRO_RENDERER
GSK_IS_CAIRO_RENDERER_CLASS
GSK_TYPE_CAIRO_RENDERER
GskCairoRenderer
GskCairoRendererClass
GSK_GL_RENDERER
GSK_GL_RENDERER_CLASS
GSK_GL_RENDERER_GET_CLASS
GSK_IS_GL_RENDERER
GSK_IS_GL_RENDERER_CLASS
GSK_TYPE_GL_RENDERER
GskGLRenderer
GskGLRendererClass
gsk_gl_renderer_get_type
GSK_VULKAN_RENDERER
GSK_VULKAN_RENDERER_CLASS
GSK_VULKAN_RENDERER_GET_CLASS
GSK_IS_VULKAN_RENDERER
GSK_IS_VULKAN_RENDERER_CLASS
GSK_TYPE_VULKAN_RENDERER
GskVulkanRenderer
GskVulkanRendererClass
gsk_vulkan_renderer_get_type
</SECTION>
<SECTION>
@@ -66,7 +32,6 @@ GskCairoNode
GskClipNode
GskColorMatrixNode
GskColorNode
GskConicGradientNode
GskContainerNode
GskCrossFadeNode
GskDebugNode
@@ -91,26 +56,28 @@ gsk_render_node_get_node_type
gsk_render_node_draw
GskSerializationError
GskParseErrorFunc
GskParseLocation
gsk_render_node_serialize
gsk_render_node_deserialize
gsk_render_node_write_to_file
GskScalingFilter
gsk_render_node_get_bounds
<SUBSECTION Nodes>
<SUBSECTION>
gsk_color_node_new
gsk_color_node_get_color
gsk_texture_node_new
gsk_texture_node_get_texture
<SUBSECTION>
GskColorStop
gsk_linear_gradient_node_new
gsk_repeating_linear_gradient_node_new
gsk_linear_gradient_node_get_start
gsk_linear_gradient_node_get_end
gsk_linear_gradient_node_get_n_color_stops
gsk_linear_gradient_node_get_color_stops
gsk_repeating_linear_gradient_node_new
<SUBSECTION>
gsk_radial_gradient_node_new
gsk_repeating_radial_gradient_node_new
gsk_radial_gradient_node_get_n_color_stops
gsk_radial_gradient_node_get_color_stops
gsk_radial_gradient_node_get_start
@@ -118,16 +85,12 @@ gsk_radial_gradient_node_get_end
gsk_radial_gradient_node_get_hradius
gsk_radial_gradient_node_get_vradius
gsk_radial_gradient_node_get_center
gsk_repeating_radial_gradient_node_new
gsk_conic_gradient_node_new
gsk_conic_gradient_node_get_n_color_stops
gsk_conic_gradient_node_get_color_stops
gsk_conic_gradient_node_get_center
gsk_conic_gradient_node_get_rotation
<SUBSECTION>
gsk_border_node_new
gsk_border_node_get_outline
gsk_border_node_get_widths
gsk_border_node_get_colors
<SUBSECTION>
gsk_inset_shadow_node_new
gsk_inset_shadow_node_get_outline
gsk_inset_shadow_node_get_color
@@ -135,6 +98,7 @@ gsk_inset_shadow_node_get_dx
gsk_inset_shadow_node_get_dy
gsk_inset_shadow_node_get_spread
gsk_inset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_outset_shadow_node_new
gsk_outset_shadow_node_get_outline
gsk_outset_shadow_node_get_color
@@ -142,45 +106,63 @@ gsk_outset_shadow_node_get_dx
gsk_outset_shadow_node_get_dy
gsk_outset_shadow_node_get_spread
gsk_outset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_cairo_node_new
gsk_cairo_node_get_draw_context
gsk_cairo_node_get_surface
<SUBSECTION>
gsk_container_node_new
gsk_container_node_get_n_children
gsk_container_node_get_child
<SUBSECTION>
gsk_transform_node_new
gsk_transform_node_get_child
gsk_transform_node_get_transform
<SUBSECTION>
gsk_opacity_node_new
gsk_opacity_node_get_child
gsk_opacity_node_get_opacity
<SUBSECTION>
gsk_color_matrix_node_new
gsk_color_matrix_node_get_child
gsk_color_matrix_node_get_color_matrix
gsk_color_matrix_node_get_color_offset
<SUBSECTION>
gsk_repeat_node_new
gsk_repeat_node_get_child
gsk_repeat_node_get_child_bounds
<SUBSECTION>
gsk_clip_node_new
gsk_clip_node_get_child
gsk_clip_node_get_clip
<SUBSECTION>
gsk_rounded_clip_node_new
gsk_rounded_clip_node_get_child
gsk_rounded_clip_node_get_clip
<SUBSECTION>
GskFillRule
gsk_fill_node_new
gsk_fill_node_get_child
gsk_fill_node_get_path
gsk_fill_node_get_fill_rule
<SUBSECTION>
GskShadow
gsk_shadow_node_new
gsk_shadow_node_get_shadow
gsk_shadow_node_get_n_shadows
gsk_shadow_node_get_child
<SUBSECTION>
GskBlendMode
gsk_blend_node_new
gsk_blend_node_get_bottom_child
gsk_blend_node_get_top_child
gsk_blend_node_get_blend_mode
<SUBSECTION>
gsk_cross_fade_node_new
gsk_cross_fade_node_get_start_child
gsk_cross_fade_node_get_end_child
gsk_cross_fade_node_get_progress
<SUBSECTION>
gsk_text_node_new
gsk_text_node_get_font
gsk_text_node_get_glyphs
@@ -188,12 +170,15 @@ gsk_text_node_get_color
gsk_text_node_has_color_glyphs
gsk_text_node_get_num_glyphs
gsk_text_node_get_offset
<SUBSECTION>
gsk_blur_node_new
gsk_blur_node_get_child
gsk_blur_node_get_radius
<SUBSECTION>
gsk_debug_node_new
gsk_debug_node_get_child
gsk_debug_node_get_message
<SUBSECTION>
gsk_gl_shader_node_new
gsk_gl_shader_node_get_n_children
gsk_gl_shader_node_get_child
@@ -211,17 +196,14 @@ GSK_TYPE_CLIP_NODE
GSK_TYPE_COLOR_MATRIX_NODE
GSK_TYPE_COLOR_NODE
GSK_TYPE_CONTAINER_NODE
GSK_TYPE_CONIC_GRADIENT_NODE
GSK_TYPE_CROSS_FADE_NODE
GSK_TYPE_DEBUG_NODE
GSK_TYPE_GL_SHADER_NODE
GSK_TYPE_FILL_NODE
GSK_TYPE_INSET_SHADOW_NODE
GSK_TYPE_LINEAR_GRADIENT_NODE
GSK_TYPE_OPACITY_NODE
GSK_TYPE_OUTSET_SHADOW_NODE
GSK_TYPE_RADIAL_GRADIENT_NODE
GSK_TYPE_REPEATING_LINEAR_GRADIENT_NODE
GSK_TYPE_REPEATING_RADIAL_GRADIENT_NODE
GSK_TYPE_REPEAT_NODE
GSK_TYPE_ROUNDED_CLIP_NODE
GSK_TYPE_SHADOW_NODE
@@ -229,7 +211,6 @@ GSK_TYPE_TEXT_NODE
GSK_TYPE_TEXTURE_NODE
GSK_TYPE_TRANSFORM_NODE
GSK_TYPE_GLSHADER_NODE
GSK_TYPE_RENDER_NODE_TYPE
GskRenderNodeClass
gsk_blend_node_get_type
gsk_blur_node_get_type
@@ -240,25 +221,23 @@ gsk_cairo_renderer_get_type
gsk_clip_node_get_type
gsk_color_matrix_node_get_type
gsk_color_node_get_type
gsk_conic_gradient_node_get_type
gsk_container_node_get_type
gsk_cross_fade_node_get_type
gsk_debug_node_get_type
gsk_gl_shader_node_get_type
gsk_fill_node_get_type
gsk_inset_shadow_node_get_type
gsk_linear_gradient_node_get_type
gsk_opacity_node_get_type
gsk_outset_shadow_node_get_type
gsk_radial_gradient_node_get_type
gsk_render_node_get_type
gsk_repeating_linear_gradient_node_get_type
gsk_repeating_radial_gradient_node_get_type
gsk_repeat_node_get_type
gsk_rounded_clip_node_get_type
gsk_shadow_node_get_type
gsk_text_node_get_type
gsk_texture_node_get_type
gsk_transform_node_get_type
gsk_gl_shader_node_get_type
GSK_TYPE_BLEND_MODE
<SUBSECTION Standard>
gsk_serialization_error_quark
@@ -281,8 +260,66 @@ gsk_rounded_rect_is_rectilinear
gsk_rounded_rect_contains_point
gsk_rounded_rect_contains_rect
gsk_rounded_rect_intersects_rect
<SUBSECTION Standard>
GSK_TYPE_CORNER
</SECTION>
<SECTION>
<FILE>GskPath</FILE>
<SUBSECTION>
GskPath
gsk_path_ref
gsk_path_unref
gsk_path_new_rect
gsk_path_new_from_cairo
<SUBSECTION>
gsk_path_print
gsk_path_to_string
gsk_path_to_cairo
<SUBSECTION>
gsk_path_is_empty
gsk_path_get_bounds
<SUBSECTION Private>
GSK_TYPE_PATH
gsk_path_get_type
</SECTION>
<SECTION>
<FILE>GskPathBuilder</FILE>
GskPathBuilder
gsk_path_builder_new
gsk_path_builder_ref
gsk_path_builder_unref
gsk_path_builder_to_path
gsk_path_builder_free_to_path
<SUBSECTION>
gsk_path_builder_add_rect
<SUBSECTION>
gsk_path_builder_move_to
gsk_path_builder_line_to
gsk_path_builder_curve_to
gsk_path_builder_conic_to
gsk_path_builder_close
<SUBSECTION Private>
GSK_TYPE_PATH_BUILDER
gsk_path_builder_get_type
</SECTION>
<SECTION>
<FILE>GskStroke</FILE>
GskLineCap
GskLineJoin
gsk_stroke_new
gsk_stroke_copy
gsk_stroke_free
gsk_stroke_equal
gsk_stroke_set_line_width
gsk_stroke_get_line_width
gsk_stroke_set_line_cap
gsk_stroke_get_line_cap
gsk_stroke_set_line_join
gsk_stroke_get_line_join
<SUBSECTION Private>
GSK_TYPE_STROKE
gsk_stroke_get_type
</SECTION>
<SECTION>
@@ -332,12 +369,10 @@ gsk_gl_shader_new_from_bytes
gsk_gl_shader_new_from_resource
gsk_gl_shader_compile
gsk_gl_shader_get_source
gsk_gl_shader_get_resource
gsk_gl_shader_get_n_textures
gsk_gl_shader_get_n_uniforms
gsk_gl_shader_get_uniform_name
gsk_gl_shader_find_uniform_by_name
GskGLUniformType
gsk_gl_shader_get_uniform_type
gsk_gl_shader_get_uniform_offset
gsk_gl_shader_get_args_size
@@ -369,10 +404,4 @@ gsk_shader_args_builder_set_bool
gsk_shader_args_builder_set_vec2
gsk_shader_args_builder_set_vec3
gsk_shader_args_builder_set_vec4
<SUBSECTION Private>
GSK_TYPE_GL_SHADER
GSK_TYPE_GL_UNIFORM_TYPE
GSK_TYPE_SHADER_ARGS_BUILDER
gsk_shader_args_builder_get_type
</SECTION>

View File

@@ -1,48 +1,27 @@
private_headers = [
'gsk-autocleanup.h',
'gskcairoblurprivate.h',
'gskcairorendererprivate.h',
'gskdebugprivate.h',
'gskdiffprivate.h',
'gskglshaderprivate.h',
'gskgldriverprivate.h',
'gskglprofilerprivate.h',
'gskglrendererprivate.h',
'gskprivate.h',
'gskprofilerprivate.h',
'gskrendererprivate.h',
'gskrendernodeprivate.h',
'gskrendernodeparserprivate.h',
'gskroundedrectprivate.h',
'gskshaderbuilderprivate.h',
'gsktextureprivate.h',
'gsktransformprivate.h',
# gsk/gl
'glutilsprivate.h',
'gskgldriverprivate.h',
'gskglglyphcacheprivate.h',
'gskgliconcacheprivate.h',
'gskglimageprivate.h',
'gskglnodesampleprivate.h',
'gskglprofilerprivate.h',
'gskglrendererprivate.h',
'gskglrenderopsprivate.h',
'gskglshaderbuilderprivate.h',
'gskglshadowcacheprivate.h',
'gskgltextureatlasprivate.h',
'opbuffer.h',
'stb_rect_pack.h',
# gsk/vulkan
'gskvulkanblendmodepipelineprivate.h',
'gskvulkanblurpipelineprivate.h',
'gskvulkanblendpipelineprivate.h',
'gskvulkanborderpipelineprivate.h',
'gskvulkanboxshadowpipelineprivate.h',
'gskvulkanbufferprivate.h',
'gskvulkanclipprivate.h',
'gskvulkancolorpipelineprivate.h',
'gskvulkancolortextpipelineprivate.h',
'gskvulkancommandpoolprivate.h',
'gskvulkancrossfadepipelineprivate.h',
'gskvulkaneffectpipelineprivate.h',
'gskvulkanglyphcacheprivate.h',
'gskvulkanimageprivate.h',
'gskvulkanlineargradientpipelineprivate.h',
'gskvulkanmemoryprivate.h',
@@ -52,8 +31,6 @@ private_headers = [
'gskvulkanrenderpassprivate.h',
'gskvulkanrenderprivate.h',
'gskvulkanshaderprivate.h',
'gskvulkantextpipelineprivate.h',
'gskvulkantexturepipelineprivate.h',
]
images = [
@@ -63,29 +40,25 @@ if get_option('gtk_doc')
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gsk4',
mode: 'none',
main_xml: 'gsk4-docs.xml',
src_dir: [
gskinc,
],
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=../gdk',
],
html_assets: images,
install: true,
)
mode: 'none',
main_xml: 'gsk4-docs.xml',
src_dir: [
gskinc,
],
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=../gdk',
],
html_assets: images,
install: true)
endif

View File

@@ -283,6 +283,7 @@
<xi:include href="xml/gtkcolorchooserwidget.xml" />
<xi:include href="xml/gtkcolorchooserdialog.xml" />
<xi:include href="xml/gtkfilechooser.xml" />
<xi:include href="xml/gtkfilechooserbutton.xml" />
<xi:include href="xml/gtkfilechoosernative.xml" />
<xi:include href="xml/gtkfilechooserdialog.xml" />
<xi:include href="xml/gtkfilechooserwidget.xml" />

View File

@@ -618,14 +618,6 @@ GtkBuildable
GtkBuildableIface
GtkBuildableParser
gtk_buildable_get_buildable_id
<SUBSECTION Parser>
gtk_buildable_parse_context_get_element
gtk_buildable_parse_context_get_element_stack
gtk_buildable_parse_context_get_position
gtk_buildable_parse_context_pop
gtk_buildable_parse_context_push
<SUBSECTION Standard>
GTK_BUILDABLE
GTK_IS_BUILDABLE
@@ -843,8 +835,6 @@ gtk_combo_box_get_active_id
gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popup
gtk_combo_box_popup_for_device
gtk_combo_box_popdown
gtk_combo_box_get_row_separator_func
gtk_combo_box_set_row_separator_func
@@ -1011,6 +1001,7 @@ gtk_editable_label_get_type
<FILE>gtktext</FILE>
<TITLE>GtkText</TITLE>
GtkText
GtkTextClass
gtk_text_new
gtk_text_new_with_buffer
gtk_text_set_buffer
@@ -1348,6 +1339,31 @@ gtk_file_chooser_widget_get_type
GtkFileChooserWidgetPrivate
</SECTION>
<SECTION>
<FILE>gtkfilechooserbutton</FILE>
<TITLE>GtkFileChooserButton</TITLE>
GtkFileChooserButton
gtk_file_chooser_button_new
gtk_file_chooser_button_new_with_dialog
gtk_file_chooser_button_get_title
gtk_file_chooser_button_set_title
gtk_file_chooser_button_get_width_chars
gtk_file_chooser_button_set_width_chars
gtk_file_chooser_button_get_modal
gtk_file_chooser_button_set_modal
<SUBSECTION Standard>
GTK_FILE_CHOOSER_BUTTON
GTK_IS_FILE_CHOOSER_BUTTON
GTK_TYPE_FILE_CHOOSER_BUTTON
GTK_FILE_CHOOSER_BUTTON_CLASS
GTK_IS_FILE_CHOOSER_BUTTON_CLASS
GTK_FILE_CHOOSER_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_file_chooser_button_get_type
GtkFileChooserButtonPrivate
</SECTION>
<SECTION>
<FILE>gtkfilefilter</FILE>
GtkFileFilter
@@ -2766,6 +2782,7 @@ gtk_sort_list_model_get_type
GtkSpinButton
GtkSpinButtonUpdatePolicy
GtkSpinType
gtk_spin_button_configure
gtk_spin_button_new
gtk_spin_button_new_with_range
gtk_spin_button_set_adjustment
@@ -2789,7 +2806,6 @@ gtk_spin_button_set_snap_to_ticks
gtk_spin_button_get_snap_to_ticks
gtk_spin_button_set_climb_rate
gtk_spin_button_get_climb_rate
gtk_spin_button_configure
gtk_spin_button_spin
gtk_spin_button_update
GTK_INPUT_ERROR
@@ -2838,7 +2854,6 @@ gtk_statusbar_push
gtk_statusbar_pop
gtk_statusbar_remove
gtk_statusbar_remove_all
gtk_statusbar_get_message
<SUBSECTION Standard>
GTK_STATUSBAR
GTK_IS_STATUSBAR
@@ -2973,8 +2988,6 @@ GTK_TEXT_BUFFER_GET_CLASS
gtk_text_buffer_get_type
<SUBSECTION Private>
GtkTextBufferPrivate
gtk_text_byte_begins_utf8_char
gtk_text_unknown_char_utf8_gtk_tests_only
</SECTION>
<SECTION>
@@ -4014,10 +4027,6 @@ gtk_cell_renderer_get_padding
gtk_cell_renderer_set_padding
gtk_cell_renderer_get_state
gtk_cell_renderer_is_activatable
gtk_cell_renderer_get_is_expanded
gtk_cell_renderer_get_is_expander
gtk_cell_renderer_set_is_expanded
gtk_cell_renderer_set_is_expander
<SUBSECTION Width-for-height>
gtk_cell_renderer_get_preferred_height
@@ -4295,6 +4304,8 @@ gtk_snapshot_push_color_matrix
gtk_snapshot_push_repeat
gtk_snapshot_push_clip
gtk_snapshot_push_rounded_clip
gtk_snapshot_push_fill
gtk_snapshot_push_stroke
gtk_snapshot_push_cross_fade
gtk_snapshot_push_blend
gtk_snapshot_push_blur
@@ -4302,7 +4313,6 @@ gtk_snapshot_push_shadow
gtk_snapshot_push_debug
gtk_snapshot_push_gl_shader
gtk_snapshot_pop
gtk_snapshot_gl_shader_pop_texture
gtk_snapshot_save
gtk_snapshot_restore
gtk_snapshot_transform
@@ -4321,13 +4331,9 @@ gtk_snapshot_append_color
gtk_snapshot_append_layout
gtk_snapshot_append_linear_gradient
gtk_snapshot_append_repeating_linear_gradient
gtk_snapshot_append_conic_gradient
gtk_snapshot_append_border
gtk_snapshot_append_inset_shadow
gtk_snapshot_append_outset_shadow
gtk_snapshot_append_radial_gradient
gtk_snapshot_append_repeating_radial_gradient
gtk_snapshot_render_insertion_cursor
gtk_snapshot_render_background
gtk_snapshot_render_frame
gtk_snapshot_render_focus
@@ -4386,9 +4392,6 @@ gtk_widget_class_add_binding_signal
gtk_widget_class_add_binding_action
gtk_widget_class_set_layout_manager_type
gtk_widget_class_get_layout_manager_type
gtk_widget_class_set_activate_signal
gtk_widget_class_set_activate_signal_from_name
gtk_widget_class_get_activate_signal
gtk_widget_activate
gtk_widget_is_focus
gtk_widget_grab_focus
@@ -4462,7 +4465,6 @@ gtk_widget_get_focusable
gtk_widget_set_focusable
gtk_widget_get_focus_on_click
gtk_widget_set_focus_on_click
gtk_widget_get_focus_child
gtk_widget_set_focus_child
gtk_widget_get_can_target
gtk_widget_set_can_target
@@ -4613,7 +4615,6 @@ gtk_window_set_destroy_with_parent
gtk_window_set_display
gtk_window_is_active
gtk_window_is_maximized
gtk_window_is_fullscreen
gtk_window_get_toplevels
gtk_window_list_toplevels
gtk_window_get_focus
@@ -4640,10 +4641,12 @@ gtk_window_get_default_size
gtk_window_get_destroy_with_parent
gtk_window_get_icon_name
gtk_window_get_modal
gtk_window_get_size
gtk_window_get_title
gtk_window_get_transient_for
gtk_window_get_group
gtk_window_has_group
gtk_window_resize
gtk_window_set_default_icon_name
gtk_window_set_icon_name
gtk_window_set_auto_startup_notification
@@ -5126,34 +5129,6 @@ GTK_PRINTER_GET_CLASS
<SUBSECTION Private>
GtkPrinterPrivate
gtk_printer_get_type
GtkPrinterOption
gtk_printer_option_allocate_choices
gtk_printer_option_choices_from_array
gtk_printer_option_clear_has_conflict
gtk_printer_option_get_activates_default
gtk_printer_option_get_type
gtk_printer_option_has_choice
gtk_printer_option_new
gtk_printer_option_set
gtk_printer_option_set_activates_default
gtk_printer_option_set_add
gtk_printer_option_set_boolean
gtk_printer_option_set_clear_conflicts
gtk_printer_option_set_foreach
gtk_printer_option_set_foreach_in_group
gtk_printer_option_set_get_groups
gtk_printer_option_set_get_type
gtk_printer_option_set_has_conflict
gtk_printer_option_set_lookup
gtk_printer_option_set_new
gtk_printer_option_set_remove
GtkPrinterOptionWidget
gtk_printer_option_widget_get_external_label
gtk_printer_option_widget_get_type
gtk_printer_option_widget_get_value
gtk_printer_option_widget_has_external_label
gtk_printer_option_widget_new
gtk_printer_option_widget_set_source
</SECTION>
@@ -5346,7 +5321,6 @@ GtkCustomPaperUnixDialogClass
<SUBSECTION Private>
gtk_paper_size_get_type
gtk_custom_paper_unix_dialog_get_type
gtk_print_load_custom_papers
GtkCustomPaperUnixDialogPrivate
</SECTION>
@@ -5502,20 +5476,6 @@ gtk_test_init
gtk_test_list_all_types
gtk_test_register_all_types
gtk_test_widget_wait_for_draw
<SUBSECTION Accessibility>
gtk_test_accessible_assert_property
gtk_test_accessible_assert_relation
gtk_test_accessible_assert_role
gtk_test_accessible_assert_state
gtk_test_accessible_check_property
gtk_test_accessible_check_relation
gtk_test_accessible_check_state
gtk_test_accessible_has_property
gtk_test_accessible_has_relation
gtk_test_accessible_has_role
gtk_test_accessible_has_state
<SECTION Private>
gtk_test_accessible_assertion_message_role
</SECTION>
<SECTION>
@@ -6179,7 +6139,6 @@ GtkPopover
gtk_popover_new
gtk_popover_popup
gtk_popover_popdown
gtk_popover_present
gtk_popover_set_child
gtk_popover_get_child
gtk_popover_set_pointing_to
@@ -6195,8 +6154,6 @@ gtk_popover_get_offset
gtk_popover_set_default_widget
gtk_popover_set_cascade_popdown
gtk_popover_get_cascade_popdown
gtk_popover_get_mnemonics_visible
gtk_popover_set_mnemonics_visible
<SUBSECTION Standard>
GTK_TYPE_POPOVER
GTK_IS_POPOVER
@@ -7039,9 +6996,8 @@ GtkNative
gtk_native_get_for_surface
gtk_native_get_surface
gtk_native_get_renderer
gtk_native_check_resize
gtk_native_get_surface_transform
gtk_native_realize
gtk_native_unrealize
<SUBSECTION Private>
gtk_native_get_type
@@ -7582,9 +7538,6 @@ gtk_accessible_reset_property
gtk_accessible_update_relation
gtk_accessible_update_relation_value
gtk_accessible_reset_relation
gtk_accessible_property_init_value
gtk_accessible_relation_init_value
gtk_accessible_state_init_value
<SUBSECTION Standard>
GTK_TYPE_ACCESSIBLE

View File

@@ -87,6 +87,7 @@ gtk_event_controller_motion_get_type
gtk_event_controller_scroll_get_type
gtk_every_filter_get_type
gtk_expander_get_type
gtk_file_chooser_button_get_type
gtk_file_chooser_dialog_get_type
gtk_file_chooser_get_type
gtk_file_chooser_native_get_type

View File

@@ -1,6 +1,9 @@
fs = import('fs')
private_headers = [
'imm-extra.h',
'gtkbitmaskprivateimpl.h',
'gdkpixbufutilsprivate.h',
'gtkaccelgroupprivate.h',
'gtkaccelmapprivate.h',
'gtkaccessibleattributesetprivate.h',
@@ -18,21 +21,14 @@ private_headers = [
'gtkapplicationprivate.h',
'gtkatcontextprivate.h',
'gtkbindingsprivate.h',
'gtkbitmaskprivateimpl.h',
'gtkbitmaskprivate.h',
'gtkbuildableprivate.h',
'gtkbuilderprivate.h',
'gtkbuilderscopeprivate.h',
'gtkbuiltiniconprivate.h',
'gtkbuttonprivate.h',
'gtkcellareaboxcontextprivate.h',
'gtkcheckbuttonprivate.h',
'gtkcolorchooserprivate.h',
'gtkcoloreditorprivate.h',
'gtkcolorpickerkwinprivate.h',
'gtkcolorpickerportalprivate.h',
'gtkcolorpickerprivate.h',
'gtkcolorpickershellprivate.h',
'gtkcolorplaneprivate.h',
'gtkcolorscaleprivate.h',
'gtkcolorswatchprivate.h',
@@ -44,7 +40,6 @@ private_headers = [
'gtkcolumnviewsorterprivate.h',
'gtkcolumnviewtitleprivate.h',
'gtkcomboboxprivate.h',
'gtkcomposetable.h',
'gtkconstraintexpressionprivate.h',
'gtkconstraintguideprivate.h',
'gtkconstraintlayoutprivate.h',
@@ -52,7 +47,6 @@ private_headers = [
'gtkconstraintsolverprivate.h',
'gtkconstrainttypesprivate.h',
'gtkconstraintvflparserprivate.h',
'gtkcountingbloomfilterprivate.h',
'gtkcssanimatedstyleprivate.h',
'gtkcssanimationprivate.h',
'gtkcssarrayvalueprivate.h',
@@ -63,7 +57,6 @@ private_headers = [
'gtkcsscalcvalueprivate.h',
'gtkcsscolorvalueprivate.h',
'gtkcsscornervalueprivate.h',
'gtkcssdataurlprivate.h',
'gtkcssdimensionvalueprivate.h',
'gtkcssdynamicprivate.h',
'gtkcsseasevalueprivate.h',
@@ -72,7 +65,6 @@ private_headers = [
'gtkcssfontfeaturesvalueprivate.h',
'gtkcssfontvariationsvalueprivate.h',
'gtkcssiconthemevalueprivate.h',
'gtkcssimageconicprivate.h',
'gtkcssimagecrossfadeprivate.h',
'gtkcssimagefallbackprivate.h',
'gtkcssimageiconthemeprivate.h',
@@ -89,7 +81,6 @@ private_headers = [
'gtkcssinheritvalueprivate.h',
'gtkcssinitialvalueprivate.h',
'gtkcsskeyframesprivate.h',
'gtkcsslocationprivate.h',
'gtkcsslookupprivate.h',
'gtkcssmatcherprivate.h',
'gtkcssnodedeclarationprivate.h',
@@ -105,7 +96,6 @@ private_headers = [
'gtkcssrgbavalueprivate.h',
'gtkcsssectionprivate.h',
'gtkcssselectorprivate.h',
'gtkcssserializerprivate.h',
'gtkcssshadowsvalueprivate.h',
'gtkcssshadowvalueprivate.h',
'gtkcssshorthandpropertyprivate.h',
@@ -114,7 +104,6 @@ private_headers = [
'gtkcssstylechangeprivate.h',
'gtkcssstyleprivate.h',
'gtkcssstylepropertyprivate.h',
'gtkcsstokenizerprivate.h',
'gtkcsstransformvalueprivate.h',
'gtkcsstransientnodeprivate.h',
'gtkcsstransitionprivate.h',
@@ -124,9 +113,6 @@ private_headers = [
'gtkcsswidgetnodeprivate.h',
'gtkcsswin32sizevalueprivate.h',
'gtkdialogprivate.h',
'gtkdragdestprivate.h',
'gtkdropprivate.h',
'gtkemojicompletion.h',
'gtkentryprivate.h',
'gtkeventcontrollerlegacyprivate.h',
'gtkeventcontrollerprivate.h',
@@ -135,7 +121,6 @@ private_headers = [
'gtkfilechooserprivate.h',
'gtkfilechooserwidgetprivate.h',
'gtkfilefilterprivate.h',
'gtkflowboxprivate.h',
'gtkfontchooserprivate.h',
'gtkfontchooserwidgetprivate.h',
'gtkgesturedragprivate.h',
@@ -159,25 +144,15 @@ private_headers = [
'gtkiconviewprivate.h',
'gtkimagedefinitionprivate.h',
'gtkimageprivate.h',
'gtkimcontextbroadway.h',
'gtkimcontextime.h',
'gtkimcontextquartz.h',
'gtkimcontextsimpleprivate.h',
'gtkimcontextsimpleseqs.h',
'gtkimcontextwayland.h',
'gtkimmoduleprivate.h',
'gtkimmodule.h',
'gtkintl.h',
'gtkistringprivate.h',
'gtkkineticscrollingprivate.h',
'gtklabelprivate.h',
'gtklayoutmanagerprivate.h',
'gtklistbaseprivate.h',
'gtklistitemprivate.h',
'gtklistitemfactoryprivate.h',
'gtklistitemmanagerprivate.h',
'gtklistitemwidgetprivate.h',
'gtklistlistmodelprivate.h',
'gtklockbuttonprivate.h',
'gtkmagnifierprivate.h',
'gtkmediafileprivate.h',
@@ -185,33 +160,20 @@ private_headers = [
'gtkmenusectionboxprivate.h',
'gtkmenutrackeritemprivate.h',
'gtkmenutrackerprivate.h',
'gtkmodelbuttonprivate.h',
'gtkmodulesprivate.h',
'gtkmountoperationprivate.h',
'gtknativedialogprivate.h',
'gtknativeprivate.h',
'gtknomediafileprivate.h',
'gtkpango.h',
'gtkpasswordentrybufferprivate.h',
'gtkpasswordentryprivate.h',
'gtkpathbar.h',
'gdkpixbufutilsprivate.h',
'gtkplacessidebarprivate.h',
'gtkplacesviewprivate.h',
'gtkplacesviewrowprivate.h',
'gtkpointerfocusprivate.h',
'gtkpopcountprivate.h',
'gtkpopovermenubarprivate.h',
'gtkpopovermenuprivate.h',
'gtkpopoverprivate.h',
'gtkprintbackendprivate.h',
'gtkprinterprivate.h',
'gtkprintoperation-portal.h',
'gtkprintoperation-private.h',
'gtkprintutils.h',
'gtkprivate.h',
'gtkprogresstrackerprivate.h',
'gtkpropertylookuplistmodelprivate.h',
'gtkquery.h',
'gtkrangeprivate.h',
'gtkrbtreeprivate.h',
@@ -219,35 +181,22 @@ private_headers = [
'gtkrenderborderprivate.h',
'gtkrendericonprivate.h',
'gtkrendernodepaintableprivate.h',
'gtkrootprivate.h',
'gtkroundedboxprivate.h',
'gtkscalerprivate.h',
'gtksearchengine.h',
'gtksearchenginemodel.h',
'gtksearchenginequartz.h',
'gtksearchenginetracker3.h',
'gtksearchentryprivate.h',
'gtksecurememoryprivate.h',
'gtksettingsprivate.h',
'gtkshortcutactionprivate.h',
'gtkshortcutcontrollerprivate.h',
'gtkshortcutmanagerprivate.h',
'gtkshortcutsshortcutprivate.h',
'gtkshortcutswindowprivate.h',
'gtksidebarrowprivate.h',
'gtksizegroup-private.h',
'gtksizerequestcacheprivate.h',
'gtksnapshotprivate.h',
'gtksorterprivate.h',
'gtksortkeysprivate.h',
'gtkspinbuttonprivate.h',
'gtkstyleanimationprivate.h',
'gtkstylecascadeprivate.h',
'gtkstylecontextprivate.h',
'gtkstylepropertyprivate.h',
'gtkstyleproviderprivate.h',
'gtktestatcontextprivate.h',
'gtktextattributes.h',
'gtktextbufferprivate.h',
'gtktextchildprivate.h',
'gtktextdisplayprivate.h',
@@ -257,17 +206,12 @@ private_headers = [
'gtktextlayoutprivate.h',
'gtktextlinedisplaycacheprivate.h',
'gtktextmarkprivate.h',
'gtktextprivate.h',
'gtktextsegment.h',
'gtktexttagprivate.h',
'gtktextutil.h',
'gtktextviewchildprivate.h',
'gtktextviewprivate.h',
'gtktogglebuttonprivate.h',
'gtktoolbarprivate.h',
'gtktooltipprivate.h',
'gtktooltipwindowprivate.h',
'gtktreedatalist.h',
'gtktreepopoverprivate.h',
'gtktreeprivate.h',
'gtktreerbtreeprivate.h',
@@ -278,21 +222,8 @@ private_headers = [
'gtkwin32drawprivate.h',
'gtkwin32themeprivate.h',
'gtkwindowprivate.h',
'gsettings-mapping.h',
'gskpango.h',
'gtkdbusgenerated.h',
'imm-extra.h',
'language-names.h',
'open-type-layout.h',
'script-names.h',
'text-input-unstable-v3-client-protocol.h',
'a11y',
'inspector',
'roaring',
'timsort',
'tools',
'gtk-text-input-client-protocol.h',
'roaring.h',
]
images = [
@@ -517,46 +448,43 @@ if get_option('gtk_doc')
expand_md_targets = []
foreach t : expand_content_md_files
expand_md_targets += custom_target(t,
input: [ t ],
output: [ fs.replace_suffix(t, '.xml') ],
command: [ expand_md, '@INPUT@', '@OUTPUT@'],
)
input: [ t ],
output: [ fs.replace_suffix(t, '.xml') ],
command: [ expand_md, '@INPUT@', '@OUTPUT@'])
endforeach
gnome.gtkdoc('gtk4',
mode: 'none',
main_xml: 'gtk4-docs.xml',
src_dir: [
gtkinc,
],
dependencies: libgtk_dep,
gobject_typesfile: configure_file(
input: 'gtk4.types.in',
output: 'gtk4.types',
configuration: types_conf,
),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--default-includes=gtk/gtk.h',
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=@0@'.format(gdkpixbuf_docpath),
'--extra-dir=../gdk',
'--extra-dir=../gsk',
],
content_files: content_files + expand_md_targets,
html_assets: images,
install: true,
)
mode: 'none',
main_xml: 'gtk4-docs.xml',
src_dir: [
gtkinc,
],
dependencies: libgtk_dep,
gobject_typesfile: configure_file(
input: 'gtk4.types.in',
output: 'gtk4.types',
configuration: types_conf,
),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--default-includes=gtk/gtk.h',
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=@0@'.format(gdkpixbuf_docpath),
'--extra-dir=../gdk',
'--extra-dir=../gsk',
],
content_files: content_files + expand_md_targets,
html_assets: images,
install: true)
endif
xsltproc = find_program('xsltproc', required: false)
@@ -591,17 +519,16 @@ if get_option('man-pages') and xsltproc.found()
man_name = man.get(0)
man_section = man.get(1, '1')
custom_target('@0@.@1@'.format(man_name, man_section),
input: '@0@.xml'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
)
input: '@0@.xml'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)))
endforeach
endif

View File

@@ -165,7 +165,7 @@ for this change.
| ::key-release-event | #GtkEventControllerKey |
| ::enter-notify-event | #GtkEventControllerMotion |
| ::leave-notify-event | #GtkEventControllerMotion |
| ::configure-event | replaced by #GdkSurface::layout |
| ::configure-event | replaced by #GdkSurface::size-changed |
| ::focus-in-event | #GtkEventControllerFocus |
| ::focus-out-event | #GtkEventControllerFocus |
| ::map-event | replaced by #GdkSurface:mapped |
@@ -510,14 +510,9 @@ gtk_window_set_gravity(), gtk_window_move(), gtk_window_parse_geometry(),
gtk_window_set_keep_above(), gtk_window_set_keep_below(),
gtk_window_begin_resize_drag(), gtk_window_begin_move_drag().
Most likely, you should just stop using them. In some cases, you can
fall back to using the underlying #GdkToplevel APIs (for example,
fall back to using the underlying #GdkToplevel APIS (for example,
gdk_toplevel_begin_resize()).
The APIs for controlling GtkWindow size have changed to be better aligned
with the way size changes are integrated in the frame cycle. gtk_window_resize()
and gtk_window_get_size() have been removed. Instead, use
gtk_window_set_default_size() and gtk_window_get_default_size().
### Adapt to GtkHeaderBar and GtkActionBar API changes
The gtk_header_bar_set_show_close_button() function has been renamed to
@@ -1149,14 +1144,6 @@ pointer coordinates as inout arguments any more, but as normal in ones.
See: gtk_tree_view_get_tooltip_context(), gtk_icon_view_get_tooltip_context()
### Stop using GtkFileChooserButton
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
the user interaction. You can replace it with a simple #GtkButton that
shows a #GtkFileChooserNative dialog when clicked; once the file selection
has completed, you can update the label of the #GtkButton with the selected
file.
## Changes to consider after the switch
GTK 4 has a number of new features that you may want to take

View File

@@ -12,6 +12,13 @@ gtk_widget_set_size_request():
we use 1x1 for implementation convenience)
- causes notifies on width_request, height_request properties
gtk_window_resize():
- causes a configure request in all cases if the window is mapped,
unless the new size is the same as the old size
- overrides the default size on map if the window is unmapped
- allows size of 0, equivalent to 1
- clamped to geometry hints
gtk_window_set_default_size():
- has no effect after the window has been mapped the first time,
unless the window has been unrealized in which case it should
@@ -19,6 +26,7 @@ gtk_window_set_default_size():
- allows size of 0, equivalent to 1
- allows size of -1 to unset the default size
- clamped to geometry hints
- gtk_window_resize() overrides it
- causes notifies on default_width, default_height properties
gtk_window_get_default_size():

View File

@@ -615,6 +615,51 @@ create_font_button (void)
return new_widget_info ("font-button", vbox, SMALL);
}
static WidgetInfo *
create_file_button (void)
{
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *picker;
char *path;
GFile *file;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
picker = gtk_file_chooser_button_new ("File Chooser Button",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_widget_set_size_request (picker, 150, -1);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_append (GTK_BOX (vbox2), picker);
gtk_box_append (GTK_BOX (vbox2),
gtk_label_new ("File Button (Files)"));
gtk_box_append (GTK_BOX (vbox),
vbox2);
gtk_box_append (GTK_BOX (vbox),
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
picker = gtk_file_chooser_button_new ("File Chooser Button",
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_widget_set_size_request (picker, 150, -1);
path = g_build_filename (g_get_home_dir (), "Documents", NULL);
file = g_file_new_for_path (path);
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (picker), file, NULL);
g_free (path);
g_object_unref (file);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_append (GTK_BOX (vbox2), picker);
gtk_box_append (GTK_BOX (vbox2), gtk_label_new ("File Button (Select Folder)"));
gtk_box_append (GTK_BOX (vbox), vbox2);
add_margin (vbox);
return new_widget_info ("file-button", vbox, MEDIUM);
}
static WidgetInfo *
create_editable_label (void)
{
@@ -2099,6 +2144,7 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_combo_box_entry ());
retval = g_list_prepend (retval, create_combo_box_text ());
retval = g_list_prepend (retval, create_entry ());
retval = g_list_prepend (retval, create_file_button ());
retval = g_list_prepend (retval, create_font_button ());
retval = g_list_prepend (retval, create_frame ());
retval = g_list_prepend (retval, create_icon_view ());

View File

@@ -1022,7 +1022,7 @@ parse_line (const char *line, const char *key)
{
const char *p;
if (g_ascii_strncasecmp (line, key, strlen (key)) != 0)
if (!g_str_has_prefix (line, key))
return NULL;
p = line + strlen (key);
if (*p != ':')

View File

@@ -280,7 +280,12 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface)
{
gdk_surface_request_layout (surface);
event = gdk_configure_event_new (surface,
message->configure_notify.width,
message->configure_notify.height);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
if (surface->resize_count >= 1)
{

View File

@@ -558,7 +558,6 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
int height,
GdkPopupLayout *layout)
{
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle final_rect;
@@ -571,10 +570,6 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
gdk_surface_layout_popup_helper (surface,
width,
height,
impl->shadow_left,
impl->shadow_right,
impl->shadow_top,
impl->shadow_bottom,
monitor,
&bounds,
layout,
@@ -601,7 +596,7 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
static void
show_popup (GdkSurface *surface)
{
gdk_surface_set_is_mapped (surface, TRUE);
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_broadway_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -1521,7 +1516,7 @@ show_surface (GdkSurface *surface)
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (!was_mapped)
gdk_surface_set_is_mapped (surface, TRUE);
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_broadway_surface_show (surface, FALSE);
@@ -1529,12 +1524,11 @@ show_surface (GdkSurface *surface)
gdk_surface_invalidate_rect (surface, NULL);
}
static void
static gboolean
gdk_broadway_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GdkToplevelSize size;
@@ -1542,7 +1536,6 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
int width, height;
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean maximize;
gdk_broadway_surface_unminimize (surface);
@@ -1584,23 +1577,14 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
gdk_broadway_surface_toplevel_resize (surface, width, height);
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
if (maximize)
gdk_broadway_surface_maximize (surface);
else
gdk_broadway_surface_unmaximize (surface);
}
if (size.shadow.is_valid)
{
impl->shadow_left = size.shadow.left;
impl->shadow_right = size.shadow.right;
impl->shadow_top = size.shadow.top;
impl->shadow_bottom = size.shadow.bottom;
}
if (gdk_toplevel_layout_get_maximized (layout))
gdk_broadway_surface_maximize (surface);
else
gdk_broadway_surface_unmaximize (surface);
show_surface (surface);
return TRUE;
}
static gboolean

View File

@@ -64,11 +64,6 @@ struct _GdkBroadwaySurface
int root_x;
int root_y;
int shadow_left;
int shadow_right;
int shadow_top;
int shadow_bottom;
};
struct _GdkBroadwaySurfaceClass

View File

@@ -59,25 +59,17 @@ libgdk_broadway = static_library('gdk-broadway',
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
] + common_cflags,
dependencies: [gdk_deps, gdk_broadway_deps],
)
link_args: common_ldflags,
dependencies: [gdk_deps, gdk_broadway_deps])
# gtk4-broadwayd
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
sources: [
clienthtml_h,
broadwayjs_h,
gdkconfig,
gdkenum_h,
'broadwayd.c',
'broadway-server.c',
'broadway-output.c',
],
clienthtml_h, broadwayjs_h, gdkconfig, gdkenum_h,
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
include_directories: [confinc, gdkinc, include_directories('.')],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', ],
dependencies: [ broadwayd_syslib, gdk_deps ],
install: true,
)
dependencies : [broadwayd_syslib, gdk_deps],
install : true)

View File

@@ -15,6 +15,9 @@ gboolean gdk_device_grab_info (GdkDisplay *display,
void gdk_pre_parse (void);
void gdk_surface_freeze_toplevel_updates (GdkSurface *surface);
void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
void gdk_display_set_double_click_time (GdkDisplay *display,

View File

@@ -49,12 +49,6 @@ struct _GdkContentProvider
GObject parent;
};
/**
* GdkContentProviderClass:
* @content_changed: Signal class closure for #GdkContentProvider::content-changed
*
* Class structure for #GdkContentProvider.
*/
struct _GdkContentProviderClass
{
GObjectClass parent_class;
@@ -62,7 +56,6 @@ struct _GdkContentProviderClass
/* signals */
void (* content_changed) (GdkContentProvider *provider);
/*< private >*/
/* vfuncs */
void (* attach_clipboard) (GdkContentProvider *provider,
GdkClipboard *clipboard);

View File

@@ -54,11 +54,12 @@ typedef enum
GDK_PROPERTY_CHANGE_MASK = 1 << 16,
GDK_PROXIMITY_IN_MASK = 1 << 18,
GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SCROLL_MASK = 1 << 20,
GDK_TOUCH_MASK = 1 << 21,
GDK_SMOOTH_SCROLL_MASK = 1 << 22,
GDK_TOUCHPAD_GESTURE_MASK = 1 << 23,
GDK_TABLET_PAD_MASK = 1 << 24,
GDK_SUBSTRUCTURE_MASK = 1 << 20,
GDK_SCROLL_MASK = 1 << 21,
GDK_TOUCH_MASK = 1 << 22,
GDK_SMOOTH_SCROLL_MASK = 1 << 23,
GDK_TOUCHPAD_GESTURE_MASK = 1 << 24,
GDK_TABLET_PAD_MASK = 1 << 25,
GDK_ALL_EVENTS_MASK = 0x3FFFFFE
} GdkEventMask;

View File

@@ -32,11 +32,6 @@ G_BEGIN_DECLS
#define GDK_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_TOOL, GdkDeviceTool))
#define GDK_IS_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_TOOL))
/**
* GdkDeviceTool:
*
* A physical tool associated to a #GdkDevice.
*/
typedef struct _GdkDeviceTool GdkDeviceTool;
/**

View File

@@ -30,12 +30,6 @@
* during a DND operation.
*/
/**
* GdkDragSurfaceInterface:
*
* The #GdkDragSurfaceInterface implementation is private to GDK.
*/
G_DEFINE_INTERFACE (GdkDragSurface, gdk_drag_surface, GDK_TYPE_SURFACE)
static gboolean

View File

@@ -430,6 +430,7 @@ static void
gdk_event_init_types_once (void)
{
g_type_ensure (GDK_TYPE_BUTTON_EVENT);
g_type_ensure (GDK_TYPE_CONFIGURE_EVENT);
g_type_ensure (GDK_TYPE_CROSSING_EVENT);
g_type_ensure (GDK_TYPE_DELETE_EVENT);
g_type_ensure (GDK_TYPE_DND_EVENT);
@@ -1314,12 +1315,6 @@ gdk_event_get_position (GdkEvent *event,
/* {{{ GdkButtonEvent */
/**
* GdkButtonEvent:
*
* An event related to a button on a pointer device/
*/
static void
gdk_button_event_finalize (GdkEvent *event)
{
@@ -1444,12 +1439,6 @@ gdk_button_event_get_button (GdkEvent *event)
/* {{{ GdkKeyEvent */
/**
* GdkKeyEvent:
*
* An event related to a key-based device.
*/
static GdkModifierType
gdk_key_event_get_state (GdkEvent *event)
{
@@ -1829,13 +1818,77 @@ gdk_key_event_get_match (GdkEvent *event,
/* }}} */
/* {{{ GdkTouchEvent */
/* {{{ GdkConfigureEvent */
static gboolean
gdk_configure_event_get_position (GdkEvent *event,
double *x,
double *y)
{
GdkConfigureEvent *self = (GdkConfigureEvent *) event;
*x = self->x;
*y = self->y;
return TRUE;
}
static const GdkEventTypeInfo gdk_configure_event_info = {
sizeof (GdkConfigureEvent),
NULL,
NULL,
NULL,
gdk_configure_event_get_position,
NULL,
NULL,
NULL,
};
GDK_DEFINE_EVENT_TYPE (GdkConfigureEvent, gdk_configure_event,
&gdk_configure_event_info,
GDK_EVENT_TYPE_SLOT (GDK_CONFIGURE))
GdkEvent *
gdk_configure_event_new (GdkSurface *surface,
int width,
int height)
{
GdkConfigureEvent *self;
g_return_val_if_fail (width >= 0 && height >= 0, NULL);
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, GDK_CURRENT_TIME);
self->width = width;
self->height = height;
return (GdkEvent *) self;
}
/**
* GdkTouchEvent:
* gdk_configure_event_get_size:
* @event: (type GdkConfigureEvent): a configure event
* @width: (out): return location for surface width
* @height: (out): return location for surface height
*
* An event related to a touch-based device.
* Extracts the surface size from a configure event.
*/
void
gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height)
{
GdkConfigureEvent *self = (GdkConfigureEvent *) event;
g_return_if_fail (GDK_IS_EVENT (event));
g_return_if_fail (GDK_IS_EVENT_TYPE (event, GDK_CONFIGURE));
*width = self->width;
*height = self->height;
}
/* }}} */
/* {{{ GdkTouchEvent */
static void
gdk_touch_event_finalize (GdkEvent *event)
@@ -1968,12 +2021,6 @@ gdk_touch_event_get_emulating_pointer (GdkEvent *event)
/* {{{ GdkCrossingEvent */
/**
* GdkCrossingEvent:
*
* An event caused by a pointing device moving between surfaces.
*/
static void
gdk_crossing_event_finalize (GdkEvent *event)
{
@@ -2112,12 +2159,6 @@ gdk_crossing_event_get_detail (GdkEvent *event)
/* {{{ GdkDeleteEvent */
/**
* GdkDeleteEvent:
*
* An event related to closing a top-level surface.
*/
static const GdkEventTypeInfo gdk_delete_event_info = {
sizeof (GdkDeleteEvent),
NULL,
@@ -2143,12 +2184,6 @@ gdk_delete_event_new (GdkSurface *surface)
/* {{{ GdkFocusEvent */
/**
* GdkFocusEvent:
*
* An event related to a focus change.
*/
static const GdkEventTypeInfo gdk_focus_event_info = {
sizeof (GdkFocusEvent),
NULL,
@@ -2200,12 +2235,6 @@ gdk_focus_event_get_in (GdkEvent *event)
/* {{{ GdkScrollEvent */
/**
* GdkScrollEvent:
*
* An event related to a scrolling motion.
*/
static void
gdk_scroll_event_finalize (GdkEvent *event)
{
@@ -2363,12 +2392,6 @@ gdk_scroll_event_is_stop (GdkEvent *event)
/* {{{ GdkTouchpadEvent */
/**
* GdkTouchpadEvent:
*
* An event related to a touchpad device.
*/
static GdkModifierType
gdk_touchpad_event_get_state (GdkEvent *event)
{
@@ -2565,12 +2588,6 @@ gdk_touchpad_event_get_pinch_scale (GdkEvent *event)
/* {{{ GdkPadEvent */
/**
* GdkPadEvent:
*
* An event related to a pad-based device.
*/
static const GdkEventTypeInfo gdk_pad_event_info = {
sizeof (GdkPadEvent),
NULL,
@@ -2739,12 +2756,6 @@ gdk_pad_event_get_group_mode (GdkEvent *event,
/* {{{ GdkMotionEvent */
/**
* GdkMotionEvent:
*
* An event related to a pointer or touch device motion.
*/
static void
gdk_motion_event_finalize (GdkEvent *event)
{
@@ -2899,12 +2910,6 @@ gdk_event_get_history (GdkEvent *event,
/* {{{ GdkProximityEvent */
/**
* GdkProximityEvent:
*
* An event related to the proximity of a tool to a device.
*/
static void
gdk_proximity_event_finalize (GdkEvent *event)
{
@@ -2962,12 +2967,6 @@ gdk_proximity_event_new (GdkEventType type,
/* {{{ GdkDNDEvent */
/**
* GdkDNDEvent:
*
* An event related to drag and drop operations.
*/
static void
gdk_dnd_event_finalize (GdkEvent *event)
{
@@ -3068,12 +3067,6 @@ gdk_dnd_event_get_drop (GdkEvent *event)
/* {{{ GdkGrabBrokenEvent */
/**
* GdkGrabBrokenEvent:
*
* An event related to a broken windowing system grab.
*/
static const GdkEventTypeInfo gdk_grab_broken_event_info = {
sizeof (GdkGrabBrokenEvent),
NULL,

View File

@@ -106,6 +106,7 @@ typedef struct _GdkEventSequence GdkEventSequence;
typedef struct _GdkEvent GdkEvent;
#define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
#define GDK_TYPE_CONFIGURE_EVENT (gdk_configure_event_get_type())
#define GDK_TYPE_CROSSING_EVENT (gdk_crossing_event_get_type())
#define GDK_TYPE_DELETE_EVENT (gdk_delete_event_get_type())
#define GDK_TYPE_DND_EVENT (gdk_dnd_event_get_type())
@@ -120,6 +121,7 @@ typedef struct _GdkEvent GdkEvent;
#define GDK_TYPE_TOUCHPAD_EVENT (gdk_touchpad_event_get_type())
typedef struct _GdkButtonEvent GdkButtonEvent;
typedef struct _GdkConfigureEvent GdkConfigureEvent;
typedef struct _GdkCrossingEvent GdkCrossingEvent;
typedef struct _GdkDeleteEvent GdkDeleteEvent;
typedef struct _GdkDNDEvent GdkDNDEvent;
@@ -146,6 +148,7 @@ typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
* @GDK_ENTER_NOTIFY: the pointer has entered the surface.
* @GDK_LEAVE_NOTIFY: the pointer has left the surface.
* @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface.
* @GDK_CONFIGURE: the size of the surface has changed.
* @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
* surface (e.g. a touchscreen or graphics tablet).
* @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
@@ -185,6 +188,7 @@ typedef enum
GDK_ENTER_NOTIFY,
GDK_LEAVE_NOTIFY,
GDK_FOCUS_CHANGE,
GDK_CONFIGURE,
GDK_PROXIMITY_IN,
GDK_PROXIMITY_OUT,
GDK_DRAG_ENTER,
@@ -425,6 +429,12 @@ GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_crossing_event_get_focus (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_configure_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height);
GDK_AVAILABLE_IN_ALL
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase

View File

@@ -322,6 +322,25 @@ struct _GdkFocusEvent
gboolean focus_in;
};
/*
* GdkConfigureEvent:
* @x: the new x coordinate of the surface, relative to its parent.
* @y: the new y coordinate of the surface, relative to its parent.
* @width: the new width of the surface.
* @height: the new height of the surface.
*
* Generated when a surface size or position has changed.
*/
struct _GdkConfigureEvent
{
GdkEvent parent_instance;
int x;
int y;
int width;
int height;
};
/*
* GdkProximityEvent:
* @tool: the #GdkDeviceTool associated to the event
@@ -476,6 +495,10 @@ GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
gboolean focus_in);
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
int width,
int height);
GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,

View File

@@ -50,7 +50,7 @@ typedef struct _GdkFrameClockClass GdkFrameClockClass;
* @GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS: corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT: corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_UPDATE: corresponds to GdkFrameClock::update.
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout. Should not be handled by applicatiosn.
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout.
* @GDK_FRAME_CLOCK_PHASE_PAINT: corresponds to GdkFrameClock::paint.
* @GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS: corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_AFTER_PAINT: corresponds to GdkFrameClock::after-paint. Should not be handled by applications.

View File

@@ -33,11 +33,6 @@ G_BEGIN_DECLS
#define GDK_GL_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_TEXTURE, GdkGLTexture))
#define GDK_IS_GL_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_TEXTURE))
/**
* GdkGLTexture:
*
* A #GdkTexture representing a GL texture object.
*/
typedef struct _GdkGLTexture GdkGLTexture;
typedef struct _GdkGLTextureClass GdkGLTextureClass;

View File

@@ -94,11 +94,6 @@ typedef enum {
#define GDK_MEMORY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_MEMORY_TEXTURE, GdkMemoryTexture))
#define GDK_IS_MEMORY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_MEMORY_TEXTURE))
/**
* GdkMemoryTexture:
*
* A #GdkTexture representing image data in memory.
*/
typedef struct _GdkMemoryTexture GdkMemoryTexture;
typedef struct _GdkMemoryTextureClass GdkMemoryTextureClass;

View File

@@ -31,11 +31,6 @@ G_BEGIN_DECLS
#define GDK_TYPE_PAINTABLE (gdk_paintable_get_type ())
/**
* GdkPaintable:
*
* Interface for paintable objects.
*/
GDK_AVAILABLE_IN_ALL
G_DECLARE_INTERFACE (GdkPaintable, gdk_paintable, GDK, PAINTABLE, GObject)
@@ -79,13 +74,11 @@ typedef enum {
* this function should return the aspect ratio computed from those.
*
* The list of functions that can be implemented for the #GdkPaintable interface.
*
* Note that apart from the #GdkPaintableInterface.snapshot() function, no virtual
* function of this interface is mandatory to implement, though it is a good idea
* to implement #GdkPaintableInterface.get_current_image() for non-static paintables
* and #GdkPaintableInterface.get_flags() if the image is not dynamic as the default
* implementation returns no flags and that will make the implementation likely
* quite slow.
* Note that apart from the first function, no function is mandatory to implement,
* though it is a good idea to implement #GdkPaintableInterface.get_current_image()
* for non-static paintables and #GdkPaintableInterface.get_flags() if the image
* is not dynamic as the default implementation returns no flags and that will
* make the implementation likely quite slow.
*/
struct _GdkPaintableInterface
{

View File

@@ -202,7 +202,6 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
if (cairo_surface_status (surface) || dest == NULL)
{
cairo_surface_destroy (surface);
g_clear_object (&dest);
return NULL;
}

View File

@@ -38,6 +38,15 @@
G_DEFINE_INTERFACE (GdkPopup, gdk_popup, GDK_TYPE_SURFACE)
enum
{
POPUP_LAYOUT_CHANGED,
N_SIGNALS
};
static guint signals[N_SIGNALS] = { 0 };
static gboolean
gdk_popup_default_present (GdkPopup *popup,
int width,
@@ -92,6 +101,25 @@ gdk_popup_default_init (GdkPopupInterface *iface)
P_("Whether to hide on outside clicks"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GdkPopup::popup-layout-changed
* @popup: the #GdkSurface that was laid out
*
* Emitted when the layout of a popup surface has changed, e.g. if the popup
* layout was reactive and after the parent moved causing the popover to end
* up partially off-screen.
*/
signals[POPUP_LAYOUT_CHANGED] =
g_signal_new (g_intern_static_string ("popup-layout-changed"),
GDK_TYPE_POPUP,
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
0);
}
/**
@@ -105,16 +133,13 @@ gdk_popup_default_init (GdkPopupInterface *iface)
* If the popup was previously now showing, it will be showed,
* otherwise it will change position according to @layout.
*
* After calling this function, the result should be handled in response
* to the #GdkSurface::layout signal being emitted. The resulting popup
* position can be queried using gdk_popup_get_position_x(),
* gdk_popup_get_position_y(), and the resulting size will be sent as
* parameters in the layout signal. Use gdk_popup_get_rect_anchor() and
* gdk_popup_get_surface_anchor() to get the resulting anchors.
* After calling this function, the result of the layout can be queried
* using gdk_popup_get_position_x(), gdk_popup_get_position_y(),
* gdk_surface_get_width(), gdk_surface_get_height(),
* gdk_popup_get_rect_anchor() and gdk_popup_get_surface_anchor().
*
* Presenting may fail, for example if the @popup is set to autohide
* and is immediately hidden upon being presented. If presenting failed,
* the #GdkSurface::layout signal will not me emitted.
* Presenting may have fail, for example if it was immediately
* hidden if the @popup was set to autohide.
*
* Returns: %FALSE if it failed to be presented, otherwise %TRUE.
*/
@@ -139,7 +164,7 @@ gdk_popup_present (GdkPopup *popup,
* Gets the current popup surface anchor.
*
* The value returned may change after calling gdk_popup_present(),
* or after the #GdkSurface::layout signal is emitted.
* or after the "popup-layout-changed" is emitted.
*
* Returns: the current surface anchor value of @popup
*/
@@ -158,7 +183,7 @@ gdk_popup_get_surface_anchor (GdkPopup *popup)
* Gets the current popup rectangle anchor.
*
* The value returned may change after calling gdk_popup_present(),
* or after the #GdkSurface::layout signal is emitted.
* or after the "popup-layout-changed" is emitted.
*
* Returns: the current rectangle anchor value of @popup
*/

View File

@@ -31,11 +31,6 @@ G_BEGIN_DECLS
#define GDK_TYPE_POPUP (gdk_popup_get_type ())
/**
* GdkPopup:
*
* Interface for popup surfaces.
*/
GDK_AVAILABLE_IN_ALL
G_DECLARE_INTERFACE (GdkPopup, gdk_popup, GDK, POPUP, GObject)

View File

@@ -29,13 +29,7 @@
G_BEGIN_DECLS
/**
* GdkSnapshot:
*
* Base type for snapshot operations.
*/
typedef struct _GdkSnapshotClass GdkSnapshotClass;
typedef struct _GdkSnapshotClass GdkSnapshotClass;
#define GDK_TYPE_SNAPSHOT (gdk_snapshot_get_type ())

View File

@@ -76,7 +76,8 @@
*/
enum {
LAYOUT,
POPUP_LAYOUT_CHANGED,
SIZE_CHANGED,
RENDER,
EVENT,
ENTER_MONITOR,
@@ -114,9 +115,6 @@ static void update_cursor (GdkDisplay *display,
static void gdk_surface_set_frame_clock (GdkSurface *surface,
GdkFrameClock *clock);
static void gdk_surface_queue_set_is_mapped (GdkSurface *surface,
gboolean is_mapped);
static guint signals[LAST_SIGNAL] = { 0 };
static GParamSpec *properties[LAST_PROP] = { NULL, };
@@ -287,10 +285,6 @@ void
gdk_surface_layout_popup_helper (GdkSurface *surface,
int width,
int height,
int shadow_left,
int shadow_right,
int shadow_top,
int shadow_bottom,
GdkMonitor *monitor,
GdkRectangle *bounds,
GdkPopupLayout *layout,
@@ -321,8 +315,8 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
gdk_popup_layout_get_offset (layout, &rect_anchor_dx, &rect_anchor_dy);
anchor_hints = gdk_popup_layout_get_anchor_hints (layout);
final_rect.width = width - shadow_left - shadow_right;
final_rect.height = height - shadow_top - shadow_bottom;
final_rect.width = width - surface->shadow_left - surface->shadow_right;
final_rect.height = height - surface->shadow_top - surface->shadow_bottom;
final_rect.x = maybe_flip_position (bounds->x,
bounds->width,
root_rect.x,
@@ -386,10 +380,10 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
final_rect.height = bounds->y + bounds->height - final_rect.y;
}
final_rect.x -= shadow_left;
final_rect.y -= shadow_top;
final_rect.width += shadow_left + shadow_right;
final_rect.height += shadow_top + shadow_bottom;
final_rect.x -= surface->shadow_left;
final_rect.y -= surface->shadow_top;
final_rect.width += surface->shadow_left + surface->shadow_right;
final_rect.height += surface->shadow_top + surface->shadow_bottom;
gdk_surface_get_origin (surface->parent, &x, &y);
final_rect.x -= x;
@@ -475,7 +469,7 @@ gdk_surface_init (GdkSurface *surface)
{
/* 0-initialization is good for all other fields. */
surface->state = 0;
surface->state = GDK_TOPLEVEL_STATE_WITHDRAWN;
surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
surface->width = 1;
surface->height = 1;
@@ -554,19 +548,18 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
* GdkSurface::layout:
* GdkSurface::size-changed:
* @surface: the #GdkSurface
* @width: the current width
* @height: the current height
* @width: the new width
* @height: the new height
*
* Emitted when the size of @surface is changed, or when relayout should
* be performed.
* Emitted when the size of @surface is changed.
*
* Surface size is reported in ”application pixels”, not
* ”device pixels” (see gdk_surface_get_scale_factor()).
*/
signals[LAYOUT] =
g_signal_new (g_intern_static_string ("layout"),
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
@@ -681,8 +674,6 @@ gdk_surface_finalize (GObject *object)
{
GdkSurface *surface = GDK_SURFACE (object);
g_clear_handle_id (&surface->request_motion_id, g_source_remove);
g_signal_handlers_disconnect_by_func (surface->display,
seat_removed_cb, surface);
@@ -928,10 +919,7 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
_gdk_surface_clear_update_area (surface);
g_clear_handle_id (&surface->set_is_mapped_source_id, g_source_remove);
surface->is_mapped = FALSE;
surface->pending_is_mapped = FALSE;
surface->state |= GDK_TOPLEVEL_STATE_WITHDRAWN;
surface->destroyed = TRUE;
surface_remove_from_pointer_info (surface, surface->display);
@@ -1276,7 +1264,7 @@ gdk_surface_schedule_update (GdkSurface *surface)
if (surface->update_freeze_count ||
gdk_surface_is_toplevel_frozen (surface))
{
surface->pending_phases |= GDK_FRAME_CLOCK_PHASE_PAINT;
surface->pending_schedule_update = TRUE;
return;
}
@@ -1329,57 +1317,6 @@ gdk_surface_process_updates_internal (GdkSurface *surface)
g_object_unref (surface);
}
static void
gdk_surface_layout_on_clock (GdkFrameClock *clock,
void *data)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkSurfaceClass *class;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
return;
if (!GDK_SURFACE_IS_MAPPED (surface))
return;
surface->pending_phases &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->compute_size)
{
if (class->compute_size (surface))
return;
}
g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
}
/**
* gdk_surface_request_layout:
* @surface: a #GdkSurface
*
* Request a %GDK_FRAME_CLOCK_PHASE_LAYOUT from the surface's
* frame clock. See gdk_frame_clock_request_phase().
*/
void
gdk_surface_request_layout (GdkSurface *surface)
{
GdkSurfaceClass *class;
GdkFrameClock *frame_clock;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->request_layout)
class->request_layout (surface);
frame_clock = gdk_surface_get_frame_clock (surface);
g_return_if_fail (frame_clock);
gdk_frame_clock_request_phase (frame_clock,
GDK_FRAME_CLOCK_PHASE_LAYOUT);
}
static void
gdk_surface_paint_on_clock (GdkFrameClock *clock,
void *data)
@@ -1401,7 +1338,6 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
* do the update later when idle instead. */
!surface->in_update)
{
surface->pending_phases &= ~GDK_FRAME_CLOCK_PHASE_PAINT;
gdk_surface_process_updates_internal (surface);
gdk_surface_remove_update_surface (surface);
}
@@ -1562,20 +1498,6 @@ gdk_surface_freeze_updates (GdkSurface *surface)
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
}
static gboolean
request_motion_cb (void *data)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
if (clock)
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
surface->request_motion_id = 0;
return G_SOURCE_REMOVE;
}
/*
* gdk_surface_thaw_updates:
* @surface: a #GdkSurface
@@ -1593,22 +1515,37 @@ gdk_surface_thaw_updates (GdkSurface *surface)
if (--surface->update_freeze_count == 0)
{
GdkFrameClock *frame_clock = surface->frame_clock;
_gdk_frame_clock_inhibit_freeze (surface->frame_clock);
_gdk_frame_clock_inhibit_freeze (frame_clock);
if (surface->pending_phases)
gdk_frame_clock_request_phase (frame_clock, surface->pending_phases);
if (surface->request_motion && surface->request_motion_id == 0)
if (surface->pending_schedule_update)
{
surface->request_motion_id =
g_idle_add_full (GDK_PRIORITY_REDRAW + 20,
request_motion_cb, surface, NULL);
surface->pending_schedule_update = FALSE;
gdk_surface_schedule_update (surface);
}
}
}
void
gdk_surface_freeze_toplevel_updates (GdkSurface *surface)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
surface->update_and_descendants_freeze_count++;
gdk_surface_freeze_updates (surface);
}
void
gdk_surface_thaw_toplevel_updates (GdkSurface *surface)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (surface->update_and_descendants_freeze_count > 0);
surface->update_and_descendants_freeze_count--;
gdk_surface_schedule_update (surface);
gdk_surface_thaw_updates (surface);
}
/*
* gdk_surface_constrain_size:
* @geometry: a #GdkGeometry structure
@@ -1732,7 +1669,8 @@ gdk_surface_hide (GdkSurface *surface)
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
gdk_surface_queue_set_is_mapped (surface, FALSE);
if (GDK_SURFACE_IS_MAPPED (surface))
gdk_synthesize_surface_state (surface, 0, GDK_TOPLEVEL_STATE_WITHDRAWN);
if (was_mapped)
{
@@ -2473,10 +2411,6 @@ gdk_surface_set_frame_clock (GdkSurface *surface,
"resume-events",
G_CALLBACK (gdk_surface_resume_events),
surface);
g_signal_connect (G_OBJECT (clock),
"layout",
G_CALLBACK (gdk_surface_layout_on_clock),
surface);
g_signal_connect (G_OBJECT (clock),
"paint",
G_CALLBACK (gdk_surface_paint_on_clock),
@@ -2497,9 +2431,6 @@ gdk_surface_set_frame_clock (GdkSurface *surface,
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
G_CALLBACK (gdk_surface_resume_events),
surface);
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
G_CALLBACK (gdk_surface_layout_on_clock),
surface);
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
G_CALLBACK (gdk_surface_paint_on_clock),
surface);
@@ -2639,10 +2570,58 @@ gdk_surface_set_opaque_region (GdkSurface *surface,
class->set_opaque_region (surface, region);
}
/**
* gdk_surface_set_shadow_width:
* @surface: a #GdkSurface
* @left: The left extent
* @right: The right extent
* @top: The top extent
* @bottom: The bottom extent
*
* Newer GTK windows using client-side decorations use extra geometry
* around their frames for effects like shadows and invisible borders.
* Window managers that want to maximize windows or snap to edges need
* to know where the extents of the actual frame lie, so that users
* dont feel like windows are snapping against random invisible edges.
*
* Note that this property is automatically updated by GTK, so this
* function should only be used by applications which do not use GTK
* to create toplevel surfaces.
*/
void
gdk_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom)
{
GdkSurfaceClass *class;
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
g_return_if_fail (left >= 0 && right >= 0 && top >= 0 && bottom >= 0);
if (surface->shadow_left == left &&
surface->shadow_right == right &&
surface->shadow_top == top &&
surface->shadow_bottom == bottom)
return;
surface->shadow_top = top;
surface->shadow_left = left;
surface->shadow_right = right;
surface->shadow_bottom = bottom;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->set_shadow_width)
class->set_shadow_width (surface, left, right, top, bottom);
}
void
gdk_surface_set_state (GdkSurface *surface,
GdkToplevelState new_state)
{
gboolean was_mapped, mapped;
gboolean was_sticky, sticky;
g_return_if_fail (GDK_IS_SURFACE (surface));
@@ -2654,15 +2633,20 @@ gdk_surface_set_state (GdkSurface *surface,
* inconsistent state to the user.
*/
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
was_sticky = GDK_SURFACE_IS_STICKY (surface);
surface->state = new_state;
mapped = GDK_SURFACE_IS_MAPPED (surface);
sticky = GDK_SURFACE_IS_STICKY (surface);
if (GDK_IS_TOPLEVEL (surface))
g_object_notify (G_OBJECT (surface), "state");
if (was_mapped != mapped)
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
if (was_sticky != sticky)
g_object_notify (G_OBJECT (surface), "sticky");
}
@@ -2675,94 +2659,6 @@ gdk_synthesize_surface_state (GdkSurface *surface,
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
}
void
gdk_surface_queue_state_change (GdkSurface *surface,
GdkToplevelState unset_flags,
GdkToplevelState set_flags)
{
surface->pending_unset_flags |= unset_flags;
surface->pending_set_flags &= ~unset_flags;
surface->pending_set_flags |= set_flags;
surface->pending_unset_flags &= ~set_flags;
}
void
gdk_surface_apply_state_change (GdkSurface *surface)
{
if (!surface->pending_unset_flags && !surface->pending_set_flags)
return;
gdk_synthesize_surface_state (surface,
surface->pending_unset_flags,
surface->pending_set_flags);
surface->pending_unset_flags = 0;
surface->pending_set_flags = 0;
}
static gboolean
set_is_mapped_idle (gpointer user_data)
{
GdkSurface *surface = GDK_SURFACE (user_data);
surface->set_is_mapped_source_id = 0;
g_return_val_if_fail (surface->pending_is_mapped != surface->is_mapped,
G_SOURCE_REMOVE);
surface->is_mapped = surface->pending_is_mapped;
if (surface->is_mapped)
gdk_surface_invalidate_rect (surface, NULL);
g_object_notify (G_OBJECT (surface), "mapped");
return G_SOURCE_REMOVE;
}
void
gdk_surface_set_is_mapped (GdkSurface *surface,
gboolean is_mapped)
{
gboolean was_mapped;
if (surface->pending_is_mapped != surface->is_mapped)
g_clear_handle_id (&surface->set_is_mapped_source_id, g_source_remove);
surface->pending_is_mapped = is_mapped;
was_mapped = surface->is_mapped;
surface->is_mapped = is_mapped;
if (surface->is_mapped)
gdk_surface_invalidate_rect (surface, NULL);
if (was_mapped != is_mapped)
g_object_notify (G_OBJECT (surface), "mapped");
}
static void
gdk_surface_queue_set_is_mapped (GdkSurface *surface,
gboolean is_mapped)
{
if (surface->pending_is_mapped == is_mapped)
return;
surface->pending_is_mapped = is_mapped;
if (surface->is_mapped == surface->pending_is_mapped)
{
g_clear_handle_id (&surface->set_is_mapped_source_id, g_source_remove);
}
else
{
g_return_if_fail (!surface->set_is_mapped_source_id);
surface->set_is_mapped_source_id =
g_idle_add_full (G_PRIORITY_HIGH - 10,
set_is_mapped_idle,
surface, NULL);
}
}
static gboolean
check_autohide (GdkEvent *event)
{
@@ -2874,6 +2770,14 @@ add_event_mark (GdkEvent *event,
break;
}
case GDK_CONFIGURE:
{
int width, height;
gdk_configure_event_get_size (event, &width, &height);
message = g_strdup_printf ("%s {width=%d, height=%d}", kind, width, height);
break;
}
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
case GDK_TOUCHPAD_SWIPE:
@@ -2911,18 +2815,30 @@ add_event_mark (GdkEvent *event,
gboolean
gdk_surface_handle_event (GdkEvent *event)
{
GdkSurface *surface = gdk_event_get_surface (event);
gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
gboolean handled = FALSE;
if (check_autohide (event))
return TRUE;
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
int width, height;
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
surface->request_motion = FALSE;
gdk_configure_event_get_size (event, &width, &height);
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
width, height);
handled = TRUE;
}
else
{
GdkSurface *surface = gdk_event_get_surface (event);
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
surface->request_motion = FALSE;
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
}
if (GDK_PROFILER_IS_RUNNING)
add_event_mark (event, begin_time, GDK_PROFILER_CURRENT_TIME);
@@ -2942,7 +2858,13 @@ gdk_surface_handle_event (GdkEvent *event)
void
gdk_surface_request_motion (GdkSurface *surface)
{
GdkFrameClock *frame_clock;
surface->request_motion = TRUE;
frame_clock = gdk_surface_get_frame_clock (surface);
if (frame_clock)
gdk_frame_clock_request_phase (frame_clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
}
/**

View File

@@ -118,9 +118,6 @@ void gdk_surface_beep (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_queue_render (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_request_layout (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkFrameClock* gdk_surface_get_frame_clock (GdkSurface *surface);
@@ -128,6 +125,13 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_set_opaque_region (GdkSurface *surface,
cairo_region_t *region);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom);
GDK_AVAILABLE_IN_ALL
GdkCairoContext *gdk_surface_create_cairo_context(GdkSurface *surface);
GDK_AVAILABLE_IN_ALL

View File

@@ -44,10 +44,6 @@ struct _GdkSurface
GdkSurface *parent; /* for popups */
GList *children; /* popups */
guint set_is_mapped_source_id;
gboolean pending_is_mapped;
gboolean is_mapped;
gpointer widget;
int x;
@@ -57,14 +53,13 @@ struct _GdkSurface
cairo_region_t *update_area;
guint update_freeze_count;
GdkFrameClockPhase pending_phases;
gboolean pending_schedule_update;
/* This is the update_area that was in effect when the current expose
started. It may be smaller than the expose area if we'e painting
more than we have to, but it represents the "true" damage. */
cairo_region_t *active_update_area;
GdkToplevelState pending_set_flags;
GdkToplevelState pending_unset_flags;
GdkToplevelState old_state;
GdkToplevelState state;
guint8 resize_count;
@@ -80,8 +75,6 @@ struct _GdkSurface
guint shortcuts_inhibited : 1;
guint request_motion : 1;
guint request_motion_id;
struct {
GdkGravity surface_anchor;
GdkGravity rect_anchor;
@@ -90,6 +83,10 @@ struct _GdkSurface
guint update_and_descendants_freeze_count;
int width, height;
int shadow_top;
int shadow_left;
int shadow_right;
int shadow_bottom;
GdkCursor *cursor;
GHashTable *device_cursor;
@@ -163,24 +160,25 @@ struct _GdkSurfaceClass
void (* set_opaque_region) (GdkSurface *surface,
cairo_region_t *region);
void (* set_shadow_width) (GdkSurface *surface,
int left,
int right,
int top,
int bottom);
GdkGLContext *(*create_gl_context) (GdkSurface *surface,
gboolean attached,
GdkGLContext *share,
GError **error);
void (* request_layout) (GdkSurface *surface);
gboolean (* compute_size) (GdkSurface *surface);
};
#define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)
#define GDK_SURFACE_IS_MAPPED(surface) ((surface)->pending_is_mapped)
#define GDK_SURFACE_IS_MAPPED(surface) (((surface)->state & GDK_TOPLEVEL_STATE_WITHDRAWN) == 0)
void gdk_surface_set_state (GdkSurface *surface,
GdkToplevelState new_state);
void gdk_surface_set_is_mapped (GdkSurface *surface,
gboolean is_mapped);
GdkMonitor * gdk_surface_get_layout_monitor (GdkSurface *surface,
GdkPopupLayout *layout,
void (*get_bounds) (GdkMonitor *monitor,
@@ -189,10 +187,6 @@ GdkMonitor * gdk_surface_get_layout_monitor (GdkSurface *surface,
void gdk_surface_layout_popup_helper (GdkSurface *surface,
int width,
int height,
int shadow_left,
int shadow_right,
int shadow_top,
int shadow_bottom,
GdkMonitor *monitor,
GdkRectangle *bounds,
GdkPopupLayout *layout,
@@ -332,22 +326,9 @@ void gdk_surface_constrain_size (GdkGeometry *geometry,
int *new_width,
int *new_height);
void gdk_surface_queue_state_change (GdkSurface *surface,
GdkToplevelState unset_flags,
GdkToplevelState set_flags);
void gdk_surface_apply_state_change (GdkSurface *surface);
void gdk_surface_emit_size_changed (GdkSurface *surface,
int width,
int height);
void gdk_surface_request_compute_size (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_request_motion (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_SURFACE_PRIVATE_H__ */

View File

@@ -51,10 +51,11 @@ enum
static guint signals[N_SIGNALS] = { 0 };
static void
static gboolean
gdk_toplevel_default_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
return FALSE;
}
static gboolean
@@ -123,7 +124,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
g_param_spec_flags ("state",
P_("State"),
P_("State"),
GDK_TYPE_TOPLEVEL_STATE, 0,
GDK_TYPE_TOPLEVEL_STATE, GDK_TOPLEVEL_STATE_WITHDRAWN,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
g_param_spec_string ("title",
@@ -238,17 +239,18 @@ gdk_toplevel_install_properties (GObjectClass *object_class,
* compute the preferred size of the toplevel surface. See
* #GdkToplevel::compute-size for details.
*
* Presenting is asynchronous and the specified layout parameters are not
* guaranteed to be respected.
* Presenting may fail.
*
* Returns: %FALSE if @toplevel failed to be presented, otherwise %TRUE.
*/
void
gboolean
gdk_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
g_return_if_fail (layout != NULL);
g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
g_return_val_if_fail (layout != NULL, FALSE);
GDK_TOPLEVEL_GET_IFACE (toplevel)->present (toplevel, layout);
return GDK_TOPLEVEL_GET_IFACE (toplevel)->present (toplevel, layout);
}
/**

View File

@@ -71,6 +71,7 @@ typedef enum
/**
* GdkToplevelState:
* @GDK_TOPLEVEL_STATE_WITHDRAWN: the surface is not shown
* @GDK_TOPLEVEL_STATE_MINIMIZED: the surface is minimized
* @GDK_TOPLEVEL_STATE_MAXIMIZED: the surface is maximized
* @GDK_TOPLEVEL_STATE_STICKY: the surface is sticky
@@ -97,37 +98,33 @@ typedef enum
*/
typedef enum
{
GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 0,
GDK_TOPLEVEL_STATE_MAXIMIZED = 1 << 1,
GDK_TOPLEVEL_STATE_STICKY = 1 << 2,
GDK_TOPLEVEL_STATE_FULLSCREEN = 1 << 3,
GDK_TOPLEVEL_STATE_ABOVE = 1 << 4,
GDK_TOPLEVEL_STATE_BELOW = 1 << 5,
GDK_TOPLEVEL_STATE_FOCUSED = 1 << 6,
GDK_TOPLEVEL_STATE_TILED = 1 << 7,
GDK_TOPLEVEL_STATE_TOP_TILED = 1 << 8,
GDK_TOPLEVEL_STATE_TOP_RESIZABLE = 1 << 9,
GDK_TOPLEVEL_STATE_RIGHT_TILED = 1 << 10,
GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE = 1 << 11,
GDK_TOPLEVEL_STATE_BOTTOM_TILED = 1 << 12,
GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE = 1 << 13,
GDK_TOPLEVEL_STATE_LEFT_TILED = 1 << 14,
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 15
GDK_TOPLEVEL_STATE_WITHDRAWN = 1 << 0,
GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 1,
GDK_TOPLEVEL_STATE_MAXIMIZED = 1 << 2,
GDK_TOPLEVEL_STATE_STICKY = 1 << 3,
GDK_TOPLEVEL_STATE_FULLSCREEN = 1 << 4,
GDK_TOPLEVEL_STATE_ABOVE = 1 << 5,
GDK_TOPLEVEL_STATE_BELOW = 1 << 6,
GDK_TOPLEVEL_STATE_FOCUSED = 1 << 7,
GDK_TOPLEVEL_STATE_TILED = 1 << 8,
GDK_TOPLEVEL_STATE_TOP_TILED = 1 << 9,
GDK_TOPLEVEL_STATE_TOP_RESIZABLE = 1 << 10,
GDK_TOPLEVEL_STATE_RIGHT_TILED = 1 << 11,
GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE = 1 << 12,
GDK_TOPLEVEL_STATE_BOTTOM_TILED = 1 << 13,
GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE = 1 << 14,
GDK_TOPLEVEL_STATE_LEFT_TILED = 1 << 15,
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 16
} GdkToplevelState;
#define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ())
/**
* GdkToplevel:
*
* An interface for top level surfaces.
*/
GDK_AVAILABLE_IN_ALL
G_DECLARE_INTERFACE (GdkToplevel, gdk_toplevel, GDK, TOPLEVEL, GObject)
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_present (GdkToplevel *toplevel,
gboolean gdk_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout);
GDK_AVAILABLE_IN_ALL
@@ -201,6 +198,7 @@ void gdk_toplevel_begin_move (GdkToplevel *toplevel,
double y,
guint32 timestamp);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_H__ */

View File

@@ -40,10 +40,7 @@ struct _GdkToplevelLayout
grefcount ref_count;
guint resizable : 1;
guint maximized_valid : 1;
guint maximized : 1;
guint fullscreen_valid : 1;
guint fullscreen : 1;
GdkMonitor *fullscreen_monitor;
};
@@ -73,9 +70,7 @@ gdk_toplevel_layout_new (void)
layout = g_new0 (GdkToplevelLayout, 1);
g_ref_count_init (&layout->ref_count);
layout->resizable = TRUE;
layout->maximized_valid = FALSE;
layout->maximized = FALSE;
layout->fullscreen_valid = FALSE;
layout->fullscreen = FALSE;
layout->fullscreen_monitor = NULL;
@@ -130,9 +125,7 @@ gdk_toplevel_layout_copy (GdkToplevelLayout *layout)
g_ref_count_init (&new_layout->ref_count);
new_layout->resizable = layout->resizable;
new_layout->maximized_valid = layout->maximized_valid;
new_layout->maximized = layout->maximized;
new_layout->fullscreen_valid = layout->fullscreen_valid;
new_layout->fullscreen = layout->fullscreen;
if (layout->fullscreen_monitor)
new_layout->fullscreen_monitor = g_object_ref (layout->fullscreen_monitor);
@@ -158,9 +151,7 @@ gdk_toplevel_layout_equal (GdkToplevelLayout *layout,
g_return_val_if_fail (other, FALSE);
return layout->resizable == other->resizable &&
layout->maximized_valid == other->maximized_valid &&
layout->maximized == other->maximized &&
layout->fullscreen_valid == other->fullscreen_valid &&
layout->fullscreen == other->fullscreen &&
layout->fullscreen_monitor == other->fullscreen_monitor;
}
@@ -207,32 +198,22 @@ void
gdk_toplevel_layout_set_maximized (GdkToplevelLayout *layout,
gboolean maximized)
{
layout->maximized_valid = TRUE;
layout->maximized = maximized;
}
/**
* gdk_toplevel_layout_get_maximized:
* @layout: a #GdkToplevelLayout
* @maximized: (out): set to %TRUE if the toplevel should be maximized
*
* If the layout specifies whether to the toplevel should go maximized,
* the value pointed to by @maximized is set to %TRUE if it should go
* fullscreen, or %FALSE, if it should go unmaximized.
* Returns whether the layout should present the
* surface as maximized.
*
* Returns: whether the @layout specifies the maximized state for the toplevel
* Returns: %TRUE if the layout is maximized
*/
gboolean
gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout,
gboolean *maximized)
gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout)
{
if (layout->maximized_valid)
{
*maximized = layout->maximized;
return TRUE;
}
return FALSE;
return layout->maximized;
}
/**
@@ -249,7 +230,6 @@ gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *layout,
gboolean fullscreen,
GdkMonitor *monitor)
{
layout->fullscreen_valid = TRUE;
layout->fullscreen = fullscreen;
if (monitor)
layout->fullscreen_monitor = g_object_ref (monitor);
@@ -258,25 +238,16 @@ gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *layout,
/**
* gdk_toplevel_layout_get_fullscreen:
* @layout: a #GdkToplevelLayout
* @fullscreen: (out): location to store whether the toplevel should be fullscreen
*
* If the layout specifies whether to the toplevel should go fullscreen,
* the value pointed to by @fullscreen is set to %TRUE if it should go
* fullscreen, or %FALSE, if it should go unfullscreen.
* Returns whether the layout should cause the surface
* to be fullscreen when presented.
*
* Returns: whether the @layout specifies the fullscreen state for the toplevel
* Returns: %TRUE if @layout is fullscreen
*/
gboolean
gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout,
gboolean *fullscreen)
gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout)
{
if (layout->fullscreen_valid)
{
*fullscreen = layout->fullscreen;
return TRUE;
}
return FALSE;
return layout->fullscreen;
}
/**

View File

@@ -30,7 +30,7 @@
G_BEGIN_DECLS
/**
* GdkToplevelLayout:
* GdkTopLevelLayout:
*
* Struct containing information for gdk_toplevel_present()
*/
@@ -66,12 +66,10 @@ void gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *l
GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout,
gboolean *maximized);
gboolean gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout);
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout,
gboolean *fullscreen);
gboolean gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout);
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_toplevel_layout_get_fullscreen_monitor (GdkToplevelLayout *layout);

View File

@@ -13,7 +13,7 @@ struct _GdkToplevelInterface
{
GTypeInterface g_iface;
void (* present) (GdkToplevel *toplevel,
gboolean (* present) (GdkToplevel *toplevel,
GdkToplevelLayout *layout);
gboolean (* minimize) (GdkToplevel *toplevel);
gboolean (* lower) (GdkToplevel *toplevel);

View File

@@ -118,53 +118,18 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
size->min_height = min_height;
}
/**
* gdk_toplevel_size_set_shadow_width:
* @size: a #GdkToplevelSize
* @left: width of the left part of the shadow
* @right: width of the right part of the shadow
* @top: height of the top part of the shadow
* @bottom: height of the bottom part of the shadow
*
* The shadow width corresponds to the part of the computed surface size
* that would consist of the shadow margin surrounding the window, would
* there be any.
*/
void
gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
int left,
int right,
int top,
int bottom)
{
size->shadow.is_valid = TRUE;
size->shadow.left = left;
size->shadow.right = right;
size->shadow.top = top;
size->shadow.bottom = bottom;
}
void
gdk_toplevel_size_validate (GdkToplevelSize *size)
{
int geometry_width, geometry_height;
if (size->min_width > size->bounds_width ||
size->min_height > size->bounds_height)
g_warning ("GdkToplevelSize: min_size (%d, %d) exceeds bounds (%d, %d)",
size->min_width, size->min_height,
size->bounds_width, size->bounds_height);
geometry_width = size->width;
geometry_height = size->height;
if (size->shadow.is_valid)
{
geometry_width -= size->shadow.left + size->shadow.right;
geometry_height -= size->shadow.top + size->shadow.bottom;
}
if (geometry_width > size->bounds_width ||
geometry_height > size->bounds_height)
g_warning ("GdkToplevelSize: geometry size (%d, %d) exceeds bounds (%d, %d)",
if (size->width > size->bounds_width ||
size->height > size->bounds_height)
g_warning ("GdkToplevelSize: size (%d, %d) exceeds bounds (%d, %d)",
size->width, size->height,
size->bounds_width, size->bounds_height);

View File

@@ -54,13 +54,6 @@ void gdk_toplevel_size_set_min_size (GdkToplevelSize *
int min_width,
int min_height);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
int left,
int right,
int top,
int bottom);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_SIZE_H__ */

View File

@@ -30,14 +30,6 @@ struct _GdkToplevelSize
int height;
int min_width;
int min_height;
struct {
gboolean is_valid;
int left;
int right;
int top;
int bottom;
} shadow;
};
void gdk_toplevel_size_init (GdkToplevelSize *size,

View File

@@ -24,25 +24,8 @@
#include <glib.h>
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#ifndef _GDK_EXTERN
@@ -52,10 +35,9 @@
/**
* GDK_DISABLE_DEPRECATION_WARNINGS:
*
* A macro that should be defined before including the `gdk.h` header.
*
* If this symbol is defined, no compiler warnings will be produced for
* uses of deprecated GDK and GTK APIs.
* A macro that should be defined before including the gdk.h header.
* If it is defined, no compiler warnings will be produced for uses
* of deprecated GDK and GTK APIs.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
@@ -70,6 +52,9 @@
/* XXX: Every new stable minor release bump should add a macro here */
#define GDK_VERSION_3_92 (G_ENCODE_VERSION (3, 92))
#define GDK_VERSION_3_94 (G_ENCODE_VERSION (3, 94))
/**
* GDK_VERSION_4_0:
*
@@ -80,34 +65,26 @@
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
* beginning of the stable series
* this means the next stable target
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#if (GDK_MINOR_VERSION % 2)
#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#else
# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#endif
/* evaluates to the previous stable version, with a hard backstop
* to the beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
/* evaluates to the previous stable version */
#if (GDK_MINOR_VERSION % 2)
#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#else
# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
#endif
/**
* GDK_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* the gdk.h header.
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
@@ -125,8 +102,7 @@
* GDK_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* the gdk.h header.
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
@@ -146,33 +122,29 @@
/* sanity checks */
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#endif
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_92
#error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_92"
#endif
#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
/* XXX: Every new stable minor release should add a set of macros here */
/* This is not really necessary for 4.0, since there can't be an
* earlier version, and there are no deprecated symbols. We just
* include it for completeness, and because it's easier to copy
* this stanza every time a new development cycle starts.
*/
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_0
# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
#else
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_0
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_92
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -82,9 +82,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-(BOOL)isOpaque
{
if ([self window])
return [[self window] isOpaque];
return YES;
return NO;
}
-(BOOL)isFlipped

View File

@@ -230,7 +230,9 @@
NSRect content_rect;
GdkSurface *surface;
GdkDisplay *display;
GdkEvent *event;
gboolean maximized;
GList *node;
surface = GDK_SURFACE (gdk_surface);
display = gdk_surface_get_display (surface);
@@ -254,7 +256,13 @@
_gdk_surface_update_size (surface);
gdk_surface_request_layout (surface);
/* Synthesize a configure event */
event = gdk_configure_event_new (surface,
content_rect.size.width,
content_rect.size.height);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event,
_gdk_display_get_next_serial (display));
_gdk_macos_surface_reposition_children (gdk_surface);
@@ -312,20 +320,11 @@
-(void)hide
{
BOOL wasKey = [self isKeyWindow];
BOOL wasMain = [self isMainWindow];
inShowOrHide = YES;
[self orderOut:nil];
inShowOrHide = NO;
initialPositionKnown = NO;
if (wasMain)
[self windowDidResignMain:nil];
if (wasKey)
[self windowDidResignKey:nil];
}
-(BOOL)trackManualMove

View File

@@ -122,7 +122,7 @@ gdk_macos_device_ungrab (GdkDevice *device,
grab = _gdk_display_get_last_device_grab (display, device);
if (grab != NULL)
grab->serial_end = grab->serial_start;
grab->serial_end = 0;
_gdk_display_device_grab_update (display, device, 0);
}

View File

@@ -610,7 +610,7 @@ fill_scroll_event (GdkMacosDisplay *self,
sx = [nsevent scrollingDeltaX];
sy = [nsevent scrollingDeltaY];
if (sx != 0.0 || sy != 0.0)
if (sx != 0.0 || dx != 0.0)
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
pointer,
NULL,

View File

@@ -477,8 +477,7 @@ _gdk_macos_display_surface_removed (GdkMacosDisplay *self,
if (self->keyboard_surface == surface)
_gdk_macos_display_surface_resigned_key (self, surface);
if (queue_contains (&self->sorted_surfaces, &surface->sorted))
g_queue_unlink (&self->sorted_surfaces, &surface->sorted);
g_queue_unlink (&self->sorted_surfaces, &surface->sorted);
if (queue_contains (&self->main_surfaces, &surface->main))
_gdk_macos_display_surface_resigned_main (self, surface);
@@ -520,30 +519,23 @@ void
_gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
GdkMacosSurface *surface)
{
gboolean was_keyboard_surface;
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
was_keyboard_surface = self->keyboard_surface == surface;
self->keyboard_surface = NULL;
if (was_keyboard_surface)
if (self->keyboard_surface == surface)
{
GdkDevice *keyboard;
GdkEvent *event;
GdkSeat *seat;
GList *node;
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
keyboard = gdk_seat_get_keyboard (seat);
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, FALSE);
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event,
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
_gdk_event_queue_append (GDK_DISPLAY (self), event);
}
self->keyboard_surface = NULL;
_gdk_macos_display_clear_sorting (self);
}
@@ -1057,8 +1049,9 @@ _gdk_macos_display_clear_sorting (GdkMacosDisplay *self)
{
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
while (self->sorted_surfaces.head != NULL)
g_queue_unlink (&self->sorted_surfaces, self->sorted_surfaces.head);
self->sorted_surfaces.head = NULL;
self->sorted_surfaces.tail = NULL;
self->sorted_surfaces.length = 0;
}
const GList *

View File

@@ -101,7 +101,7 @@ create_pixel_format (int major,
NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFABackingStore,
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAColorSize, 32,
NSOpenGLPFAAlphaSize, 8,
(NSOpenGLPixelFormatAttribute)nil
@@ -173,13 +173,11 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
NSOpenGLContext *shared_gl_context = nil;
NSOpenGLContext *gl_context;
NSOpenGLPixelFormat *pixelFormat;
CGLContextObj cgl_context;
GdkGLContext *shared;
GdkGLContext *shared_data;
NSOpenGLContext *existing;
GLint sync_to_framerate = 1;
GLint validate = 0;
GLint swapRect[4];
int major, minor;
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
@@ -228,19 +226,8 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
return FALSE;
}
cgl_context = [gl_context CGLContextObj];
swapRect[0] = 0;
swapRect[1] = 0;
swapRect[2] = surface->width;
swapRect[3] = surface->height;
CGLSetParameter (cgl_context, kCGLCPSwapRectangle, swapRect);
CGLSetParameter (cgl_context, kCGLCPSwapInterval, &sync_to_framerate);
CGLEnable (cgl_context, kCGLCESwapRectangle);
if (validate)
CGLEnable (cgl_context, kCGLCEStateValidation);
[gl_context setValues:&sync_to_framerate forParameter:NSOpenGLCPSwapInterval];
[gl_context setValues:&validate forParameter:NSOpenGLContextParameterStateValidation];
self->dummy_window = [[NSWindow alloc] initWithContentRect:NSZeroRect
styleMask:0
@@ -272,12 +259,9 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
cairo_region_t *painted)
{
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
GdkSurface *surface;
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
surface = gdk_draw_context_get_surface (context);
/* If begin frame is called, that means we are trying to draw to
* the NSWindow using our view. That might be a GdkMacosCairoView
* but we need it to be a GL view. Also, only in this case do we
@@ -287,31 +271,17 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
if (!self->is_attached &&
gdk_gl_context_get_shared_context (GDK_GL_CONTEXT (context)))
{
CGLContextObj glctx = [self->gl_context CGLContextObj];
GLint swapRect[4];
ensure_gl_view (self);
g_clear_pointer (&self->damage, cairo_region_destroy);
self->damage = cairo_region_copy (painted);
cairo_region_get_extents (painted, &self->flush_rect);
/* Coordinates are in display coordinates, where as flush_rect is
* in GDK coordinates. Must flip Y to match display coordinates where
* 0,0 is the bottom-left corner.
*/
swapRect[0] = self->flush_rect.x; /* left */
swapRect[1] = surface->height - self->flush_rect.y; /* bottom */
swapRect[2] = self->flush_rect.width; /* width */
swapRect[3] = self->flush_rect.height; /* height */
CGLSetParameter (glctx, kCGLCPSwapRectangle, swapRect);
}
if (self->needs_resize)
{
CGLContextObj cgl_context = [self->gl_context CGLContextObj];
GdkSurface *surface = gdk_draw_context_get_surface (context);
GLint opaque;
self->needs_resize = FALSE;
@@ -332,8 +302,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
opaque = GDK_MACOS_TOPLEVEL_SURFACE (surface)->decorated;
else
opaque = FALSE;
CGLSetParameter (cgl_context, kCGLCPSurfaceOpacity, &opaque);
[self->gl_context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
[self->gl_context update];
}
@@ -342,7 +311,8 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
if (!self->is_attached)
{
NSView *nsview = _gdk_macos_surface_get_view (GDK_MACOS_SURFACE (surface));
GdkMacosSurface *surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (context));
NSView *nsview = _gdk_macos_surface_get_view (surface);
g_assert (self->gl_context != NULL);
g_assert (GDK_IS_MACOS_GL_VIEW (nsview));
@@ -362,6 +332,14 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->end_frame (context, painted);
/* We want to limit how much gets moved to the front buffer so here
* we adjust the clip rectangle before flushBuffer is called.
*/
G_STATIC_ASSERT (sizeof (GLint) == sizeof (int));
[self->gl_context
setValues:(GLint *)&self->flush_rect
forParameter:NSOpenGLCPSwapRectangle];
[self->gl_context flushBuffer];
}
@@ -469,28 +447,15 @@ _gdk_macos_gl_context_new (GdkMacosSurface *surface,
gboolean
_gdk_macos_gl_context_make_current (GdkMacosGLContext *self)
{
NSOpenGLContext *current;
g_return_val_if_fail (GDK_IS_MACOS_GL_CONTEXT (self), FALSE);
if (self->gl_context == NULL)
return FALSE;
current = [NSOpenGLContext currentContext];
if (self->gl_context != current)
if (self->gl_context != nil)
{
/* The OpenGL mac programming guide suggests that glFlush() is called
* before switching current contexts to ensure that the drawing commands
* are submitted.
*/
if (current != NULL)
glFlush ();
[self->gl_context makeCurrentContext];
return TRUE;
}
return TRUE;
return FALSE;
}
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -69,10 +69,6 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
width,
height,
self->parent_instance.shadow_left,
self->parent_instance.shadow_right,
self->parent_instance.shadow_top,
self->parent_instance.shadow_bottom,
monitor,
&bounds,
self->layout,

View File

@@ -85,11 +85,6 @@ void _gdk_macos_surface_get_shadow (GdkMacosSurface
int *right,
int *bottom,
int *left);
void _gdk_macos_surface_set_shadow (GdkMacosSurface *self,
int top,
int right,
int bottom,
int left);
NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self);
gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self);
void _gdk_macos_surface_set_modal_hint (GdkMacosSurface *self,

View File

@@ -85,7 +85,7 @@ _gdk_macos_surface_reposition_children (GdkMacosSurface *self)
}
if (GDK_IS_POPUP (self) && self->did_initial_present)
gdk_surface_request_layout (GDK_SURFACE (self));
g_signal_emit_by_name (self, "popup-layout-changed");
}
static void
@@ -112,21 +112,15 @@ gdk_macos_surface_hide (GdkSurface *surface)
{
GdkMacosSurface *self = (GdkMacosSurface *)surface;
GdkSeat *seat;
gboolean was_mapped;
g_assert (GDK_IS_MACOS_SURFACE (self));
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
seat = gdk_display_get_default_seat (surface->display);
gdk_seat_ungrab (seat);
[self->window hide];
_gdk_surface_clear_update_area (surface);
if (was_mapped)
gdk_surface_freeze_updates (GDK_SURFACE (self));
}
static int
@@ -139,12 +133,12 @@ gdk_macos_surface_get_scale_factor (GdkSurface *surface)
return [self->window backingScaleFactor];
}
void
_gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
int top,
int right,
int bottom,
int left)
static void
gdk_macos_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom)
{
GdkMacosSurface *self = (GdkMacosSurface *)surface;
@@ -367,17 +361,6 @@ gdk_macos_surface_destroy (GdkSurface *surface,
GdkMacosSurface *self = (GdkMacosSurface *)surface;
GdkMacosWindow *window = g_steal_pointer (&self->window);
GdkFrameClock *frame_clock;
if ((frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
{
g_signal_handlers_disconnect_by_func (frame_clock,
G_CALLBACK (gdk_macos_surface_before_paint),
self);
g_signal_handlers_disconnect_by_func (frame_clock,
G_CALLBACK (gdk_macos_surface_before_paint),
self);
}
g_clear_pointer (&self->title, g_free);
@@ -491,6 +474,7 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
surface_class->hide = gdk_macos_surface_hide;
surface_class->set_input_region = gdk_macos_surface_set_input_region;
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
surface_class->set_shadow_width = gdk_macos_surface_set_shadow_width;
properties [PROP_NATIVE] =
g_param_spec_pointer ("native",
@@ -549,10 +533,7 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
}
if (ret != NULL)
{
gdk_surface_freeze_updates (GDK_SURFACE (ret));
_gdk_macos_surface_monitor_changed (ret);
}
_gdk_macos_surface_monitor_changed (ret);
g_object_unref (frame_clock);
@@ -762,7 +743,7 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
if (!was_mapped)
gdk_surface_set_is_mapped (GDK_SURFACE (self), TRUE);
gdk_synthesize_surface_state (GDK_SURFACE (self), GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (GDK_SURFACE (self)->display));
@@ -774,7 +755,6 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
{
_gdk_macos_surface_update_position (self);
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
gdk_surface_thaw_updates (GDK_SURFACE (self));
}
}

View File

@@ -96,14 +96,10 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
GdkGeometry geometry;
GdkSurfaceHints mask;
NSWindowStyleMask style_mask;
gboolean maximize;
gboolean fullscreen;
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
_gdk_macos_toplevel_surface_attach_to_parent (self);
style_mask = [nswindow styleMask];
monitor = gdk_display_get_monitor_at_surface (display, surface);
@@ -157,44 +153,27 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
if (style_mask != [nswindow styleMask])
[nswindow setStyleMask:style_mask];
if (size.shadow.is_valid)
{
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
size.shadow.top,
size.shadow.right,
size.shadow.bottom,
size.shadow.left);
}
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
_gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height);
/* Maximized state */
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
if (maximize)
_gdk_macos_toplevel_surface_maximize (self);
else
_gdk_macos_toplevel_surface_unmaximize (self);
}
if (gdk_toplevel_layout_get_maximized (layout))
_gdk_macos_toplevel_surface_maximize (self);
else
_gdk_macos_toplevel_surface_unmaximize (self);
/* Fullscreen state */
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
{
if (fullscreen)
_gdk_macos_toplevel_surface_fullscreen (self);
else
_gdk_macos_toplevel_surface_unfullscreen (self);
}
if (gdk_toplevel_layout_get_fullscreen (layout))
_gdk_macos_toplevel_surface_fullscreen (self);
else
_gdk_macos_toplevel_surface_unfullscreen (self);
if (GDK_SURFACE (self)->transient_for != NULL)
{
}
else
{
[nswindow setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];
if (!self->decorated &&
!GDK_MACOS_SURFACE (self)->did_initial_present &&
GDK_SURFACE (self)->x == 0 &&

View File

@@ -55,9 +55,9 @@ gdk_macos_deps = [
libgdk_c_args += ['-xobjective-c']
libgdk_macos = static_library('gdk-macos',
gdk_macos_sources, gdkconfig, gdkenum_h,
include_directories: [ confinc, gdkinc, ],
c_args: [ libgdk_c_args, common_cflags, ],
link_with: [],
dependencies: [ gdk_deps, gdk_macos_deps, ],
)
gdk_macos_sources, gdkconfig, gdkenum_h,
include_directories: [ confinc, gdkinc, ],
c_args: libgdk_c_args + common_cflags,
link_args: common_ldflags,
link_with: [],
dependencies: gdk_deps + gdk_macos_deps)

View File

@@ -112,39 +112,32 @@ gdk_private_h_sources = files([
'gdktoplevelsizeprivate.h',
])
gdk_gresource_xml = configure_file(output: 'gdk.gresource.xml',
input: 'gen-gdk-gresources-xml.py',
command: [
find_program('gen-gdk-gresources-xml.py'),
meson.current_source_dir(),
'@OUTPUT@',
],
)
gdk_gresource_xml = configure_file(output : 'gdk.gresource.xml',
input : 'gen-gdk-gresources-xml.py',
command : [find_program('gen-gdk-gresources-xml.py'),
meson.current_source_dir(), '@OUTPUT@'])
gdkresources = gnome.compile_resources('gdkresources',
gdk_gresource_xml,
source_dir: '.',
c_name: '_gdk',
extra_args: '--manual-register',
)
extra_args: '--manual-register')
gdk_headers = gdk_public_headers
gdk_enums = gnome.mkenums('gdkenumtypes',
sources: gdk_public_headers,
c_template: 'gdkenumtypes.c.template',
h_template: 'gdkenumtypes.h.template',
install_dir: gtk_includedir / 'gtk-4.0/gdk',
install_header: true,
)
c_template : 'gdkenumtypes.c.template',
h_template : 'gdkenumtypes.h.template',
install_dir: join_paths(gtk_includedir, 'gtk-4.0/gdk'),
install_header : true)
gdkenum_h = gdk_enums[1]
gdk_marshalers = gnome.genmarshal('gdkmarshalers',
sources: 'gdkmarshalers.list',
prefix: '_gdk_marshal',
valist_marshallers: true,
)
sources : 'gdkmarshalers.list',
prefix : '_gdk_marshal',
valist_marshallers : true)
gdkmarshal_h = gdk_marshalers[1]
@@ -157,11 +150,11 @@ gdkconfig_cdata.set('GDK_WINDOWING_MACOS', macos_enabled)
gdkconfig_cdata.set('GDK_RENDERING_VULKAN', have_vulkan)
gdkconfig = configure_file(
input: 'gdkconfig.h.meson',
output: 'gdkconfig.h',
configuration: gdkconfig_cdata,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
)
input : 'gdkconfig.h.meson',
output : 'gdkconfig.h',
configuration : gdkconfig_cdata,
install_dir: join_paths(gtk_includedir, 'gtk-4.0/gdk'))
gdkversion_cdata = configuration_data()
gdkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version)
@@ -169,11 +162,10 @@ gdkversion_cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
gdkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
gdkversionmacros = configure_file(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
input : 'gdkversionmacros.h.in',
output : 'gdkversionmacros.h',
configuration: gdkversion_cdata,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
)
install_dir: join_paths(gtk_includedir, 'gtk-4.0/gdk'))
gdkinc = include_directories('.')
gdkx11_inc = include_directories('x11')
@@ -259,7 +251,7 @@ libgdk = static_library('gdk',
include_directories: [confinc, gdkx11_inc, wlinc],
c_args: libgdk_c_args + common_cflags,
link_whole: gdk_backends,
)
link_args: common_ldflags)
# We don't have link_with: to internal static libs here on purpose, just
# list the dependencies and generated headers and such, for use in the
@@ -267,5 +259,4 @@ libgdk = static_library('gdk',
libgdk_dep = declare_dependency(
sources: ['gdk.h', gdkconfig, gdkenum_h],
include_directories: [confinc, gdkx11_inc, wlinc],
dependencies: gdk_deps + [libgtk_css_dep],
)
dependencies: gdk_deps + [libgtk_css_dep])

View File

@@ -5,8 +5,8 @@ wayland_cursor_sources = files([
])
libwayland_cursor = static_library('wayland+cursor',
sources: wayland_cursor_sources,
include_directories: [ confinc, ],
dependencies: [ glib_dep, wlclientdep, ],
c_args: common_cflags,
)
sources: wayland_cursor_sources,
include_directories: [ confinc, ],
dependencies: [ glib_dep, wlclientdep, ],
c_args: common_cflags,
link_args: common_ldflags)

View File

@@ -4502,7 +4502,7 @@ gdk_wayland_seat_grab (GdkSeat *seat,
if (prepare_func)
(prepare_func) (seat, surface, prepare_func_data);
if (!gdk_wayland_surface_has_surface (surface))
if (!gdk_surface_get_mapped (surface))
{
gdk_wayland_seat_set_grab_surface (wayland_seat, NULL);
return GDK_GRAB_NOT_VIEWABLE;

View File

@@ -96,7 +96,6 @@ void gdk_wayland_surface_sync (GdkSurface *surface);
void gdk_wayland_surface_commit (GdkSurface *surface);
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
void gdk_wayland_surface_request_frame (GdkSurface *surface);
gboolean gdk_wayland_surface_has_surface (GdkSurface *surface);
void gdk_wayland_surface_attach_image (GdkSurface *surface,
cairo_surface_t *cairo_surface,
const cairo_region_t *damage);

View File

@@ -122,11 +122,11 @@ struct _GdkWaylandSurface
gint64 pending_frame_counter;
guint32 scale;
int shadow_left;
int shadow_right;
int shadow_top;
int shadow_bottom;
gboolean shadow_dirty;
int margin_left;
int margin_right;
int margin_top;
int margin_bottom;
gboolean margin_dirty;
struct wl_output *initial_fullscreen_output;
@@ -162,7 +162,6 @@ struct _GdkWaylandSurface
int width;
int height;
GdkToplevelState state;
gboolean is_resizing;
} toplevel;
struct {
@@ -180,25 +179,6 @@ struct _GdkWaylandSurface
gboolean is_dirty;
} pending;
struct {
GdkToplevelState unset_flags;
GdkToplevelState set_flags;
} initial_state;
struct {
struct {
gboolean should_constrain;
gboolean size_is_fixed;
} toplevel;
struct {
int x;
int y;
} popup;
int configured_width;
int configured_height;
gboolean surface_geometry_dirty;
} next_layout;
uint32_t last_configure_serial;
int state_freeze_count;
@@ -284,17 +264,12 @@ static void gdk_wayland_surface_maybe_resize (GdkSurface *surface,
int height,
int scale);
static void gdk_wayland_surface_resize (GdkSurface *surface,
int width,
int height,
int scale);
static void gdk_wayland_surface_configure (GdkSurface *surface);
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandSurface *impl);
static void maybe_set_gtk_surface_modal (GdkSurface *surface);
static void gdk_wayland_surface_sync_shadow (GdkSurface *surface);
static void gdk_wayland_surface_sync_margin (GdkSurface *surface);
static void gdk_wayland_surface_sync_input_region (GdkSurface *surface);
static void gdk_wayland_surface_sync_opaque_region (GdkSurface *surface);
@@ -315,8 +290,6 @@ static void update_popup_layout_state (GdkSurface *surface,
static gboolean gdk_wayland_surface_is_exported (GdkWaylandSurface *impl);
static void configure_toplevel_geometry (GdkSurface *surface);
static void
gdk_wayland_surface_init (GdkWaylandSurface *impl)
{
@@ -363,11 +336,8 @@ _gdk_wayland_surface_save_size (GdkSurface *surface)
GDK_TOPLEVEL_STATE_TILED))
return;
if (surface->width <= 1 || surface->height <= 1)
return;
impl->saved_width = surface->width - impl->shadow_left - impl->shadow_right;
impl->saved_height = surface->height - impl->shadow_top - impl->shadow_bottom;
impl->saved_width = surface->width - impl->margin_left - impl->margin_right;
impl->saved_height = surface->height - impl->margin_top - impl->margin_bottom;
}
static void
@@ -612,59 +582,6 @@ on_frame_clock_before_paint (GdkFrameClock *clock,
*/
timings->predicted_presentation_time = timings->frame_time + refresh_interval / 2 + refresh_interval;
}
gdk_surface_apply_state_change (surface);
}
static void
configure_popup_geometry (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gdk_wayland_surface_move_resize (surface,
impl->next_layout.popup.x,
impl->next_layout.popup.y,
impl->next_layout.configured_width,
impl->next_layout.configured_height);
}
static void
configure_drag_surface_geometry (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gdk_wayland_surface_resize (surface,
impl->next_layout.configured_width,
impl->next_layout.configured_height,
impl->scale);
}
static gboolean
gdk_wayland_surface_compute_size (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (impl->next_layout.surface_geometry_dirty)
{
if (GDK_IS_TOPLEVEL (impl))
configure_toplevel_geometry (surface);
else if (GDK_IS_POPUP (impl))
configure_popup_geometry (surface);
else if (GDK_IS_DRAG_SURFACE (impl))
configure_drag_surface_geometry (surface);
impl->next_layout.surface_geometry_dirty = FALSE;
}
return FALSE;
}
static void
gdk_wayland_surface_request_layout (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
impl->next_layout.surface_geometry_dirty = TRUE;
}
void
@@ -686,14 +603,6 @@ gdk_wayland_surface_request_frame (GdkSurface *surface)
impl->awaiting_frame = TRUE;
}
gboolean
gdk_wayland_surface_has_surface (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
return !!impl->display_server.wl_surface;
}
void
gdk_wayland_surface_commit (GdkSurface *surface)
{
@@ -892,7 +801,7 @@ gdk_wayland_surface_attach_image (GdkSurface *surface,
void
gdk_wayland_surface_sync (GdkSurface *surface)
{
gdk_wayland_surface_sync_shadow (surface);
gdk_wayland_surface_sync_margin (surface);
gdk_wayland_surface_sync_opaque_region (surface);
gdk_wayland_surface_sync_input_region (surface);
}
@@ -1001,6 +910,16 @@ gdk_wayland_surface_resize (GdkSurface *surface,
{
gdk_wayland_surface_update_size (surface, width, height, scale);
_gdk_surface_update_size (surface);
if (is_realized_shell_surface (GDK_WAYLAND_SURFACE (surface)))
{
GdkDisplay *display;
GdkEvent *event;
event = gdk_configure_event_new (surface, width, height);
display = gdk_surface_get_display (surface);
_gdk_wayland_display_deliver_event (display, event);
}
}
static void gdk_wayland_surface_show (GdkSurface *surface,
@@ -1150,10 +1069,10 @@ gdk_wayland_surface_get_window_geometry (GdkSurface *surface,
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
*geometry = (GdkRectangle) {
.x = impl->shadow_left,
.y = impl->shadow_top,
.width = surface->width - (impl->shadow_left + impl->shadow_right),
.height = surface->height - (impl->shadow_top + impl->shadow_bottom)
.x = impl->margin_left,
.y = impl->margin_top,
.width = surface->width - (impl->margin_left + impl->margin_right),
.height = surface->height - (impl->margin_top + impl->margin_bottom)
};
}
@@ -1162,7 +1081,7 @@ static void gdk_wayland_surface_set_geometry_hints (GdkWaylandSurface *impl,
GdkSurfaceHints geom_mask);
static void
gdk_wayland_surface_sync_shadow (GdkSurface *surface)
gdk_wayland_surface_sync_margin (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandDisplay *display_wayland =
@@ -1336,7 +1255,7 @@ gdk_wayland_surface_create_surface (GdkSurface *surface)
}
static void
configure_toplevel_geometry (GdkSurface *surface)
configure_surface_geometry (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
@@ -1344,6 +1263,7 @@ configure_toplevel_geometry (GdkSurface *surface)
GdkRectangle monitor_geometry;
int bounds_width, bounds_height;
GdkToplevelSize size;
int width, height;
GdkToplevelLayout *layout;
GdkGeometry geometry;
GdkSurfaceHints mask;
@@ -1356,8 +1276,10 @@ configure_toplevel_geometry (GdkSurface *surface)
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
g_warn_if_fail (size.width > 0);
g_warn_if_fail (size.height > 0);
width = size.width;
height = size.height;
g_warn_if_fail (width > 0);
g_warn_if_fail (height > 0);
layout = impl->toplevel.layout;
if (gdk_toplevel_layout_get_resizable (layout))
@@ -1368,71 +1290,13 @@ configure_toplevel_geometry (GdkSurface *surface)
}
else
{
geometry.max_width = geometry.min_width = size.width;
geometry.max_height = geometry.min_height = size.height;
geometry.max_width = geometry.min_width = width;
geometry.max_height = geometry.min_height = height;
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
}
gdk_wayland_surface_set_geometry_hints (impl, &geometry, mask);
if (size.shadow.is_valid)
{
impl->shadow_left = size.shadow.left;
impl->shadow_right = size.shadow.right;
impl->shadow_top = size.shadow.top;
impl->shadow_bottom = size.shadow.bottom;
}
if (impl->next_layout.configured_width > 0 &&
impl->next_layout.configured_height > 0)
{
int width, height;
width = impl->next_layout.configured_width +
impl->shadow_left + impl->shadow_right;
height = impl->next_layout.configured_height +
impl->shadow_top + impl->shadow_bottom;
if (impl->next_layout.toplevel.should_constrain)
{
gdk_surface_constrain_size (&impl->geometry_hints,
impl->geometry_mask,
width, height,
&width, &height);
}
gdk_wayland_surface_resize (surface, width, height, impl->scale);
if (!impl->next_layout.toplevel.size_is_fixed)
{
impl->next_layout.toplevel.should_constrain = FALSE;
impl->next_layout.configured_width = 0;
impl->next_layout.configured_height = 0;
}
}
else
{
int width, height;
width = size.width;
height = size.height;
gdk_surface_constrain_size (&geometry, mask,
width, height,
&width, &height);
gdk_wayland_surface_resize (surface, width, height, impl->scale);
}
}
static void
synthesize_initial_surface_state (GdkSurface *surface,
GdkToplevelState unset_flags,
GdkToplevelState set_flags)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
impl->initial_state.unset_flags |= unset_flags;
impl->initial_state.set_flags &= ~unset_flags;
impl->initial_state.set_flags |= set_flags;
impl->initial_state.unset_flags &= ~set_flags;
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
gdk_wayland_surface_resize (surface, width, height, impl->scale);
}
static void
@@ -1443,21 +1307,16 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkToplevelState new_state;
int width, height;
gboolean is_resizing;
gboolean fixed_size;
gboolean saved_size;
new_state = impl->pending.toplevel.state;
impl->pending.toplevel.state = 0;
is_resizing = impl->pending.toplevel.is_resizing;
impl->pending.toplevel.is_resizing = FALSE;
fixed_size =
new_state & (GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_TILED) ||
is_resizing;
GDK_TOPLEVEL_STATE_TILED);
width = impl->pending.toplevel.width;
height = impl->pending.toplevel.height;
@@ -1479,37 +1338,34 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
if (width > 0 && height > 0)
{
GdkSurfaceHints geometry_mask = impl->geometry_mask;
if (!saved_size)
{
impl->next_layout.toplevel.should_constrain = TRUE;
/* Do not reapply constrains if we are restoring original size */
gdk_surface_constrain_size (&impl->geometry_hints,
geometry_mask,
width + impl->margin_left + impl->margin_right,
height + impl->margin_top + impl->margin_bottom,
&width,
&height);
/* Save size for next time we get 0x0 */
_gdk_wayland_surface_save_size (surface);
}
else if (is_resizing)
{
impl->next_layout.toplevel.should_constrain = TRUE;
}
else
{
impl->next_layout.toplevel.should_constrain = FALSE;
width += impl->margin_left + impl->margin_right;
height += impl->margin_top + impl->margin_bottom;
}
impl->next_layout.toplevel.size_is_fixed = fixed_size;
impl->next_layout.configured_width = width;
impl->next_layout.configured_height = height;
gdk_wayland_surface_resize (surface, width, height, impl->scale);
}
else
{
impl->next_layout.toplevel.should_constrain = FALSE;
impl->next_layout.toplevel.size_is_fixed = FALSE;
impl->next_layout.configured_width = 0;
impl->next_layout.configured_height = 0;
configure_surface_geometry (surface);
}
impl->next_layout.surface_geometry_dirty = TRUE;
gdk_surface_request_layout (surface);
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("configure, surface %p %dx%d,%s%s%s%s",
surface, width, height,
@@ -1518,7 +1374,7 @@ gdk_wayland_surface_configure_toplevel (GdkSurface *surface)
(new_state & GDK_TOPLEVEL_STATE_FOCUSED) ? " focused" : "",
(new_state & GDK_TOPLEVEL_STATE_TILED) ? " tiled" : ""));
gdk_surface_queue_state_change (surface, ~0 & ~new_state, new_state);
gdk_surface_set_state (surface, new_state);
switch (display_wayland->shell_variant)
{
@@ -1539,7 +1395,6 @@ static void
gdk_wayland_surface_configure_popup (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (surface->parent);
int x, y, width, height;
if (impl->display_server.xdg_popup)
@@ -1579,30 +1434,18 @@ gdk_wayland_surface_configure_popup (GdkSurface *surface)
width = impl->pending.popup.width;
height = impl->pending.popup.height;
x += parent_impl->shadow_left;
y += parent_impl->shadow_top;
gdk_wayland_surface_resize (surface, width, height, impl->scale);
update_popup_layout_state (surface,
x, y,
width, height,
impl->popup.layout);
impl->next_layout.popup.x = x;
impl->next_layout.popup.y = y;
impl->next_layout.configured_width = width;
impl->next_layout.configured_height = height;
impl->next_layout.surface_geometry_dirty = TRUE;
gdk_surface_request_layout (surface);
}
if (!impl->pending.popup.has_repositioned_token &&
!impl->pending.is_initial_configure)
g_signal_emit_by_name (surface, "popup-layout-changed");
static void
maybe_notify_mapped (GdkSurface *surface)
{
if (surface->destroyed)
return;
if (!GDK_SURFACE_IS_MAPPED (surface))
gdk_surface_set_is_mapped (surface, TRUE);
gdk_surface_invalidate_rect (surface, NULL);
}
static void
@@ -1615,7 +1458,6 @@ gdk_wayland_surface_configure (GdkSurface *surface)
gdk_surface_thaw_updates (surface);
impl->initial_configure_received = TRUE;
impl->pending.is_initial_configure = TRUE;
maybe_notify_mapped (surface);
}
impl->has_uncommitted_ack_configure = TRUE;
@@ -1697,12 +1539,9 @@ xdg_toplevel_configure (void *data,
struct wl_array *states)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
uint32_t *p;
GdkToplevelState pending_state = 0;
impl->pending.toplevel.is_resizing = FALSE;
wl_array_for_each (p, states)
{
uint32_t state = *p;
@@ -1719,7 +1558,6 @@ xdg_toplevel_configure (void *data,
pending_state |= GDK_TOPLEVEL_STATE_FOCUSED;
break;
case XDG_TOPLEVEL_STATE_RESIZING:
impl->pending.toplevel.is_resizing = TRUE;
break;
default:
/* Unknown state */
@@ -1790,12 +1628,9 @@ zxdg_toplevel_v6_configure (void *data,
struct wl_array *states)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
uint32_t *p;
GdkToplevelState pending_state = 0;
impl->pending.toplevel.is_resizing = FALSE;
wl_array_for_each (p, states)
{
uint32_t state = *p;
@@ -1812,7 +1647,6 @@ zxdg_toplevel_v6_configure (void *data,
pending_state |= GDK_TOPLEVEL_STATE_FOCUSED;
break;
case ZXDG_TOPLEVEL_V6_STATE_RESIZING:
impl->pending.toplevel.is_resizing = TRUE;
break;
default:
/* Unknown state */
@@ -1930,20 +1764,20 @@ gdk_wayland_surface_create_xdg_toplevel (GdkSurface *surface)
switch (display_wayland->shell_variant)
{
case GDK_WAYLAND_SHELL_VARIANT_XDG_SHELL:
if (impl->initial_state.set_flags & GDK_TOPLEVEL_STATE_MAXIMIZED)
if (surface->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
xdg_toplevel_set_maximized (impl->display_server.xdg_toplevel);
if (impl->initial_state.set_flags & GDK_TOPLEVEL_STATE_MINIMIZED)
if (surface->state & GDK_TOPLEVEL_STATE_MINIMIZED)
xdg_toplevel_set_minimized (impl->display_server.xdg_toplevel);
if (impl->initial_state.set_flags & GDK_TOPLEVEL_STATE_FULLSCREEN)
if (surface->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
xdg_toplevel_set_fullscreen (impl->display_server.xdg_toplevel,
impl->initial_fullscreen_output);
break;
case GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6:
if (impl->initial_state.set_flags & GDK_TOPLEVEL_STATE_MAXIMIZED)
if (surface->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
zxdg_toplevel_v6_set_maximized (impl->display_server.zxdg_toplevel_v6);
if (impl->initial_state.set_flags & GDK_TOPLEVEL_STATE_MINIMIZED)
if (surface->state & GDK_TOPLEVEL_STATE_MINIMIZED)
zxdg_toplevel_v6_set_minimized (impl->display_server.zxdg_toplevel_v6);
if (impl->initial_state.set_flags & GDK_TOPLEVEL_STATE_FULLSCREEN)
if (surface->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
zxdg_toplevel_v6_set_fullscreen (impl->display_server.zxdg_toplevel_v6,
impl->initial_fullscreen_output);
break;
@@ -2264,9 +2098,9 @@ calculate_popup_rect (GdkSurface *surface,
int x = 0, y = 0;
width = (impl->popup.unconstrained_width -
(impl->shadow_left + impl->shadow_right));
(impl->margin_left + impl->margin_right));
height = (impl->popup.unconstrained_height -
(impl->shadow_top + impl->shadow_bottom));
(impl->margin_top + impl->margin_bottom));
anchor_rect = *gdk_popup_layout_get_anchor_rect (layout);
gdk_popup_layout_get_offset (layout, &dx, &dy);
@@ -2367,12 +2201,26 @@ update_popup_layout_state (GdkSurface *surface,
int height,
GdkPopupLayout *layout)
{
int surface_x, surface_y;
int surface_width, surface_height;
GdkRectangle best_rect;
GdkRectangle flipped_rect;
GdkGravity rect_anchor;
GdkGravity surface_anchor;
GdkAnchorHints anchor_hints;
x += surface->parent->shadow_left;
y += surface->parent->shadow_top;
surface_x = x;
surface_y = y;
surface_width = width + surface->shadow_left + surface->shadow_right;
surface_height = height + surface->shadow_top + surface->shadow_bottom;
gdk_wayland_surface_move_resize (surface,
surface_x, surface_y,
surface_width, surface_height);
rect_anchor = gdk_popup_layout_get_rect_anchor (layout);
surface_anchor = gdk_popup_layout_get_surface_anchor (layout);
anchor_hints = gdk_popup_layout_get_anchor_hints (layout);
@@ -2452,7 +2300,6 @@ create_dynamic_positioner (GdkSurface *surface,
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkSurface *parent = surface->parent;
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (parent);
GdkWaylandDisplay *display =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
GdkRectangle geometry;
@@ -2467,15 +2314,15 @@ create_dynamic_positioner (GdkSurface *surface,
GdkAnchorHints anchor_hints;
geometry = (GdkRectangle) {
.x = impl->shadow_left,
.y = impl->shadow_top,
.width = width - (impl->shadow_left + impl->shadow_right),
.height = height - (impl->shadow_top + impl->shadow_bottom),
.x = impl->margin_left,
.y = impl->margin_top,
.width = width - (impl->margin_left + impl->margin_right),
.height = height - (impl->margin_top + impl->margin_bottom),
};
anchor_rect = gdk_popup_layout_get_anchor_rect (layout);
real_anchor_rect_x = anchor_rect->x - parent_impl->shadow_left;
real_anchor_rect_y = anchor_rect->y - parent_impl->shadow_top;
real_anchor_rect_x = anchor_rect->x - parent->shadow_left;
real_anchor_rect_y = anchor_rect->y - parent->shadow_top;
anchor_rect_width = MAX (anchor_rect->width, 1);
anchor_rect_height = MAX (anchor_rect->height, 1);
@@ -2534,13 +2381,14 @@ create_dynamic_positioner (GdkSurface *surface,
xdg_positioner_get_version (positioner) >=
XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION)
{
GdkWaylandSurface *parent_impl = GDK_WAYLAND_SURFACE (parent);
int parent_width;
int parent_height;
parent_width = parent->width - (parent_impl->shadow_left +
parent_impl->shadow_right);
parent_height = parent->height - (parent_impl->shadow_top +
parent_impl->shadow_bottom);
parent_width = parent->width - (parent_impl->margin_left +
parent_impl->margin_right);
parent_height = parent->height - (parent_impl->margin_top +
parent_impl->margin_bottom);
xdg_positioner_set_parent_size (positioner,
parent_width,
@@ -2959,12 +2807,6 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface)
unset_transient_for_exported (surface);
impl->last_sent_window_geometry = (GdkRectangle) { 0 };
impl->last_sent_min_width = 0;
impl->last_sent_min_height = 0;
impl->last_sent_max_width = 0;
impl->last_sent_max_height = 0;
_gdk_wayland_surface_clear_saved_size (surface);
impl->mapped = FALSE;
}
@@ -3140,6 +2982,8 @@ gdk_wayland_surface_map_popup (GdkSurface *surface,
impl->popup.unconstrained_width = width;
impl->popup.unconstrained_height = height;
impl->mapped = TRUE;
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
}
static void
@@ -3566,9 +3410,9 @@ gdk_wayland_surface_set_geometry_hints (GdkWaylandSurface *impl,
if (geom_mask & GDK_HINT_MIN_SIZE)
{
min_width = MAX (0, (geometry->min_width -
(impl->shadow_left + impl->shadow_right)));
(impl->margin_left + impl->margin_right)));
min_height = MAX (0, (geometry->min_height -
(impl->shadow_top + impl->shadow_bottom)));
(impl->margin_top + impl->margin_bottom)));
}
else
{
@@ -3579,9 +3423,9 @@ gdk_wayland_surface_set_geometry_hints (GdkWaylandSurface *impl,
if (geom_mask & GDK_HINT_MAX_SIZE)
{
max_width = MAX (0, (geometry->max_width -
(impl->shadow_left + impl->shadow_right)));
(impl->margin_left + impl->margin_right)));
max_height = MAX (0, (geometry->max_height -
(impl->shadow_top + impl->shadow_bottom)));
(impl->margin_top + impl->margin_bottom)));
}
else
{
@@ -3764,7 +3608,7 @@ gdk_wayland_surface_maximize (GdkSurface *surface)
}
else
{
synthesize_initial_surface_state (surface, 0, GDK_TOPLEVEL_STATE_MAXIMIZED);
gdk_synthesize_surface_state (surface, 0, GDK_TOPLEVEL_STATE_MAXIMIZED);
}
}
@@ -3795,7 +3639,7 @@ gdk_wayland_surface_unmaximize (GdkSurface *surface)
}
else
{
synthesize_initial_surface_state (surface, GDK_TOPLEVEL_STATE_MAXIMIZED, 0);
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_MAXIMIZED, 0);
}
}
@@ -3832,7 +3676,7 @@ gdk_wayland_surface_fullscreen_on_monitor (GdkSurface *surface,
}
else
{
synthesize_initial_surface_state (surface, 0, GDK_TOPLEVEL_STATE_FULLSCREEN);
gdk_synthesize_surface_state (surface, 0, GDK_TOPLEVEL_STATE_FULLSCREEN);
impl->initial_fullscreen_output = output;
}
}
@@ -3870,7 +3714,7 @@ gdk_wayland_surface_fullscreen (GdkSurface *surface)
}
else
{
synthesize_initial_surface_state (surface, 0, GDK_TOPLEVEL_STATE_FULLSCREEN);
gdk_synthesize_surface_state (surface, 0, GDK_TOPLEVEL_STATE_FULLSCREEN);
}
}
@@ -3903,7 +3747,7 @@ gdk_wayland_surface_unfullscreen (GdkSurface *surface)
}
else
{
synthesize_initial_surface_state (surface, GDK_TOPLEVEL_STATE_FULLSCREEN, 0);
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_FULLSCREEN, 0);
}
}
@@ -4077,6 +3921,34 @@ gdk_wayland_surface_set_opaque_region (GdkSurface *surface,
impl->opaque_region_dirty = TRUE;
}
static void
gdk_wayland_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
int new_width, new_height;
if (GDK_SURFACE_DESTROYED (surface))
return;
/* Reconfigure surface to keep the same surface geometry */
new_width = surface->width -
(impl->margin_left + impl->margin_right) + (left + right);
new_height = surface->height -
(impl->margin_top + impl->margin_bottom) + (top + bottom);
gdk_wayland_surface_maybe_resize (surface,
new_width, new_height,
impl->scale);
impl->margin_left = left;
impl->margin_right = right;
impl->margin_top = top;
impl->margin_bottom = bottom;
}
static gboolean
gdk_wayland_surface_show_window_menu (GdkSurface *surface,
GdkEvent *event)
@@ -4161,9 +4033,8 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
impl_class->drag_begin = _gdk_wayland_surface_drag_begin;
impl_class->get_scale_factor = gdk_wayland_surface_get_scale_factor;
impl_class->set_opaque_region = gdk_wayland_surface_set_opaque_region;
impl_class->set_shadow_width = gdk_wayland_surface_set_shadow_width;
impl_class->create_gl_context = gdk_wayland_surface_create_gl_context;
impl_class->request_layout = gdk_wayland_surface_request_layout;
impl_class->compute_size = gdk_wayland_surface_compute_size;
}
void
@@ -4866,53 +4737,97 @@ gdk_wayland_toplevel_class_init (GdkWaylandToplevelClass *class)
}
static void
show_surface (GdkSurface *surface)
{
gboolean was_mapped;
if (surface->destroyed)
return;
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_wayland_surface_show (surface, FALSE);
if (!was_mapped)
gdk_surface_invalidate_rect (surface, NULL);
}
static void
reconfigure_callback (void *data,
struct wl_callback *callback,
uint32_t time)
{
gboolean *done = (gboolean *) data;
*done = TRUE;
}
static const struct wl_callback_listener reconfigure_listener = {
reconfigure_callback
};
static gboolean
gdk_wayland_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gboolean pending_configure = FALSE;
gboolean maximize;
gboolean fullscreen;
GdkWaylandDisplay *display_wayland;
struct wl_callback *callback;
gboolean done = FALSE;
int last_configure_serial = impl->last_configure_serial;
gboolean needs_reconfigure = TRUE;
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
if (gdk_toplevel_layout_get_maximized (layout))
{
if (maximize)
gdk_wayland_surface_maximize (surface);
else
gdk_wayland_surface_unmaximize (surface);
pending_configure = TRUE;
gdk_wayland_surface_maximize (surface);
needs_reconfigure = FALSE;
}
else
{
gdk_wayland_surface_unmaximize (surface);
}
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
if (gdk_toplevel_layout_get_fullscreen (layout))
{
if (fullscreen)
{
GdkMonitor *monitor;
monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
if (monitor)
gdk_wayland_surface_fullscreen_on_monitor (surface, monitor);
else
gdk_wayland_surface_fullscreen (surface);
}
GdkMonitor *monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
if (monitor)
gdk_wayland_surface_fullscreen_on_monitor (surface, monitor);
else
{
gdk_wayland_surface_unfullscreen (surface);
}
pending_configure = TRUE;
gdk_wayland_surface_fullscreen (surface);
needs_reconfigure = FALSE;
}
else
gdk_wayland_surface_unfullscreen (surface);
g_clear_pointer (&impl->toplevel.layout, gdk_toplevel_layout_unref);
impl->toplevel.layout = gdk_toplevel_layout_copy (layout);
gdk_wayland_surface_show (surface, FALSE);
show_surface (surface);
if (!pending_configure)
{
impl->next_layout.surface_geometry_dirty = TRUE;
gdk_surface_request_layout (surface);
}
display_wayland = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
callback = wl_display_sync (display_wayland->wl_display);
wl_proxy_set_queue ((struct wl_proxy *) callback, impl->event_queue);
wl_callback_add_listener (callback,
&reconfigure_listener,
&done);
while (is_realized_toplevel (impl) &&
(!impl->initial_configure_received || !done))
wl_display_dispatch_queue (display_wayland->wl_display, impl->event_queue);
wl_callback_destroy (callback);
if (needs_reconfigure &&
last_configure_serial == impl->last_configure_serial &&
!(surface->state & (GDK_TOPLEVEL_STATE_MAXIMIZED |
GDK_TOPLEVEL_STATE_FULLSCREEN |
GDK_TOPLEVEL_STATE_TILED)))
configure_surface_geometry (surface);
return TRUE;
}
static gboolean
@@ -5046,14 +4961,8 @@ gdk_wayland_drag_surface_present (GdkDragSurface *drag_surface,
GdkSurface *surface = GDK_SURFACE (drag_surface);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gdk_wayland_surface_show (surface, FALSE);
impl->next_layout.configured_width = width;
impl->next_layout.configured_height = height;
impl->next_layout.surface_geometry_dirty = TRUE;
gdk_surface_request_layout (surface);
maybe_notify_mapped (surface);
gdk_wayland_surface_resize (surface, width, height, impl->scale);
show_surface (surface);
return TRUE;
}

View File

@@ -77,38 +77,31 @@ foreach p: proto_sources
endif
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
input: input,
output: '@0@-client-protocol.h'.format(output_base),
command: [
wayland_scanner,
'client-header',
'@INPUT@', '@OUTPUT@',
],
)
input: input,
output: '@0@-client-protocol.h'.format(output_base),
command: [
wayland_scanner,
'client-header',
'@INPUT@', '@OUTPUT@',
])
gdk_wayland_sources += custom_target('@0@ source'.format(output_base),
input: input,
output: '@0@-protocol.c'.format(output_base),
command: [
wayland_scanner,
'private-code',
'@INPUT@', '@OUTPUT@',
],
)
input: input,
output: '@0@-protocol.c'.format(output_base),
command: [
wayland_scanner,
'private-code',
'@INPUT@', '@OUTPUT@',
])
endforeach
libgdk_wayland = static_library('gdk-wayland',
sources: [
gdk_wayland_sources,
gdk_wayland_gen_headers,
gdkconfig,
gdkenum_h,
],
include_directories: [ confinc, gdkinc, ],
c_args: [
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
] + common_cflags,
link_with: [ libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps ],
)
gdk_wayland_sources, gdk_wayland_gen_headers, gdkconfig, gdkenum_h,
include_directories: [ confinc, gdkinc, ],
c_args: [
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
] + common_cflags,
link_args: common_ldflags,
link_with: [libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps])

View File

@@ -562,6 +562,7 @@ event_mask_string (GdkEventMask mask)
BIT (VISIBILITY_NOTIFY);
BIT (PROXIMITY_IN);
BIT (PROXIMITY_OUT);
BIT (SUBSTRUCTURE);
BIT (SCROLL);
#undef BIT
@@ -1277,6 +1278,35 @@ _gdk_win32_get_window_rect (GdkSurface *window,
return !impl->inhibit_configure;
}
void
_gdk_win32_do_emit_configure_event (GdkSurface *surface,
RECT rect)
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
impl->unscaled_width = rect.right - rect.left;
impl->unscaled_height = rect.bottom - rect.top;
surface->width = (impl->unscaled_width + impl->surface_scale - 1) / impl->surface_scale;
surface->height = (impl->unscaled_height + impl->surface_scale - 1) / impl->surface_scale;
surface->x = rect.left / impl->surface_scale;
surface->y = rect.top / impl->surface_scale;
_gdk_surface_update_size (surface);
g_signal_emit_by_name (surface, "size-changed", surface->width, surface->height);
}
void
_gdk_win32_emit_configure_event (GdkSurface *surface)
{
RECT rect;
if (!_gdk_win32_get_window_rect (surface, &rect))
return;
_gdk_win32_do_emit_configure_event (surface, rect);
}
cairo_region_t *
_gdk_win32_hrgn_to_region (HRGN hrgn,
guint scale)
@@ -2066,8 +2096,8 @@ gdk_event_translate (MSG *msg,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
keycode,
state,
keycode,
is_modifier,
&translated,
&translated);
@@ -2140,8 +2170,8 @@ gdk_event_translate (MSG *msg,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
build_key_event_state (key_state),
0,
FALSE,
&translated,
&translated);
@@ -2153,8 +2183,8 @@ gdk_event_translate (MSG *msg,
window,
device_manager_win32->core_keyboard,
_gdk_win32_get_next_tick (msg->time),
0,
build_key_event_state (key_state),
0,
FALSE,
&translated,
&translated);
@@ -2825,6 +2855,11 @@ gdk_event_translate (MSG *msg,
set_bits = 0;
unset_bits = 0;
if (IsWindowVisible (msg->hwnd))
unset_bits |= GDK_TOPLEVEL_STATE_WITHDRAWN;
else
set_bits |= GDK_TOPLEVEL_STATE_WITHDRAWN;
if (IsIconic (msg->hwnd))
set_bits |= GDK_TOPLEVEL_STATE_MINIMIZED;
else
@@ -2835,7 +2870,6 @@ gdk_event_translate (MSG *msg,
else
unset_bits |= GDK_TOPLEVEL_STATE_MAXIMIZED;
gdk_surface_set_is_mapped (window, !!IsWindowVisible (msg->hwnd));
gdk_synthesize_surface_state (window, unset_bits, set_bits);
new_state = window->state;
@@ -2856,7 +2890,7 @@ gdk_event_translate (MSG *msg,
{
if (!IsIconic (msg->hwnd) &&
!GDK_SURFACE_DESTROYED (window))
gdk_surface_request_layout (window);
_gdk_win32_emit_configure_event (window);
}
if ((windowpos->flags & SWP_HIDEWINDOW) &&

View File

@@ -274,6 +274,11 @@ _gdk_win32_surface_state_to_string (GdkToplevelState state)
if (state & GDK_TOPLEVEL_STATE_ ## x) \
(bufp += sprintf (bufp, "%s" #x, s), s = "|")
/* For clarity, also show the complement of WITHDRAWN, i.e. "MAPPED" */
if (!(state & GDK_TOPLEVEL_STATE_WITHDRAWN))
(bufp += sprintf (bufp, "MAPPED"), s = "|");
BIT (WITHDRAWN);
BIT (MINIMIZED);
BIT (MAXIMIZED);
BIT (STICKY);

View File

@@ -407,6 +407,7 @@ GdkSurface *gdk_win32_display_get_root_window (GdkDisplay *display);
/* Distributed display manager implementation */
GdkDisplay *_gdk_win32_display_open (const char *display_name);
void _gdk_win32_append_event (GdkEvent *event);
void _gdk_win32_emit_configure_event (GdkSurface *window);
guint32 _gdk_win32_keymap_get_decimal_mark (GdkWin32Keymap *keymap);

View File

@@ -1006,7 +1006,9 @@ gdk_win32_surface_hide (GdkSurface *window)
_gdk_win32_surface_state_to_string (window->state)));
if (GDK_SURFACE_IS_MAPPED (window))
gdk_surface_set_is_mapped (window, FALSE);
gdk_synthesize_surface_state (window,
0,
GDK_TOPLEVEL_STATE_WITHDRAWN);
_gdk_surface_clear_update_area (window);
@@ -1188,7 +1190,7 @@ gdk_win32_surface_move_resize_internal (GdkSurface *window,
out:
surface->inhibit_configure = FALSE;
gdk_surface_request_layout (window);
_gdk_win32_emit_configure_event (window);
}
void
@@ -1215,7 +1217,6 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
int height,
GdkPopupLayout *layout)
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle final_rect;
@@ -1228,10 +1229,6 @@ gdk_win32_surface_layout_popup (GdkSurface *surface,
gdk_surface_layout_popup_helper (surface,
width,
height,
impl->margins.left,
impl->margins.right,
impl->margins.top,
impl->margins.bottom,
monitor,
&bounds,
layout,
@@ -1260,7 +1257,7 @@ static void
show_popup (GdkSurface *surface)
{
gdk_win32_surface_raise (surface);
gdk_surface_set_is_mapped (surface, TRUE);
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
show_window_internal (surface, FALSE, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -4016,7 +4013,7 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
rect.bottom != new_rect.bottom))
{
context->native_move_resize_pending = TRUE;
gdk_surface_request_layout (window);
_gdk_win32_do_emit_configure_event (window, new_rect);
}
else if (context->op == GDK_WIN32_DRAGOP_MOVE &&
(rect.left != new_rect.left ||
@@ -4024,7 +4021,7 @@ gdk_win32_surface_do_move_resize_drag (GdkSurface *window,
{
context->native_move_resize_pending = FALSE;
gdk_surface_request_layout (window);
_gdk_win32_do_emit_configure_event (window, new_rect);
if (impl->layered)
{
@@ -4618,6 +4615,8 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
//impl_class->beep = gdk_x11_surface_beep;
impl_class->set_shadow_width = gdk_win32_surface_set_shadow_width;
impl_class->destroy_notify = gdk_win32_surface_destroy_notify;
impl_class->drag_begin = _gdk_win32_surface_drag_begin;
impl_class->create_gl_context = _gdk_win32_surface_create_gl_context;
@@ -4922,7 +4921,7 @@ show_surface (GdkSurface *surface)
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (!was_mapped)
gdk_surface_set_is_mapped (surface, TRUE);
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_win32_surface_show (surface, FALSE);
@@ -4942,8 +4941,6 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
int width, height;
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean maximize;
gboolean fullscreen;
monitor = gdk_display_get_monitor_at_surface (display, surface);
if (monitor)
@@ -4983,33 +4980,18 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
gdk_win32_surface_resize (surface, width, height);
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
if (maximize)
gdk_win32_surface_maximize (surface);
else
gdk_win32_surface_unmaximize (surface);
}
if (gdk_toplevel_layout_get_maximized (layout))
gdk_win32_surface_maximize (surface);
else
gdk_win32_surface_unmaximize (surface);
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
{
if (fullscreen)
gdk_win32_surface_fullscreen (surface);
else
gdk_win32_surface_unfullscreen (surface);
}
if (gdk_toplevel_layout_get_fullscreen (layout))
gdk_win32_surface_fullscreen (surface);
else
gdk_win32_surface_unfullscreen (surface);
show_surface (surface);
if (size.shadow.is_valid)
{
gdk_win32_surface_set_shadow_width (surface,
size.shadow.left,
size.shadow.right,
size.shadow.top,
size.shadow.bottom);
}
return TRUE;
}

View File

@@ -50,16 +50,11 @@ if win32_has_egl
endif
gdk_win32_deps = [ # FIXME
pangowin32_dep
pangowin32_dep
]
libgdk_win32 = static_library('gdk-win32',
gdk_win32_sources, gdkconfig, gdkenum_h,
include_directories: [ confinc, gdkinc ],
c_args: [
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
'-DINSIDE_GDK_WIN32',
] + GDK_WIN32_EGL_CFLAGS,
dependencies: [ gdk_deps, gdk_win32_deps ],
)
include_directories: [confinc, gdkinc],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', '-DINSIDE_GDK_WIN32'] + GDK_WIN32_EGL_CFLAGS,
dependencies: [gdk_deps, gdk_win32_deps])

View File

@@ -1,40 +1,9 @@
/* gdkdevice-xi2-private.h: Private header for GdkX11DeviceXI2
*
* Copyright 2020 Red Hat
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_DEVICE_XI2_PRIVATE_H__
#define __GDK_DEVICE_XI2_PRIVATE_H__
#include "gdkx11device-xi2.h"
G_BEGIN_DECLS
void gdk_x11_device_xi2_query_state (GdkDevice *device,
GdkSurface *surface,
double *win_x,
double *win_y,
GdkModifierType *mask);
GdkX11DeviceType gdk_x11_device_xi2_get_device_type (GdkX11DeviceXI2 *device);
void gdk_x11_device_xi2_set_device_type (GdkX11DeviceXI2 *device,
GdkX11DeviceType type);
G_END_DECLS
#endif

View File

@@ -18,8 +18,8 @@
#include "config.h"
#include "gdkx11devicemanager-xi2.h"
#include "gdkx11device-xi2.h"
#include "gdkdevice-xi2-private.h"
#include "gdkdeviceprivate.h"
#include "gdkdevicetoolprivate.h"
#include "gdkdisplayprivate.h"
@@ -1716,49 +1716,19 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
scroll_valuators_changed (GDK_X11_DEVICE_XI2 (source_device),
&xev->valuators, &delta_x, &delta_y))
{
GdkModifierType state;
GDK_DISPLAY_NOTE (display, EVENTS,
g_message ("smooth scroll: \n\tdevice: %u\n\tsource device: %u\n\twindow %ld\n\tdeltas: %f %f",
xev->deviceid, xev->sourceid,
xev->event, delta_x, delta_y));
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
if (gdk_device_get_source (source_device) != GDK_SOURCE_TOUCHPAD &&
((delta_x == 0.0 && ABS (delta_y) == 1.0) ||
(ABS (delta_x) == 1.0 && delta_y == 0.0)))
{
GdkScrollDirection direction;
if (delta_x > 0)
direction = GDK_SCROLL_RIGHT;
else if (delta_x < 0)
direction = GDK_SCROLL_LEFT;
else if (delta_y > 0)
direction = GDK_SCROLL_DOWN;
else
direction = GDK_SCROLL_UP;
event = gdk_scroll_event_new_discrete (surface,
device,
NULL,
xev->time,
state,
direction,
FALSE);
}
else
{
event = gdk_scroll_event_new (surface,
device,
NULL,
xev->time,
state,
delta_x,
delta_y,
delta_x == 0.0 && delta_y == 0.0);
}
event = gdk_scroll_event_new (surface,
device,
NULL,
xev->time,
_gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group),
delta_x,
delta_y,
delta_x == 0.0 && delta_y == 0.0);
break;
}

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