Compare commits
2 Commits
path-ops2
...
css-border
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1e6e8e2a7 | ||
|
|
61756ab39d |
@@ -207,7 +207,9 @@ msys2-mingw64:
|
|||||||
|
|
||||||
macos-x86_64:
|
macos-x86_64:
|
||||||
rules:
|
rules:
|
||||||
# Do not run in forks as the runner is not available there.
|
# run merge request pipelines
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
# do not run in forks
|
||||||
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
- if: $CI_PROJECT_NAMESPACE == "GNOME"
|
||||||
stage: build
|
stage: build
|
||||||
tags:
|
tags:
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ case "${backend}" in
|
|||||||
--suite=gtk \
|
--suite=gtk \
|
||||||
--no-suite=failing \
|
--no-suite=failing \
|
||||||
--no-suite=flaky \
|
--no-suite=flaky \
|
||||||
--no-suite=headless \
|
|
||||||
--no-suite=gsk-compare-broadway
|
--no-suite=gsk-compare-broadway
|
||||||
|
|
||||||
# Store the exit code for the CI run, but always
|
# Store the exit code for the CI run, but always
|
||||||
@@ -46,7 +45,6 @@ case "${backend}" in
|
|||||||
--suite=gtk \
|
--suite=gtk \
|
||||||
--no-suite=failing \
|
--no-suite=failing \
|
||||||
--no-suite=flaky \
|
--no-suite=flaky \
|
||||||
--no-suite=headless \
|
|
||||||
--no-suite=${backend}_failing \
|
--no-suite=${backend}_failing \
|
||||||
--no-suite=gsk-compare-broadway
|
--no-suite=gsk-compare-broadway
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
@@ -69,7 +67,6 @@ case "${backend}" in
|
|||||||
--suite=gtk \
|
--suite=gtk \
|
||||||
--no-suite=failing \
|
--no-suite=failing \
|
||||||
--no-suite=flaky \
|
--no-suite=flaky \
|
||||||
--no-suite=headless \
|
|
||||||
--no-suite=gsk-compare-opengl
|
--no-suite=gsk-compare-opengl
|
||||||
|
|
||||||
kill ${server}
|
kill ${server}
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ The issue tracker is meant to be used for actionable issues only.
|
|||||||
|
|
||||||
You should not open a new issue for security related questions.
|
You should not open a new issue for security related questions.
|
||||||
|
|
||||||
When in doubt, follow [security](https://security.gnome.org/).
|
When in doubt, send an email to the [security](mailto:security@gnome.org)
|
||||||
|
mailing list.
|
||||||
|
|
||||||
### Bug reports
|
### Bug reports
|
||||||
|
|
||||||
@@ -243,11 +244,13 @@ people committing to GTK to follow a few rules:
|
|||||||
code, you should always ask. If your change is minor and you've been
|
code, you should always ask. If your change is minor and you've been
|
||||||
working on GTK for a while it probably isn't necessary to ask. But when
|
working on GTK for a while it probably isn't necessary to ask. But when
|
||||||
in doubt, ask. Even if your change is correct, somebody may know a
|
in doubt, ask. Even if your change is correct, somebody may know a
|
||||||
better way to do things.
|
better way to do things. If you are making changes to GTK, you should
|
||||||
The `gtk` [room on matrix](https://matrix.to/#/#gtk:gnome.org) is also a
|
be subscribed to the [gtk-devel](https://mail.gnome.org/mailman/listinfo/gtk-devel-list)
|
||||||
good place to find GTK developers to discuss changes, but if you live
|
mailing list; this is a good place to ask about intended changes.
|
||||||
outside of the EU/US time zones, the [gtk tag on the GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
|
The `#gtk` IRC channel on irc.gnome.org is also a good place to find GTK
|
||||||
is the most certain and preferred method.
|
developers to discuss changes, but if you live outside of the EU/US time
|
||||||
|
zones, an email to the gtk-devel mailing list is the most certain and
|
||||||
|
preferred method.
|
||||||
|
|
||||||
0. Ask _first_.
|
0. Ask _first_.
|
||||||
|
|
||||||
|
|||||||
58
NEWS
@@ -1,64 +1,6 @@
|
|||||||
Overview of Changes in 4.13.1, xx-xx-xxxx
|
Overview of Changes in 4.13.1, xx-xx-xxxx
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
* GtkTooltip:
|
|
||||||
- Don't cross native boundaries when looking for tooltips
|
|
||||||
|
|
||||||
* GtkCenterLayout, GtkEntry, GtkSearchEntry:
|
|
||||||
- Fix some issues with baseline handling
|
|
||||||
|
|
||||||
* GtkFileChooser:
|
|
||||||
- Make "Visit file" scroll to the file
|
|
||||||
|
|
||||||
* GtkSwitch:
|
|
||||||
- Respect text direction
|
|
||||||
|
|
||||||
* Paths:
|
|
||||||
- GskPathMeasure performance has been improved
|
|
||||||
- Add custom contours for circles, rounded rectangles and rectangles
|
|
||||||
- Simplify GskPathPoint handling
|
|
||||||
- gsk_path_point_get_closest_point now returns the distance as well
|
|
||||||
|
|
||||||
* Input:
|
|
||||||
- Handle (some) single-key compose sequences
|
|
||||||
|
|
||||||
* GSK:
|
|
||||||
- Make the repeated gradients match between GL and cairo
|
|
||||||
- Make rounded rect shrinking match between Vulkan, GL and cairo
|
|
||||||
- Fix parsing of text nodes with color glyphs
|
|
||||||
- Restrict an optimization to the cases where it is crrect
|
|
||||||
- Fix rendering of shadows with opacity
|
|
||||||
- The Vulkan renderer now requires Vulkan 1.2
|
|
||||||
|
|
||||||
* macOS:
|
|
||||||
- Clamp damage regions to the surface size
|
|
||||||
|
|
||||||
* Tools:
|
|
||||||
- gtk4-path-tool gained restrict and reverse commands
|
|
||||||
- gtk4-path-tool show and render can show control points
|
|
||||||
|
|
||||||
* Demos:
|
|
||||||
- Add a demo for hit testing with paths
|
|
||||||
|
|
||||||
* Build:
|
|
||||||
- Fix build problems with C++ compilers
|
|
||||||
|
|
||||||
* Translation updates
|
|
||||||
Brazilian Portuguese
|
|
||||||
British English
|
|
||||||
Catalan
|
|
||||||
Czech
|
|
||||||
Danish
|
|
||||||
Galician
|
|
||||||
Georgian
|
|
||||||
Italian
|
|
||||||
Korean
|
|
||||||
Lithuanian
|
|
||||||
Polish
|
|
||||||
Punjabi
|
|
||||||
Slovenian
|
|
||||||
|
|
||||||
|
|
||||||
Overview of Changes in 4.13.0, 25-08-2023
|
Overview of Changes in 4.13.0, 25-08-2023
|
||||||
=========================================
|
=========================================
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
@@ -223,7 +223,7 @@ delete_messages (gpointer data)
|
|||||||
static void
|
static void
|
||||||
pop_message (GtkWidget *status)
|
pop_message (GtkWidget *status)
|
||||||
{
|
{
|
||||||
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
|
GList *messages = (GList *) g_object_get_data (G_OBJECT (status), "messages");
|
||||||
|
|
||||||
if (messages)
|
if (messages)
|
||||||
{
|
{
|
||||||
@@ -241,7 +241,7 @@ static void
|
|||||||
push_message (GtkWidget *status,
|
push_message (GtkWidget *status,
|
||||||
const char *message)
|
const char *message)
|
||||||
{
|
{
|
||||||
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
|
GList *messages = (GList *) g_object_get_data (G_OBJECT (status), "messages");
|
||||||
|
|
||||||
gtk_label_set_label (GTK_LABEL (status), message);
|
gtk_label_set_label (GTK_LABEL (status), message);
|
||||||
messages = g_list_prepend (messages, g_strdup (message));
|
messages = g_list_prepend (messages, g_strdup (message));
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1019 B After Width: | Height: | Size: 985 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -127,7 +127,6 @@
|
|||||||
<file>fishbowl.ui</file>
|
<file>fishbowl.ui</file>
|
||||||
<file>gtkfishbowl.c</file>
|
<file>gtkfishbowl.c</file>
|
||||||
<file>gtkfishbowl.h</file>
|
<file>gtkfishbowl.h</file>
|
||||||
<file>tiger.node</file>
|
|
||||||
</gresource>
|
</gresource>
|
||||||
<gresource prefix="/frames">
|
<gresource prefix="/frames">
|
||||||
<file>frames.ui</file>
|
<file>frames.ui</file>
|
||||||
@@ -295,7 +294,6 @@
|
|||||||
<file>gears.c</file>
|
<file>gears.c</file>
|
||||||
<file>gestures.c</file>
|
<file>gestures.c</file>
|
||||||
<file>glarea.c</file>
|
<file>glarea.c</file>
|
||||||
<file>glyphs.c</file>
|
|
||||||
<file>gltransition.c</file>
|
<file>gltransition.c</file>
|
||||||
<file>headerbar.c</file>
|
<file>headerbar.c</file>
|
||||||
<file>hypertext.c</file>
|
<file>hypertext.c</file>
|
||||||
@@ -338,9 +336,7 @@
|
|||||||
<file>panes.c</file>
|
<file>panes.c</file>
|
||||||
<file>password_entry.c</file>
|
<file>password_entry.c</file>
|
||||||
<file>path_fill.c</file>
|
<file>path_fill.c</file>
|
||||||
<file>path_maze.c</file>
|
|
||||||
<file>path_spinner.c</file>
|
<file>path_spinner.c</file>
|
||||||
<file>path_sweep.c</file>
|
|
||||||
<file>path_walk.c</file>
|
<file>path_walk.c</file>
|
||||||
<file>path_text.c</file>
|
<file>path_text.c</file>
|
||||||
<file>peg_solitaire.c</file>
|
<file>peg_solitaire.c</file>
|
||||||
@@ -428,10 +424,6 @@
|
|||||||
<gresource prefix="/fontrendering">
|
<gresource prefix="/fontrendering">
|
||||||
<file>fontrendering.ui</file>
|
<file>fontrendering.ui</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
<gresource prefix="/path_sweep">
|
|
||||||
<file>path_sweep.ui</file>
|
|
||||||
<file compressed="true">path_world.txt</file>
|
|
||||||
</gresource>
|
|
||||||
<gresource prefix="/path_walk">
|
<gresource prefix="/path_walk">
|
||||||
<file>path_walk.ui</file>
|
<file>path_walk.ui</file>
|
||||||
<file compressed="true">path_world.txt</file>
|
<file compressed="true">path_world.txt</file>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
@@ -11,9 +11,6 @@
|
|||||||
#include "gtkgears.h"
|
#include "gtkgears.h"
|
||||||
#include "gskshaderpaintable.h"
|
#include "gskshaderpaintable.h"
|
||||||
|
|
||||||
#include "nodewidget.h"
|
|
||||||
#include "graphwidget.h"
|
|
||||||
|
|
||||||
const char *const css =
|
const char *const css =
|
||||||
".blurred-button {"
|
".blurred-button {"
|
||||||
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
|
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
|
||||||
@@ -74,7 +71,14 @@ create_blurred_button (void)
|
|||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
create_font_button (void)
|
create_font_button (void)
|
||||||
{
|
{
|
||||||
return gtk_font_dialog_button_new (gtk_font_dialog_new ());
|
GtkFontDialog *dialog;
|
||||||
|
GtkWidget *button;
|
||||||
|
|
||||||
|
dialog = gtk_font_dialog_new ();
|
||||||
|
button = gtk_font_dialog_button_new (dialog);
|
||||||
|
g_object_unref (dialog);
|
||||||
|
|
||||||
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
@@ -204,18 +208,6 @@ create_menu_button (void)
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
create_tiger (void)
|
|
||||||
{
|
|
||||||
return node_widget_new ("/fishbowl/tiger.node");
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkWidget *
|
|
||||||
create_graph (void)
|
|
||||||
{
|
|
||||||
return graph_widget_new ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
const char *name;
|
const char *name;
|
||||||
GtkWidget * (*create_func) (void);
|
GtkWidget * (*create_func) (void);
|
||||||
@@ -233,8 +225,6 @@ static const struct {
|
|||||||
{ "Switch", create_switch },
|
{ "Switch", create_switch },
|
||||||
{ "Menubutton", create_menu_button },
|
{ "Menubutton", create_menu_button },
|
||||||
{ "Shader", create_cogs },
|
{ "Shader", create_cogs },
|
||||||
{ "Tiger", create_tiger },
|
|
||||||
{ "Graph", create_graph },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int selected_widget_type = -1;
|
static int selected_widget_type = -1;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -1,153 +0,0 @@
|
|||||||
#include "graphwidget.h"
|
|
||||||
|
|
||||||
struct _GraphWidget
|
|
||||||
{
|
|
||||||
GtkWidget parent_instance;
|
|
||||||
|
|
||||||
GskPath *path;
|
|
||||||
GskStroke *stroke;
|
|
||||||
GdkRGBA color;
|
|
||||||
|
|
||||||
guint tick_cb;
|
|
||||||
guint64 start_time;
|
|
||||||
|
|
||||||
double period;
|
|
||||||
double amplitude;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GraphWidgetClass
|
|
||||||
{
|
|
||||||
GtkWidgetClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GraphWidget, graph_widget, GTK_TYPE_WIDGET)
|
|
||||||
|
|
||||||
static void
|
|
||||||
update_path (GraphWidget *self,
|
|
||||||
float amplitude)
|
|
||||||
{
|
|
||||||
graphene_point_t p[20];
|
|
||||||
GskPathBuilder *builder;
|
|
||||||
|
|
||||||
g_clear_pointer (&self->path, gsk_path_unref);
|
|
||||||
|
|
||||||
for (int i = 0; i < 20; i++)
|
|
||||||
{
|
|
||||||
p[i].x = 10 * i;
|
|
||||||
p[i].y = 50;
|
|
||||||
|
|
||||||
if (i % 4 == 1 || i % 4 == 2)
|
|
||||||
{
|
|
||||||
if (i % 8 < 4)
|
|
||||||
p[i].y += amplitude;
|
|
||||||
else
|
|
||||||
p[i].y -= amplitude;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
builder = gsk_path_builder_new ();
|
|
||||||
gsk_path_builder_move_to (builder, p[0].x, p[0].y);
|
|
||||||
|
|
||||||
for (int i = 0; i < 20; i += 4)
|
|
||||||
gsk_path_builder_cubic_to (builder,
|
|
||||||
p[i+1].x, p[i+1].y,
|
|
||||||
p[i+2].x, p[i+2].y,
|
|
||||||
p[i+3].x, p[i+3].y);
|
|
||||||
|
|
||||||
self->path = gsk_path_builder_free_to_path (builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
tick_cb (GtkWidget *widget,
|
|
||||||
GdkFrameClock *frame_clock,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
GraphWidget *self = GRAPH_WIDGET (widget);
|
|
||||||
guint64 now;
|
|
||||||
double angle;
|
|
||||||
|
|
||||||
now = gdk_frame_clock_get_frame_time (frame_clock);
|
|
||||||
|
|
||||||
if (self->start_time == 0)
|
|
||||||
self->start_time = now;
|
|
||||||
|
|
||||||
angle = 360 * (now - self->start_time) / (double)(self->period * G_TIME_SPAN_MINUTE);
|
|
||||||
update_path (self, sin (angle) * self->amplitude);
|
|
||||||
|
|
||||||
gtk_widget_queue_draw (widget);
|
|
||||||
|
|
||||||
return G_SOURCE_CONTINUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
graph_widget_init (GraphWidget *self)
|
|
||||||
{
|
|
||||||
self->color.red = g_random_double_range (0, 1);
|
|
||||||
self->color.green = g_random_double_range (0, 1);
|
|
||||||
self->color.blue = g_random_double_range (0, 1);
|
|
||||||
self->color.alpha = 1;
|
|
||||||
|
|
||||||
self->period = g_random_double_range (0.5, 1);
|
|
||||||
self->amplitude = g_random_double_range (10, 25);
|
|
||||||
|
|
||||||
self->stroke = gsk_stroke_new (2);
|
|
||||||
|
|
||||||
update_path (self, 0);
|
|
||||||
|
|
||||||
self->start_time = 0;
|
|
||||||
self->tick_cb = gtk_widget_add_tick_callback (GTK_WIDGET (self), tick_cb, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
graph_widget_dispose (GObject *object)
|
|
||||||
{
|
|
||||||
GraphWidget *self = GRAPH_WIDGET (object);
|
|
||||||
|
|
||||||
g_clear_pointer (&self->path, gsk_path_unref);
|
|
||||||
gsk_stroke_free (self->stroke);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (graph_widget_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
graph_widget_snapshot (GtkWidget *widget,
|
|
||||||
GtkSnapshot *snapshot)
|
|
||||||
{
|
|
||||||
GraphWidget *self = GRAPH_WIDGET (widget);
|
|
||||||
|
|
||||||
gtk_snapshot_append_stroke (snapshot, self->path, self->stroke, &self->color);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
graph_widget_measure (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
int for_size,
|
|
||||||
int *minimum,
|
|
||||||
int *natural,
|
|
||||||
int *minimum_baseline,
|
|
||||||
int *natural_baseline)
|
|
||||||
{
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
*minimum = *natural = 200;
|
|
||||||
else
|
|
||||||
*minimum = *natural = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
graph_widget_class_init (GraphWidgetClass *class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
|
||||||
|
|
||||||
object_class->dispose = graph_widget_dispose;
|
|
||||||
|
|
||||||
widget_class->snapshot = graph_widget_snapshot;
|
|
||||||
widget_class->measure = graph_widget_measure;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
graph_widget_new (void)
|
|
||||||
{
|
|
||||||
return g_object_new (GRAPH_TYPE_WIDGET, NULL);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#define GRAPH_TYPE_WIDGET (graph_widget_get_type ())
|
|
||||||
G_DECLARE_FINAL_TYPE (GraphWidget, graph_widget, GRAPH, WIDGET, GtkWidget)
|
|
||||||
|
|
||||||
GtkWidget * graph_widget_new (void);
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -34,7 +34,6 @@ demos = files([
|
|||||||
'gestures.c',
|
'gestures.c',
|
||||||
'glarea.c',
|
'glarea.c',
|
||||||
'gltransition.c',
|
'gltransition.c',
|
||||||
'glyphs.c',
|
|
||||||
'headerbar.c',
|
'headerbar.c',
|
||||||
'hypertext.c',
|
'hypertext.c',
|
||||||
'iconscroll.c',
|
'iconscroll.c',
|
||||||
@@ -74,9 +73,7 @@ demos = files([
|
|||||||
'panes.c',
|
'panes.c',
|
||||||
'password_entry.c',
|
'password_entry.c',
|
||||||
'path_fill.c',
|
'path_fill.c',
|
||||||
'path_maze.c',
|
|
||||||
'path_spinner.c',
|
'path_spinner.c',
|
||||||
'path_sweep.c',
|
|
||||||
'path_walk.c',
|
'path_walk.c',
|
||||||
'path_text.c',
|
'path_text.c',
|
||||||
'peg_solitaire.c',
|
'peg_solitaire.c',
|
||||||
@@ -143,8 +140,6 @@ extra_demo_sources = files([
|
|||||||
'unicode-names.c',
|
'unicode-names.c',
|
||||||
'suggestionentry.c',
|
'suggestionentry.c',
|
||||||
'language-names.c',
|
'language-names.c',
|
||||||
'nodewidget.c',
|
|
||||||
'graphwidget.c',
|
|
||||||
])
|
])
|
||||||
|
|
||||||
if os_unix
|
if os_unix
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -1,76 +0,0 @@
|
|||||||
#include "nodewidget.h"
|
|
||||||
|
|
||||||
struct _NodeWidget
|
|
||||||
{
|
|
||||||
GtkWidget parent_instance;
|
|
||||||
|
|
||||||
GskRenderNode *node;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _NodeWidgetClass
|
|
||||||
{
|
|
||||||
GtkWidgetClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NodeWidget, node_widget, GTK_TYPE_WIDGET)
|
|
||||||
|
|
||||||
static void
|
|
||||||
node_widget_init (NodeWidget *self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
node_widget_dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NodeWidget *self = NODE_WIDGET (object);
|
|
||||||
|
|
||||||
gsk_render_node_unref (self->node);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (node_widget_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
node_widget_snapshot (GtkWidget *widget,
|
|
||||||
GtkSnapshot *snapshot)
|
|
||||||
{
|
|
||||||
NodeWidget *self = NODE_WIDGET (widget);
|
|
||||||
|
|
||||||
gtk_snapshot_append_node (snapshot, self->node);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
node_widget_class_init (NodeWidgetClass *class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
|
||||||
|
|
||||||
object_class->dispose = node_widget_dispose;
|
|
||||||
|
|
||||||
widget_class->snapshot = node_widget_snapshot;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
node_widget_new (const char *resource)
|
|
||||||
{
|
|
||||||
NodeWidget *self;
|
|
||||||
GBytes *bytes;
|
|
||||||
GskRenderNode *node;
|
|
||||||
graphene_rect_t bounds;
|
|
||||||
float scale;
|
|
||||||
GskTransform *transform;
|
|
||||||
|
|
||||||
self = g_object_new (NODE_TYPE_WIDGET, NULL);
|
|
||||||
|
|
||||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
|
||||||
node = gsk_render_node_deserialize (bytes, NULL, NULL);
|
|
||||||
g_bytes_unref (bytes);
|
|
||||||
|
|
||||||
gsk_render_node_get_bounds (node, &bounds);
|
|
||||||
scale = MIN (100.0/bounds.size.width, 100.0/bounds.size.height);
|
|
||||||
transform = gsk_transform_scale (NULL, scale, scale);
|
|
||||||
self->node = gsk_transform_node_new (node, transform);
|
|
||||||
gsk_transform_unref (transform);
|
|
||||||
gsk_render_node_unref (node);
|
|
||||||
|
|
||||||
return GTK_WIDGET (self);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#define NODE_TYPE_WIDGET (node_widget_get_type ())
|
|
||||||
G_DECLARE_FINAL_TYPE (NodeWidget, node_widget, NODE, WIDGET, GtkWidget)
|
|
||||||
|
|
||||||
GtkWidget * node_widget_new (const char *file);
|
|
||||||
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -1,369 +0,0 @@
|
|||||||
/* Path/Maze
|
|
||||||
*
|
|
||||||
* This demo shows how to use a GskPath to create a maze and use
|
|
||||||
* gsk_path_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 "config.h"
|
|
||||||
#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
|
|
||||||
celebrate (gboolean win)
|
|
||||||
{
|
|
||||||
char *path;
|
|
||||||
GtkMediaStream *stream;
|
|
||||||
|
|
||||||
if (win)
|
|
||||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
|
|
||||||
else
|
|
||||||
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
|
|
||||||
stream = gtk_media_file_new_for_filename (path);
|
|
||||||
gtk_media_stream_set_volume (stream, 1.0);
|
|
||||||
gtk_media_stream_play (stream);
|
|
||||||
|
|
||||||
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
|
|
||||||
g_free (path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pointer_motion (GtkEventControllerMotion *controller,
|
|
||||||
double x,
|
|
||||||
double y,
|
|
||||||
GtkMaze *self)
|
|
||||||
{
|
|
||||||
GskPathPoint point;
|
|
||||||
float distance;
|
|
||||||
|
|
||||||
if (!self->active)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (gsk_path_get_closest_point (self->path,
|
|
||||||
&GRAPHENE_POINT_INIT (x, y),
|
|
||||||
INFINITY,
|
|
||||||
&point,
|
|
||||||
&distance))
|
|
||||||
{
|
|
||||||
if (distance < MAZE_STROKE_SIZE_ACTIVE / 2.f)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
celebrate (FALSE);
|
|
||||||
|
|
||||||
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] = { FALSE, FALSE, FALSE, FALSE };
|
|
||||||
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_window_present (GTK_WINDOW (window));
|
|
||||||
else
|
|
||||||
gtk_window_destroy (GTK_WINDOW (window));
|
|
||||||
|
|
||||||
return window;
|
|
||||||
}
|
|
||||||
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
#include "paintable.h"
|
#include "paintable.h"
|
||||||
|
|
||||||
#undef SHOW_CONTROLS
|
|
||||||
|
|
||||||
#define GTK_TYPE_SPINNER_PAINTABLE (gtk_spinner_paintable_get_type ())
|
#define GTK_TYPE_SPINNER_PAINTABLE (gtk_spinner_paintable_get_type ())
|
||||||
G_DECLARE_FINAL_TYPE (GtkSpinnerPaintable, gtk_spinner_paintable, GTK, SPINNER_PAINTABLE, GObject)
|
G_DECLARE_FINAL_TYPE (GtkSpinnerPaintable, gtk_spinner_paintable, GTK, SPINNER_PAINTABLE, GObject)
|
||||||
|
|
||||||
@@ -58,9 +56,9 @@ gtk_spinner_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_spinner_paintable_snapshot (GdkPaintable *paintable,
|
gtk_spinner_paintable_snapshot (GdkPaintable *paintable,
|
||||||
GdkSnapshot *snapshot,
|
GdkSnapshot *snapshot,
|
||||||
double width,
|
double width,
|
||||||
double height)
|
double height)
|
||||||
{
|
{
|
||||||
GtkSpinnerPaintable *self = GTK_SPINNER_PAINTABLE (paintable);
|
GtkSpinnerPaintable *self = GTK_SPINNER_PAINTABLE (paintable);
|
||||||
|
|
||||||
@@ -152,7 +150,6 @@ static gboolean
|
|||||||
add_controls (GskPathOperation op,
|
add_controls (GskPathOperation op,
|
||||||
const graphene_point_t *pts,
|
const graphene_point_t *pts,
|
||||||
gsize n_pts,
|
gsize n_pts,
|
||||||
float weight,
|
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
GskPathBuilder *builder = data;
|
GskPathBuilder *builder = data;
|
||||||
@@ -169,7 +166,7 @@ add_controls (GskPathOperation op,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GSK_PATH_QUAD:
|
case GSK_PATH_QUAD:
|
||||||
case GSK_PATH_CONIC:
|
case GSK_PATH_ARC:
|
||||||
gsk_path_builder_line_to (builder, pts[1].x, pts[1].y);
|
gsk_path_builder_line_to (builder, pts[1].x, pts[1].y);
|
||||||
gsk_path_builder_line_to (builder, pts[2].x, pts[2].y);
|
gsk_path_builder_line_to (builder, pts[2].x, pts[2].y);
|
||||||
break;
|
break;
|
||||||
@@ -193,21 +190,32 @@ update_path (GtkSpinnerPaintable *self)
|
|||||||
{
|
{
|
||||||
GskPathBuilder *builder;
|
GskPathBuilder *builder;
|
||||||
GskPathPoint start, end;
|
GskPathPoint start, end;
|
||||||
graphene_point_t p0, p1;
|
GskTransform *t;
|
||||||
|
graphene_point_t p, p0, p1;
|
||||||
float start_angle, end_angle;
|
float start_angle, end_angle;
|
||||||
|
|
||||||
|
p = GRAPHENE_POINT_INIT (40, 0);
|
||||||
start_angle = self->angle;
|
start_angle = self->angle;
|
||||||
end_angle = fmod (self->angle + 360 * self->completion / 100, 360);
|
end_angle = fmod (self->angle + 360 * self->completion / 100, 360);
|
||||||
|
|
||||||
p0 = GRAPHENE_POINT_INIT (50 + 40 * cos (M_PI * start_angle / 180),
|
t = gsk_transform_translate (
|
||||||
50 + 40 * sin (M_PI * start_angle / 180));
|
gsk_transform_rotate (
|
||||||
p1 = GRAPHENE_POINT_INIT (50 + 40 * cos (M_PI * end_angle / 180),
|
gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (50, 50)),
|
||||||
50 + 40 * sin (M_PI * end_angle / 180));
|
start_angle),
|
||||||
|
&GRAPHENE_POINT_INIT (-50, -50));
|
||||||
|
gsk_transform_transform_point (t, &p, &p0);
|
||||||
|
|
||||||
|
t = gsk_transform_translate (
|
||||||
|
gsk_transform_rotate (
|
||||||
|
gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (50, 50)),
|
||||||
|
end_angle),
|
||||||
|
&GRAPHENE_POINT_INIT (-50, -50));
|
||||||
|
gsk_transform_transform_point (t, &p, &p1);
|
||||||
|
|
||||||
g_clear_pointer (&self->path, gsk_path_unref);
|
g_clear_pointer (&self->path, gsk_path_unref);
|
||||||
|
|
||||||
gsk_path_get_closest_point (self->circle, &p0, INFINITY, &start, NULL);
|
gsk_path_get_closest_point (self->circle, &p0, INFINITY, &start);
|
||||||
gsk_path_get_closest_point (self->circle, &p1, INFINITY, &end, NULL);
|
gsk_path_get_closest_point (self->circle, &p1, INFINITY, &end);
|
||||||
|
|
||||||
builder = gsk_path_builder_new ();
|
builder = gsk_path_builder_new ();
|
||||||
gsk_path_builder_add_segment (builder, self->circle, &start, &end);
|
gsk_path_builder_add_segment (builder, self->circle, &start, &end);
|
||||||
|
|||||||
@@ -1,319 +0,0 @@
|
|||||||
/* Path/Sweep
|
|
||||||
*
|
|
||||||
* This demo shows how path intersections can be used.
|
|
||||||
*
|
|
||||||
* The world map that is used here is a path with 211 lines and 1569 cubic
|
|
||||||
* Bėzier segments in 121 contours.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <glib/gi18n.h>
|
|
||||||
#include <gtk/gtk.h>
|
|
||||||
|
|
||||||
#define GTK_TYPE_PATH_SWEEP (gtk_path_sweep_get_type ())
|
|
||||||
G_DECLARE_FINAL_TYPE (GtkPathSweep, gtk_path_sweep, GTK, PATH_SWEEP, GtkWidget)
|
|
||||||
|
|
||||||
#define POINT_SIZE 8
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_PATH,
|
|
||||||
N_PROPS
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkPathSweep
|
|
||||||
{
|
|
||||||
GtkWidget parent_instance;
|
|
||||||
|
|
||||||
GskPath *path;
|
|
||||||
graphene_rect_t bounds;
|
|
||||||
float y_pos;
|
|
||||||
gboolean in;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GtkPathSweepClass
|
|
||||||
{
|
|
||||||
GtkWidgetClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GtkPathSweep, gtk_path_sweep, GTK_TYPE_WIDGET)
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
intersection_cb (GskPath *path1,
|
|
||||||
const GskPathPoint *point1,
|
|
||||||
GskPath *path2,
|
|
||||||
const GskPathPoint *point2,
|
|
||||||
GskPathIntersection kind,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GskPathBuilder *builder = data;
|
|
||||||
graphene_point_t p;
|
|
||||||
|
|
||||||
gsk_path_point_get_position (point1, path1, &p);
|
|
||||||
gsk_path_builder_add_circle (builder, &p, 4);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GskPath *
|
|
||||||
get_intersection_path (GskPath *path1,
|
|
||||||
GskPath *path2)
|
|
||||||
{
|
|
||||||
GskPathBuilder *builder = gsk_path_builder_new ();
|
|
||||||
|
|
||||||
gsk_path_foreach_intersection (path1, path2, intersection_cb, builder);
|
|
||||||
|
|
||||||
return gsk_path_builder_to_path (builder);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_snapshot (GtkWidget *widget,
|
|
||||||
GtkSnapshot *snapshot)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = GTK_PATH_SWEEP (widget);
|
|
||||||
GskStroke *stroke;
|
|
||||||
|
|
||||||
if (self->path == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_snapshot_save (snapshot);
|
|
||||||
|
|
||||||
stroke = gsk_stroke_new (2.0);
|
|
||||||
|
|
||||||
gtk_snapshot_append_stroke (snapshot, self->path, stroke, &(GdkRGBA) { 0, 0, 0, 1 });
|
|
||||||
|
|
||||||
if (self->in)
|
|
||||||
{
|
|
||||||
graphene_rect_t bounds;
|
|
||||||
GskPathBuilder *builder;
|
|
||||||
GskPath *line, *isecs;
|
|
||||||
|
|
||||||
gsk_path_get_stroke_bounds (self->path, stroke, &bounds);
|
|
||||||
|
|
||||||
builder = gsk_path_builder_new ();
|
|
||||||
gsk_path_builder_move_to (builder, bounds.origin.x, bounds.origin.y + self->y_pos);
|
|
||||||
gsk_path_builder_line_to (builder, bounds.origin.x + bounds.size.width, bounds.origin.y + self->y_pos);
|
|
||||||
line = gsk_path_builder_free_to_path (builder);
|
|
||||||
|
|
||||||
gtk_snapshot_append_stroke (snapshot, line, stroke, &(GdkRGBA) { 0, 0, 0, 1 });
|
|
||||||
|
|
||||||
isecs = get_intersection_path (self->path, line);
|
|
||||||
|
|
||||||
gtk_snapshot_append_fill (snapshot, isecs, GSK_FILL_RULE_WINDING, &(GdkRGBA) { 1, 0, 0, 1 });
|
|
||||||
gtk_snapshot_append_stroke (snapshot, isecs, stroke, &(GdkRGBA) { 0, 0, 0, 1 });
|
|
||||||
|
|
||||||
gsk_path_unref (isecs);
|
|
||||||
gsk_path_unref (line);
|
|
||||||
}
|
|
||||||
|
|
||||||
gsk_stroke_free (stroke);
|
|
||||||
|
|
||||||
gtk_snapshot_restore (snapshot);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_measure (GtkWidget *widget,
|
|
||||||
GtkOrientation orientation,
|
|
||||||
int for_size,
|
|
||||||
int *minimum,
|
|
||||||
int *natural,
|
|
||||||
int *minimum_baseline,
|
|
||||||
int *natural_baseline)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = GTK_PATH_SWEEP (widget);
|
|
||||||
|
|
||||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
|
||||||
*minimum = *natural = (int) ceilf (self->bounds.size.width);
|
|
||||||
else
|
|
||||||
*minimum = *natural = (int) ceilf (self->bounds.size.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_set_path (GtkPathSweep *self,
|
|
||||||
GskPath *path)
|
|
||||||
{
|
|
||||||
if (self->path == path)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_clear_pointer (&self->path, gsk_path_unref);
|
|
||||||
graphene_rect_init (&self->bounds, 0, 0, 0, 0);
|
|
||||||
if (path)
|
|
||||||
{
|
|
||||||
GskStroke *stroke;
|
|
||||||
|
|
||||||
self->path = gsk_path_ref (path);
|
|
||||||
stroke = gsk_stroke_new (2.0);
|
|
||||||
gsk_path_get_stroke_bounds (path, stroke, &self->bounds);
|
|
||||||
gsk_stroke_free (stroke);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PATH]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_set_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
const GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = GTK_PATH_SWEEP (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_PATH:
|
|
||||||
gtk_path_sweep_set_path (self, g_value_get_boxed (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = GTK_PATH_SWEEP (object);
|
|
||||||
|
|
||||||
switch (prop_id)
|
|
||||||
{
|
|
||||||
case PROP_PATH:
|
|
||||||
g_value_set_boxed (value, self->path);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_dispose (GObject *object)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = GTK_PATH_SWEEP (object);
|
|
||||||
|
|
||||||
g_clear_pointer (&self->path, gsk_path_unref);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (gtk_path_sweep_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_class_init (GtkPathSweepClass *klass)
|
|
||||||
{
|
|
||||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
object_class->dispose = gtk_path_sweep_dispose;
|
|
||||||
object_class->set_property = gtk_path_sweep_set_property;
|
|
||||||
object_class->get_property = gtk_path_sweep_get_property;
|
|
||||||
|
|
||||||
widget_class->snapshot = gtk_path_sweep_snapshot;
|
|
||||||
widget_class->measure = gtk_path_sweep_measure;
|
|
||||||
|
|
||||||
properties[PROP_PATH] =
|
|
||||||
g_param_spec_boxed ("path", NULL, NULL,
|
|
||||||
GSK_TYPE_PATH,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
motion_cb (GtkEventControllerMotion *controller,
|
|
||||||
double x,
|
|
||||||
double y,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = data;
|
|
||||||
|
|
||||||
self->y_pos = y;
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
enter_cb (GtkEventControllerMotion *controller,
|
|
||||||
double x,
|
|
||||||
double y,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = data;
|
|
||||||
|
|
||||||
self->in = TRUE;
|
|
||||||
self->y_pos = y;
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
leave_cb (GtkEventControllerMotion *controller,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self = data;
|
|
||||||
|
|
||||||
self->in = FALSE;
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_path_sweep_init (GtkPathSweep *self)
|
|
||||||
{
|
|
||||||
GtkEventController *controller;
|
|
||||||
|
|
||||||
/* Data taken from
|
|
||||||
* https://commons.wikimedia.org/wiki/Maps_of_the_world#/media/File:Simplified_blank_world_map_without_Antartica_(no_borders).svg
|
|
||||||
*/
|
|
||||||
GBytes *data = g_resources_lookup_data ("/path_sweep/path_world.txt", 0, NULL);
|
|
||||||
GskPath *path = gsk_path_parse (g_bytes_get_data (data, NULL));
|
|
||||||
g_bytes_unref (data);
|
|
||||||
gtk_path_sweep_set_path (self, path);
|
|
||||||
gsk_path_unref (path);
|
|
||||||
|
|
||||||
controller = gtk_event_controller_motion_new ();
|
|
||||||
g_signal_connect (controller, "motion", G_CALLBACK (motion_cb), self);
|
|
||||||
g_signal_connect (controller, "enter", G_CALLBACK (enter_cb), self);
|
|
||||||
g_signal_connect (controller, "leave", G_CALLBACK (leave_cb), self);
|
|
||||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
gtk_path_sweep_new (void)
|
|
||||||
{
|
|
||||||
GtkPathSweep *self;
|
|
||||||
|
|
||||||
self = g_object_new (GTK_TYPE_PATH_SWEEP, NULL);
|
|
||||||
|
|
||||||
return GTK_WIDGET (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkWidget *
|
|
||||||
do_path_sweep (GtkWidget *do_widget)
|
|
||||||
{
|
|
||||||
static GtkWidget *window = NULL;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
{
|
|
||||||
GtkBuilder *builder;
|
|
||||||
|
|
||||||
g_type_ensure (GTK_TYPE_PATH_SWEEP);
|
|
||||||
|
|
||||||
builder = gtk_builder_new_from_resource ("/path_sweep/path_sweep.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_window_present (GTK_WINDOW (window));
|
|
||||||
else
|
|
||||||
gtk_window_destroy (GTK_WINDOW (window));
|
|
||||||
|
|
||||||
return window;
|
|
||||||
}
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<interface>
|
|
||||||
<object class="GtkWindow" id="window">
|
|
||||||
<property name="title" translatable="yes">World Map</property>
|
|
||||||
<property name="child">
|
|
||||||
<object class="GtkBox">
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkPathSweep" id="view">
|
|
||||||
<property name="hexpand">true</property>
|
|
||||||
<property name="vexpand">true</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
</interface>
|
|
||||||
@@ -501,13 +501,15 @@ pointer_motion (GtkEventControllerMotion *controller,
|
|||||||
GtkPathWidget *self)
|
GtkPathWidget *self)
|
||||||
{
|
{
|
||||||
GskPathPoint point;
|
GskPathPoint point;
|
||||||
|
graphene_point_t pos;
|
||||||
|
|
||||||
if (gsk_path_get_closest_point (self->line_path,
|
if (gsk_path_get_closest_point (self->line_path,
|
||||||
&GRAPHENE_POINT_INIT (x, y),
|
&GRAPHENE_POINT_INIT (x, y),
|
||||||
INFINITY,
|
INFINITY,
|
||||||
&point,
|
&point))
|
||||||
NULL))
|
|
||||||
{
|
{
|
||||||
|
gsk_path_point_get_position (&point, self->line_path, &pos);
|
||||||
|
|
||||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@
|
|||||||
<property name="lower">0</property>
|
<property name="lower">0</property>
|
||||||
<property name="upper">5000</property>
|
<property name="upper">5000</property>
|
||||||
<property name="value">500</property>
|
<property name="value">500</property>
|
||||||
<property name="step-increment">1</property>
|
|
||||||
<property name="page-increment">10</property>
|
|
||||||
</object>
|
</object>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 844 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -149,16 +149,15 @@ Creates a node like `gsk_debug_node_new()` with the given properties.
|
|||||||
|
|
||||||
### fill
|
### fill
|
||||||
|
|
||||||
| property | syntax | default | printed |
|
| property | syntax | default | printed |
|
||||||
| --------- | --------------- | ---------------------- | ----------- |
|
| -------- | ---------------- | ---------------------- | ----------- |
|
||||||
| child | `<node>` | *see below* | always |
|
| child | `<node>` | *see below* | always |
|
||||||
| path | `<string>` | "" | always |
|
| path | `<string>` | "" | always |
|
||||||
| fill-rule | `<fill-rule>` | winding | always |
|
| fill-rule| `<fill-rule>` | winding | always |
|
||||||
|
|
||||||
Creates a node like `gsk_fill_node_new()` with the given properties.
|
Creates a node like `gsk_fill_node_new()` with the given properties.
|
||||||
|
|
||||||
The default child node is the default color node, but created with the
|
The default child node is created with the bounds of the path.
|
||||||
bounds of the path.
|
|
||||||
|
|
||||||
### glshader
|
### glshader
|
||||||
|
|
||||||
@@ -317,8 +316,7 @@ Creates a node like `gsk_shadow_node_new()` with the given properties.
|
|||||||
|
|
||||||
Creates a node like `gsk_stroke_node_new()` with the given properties.
|
Creates a node like `gsk_stroke_node_new()` with the given properties.
|
||||||
|
|
||||||
The default child node is the default color node, but created with the
|
The default child node is created with the stroke bounds of the path.
|
||||||
stroke bounds of the path.
|
|
||||||
|
|
||||||
### text
|
### text
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1019 B After Width: | Height: | Size: 985 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 844 B |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 823 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
@@ -12,15 +12,9 @@ SYNOPSIS
|
|||||||
--------
|
--------
|
||||||
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
||||||
|
|
|
|
||||||
| **gtk4-path-tool** simplify [OPTIONS...] <PATH>
|
|
||||||
| **gtk4-path-tool** intersection [OPTIONS...] <PATH> <PATH>
|
|
||||||
| **gtk4-path-tool** union [OPTIONS...] <PATH> <PATH>
|
|
||||||
| **gtk4-path-tool** difference [OPTIONS...] <PATH> <PATH>
|
|
||||||
| **gtk4-path-tool** symmetric-difference [OPTIONS...] <PATH> <PATH>
|
|
||||||
| **gtk4-path-tool** decompose [OPTIONS...] <PATH>
|
| **gtk4-path-tool** decompose [OPTIONS...] <PATH>
|
||||||
| **gtk4-path-tool** show [OPTIONS...] <PATH>
|
| **gtk4-path-tool** show [OPTIONS...] <PATH>
|
||||||
| **gtk4-path-tool** render [OPTIONS...] <PATH>
|
| **gtk4-path-tool** render [OPTIONS...] <PATH>
|
||||||
| **gtk4-path-tool** reverse [OPTIONS...] <PATH>
|
|
||||||
| **gtk4-path-tool** info [OPTIONS...] <PATH>
|
| **gtk4-path-tool** info [OPTIONS...] <PATH>
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@@ -60,22 +54,6 @@ Showing
|
|||||||
The ``show`` command displays the given path in a window. The interior
|
The ``show`` command displays the given path in a window. The interior
|
||||||
of the path is filled.
|
of the path is filled.
|
||||||
|
|
||||||
``--fill``
|
|
||||||
|
|
||||||
Fill the path (this is the default).
|
|
||||||
|
|
||||||
``--stroke``
|
|
||||||
|
|
||||||
Stroke the path instead of filling it.
|
|
||||||
|
|
||||||
``--points``
|
|
||||||
|
|
||||||
Show points on the path.
|
|
||||||
|
|
||||||
``--controls``
|
|
||||||
|
|
||||||
Show control points.
|
|
||||||
|
|
||||||
``--fill-rule=VALUE``
|
``--fill-rule=VALUE``
|
||||||
|
|
||||||
The fill rule that is used to determine what areas are inside the path.
|
The fill rule that is used to determine what areas are inside the path.
|
||||||
@@ -91,10 +69,13 @@ of the path is filled.
|
|||||||
The color that is used to render the background behind the path.
|
The color that is used to render the background behind the path.
|
||||||
If not specified, white is used.
|
If not specified, white is used.
|
||||||
|
|
||||||
``--point-color=COLOR``
|
``--fill``
|
||||||
|
|
||||||
The color that is used to render the points.
|
Fill the path (this is the default).
|
||||||
If not specified, red is used.
|
|
||||||
|
``--stroke``
|
||||||
|
|
||||||
|
Stroke the path instead of filling it.
|
||||||
|
|
||||||
``--line-width=VALUE``
|
``--line-width=VALUE``
|
||||||
|
|
||||||
@@ -137,22 +118,6 @@ Rendering
|
|||||||
The ``render`` command renders the given path as a PNG image.
|
The ``render`` command renders the given path as a PNG image.
|
||||||
The interior of the path is filled.
|
The interior of the path is filled.
|
||||||
|
|
||||||
``--fill``
|
|
||||||
|
|
||||||
Fill the path (this is the default).
|
|
||||||
|
|
||||||
``--stroke``
|
|
||||||
|
|
||||||
Stroke the path instead of filling it.
|
|
||||||
|
|
||||||
``--points``
|
|
||||||
|
|
||||||
Show points on the path.
|
|
||||||
|
|
||||||
``--controls``
|
|
||||||
|
|
||||||
Show control points.
|
|
||||||
|
|
||||||
``--fill-rule=VALUE``
|
``--fill-rule=VALUE``
|
||||||
|
|
||||||
The fill rule that is used to determine what areas are inside the path.
|
The fill rule that is used to determine what areas are inside the path.
|
||||||
@@ -168,16 +133,19 @@ The interior of the path is filled.
|
|||||||
The color that is used to render the background behind the path.
|
The color that is used to render the background behind the path.
|
||||||
If not specified, white is used.
|
If not specified, white is used.
|
||||||
|
|
||||||
``--point-color=COLOR``
|
|
||||||
|
|
||||||
The color that is used to render the points.
|
|
||||||
If not specified, red is used.
|
|
||||||
|
|
||||||
``--output-file=FILE``
|
``--output-file=FILE``
|
||||||
|
|
||||||
The file to save the PNG image to.
|
The file to save the PNG image to.
|
||||||
If not specified, "path.png" is used.
|
If not specified, "path.png" is used.
|
||||||
|
|
||||||
|
``--fill``
|
||||||
|
|
||||||
|
Fill the path (this is the default).
|
||||||
|
|
||||||
|
``--stroke``
|
||||||
|
|
||||||
|
Stroke the path instead of filling it.
|
||||||
|
|
||||||
``--line-width=VALUE``
|
``--line-width=VALUE``
|
||||||
|
|
||||||
The line width to use for the stroke. ``VALUE`` must be a positive number.
|
The line width to use for the stroke. ``VALUE`` must be a positive number.
|
||||||
@@ -200,7 +168,6 @@ The interior of the path is filled.
|
|||||||
|
|
||||||
The limit at which to clip miters at line joins. The default value is 4.
|
The limit at which to clip miters at line joins. The default value is 4.
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
``--dashes=VALUE``
|
``--dashes=VALUE``
|
||||||
|
|
||||||
The dash pattern to use for this stroke. A dash pattern is specified by
|
The dash pattern to use for this stroke. A dash pattern is specified by
|
||||||
@@ -214,27 +181,6 @@ The interior of the path is filled.
|
|||||||
The offset into the dash pattern where dashing should begin.
|
The offset into the dash pattern where dashing should begin.
|
||||||
The default value is 0.
|
The default value is 0.
|
||||||
|
|
||||||
Boolean Operations
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The ``intersection``, ``union``, ``difference`` and ``symmetric-difference`` commands
|
|
||||||
perform boolean operations on paths. Given two paths, they create a new path which
|
|
||||||
encircles the area that is the intersection, union, difference or symmetric difference
|
|
||||||
of the areas encircled by the paths.
|
|
||||||
|
|
||||||
Simplification
|
|
||||||
^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The ``simplify`` command removes areas of overlap from a path such that the resulting
|
|
||||||
path encircles the same area, but every edge in the resulting path is a boundary between
|
|
||||||
the inside and the outside.
|
|
||||||
|
|
||||||
Reversing
|
|
||||||
^^^^^^^^^
|
|
||||||
|
|
||||||
The ``reverse`` command changes the direction of the path. The resulting
|
|
||||||
paths starts where the original path ends.
|
|
||||||
|
|
||||||
Info
|
Info
|
||||||
^^^^
|
^^^^
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -82,18 +82,6 @@ gdk_array(init) (GdkArray *self)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
G_GNUC_UNUSED static inline gsize
|
|
||||||
gdk_array(get_capacity) (const GdkArray *self)
|
|
||||||
{
|
|
||||||
return self->end_allocation - self->start;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_GNUC_UNUSED static inline gsize
|
|
||||||
gdk_array(get_size) (const GdkArray *self)
|
|
||||||
{
|
|
||||||
return self->end - self->start;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
gdk_array(free_elements) (_T_ *start,
|
gdk_array(free_elements) (_T_ *start,
|
||||||
_T_ *end)
|
_T_ *end)
|
||||||
@@ -122,38 +110,6 @@ gdk_array(clear) (GdkArray *self)
|
|||||||
gdk_array(init) (self);
|
gdk_array(init) (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* gdk_array_steal:
|
|
||||||
* @self: the array
|
|
||||||
*
|
|
||||||
* Steals all data in the array and clears the array.
|
|
||||||
*
|
|
||||||
* If you need to know the size of the data, you should query it
|
|
||||||
* beforehand.
|
|
||||||
*
|
|
||||||
* Returns: The array's data
|
|
||||||
**/
|
|
||||||
G_GNUC_UNUSED static inline _T_ *
|
|
||||||
gdk_array(steal) (GdkArray *self)
|
|
||||||
{
|
|
||||||
_T_ *result;
|
|
||||||
|
|
||||||
#ifdef GDK_ARRAY_PREALLOC
|
|
||||||
if (self->start == self->preallocated)
|
|
||||||
{
|
|
||||||
gsize size = GDK_ARRAY_REAL_SIZE (gdk_array(get_size) (self));
|
|
||||||
result = g_new (_T_, size);
|
|
||||||
memcpy (result, self->preallocated, sizeof (_T_) * size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
result = self->start;
|
|
||||||
|
|
||||||
gdk_array(init) (self);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_GNUC_UNUSED static inline _T_ *
|
G_GNUC_UNUSED static inline _T_ *
|
||||||
gdk_array(get_data) (const GdkArray *self)
|
gdk_array(get_data) (const GdkArray *self)
|
||||||
{
|
{
|
||||||
@@ -167,6 +123,18 @@ gdk_array(index) (const GdkArray *self,
|
|||||||
return self->start + pos;
|
return self->start + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
G_GNUC_UNUSED static inline gsize
|
||||||
|
gdk_array(get_capacity) (const GdkArray *self)
|
||||||
|
{
|
||||||
|
return self->end_allocation - self->start;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_GNUC_UNUSED static inline gsize
|
||||||
|
gdk_array(get_size) (const GdkArray *self)
|
||||||
|
{
|
||||||
|
return self->end - self->start;
|
||||||
|
}
|
||||||
|
|
||||||
G_GNUC_UNUSED static inline gboolean
|
G_GNUC_UNUSED static inline gboolean
|
||||||
gdk_array(is_empty) (const GdkArray *self)
|
gdk_array(is_empty) (const GdkArray *self)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -473,7 +473,8 @@ gdk_display_get_event (GdkDisplay *display)
|
|||||||
* @display: a `GdkDisplay`
|
* @display: a `GdkDisplay`
|
||||||
* @event: (transfer none): a `GdkEvent`
|
* @event: (transfer none): a `GdkEvent`
|
||||||
*
|
*
|
||||||
* Adds the given event to the event queue for @display.
|
* Appends the given event onto the front of the event
|
||||||
|
* queue for @display.
|
||||||
*
|
*
|
||||||
* Deprecated: 4.10: This function is only useful in very
|
* Deprecated: 4.10: This function is only useful in very
|
||||||
* special situations and should not be used by applications.
|
* special situations and should not be used by applications.
|
||||||
|
|||||||
@@ -1408,11 +1408,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
|||||||
},
|
},
|
||||||
.enabledExtensionCount = device_extensions->len,
|
.enabledExtensionCount = device_extensions->len,
|
||||||
.ppEnabledExtensionNames = (const char * const *) device_extensions->pdata,
|
.ppEnabledExtensionNames = (const char * const *) device_extensions->pdata,
|
||||||
.pNext = &(VkPhysicalDeviceVulkan12Features) {
|
.pNext = &(VkPhysicalDeviceDescriptorIndexingFeatures) {
|
||||||
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES,
|
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES,
|
||||||
.shaderSampledImageArrayNonUniformIndexing = VK_TRUE,
|
|
||||||
.shaderStorageBufferArrayNonUniformIndexing = VK_TRUE,
|
|
||||||
.descriptorIndexing = VK_TRUE,
|
|
||||||
.descriptorBindingPartiallyBound = VK_TRUE,
|
.descriptorBindingPartiallyBound = VK_TRUE,
|
||||||
.descriptorBindingVariableDescriptorCount = VK_TRUE,
|
.descriptorBindingVariableDescriptorCount = VK_TRUE,
|
||||||
.descriptorBindingSampledImageUpdateAfterBind = VK_TRUE,
|
.descriptorBindingSampledImageUpdateAfterBind = VK_TRUE,
|
||||||
@@ -1556,7 +1553,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
|||||||
.applicationVersion = 0,
|
.applicationVersion = 0,
|
||||||
.pEngineName = "GTK",
|
.pEngineName = "GTK",
|
||||||
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
||||||
.apiVersion = VK_API_VERSION_1_2
|
.apiVersion = VK_API_VERSION_1_0
|
||||||
},
|
},
|
||||||
.enabledLayerCount = used_layers->len,
|
.enabledLayerCount = used_layers->len,
|
||||||
.ppEnabledLayerNames = (const char * const *) used_layers->pdata,
|
.ppEnabledLayerNames = (const char * const *) used_layers->pdata,
|
||||||
|
|||||||
@@ -188,14 +188,6 @@ copy_surface_data (GdkMacosBuffer *from,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clamp_region_to_surface (cairo_region_t *region,
|
|
||||||
GdkSurface *surface)
|
|
||||||
{
|
|
||||||
cairo_rectangle_int_t rectangle = {0, 0, surface->width, surface->height};
|
|
||||||
cairo_region_intersect_rectangle (region, &rectangle);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||||
GdkMemoryDepth depth,
|
GdkMemoryDepth depth,
|
||||||
@@ -213,8 +205,6 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
|||||||
surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (draw_context));
|
surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (draw_context));
|
||||||
buffer = _gdk_macos_surface_get_buffer (surface);
|
buffer = _gdk_macos_surface_get_buffer (surface);
|
||||||
|
|
||||||
clamp_region_to_surface (region, GDK_SURFACE (surface));
|
|
||||||
|
|
||||||
_gdk_macos_buffer_set_damage (buffer, region);
|
_gdk_macos_buffer_set_damage (buffer, region);
|
||||||
_gdk_macos_buffer_set_flipped (buffer, FALSE);
|
_gdk_macos_buffer_set_flipped (buffer, FALSE);
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ struct _GdkMacosDisplay
|
|||||||
/* Note if we have a key window that is not a GdkMacosWindow
|
/* Note if we have a key window that is not a GdkMacosWindow
|
||||||
* such as a NSPanel used for native dialogs.
|
* such as a NSPanel used for native dialogs.
|
||||||
*/
|
*/
|
||||||
guint key_window_is_foreign : 1;
|
guint key_window_is_foregin : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GdkMacosDisplayClass
|
struct _GdkMacosDisplayClass
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ select_key_in_idle_cb (gpointer data)
|
|||||||
self->select_key_in_idle = 0;
|
self->select_key_in_idle = 0;
|
||||||
|
|
||||||
/* Don't steal focus from NSPanel, etc */
|
/* Don't steal focus from NSPanel, etc */
|
||||||
if (self->key_window_is_foreign)
|
if (self->key_window_is_foregin)
|
||||||
return G_SOURCE_REMOVE;
|
return G_SOURCE_REMOVE;
|
||||||
|
|
||||||
if (self->keyboard_surface == NULL)
|
if (self->keyboard_surface == NULL)
|
||||||
@@ -941,7 +941,7 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self)
|
|||||||
NSArray *array = [NSApp orderedWindows];
|
NSArray *array = [NSApp orderedWindows];
|
||||||
GQueue sorted = G_QUEUE_INIT;
|
GQueue sorted = G_QUEUE_INIT;
|
||||||
|
|
||||||
self->key_window_is_foreign = FALSE;
|
self->key_window_is_foregin = FALSE;
|
||||||
|
|
||||||
for (id obj in array)
|
for (id obj in array)
|
||||||
{
|
{
|
||||||
@@ -949,7 +949,7 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self)
|
|||||||
GdkMacosSurface *surface;
|
GdkMacosSurface *surface;
|
||||||
|
|
||||||
if ([nswindow isKeyWindow])
|
if ([nswindow isKeyWindow])
|
||||||
self->key_window_is_foreign = !GDK_IS_MACOS_WINDOW (nswindow);
|
self->key_window_is_foregin = !GDK_IS_MACOS_WINDOW (nswindow);
|
||||||
|
|
||||||
if (!GDK_IS_MACOS_WINDOW (nswindow))
|
if (!GDK_IS_MACOS_WINDOW (nswindow))
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -46,21 +46,6 @@ static const struct xdg_activation_token_v1_listener token_listener = {
|
|||||||
token_done,
|
token_done,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct wl_surface *
|
|
||||||
peek_launcher_toplevel (GdkSeat *seat)
|
|
||||||
{
|
|
||||||
struct wl_surface *wl_surface = NULL;
|
|
||||||
GdkSurface *focus_surface;
|
|
||||||
|
|
||||||
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (seat));
|
|
||||||
while (focus_surface && focus_surface->parent)
|
|
||||||
focus_surface = focus_surface->parent;
|
|
||||||
if (focus_surface)
|
|
||||||
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
|
|
||||||
|
|
||||||
return wl_surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
|
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
|
||||||
GAppInfo *info,
|
GAppInfo *info,
|
||||||
@@ -77,6 +62,7 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
|||||||
struct wl_event_queue *event_queue;
|
struct wl_event_queue *event_queue;
|
||||||
struct wl_surface *wl_surface = NULL;
|
struct wl_surface *wl_surface = NULL;
|
||||||
GdkWaylandSeat *seat;
|
GdkWaylandSeat *seat;
|
||||||
|
GdkSurface *focus_surface;
|
||||||
AppLaunchData app_launch_data = { 0 };
|
AppLaunchData app_launch_data = { 0 };
|
||||||
|
|
||||||
event_queue = wl_display_create_queue (display->wl_display);
|
event_queue = wl_display_create_queue (display->wl_display);
|
||||||
@@ -92,7 +78,9 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
|
|||||||
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
|
||||||
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
|
||||||
|
|
||||||
wl_surface = peek_launcher_toplevel (GDK_SEAT (seat));
|
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
|
||||||
|
if (focus_surface)
|
||||||
|
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
|
||||||
if (wl_surface)
|
if (wl_surface)
|
||||||
xdg_activation_token_v1_set_surface (token, wl_surface);
|
xdg_activation_token_v1_set_surface (token, wl_surface);
|
||||||
|
|
||||||
|
|||||||
@@ -96,12 +96,6 @@
|
|||||||
#define XDG_ACTIVATION_VERSION 1
|
#define XDG_ACTIVATION_VERSION 1
|
||||||
#define OUTPUT_VERSION 3
|
#define OUTPUT_VERSION 3
|
||||||
|
|
||||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
|
||||||
#define XDG_WM_BASE_VERSION 6
|
|
||||||
#else
|
|
||||||
#define XDG_WM_BASE_VERSION 5
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||||
|
|
||||||
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
||||||
@@ -644,8 +638,7 @@ _gdk_wayland_display_open (const char *display_name)
|
|||||||
wl_registry_bind (display_wayland->wl_registry,
|
wl_registry_bind (display_wayland->wl_registry,
|
||||||
display_wayland->xdg_wm_base_id,
|
display_wayland->xdg_wm_base_id,
|
||||||
&xdg_wm_base_interface,
|
&xdg_wm_base_interface,
|
||||||
MIN (display_wayland->xdg_wm_base_version,
|
MIN (display_wayland->xdg_wm_base_version, 4));
|
||||||
XDG_WM_BASE_VERSION));
|
|
||||||
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
|
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
|
||||||
&xdg_wm_base_listener,
|
&xdg_wm_base_listener,
|
||||||
display_wayland);
|
display_wayland);
|
||||||
|
|||||||