Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eccbd4fe5f | |||
| 3b967f1242 |
@@ -32,6 +32,7 @@ xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
--timeout-multiplier 2 \
|
||||
--print-errorlogs \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:gsk \
|
||||
--no-suite=gtk:a11y
|
||||
|
||||
# Save the exit code
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
subdir('gtk-demo')
|
||||
subdir('icon-browser')
|
||||
subdir('node-editor')
|
||||
subdir('widget-factory')
|
||||
|
||||
@@ -1,323 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkrendererpaintableprivate.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
struct _GtkRendererPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GskRenderer *renderer;
|
||||
GdkPaintable *paintable;
|
||||
};
|
||||
|
||||
struct _GtkRendererPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PAINTABLE,
|
||||
PROP_RENDERER,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
GtkSnapshot *node_snapshot;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return;
|
||||
|
||||
if (self->renderer == NULL ||
|
||||
!gsk_renderer_is_realized (self->renderer))
|
||||
{
|
||||
gdk_paintable_snapshot (self->paintable, snapshot, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
node_snapshot = gtk_snapshot_new ();
|
||||
gdk_paintable_snapshot (self->paintable, node_snapshot, width, height);
|
||||
node = gtk_snapshot_free_to_node (node_snapshot);
|
||||
if (node == NULL)
|
||||
return;
|
||||
|
||||
texture = gsk_renderer_render_texture (self->renderer,
|
||||
node,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
gdk_paintable_snapshot (GDK_PAINTABLE (texture), snapshot, width, height);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_renderer_paintable_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return 0;
|
||||
|
||||
return gdk_paintable_get_intrinsic_width (self->paintable);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_renderer_paintable_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return 0;
|
||||
|
||||
return gdk_paintable_get_intrinsic_height (self->paintable);
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_renderer_paintable_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return 0.0;
|
||||
|
||||
return gdk_paintable_get_intrinsic_aspect_ratio (self->paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gtk_renderer_paintable_paintable_snapshot;
|
||||
iface->get_intrinsic_width = gtk_renderer_paintable_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = gtk_renderer_paintable_paintable_get_intrinsic_height;
|
||||
iface->get_intrinsic_aspect_ratio = gtk_renderer_paintable_paintable_get_intrinsic_aspect_ratio;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GtkRendererPaintable, gtk_renderer_paintable, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gtk_renderer_paintable_paintable_init))
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PAINTABLE:
|
||||
gtk_renderer_paintable_set_paintable (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_RENDERER:
|
||||
gtk_renderer_paintable_set_renderer (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PAINTABLE:
|
||||
g_value_set_object (value, self->paintable);
|
||||
break;
|
||||
|
||||
case PROP_RENDERER:
|
||||
g_value_set_object (value, self->renderer);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_unset_paintable (GtkRendererPaintable *self)
|
||||
{
|
||||
guint flags;
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return;
|
||||
|
||||
flags = gdk_paintable_get_flags (self->paintable);
|
||||
|
||||
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||
g_signal_handlers_disconnect_by_func (self->paintable,
|
||||
gdk_paintable_invalidate_contents,
|
||||
self);
|
||||
|
||||
if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0)
|
||||
g_signal_handlers_disconnect_by_func (self->paintable,
|
||||
gdk_paintable_invalidate_size,
|
||||
self);
|
||||
|
||||
g_clear_object (&self->paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_dispose (GObject *object)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (object);
|
||||
|
||||
g_clear_object (&self->renderer);
|
||||
gtk_renderer_paintable_unset_paintable (self);
|
||||
|
||||
G_OBJECT_CLASS (gtk_renderer_paintable_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_class_init (GtkRendererPaintableClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->get_property = gtk_renderer_paintable_get_property;
|
||||
gobject_class->set_property = gtk_renderer_paintable_set_property;
|
||||
gobject_class->dispose = gtk_renderer_paintable_dispose;
|
||||
|
||||
properties[PROP_PAINTABLE] =
|
||||
g_param_spec_object ("paintable",
|
||||
"Paintable",
|
||||
"The paintable to be shown",
|
||||
GDK_TYPE_PAINTABLE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
properties[PROP_RENDERER] =
|
||||
g_param_spec_object ("renderer",
|
||||
"Renderer",
|
||||
"Renderer used to render the paintable",
|
||||
GSK_TYPE_RENDERER,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_init (GtkRendererPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
gtk_renderer_paintable_new (GskRenderer *renderer,
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
g_return_val_if_fail (renderer == NULL || GSK_IS_RENDERER (renderer), NULL);
|
||||
g_return_val_if_fail (paintable == NULL || GDK_IS_PAINTABLE (paintable), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_RENDERER_PAINTABLE,
|
||||
"renderer", renderer,
|
||||
"paintable", paintable,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_renderer_paintable_set_renderer (GtkRendererPaintable *self,
|
||||
GskRenderer *renderer)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_RENDERER_PAINTABLE (self));
|
||||
g_return_if_fail (renderer == NULL || GSK_IS_RENDERER (renderer));
|
||||
|
||||
if (!g_set_object (&self->renderer, renderer))
|
||||
return;
|
||||
|
||||
if (self->paintable)
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_RENDERER]);
|
||||
}
|
||||
|
||||
GskRenderer *
|
||||
gtk_renderer_paintable_get_renderer (GtkRendererPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_RENDERER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->renderer;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_renderer_paintable_set_paintable (GtkRendererPaintable *self,
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_RENDERER_PAINTABLE (self));
|
||||
g_return_if_fail (paintable == NULL || GDK_IS_PAINTABLE (paintable));
|
||||
|
||||
if (self->paintable == paintable)
|
||||
return;
|
||||
|
||||
gtk_renderer_paintable_unset_paintable (self);
|
||||
|
||||
if (paintable)
|
||||
{
|
||||
const guint flags = gdk_paintable_get_flags (paintable);
|
||||
|
||||
self->paintable = g_object_ref (paintable);
|
||||
|
||||
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||
g_signal_connect_swapped (paintable,
|
||||
"invalidate-contents",
|
||||
G_CALLBACK (gdk_paintable_invalidate_contents),
|
||||
self);
|
||||
if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0)
|
||||
g_signal_connect_swapped (paintable,
|
||||
"invalidate-size",
|
||||
G_CALLBACK (gdk_paintable_invalidate_size),
|
||||
self);
|
||||
}
|
||||
|
||||
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PAINTABLE]);
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
gtk_renderer_paintable_get_paintable (GtkRendererPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_RENDERER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->paintable;
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RENDERER_PAINTABLE_H__
|
||||
#define __GTK_RENDERER_PAINTABLE_H__
|
||||
|
||||
#include <gsk/gsk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_RENDERER_PAINTABLE (gtk_renderer_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GtkRendererPaintable, gtk_renderer_paintable, GTK, RENDERER_PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * gtk_renderer_paintable_new (GskRenderer *renderer,
|
||||
GdkPaintable *paintable);
|
||||
|
||||
void gtk_renderer_paintable_set_renderer (GtkRendererPaintable *self,
|
||||
GskRenderer *renderer);
|
||||
GskRenderer * gtk_renderer_paintable_get_renderer (GtkRendererPaintable *self) G_GNUC_PURE;
|
||||
void gtk_renderer_paintable_set_paintable (GtkRendererPaintable *self,
|
||||
GdkPaintable *paintable);
|
||||
GdkPaintable * gtk_renderer_paintable_get_paintable (GtkRendererPaintable *self) G_GNUC_PURE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDERER_PAINTABLE_H__ */
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <node-editor-application.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
return g_application_run (G_APPLICATION (node_editor_application_new ()), argc, argv);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
node_editor_sources = [
|
||||
'gtkrendererpaintable.c',
|
||||
'main.c',
|
||||
'node-editor-application.c',
|
||||
'node-editor-window.c',
|
||||
]
|
||||
|
||||
node_editor_resources = gnome.compile_resources('node_editor_resources',
|
||||
'node-editor.gresource.xml',
|
||||
source_dir: '.')
|
||||
|
||||
executable('gtk4-node-editor',
|
||||
node_editor_sources, node_editor_resources,
|
||||
dependencies: libgtk_dep,
|
||||
include_directories: confinc,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: false)
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "node-editor-application.h"
|
||||
|
||||
#include "node-editor-window.h"
|
||||
|
||||
struct _NodeEditorApplication
|
||||
{
|
||||
GtkApplication parent;
|
||||
};
|
||||
|
||||
struct _NodeEditorApplicationClass
|
||||
{
|
||||
GtkApplicationClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
|
||||
|
||||
static void
|
||||
node_editor_application_init (NodeEditorApplication *app)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
quit_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer data)
|
||||
{
|
||||
g_application_quit (G_APPLICATION (data));
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] =
|
||||
{
|
||||
{ "quit", quit_activated, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
node_editor_application_startup (GApplication *app)
|
||||
{
|
||||
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
const char *open_accels[2] = { "<Ctrl>O", NULL };
|
||||
|
||||
G_APPLICATION_CLASS (node_editor_application_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.open", open_accels);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_activate (GApplication *app)
|
||||
{
|
||||
NodeEditorWindow *win;
|
||||
|
||||
win = node_editor_window_new (NODE_EDITOR_APPLICATION (app));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_open (GApplication *app,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint)
|
||||
{
|
||||
NodeEditorWindow *win;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
{
|
||||
win = node_editor_window_new (NODE_EDITOR_APPLICATION (app));
|
||||
node_editor_window_load (win, files[i]);
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_class_init (NodeEditorApplicationClass *class)
|
||||
{
|
||||
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||
|
||||
application_class->startup = node_editor_application_startup;
|
||||
application_class->activate = node_editor_application_activate;
|
||||
application_class->open = node_editor_application_open;
|
||||
}
|
||||
|
||||
NodeEditorApplication *
|
||||
node_editor_application_new (void)
|
||||
{
|
||||
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __NODE_EDITOR_APPLICATION_H__
|
||||
#define __NODE_EDITOR_APPLICATION_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
#define NODE_EDITOR_APPLICATION_TYPE (node_editor_application_get_type ())
|
||||
#define NODE_EDITOR_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NODE_EDITOR_APPLICATION_TYPE, NodeEditorApplication))
|
||||
|
||||
|
||||
typedef struct _NodeEditorApplication NodeEditorApplication;
|
||||
typedef struct _NodeEditorApplicationClass NodeEditorApplicationClass;
|
||||
|
||||
|
||||
GType node_editor_application_get_type (void);
|
||||
NodeEditorApplication *node_editor_application_new (void);
|
||||
|
||||
|
||||
#endif /* __NODE_EDITOR_APPLICATION_H__ */
|
||||
@@ -1,570 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "node-editor-window.h"
|
||||
|
||||
#include "gtkrendererpaintableprivate.h"
|
||||
|
||||
#include "gsk/gskrendernodeparserprivate.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gsize start_chars;
|
||||
gsize end_chars;
|
||||
char *message;
|
||||
} TextViewError;
|
||||
|
||||
struct _NodeEditorWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
|
||||
GtkWidget *picture;
|
||||
GtkWidget *text_view;
|
||||
GtkTextBuffer *text_buffer;
|
||||
|
||||
GtkWidget *renderer_listbox;
|
||||
GListStore *renderers;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
GArray *errors;
|
||||
};
|
||||
|
||||
struct _NodeEditorWindowClass
|
||||
{
|
||||
GtkApplicationWindowClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
||||
static void
|
||||
text_view_error_free (TextViewError *e)
|
||||
{
|
||||
g_free (e->message);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
get_current_text (GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
|
||||
|
||||
return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
deserialize_error_func (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
const GtkCssLocation *start_location = gtk_css_section_get_start_location (section);
|
||||
const GtkCssLocation *end_location = gtk_css_section_get_end_location (section);
|
||||
NodeEditorWindow *self = user_data;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
TextViewError text_view_error;
|
||||
|
||||
gtk_text_buffer_get_iter_at_line_offset (self->text_buffer, &start_iter,
|
||||
start_location->lines,
|
||||
start_location->line_chars);
|
||||
gtk_text_buffer_get_iter_at_line_offset (self->text_buffer, &end_iter,
|
||||
end_location->lines,
|
||||
end_location->line_chars);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "error",
|
||||
&start_iter, &end_iter);
|
||||
|
||||
text_view_error.start_chars = start_location->chars;
|
||||
text_view_error.end_chars = end_location->chars;
|
||||
text_view_error.message = g_strdup (error->message);
|
||||
g_array_append_val (self->errors, text_view_error);
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
char *text;
|
||||
GBytes *bytes;
|
||||
|
||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||
text = get_current_text (self->text_buffer);
|
||||
bytes = g_bytes_new_take (text, strlen (text));
|
||||
|
||||
/* If this is too slow, go fix the parser performance */
|
||||
node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
|
||||
g_bytes_unref (bytes);
|
||||
if (node)
|
||||
{
|
||||
/* XXX: Is this code necessary or can we have API to turn nodes into paintables? */
|
||||
GtkSnapshot *snapshot;
|
||||
GdkPaintable *paintable;
|
||||
graphene_rect_t bounds;
|
||||
guint i;
|
||||
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- bounds.origin.x, - bounds.origin.y));
|
||||
gtk_snapshot_append_node (snapshot, node);
|
||||
gsk_render_node_unref (node);
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, &bounds.size);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (self->picture), paintable);
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i++)
|
||||
{
|
||||
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
||||
gtk_renderer_paintable_set_paintable (item, paintable);
|
||||
g_object_unref (item);
|
||||
}
|
||||
g_clear_object (&paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_picture_set_paintable (GTK_PICTURE (self->picture), NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_view_query_tooltip_cb (GtkWidget *widget,
|
||||
int x,
|
||||
int y,
|
||||
gboolean keyboard_tip,
|
||||
GtkTooltip *tooltip,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
guint i;
|
||||
|
||||
if (keyboard_tip)
|
||||
{
|
||||
gint offset;
|
||||
|
||||
g_object_get (self->text_buffer, "cursor-position", &offset, NULL);
|
||||
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &iter, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint bx, by, trailing;
|
||||
|
||||
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT,
|
||||
x, y, &bx, &by);
|
||||
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
|
||||
}
|
||||
|
||||
for (i = 0; i < self->errors->len; i ++)
|
||||
{
|
||||
const TextViewError *e = &g_array_index (self->errors, TextViewError, i);
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &start_iter, e->start_chars);
|
||||
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &end_iter, e->end_chars);
|
||||
|
||||
if (gtk_text_iter_in_range (&iter, &start_iter, &end_iter))
|
||||
{
|
||||
gtk_tooltip_set_text (tooltip, e->message);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file)
|
||||
{
|
||||
GtkTextIter end;
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
|
||||
if (bytes == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
|
||||
{
|
||||
g_bytes_unref (bytes);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_end_iter (self->text_buffer, &end);
|
||||
gtk_text_buffer_insert (self->text_buffer,
|
||||
&end,
|
||||
g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes));
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
open_response_cb (GtkWidget *dialog,
|
||||
gint response,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
node_editor_window_load (self, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
show_open_filechooser (NodeEditorWindow *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Open node file",
|
||||
GTK_WINDOW (self),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Load", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), ".");
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
open_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
show_open_filechooser (self);
|
||||
}
|
||||
|
||||
static void
|
||||
save_response_cb (GtkWidget *dialog,
|
||||
gint response,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
char *text, *filename;
|
||||
GError *error = NULL;
|
||||
|
||||
text = get_current_text (self->text_buffer);
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
if (!g_file_set_contents (filename, text, -1, &error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Saving failed");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
"%s", error->message);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
gtk_widget_show (dialog);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
save_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Save node",
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), ".");
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
create_texture (NodeEditorWindow *self)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
GtkSnapshot *snapshot;
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
|
||||
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
|
||||
if (paintable == NULL ||
|
||||
gdk_paintable_get_intrinsic_width (paintable) <= 0 ||
|
||||
gdk_paintable_get_intrinsic_height (paintable) <= 0)
|
||||
return NULL;
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gdk_paintable_snapshot (paintable, snapshot, gdk_paintable_get_intrinsic_width (paintable), gdk_paintable_get_intrinsic_height (paintable));
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
/* ahem */
|
||||
renderer = GTK_ROOT_GET_IFACE (gtk_widget_get_root (GTK_WIDGET (self)))->get_renderer (gtk_widget_get_root (GTK_WIDGET (self)));
|
||||
texture = gsk_renderer_render_texture (renderer, node, NULL);
|
||||
gsk_render_node_unref (node);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_response_cb (GtkWidget *dialog,
|
||||
gint response,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
if (!gdk_texture_save_to_png (texture, filename))
|
||||
{
|
||||
GtkWidget *message_dialog;
|
||||
|
||||
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Exporting to image failed");
|
||||
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
gtk_widget_show (message_dialog);
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GtkWidget *dialog;
|
||||
|
||||
texture = create_texture (self);
|
||||
if (texture == NULL)
|
||||
return;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("",
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (export_image_response_cb), texture);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_finalize (GObject *object)
|
||||
{
|
||||
NodeEditorWindow *self = (NodeEditorWindow *)object;
|
||||
|
||||
g_array_free (self->errors, TRUE);
|
||||
|
||||
g_clear_object (&self->renderers);
|
||||
|
||||
G_OBJECT_CLASS (node_editor_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_add_renderer (NodeEditorWindow *self,
|
||||
GskRenderer *renderer,
|
||||
const char *description)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
surface = gtk_widget_get_surface (GTK_WIDGET (self));
|
||||
g_assert (surface != NULL);
|
||||
|
||||
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
return;
|
||||
}
|
||||
|
||||
paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));
|
||||
g_object_set_data_full (G_OBJECT (paintable), "description", g_strdup (description), g_free);
|
||||
g_clear_object (&renderer);
|
||||
|
||||
g_list_store_append (self->renderers, paintable);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_realize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
|
||||
|
||||
#if 0
|
||||
node_editor_window_add_renderer (self,
|
||||
NULL,
|
||||
"Default");
|
||||
#endif
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_gl_renderer_new (),
|
||||
"OpenGL");
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_vulkan_renderer_new (),
|
||||
"Vulkan");
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_broadway_renderer_new (),
|
||||
"Broadway");
|
||||
#endif
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_cairo_renderer_new (),
|
||||
"Cairo");
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_unrealize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
|
||||
g_list_store_remove_all (self->renderers);
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->finalize = node_editor_window_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
|
||||
|
||||
widget_class->realize = node_editor_window_realize;
|
||||
widget_class->unrealize = node_editor_window_unrealize;
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_buffer);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, save_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
node_editor_window_create_renderer_widget (gpointer item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkPaintable *paintable = item;
|
||||
GtkWidget *box, *label, *picture;
|
||||
GtkWidget *row;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 120, 90);
|
||||
|
||||
label = gtk_label_new (g_object_get_data (G_OBJECT (paintable), "description"));
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_container_add (GTK_CONTAINER (box), picture);
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
gtk_container_add (GTK_CONTAINER (row), box);
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
static void
|
||||
window_open (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
NodeEditorWindow *self = user_data;
|
||||
|
||||
show_open_filechooser (self);
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "open", window_open, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
node_editor_window_init (NodeEditorWindow *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
|
||||
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
|
||||
G_LIST_MODEL (self->renderers),
|
||||
node_editor_window_create_renderer_widget,
|
||||
self,
|
||||
NULL);
|
||||
|
||||
self->errors = g_array_new (FALSE, TRUE, sizeof (TextViewError));
|
||||
g_array_set_clear_func (self->errors, (GDestroyNotify)text_view_error_free);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
|
||||
}
|
||||
|
||||
NodeEditorWindow *
|
||||
node_editor_window_new (NodeEditorApplication *application)
|
||||
{
|
||||
return g_object_new (NODE_EDITOR_WINDOW_TYPE,
|
||||
"application", application,
|
||||
NULL);
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __NODE_EDITOR_WINDOW_H__
|
||||
#define __NODE_EDITOR_WINDOW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "node-editor-application.h"
|
||||
|
||||
#define NODE_EDITOR_WINDOW_TYPE (node_editor_window_get_type ())
|
||||
#define NODE_EDITOR_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NODE_EDITOR_WINDOW_TYPE, NodeEditorWindow))
|
||||
|
||||
|
||||
typedef struct _NodeEditorWindow NodeEditorWindow;
|
||||
typedef struct _NodeEditorWindowClass NodeEditorWindowClass;
|
||||
|
||||
|
||||
GType node_editor_window_get_type (void);
|
||||
|
||||
NodeEditorWindow * node_editor_window_new (NodeEditorApplication *application);
|
||||
|
||||
gboolean node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file);
|
||||
|
||||
#endif /* __NODE_EDITOR_WINDOW_H__ */
|
||||
@@ -1,113 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkTextTagTable" id="tags">
|
||||
<child type="tag">
|
||||
<object class="GtkTextTag">
|
||||
<property name="name">error</property>
|
||||
<property name="underline">error</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkTextBuffer" id="text_buffer">
|
||||
<property name="tag-table">tags</property>
|
||||
<signal name="changed" handler="text_changed"/>
|
||||
</object>
|
||||
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
<property name="tooltip-text">Open node file</property>
|
||||
<signal name="clicked" handler="open_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">document-save-symbolic</property>
|
||||
<property name="tooltip-text">Save to node file</property>
|
||||
<signal name="clicked" handler="save_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">insert-image-symbolic</property>
|
||||
<property name="tooltip-text">Export to image</property>
|
||||
<signal name="clicked" handler="export_image_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">GTK Node Editor</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="shrink-child2">false</property>
|
||||
<property name="position">400</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="expand">1</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="text_view">
|
||||
<property name="buffer">text_buffer</property>
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="monospace">1</property>
|
||||
<property name="has-focus">1</property>
|
||||
<property name="top-margin">6</property>
|
||||
<property name="left-margin">6</property>
|
||||
<property name="right-margin">6</property>
|
||||
<property name="bottom-margin">6</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="expand">1</property>
|
||||
<property name="min-content-height">100</property>
|
||||
<property name="min-content-width">100</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="renderer_listbox">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gtk/gtk4/node-editor">
|
||||
<file preprocess="xml-stripblanks">node-editor-window.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
@@ -1,17 +1,12 @@
|
||||
<SECTION>
|
||||
<FILE>GskRenderer</FILE>
|
||||
gsk_renderer_new_for_surface
|
||||
gsk_renderer_get_surface
|
||||
gsk_renderer_realize
|
||||
gsk_renderer_unrealize
|
||||
gsk_renderer_is_realized
|
||||
gsk_renderer_render
|
||||
gsk_renderer_render_texture
|
||||
<SUBSECTION>
|
||||
gsk_renderer_new_for_surface
|
||||
gsk_gl_renderer_new
|
||||
gsk_cairo_renderer_new
|
||||
gsk_vulkan_renderer_new
|
||||
gsk_broadway_renderer_new
|
||||
<SUBSECTION Standard>
|
||||
GSK_IS_RENDERER
|
||||
GSK_RENDERER
|
||||
|
||||
@@ -24,7 +24,9 @@ gdk_broadway_public_headers = [
|
||||
'gdkbroadwaymonitor.h',
|
||||
]
|
||||
|
||||
install_headers(gdk_broadway_public_headers, 'gdkbroadway.h', subdir: 'gtk-4.0/gdk/broadway/')
|
||||
# Broadway backend headers aren't installed it seems
|
||||
#install_headers(gdk_broadway_public_headers, subdir: 'gtk-4.0/gdk/broadway/')
|
||||
#install_headers('gdkbroadway.h', subdir: 'gtk-4.0/gdk/')
|
||||
|
||||
gdk_broadway_deps = [shmlib]
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@ gdk_quartz_public_headers = files([
|
||||
'gdkquartzsurface.h',
|
||||
])
|
||||
|
||||
install_headers(gdk_quartz_public_headers, 'gdkquartz.h', subdir: 'gtk-4.0/gdk/quartz/')
|
||||
install_headers(gdk_quartz_public_headers, subdir: 'gtk-4.0/gdk/quartz/')
|
||||
install_headers('gdkquartz.h', subdir: 'gtk-4.0/gdk/')
|
||||
|
||||
gdk_quartz_deps = [ # FIXME
|
||||
]
|
||||
|
||||
@@ -26,7 +26,8 @@ gdk_wayland_public_headers = files([
|
||||
'gdkwaylandsurface.h'
|
||||
])
|
||||
|
||||
install_headers(gdk_wayland_public_headers, 'gdkwayland.h', subdir: 'gtk-4.0/gdk/wayland/')
|
||||
install_headers(gdk_wayland_public_headers, subdir: 'gtk-4.0/gdk/wayland/')
|
||||
install_headers('gdkwayland.h', subdir: 'gtk-4.0/gdk/')
|
||||
|
||||
gdk_wayland_deps = [
|
||||
shmlib,
|
||||
|
||||
@@ -42,7 +42,8 @@ gdk_win32_public_headers = files([
|
||||
'gdkwin32surface.h',
|
||||
])
|
||||
|
||||
install_headers(gdk_win32_public_headers, 'gdkwin32.h', subdir: 'gtk-4.0/gdk/win32/')
|
||||
install_headers(gdk_win32_public_headers, subdir: 'gtk-4.0/gdk/win32/')
|
||||
install_headers('gdkwin32.h', subdir: 'gtk-4.0/gdk/')
|
||||
|
||||
gdk_win32_deps = [ # FIXME
|
||||
pangowin32_dep
|
||||
|
||||
+2
-1
@@ -54,7 +54,8 @@ gdk_x11_public_headers = files([
|
||||
'gdkx11surface.h',
|
||||
])
|
||||
|
||||
install_headers(gdk_x11_public_headers, 'gdkx.h', subdir: 'gtk-4.0/gdk/x11/')
|
||||
install_headers(gdk_x11_public_headers, subdir: 'gtk-4.0/gdk/x11/')
|
||||
install_headers('gdkx.h', subdir: 'gtk-4.0/gdk/')
|
||||
|
||||
gdk_x11_deps = [
|
||||
xrender_dep,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskbroadwayrenderer.h"
|
||||
|
||||
#include "gskbroadwayrendererprivate.h"
|
||||
#include "broadway/gdkprivate-broadway.h"
|
||||
|
||||
#include "gskdebugprivate.h"
|
||||
@@ -828,23 +827,3 @@ static void
|
||||
gsk_broadway_renderer_init (GskBroadwayRenderer *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_broadway_renderer_new:
|
||||
*
|
||||
* Creates a new Broadway renderer.
|
||||
*
|
||||
* The Broadway renderer is the default renderer for the broadway backend.
|
||||
* It will only work with broadway surfaces, otherwise it will fail the
|
||||
* call to gdk_renderer_realize().
|
||||
*
|
||||
* This function is only available when GTK was compiled with Broadway
|
||||
* support.
|
||||
*
|
||||
* Returns: a new Broadway renderer.
|
||||
**/
|
||||
GskRenderer *
|
||||
gsk_broadway_renderer_new (void)
|
||||
{
|
||||
return g_object_new (GSK_TYPE_BROADWAY_RENDERER, NULL);
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2019 Alexander Larsson
|
||||
*
|
||||
* 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 __GSK_BROADWAY_RENDERER_H__
|
||||
#define __GSK_BROADWAY_RENDERER_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
|
||||
#include <gdk/broadway/gdkbroadway.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_BROADWAY_RENDERER (gsk_broadway_renderer_get_type ())
|
||||
|
||||
#define GSK_BROADWAY_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRenderer))
|
||||
#define GSK_IS_BROADWAY_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_BROADWAY_RENDERER))
|
||||
#define GSK_BROADWAY_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRendererClass))
|
||||
#define GSK_IS_BROADWAY_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_BROADWAY_RENDERER))
|
||||
#define GSK_BROADWAY_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRendererClass))
|
||||
|
||||
typedef struct _GskBroadwayRenderer GskBroadwayRenderer;
|
||||
typedef struct _GskBroadwayRendererClass GskBroadwayRendererClass;
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gsk_broadway_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer * gsk_broadway_renderer_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GDK_WINDOWING_BROADWAY */
|
||||
|
||||
#endif /* __GSK_BROADWAY_RENDERER_H__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef __GSK_BROADWAY_RENDERER_PRIVATE_H__
|
||||
#define __GSK_BROADWAY_RENDERER_PRIVATE_H__
|
||||
|
||||
#include "broadway/gdkbroadway.h"
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_BROADWAY_RENDERER (gsk_broadway_renderer_get_type ())
|
||||
|
||||
#define GSK_BROADWAY_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRenderer))
|
||||
#define GSK_IS_BROADWAY_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_BROADWAY_RENDERER))
|
||||
#define GSK_BROADWAY_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRendererClass))
|
||||
#define GSK_IS_BROADWAY_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_BROADWAY_RENDERER))
|
||||
#define GSK_BROADWAY_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_BROADWAY_RENDERER, GskBroadwayRendererClass))
|
||||
|
||||
typedef struct _GskBroadwayRenderer GskBroadwayRenderer;
|
||||
typedef struct _GskBroadwayRendererClass GskBroadwayRendererClass;
|
||||
|
||||
GType gsk_broadway_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_BROADWAY_RENDERER_PRIVATE_H__ */
|
||||
+3
-17
@@ -1,6 +1,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gskglrenderer.h"
|
||||
#include "gskglrendererprivate.h"
|
||||
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskenums.h"
|
||||
@@ -1883,13 +1883,13 @@ render_cross_fade_node (GskGLRenderer *self,
|
||||
&node->bounds,
|
||||
start_node,
|
||||
&start_texture_id, &is_offscreen1,
|
||||
FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY);
|
||||
FORCE_OFFSCREEN | RESET_CLIP);
|
||||
|
||||
add_offscreen_ops (self, builder,
|
||||
&node->bounds,
|
||||
end_node,
|
||||
&end_texture_id, &is_offscreen2,
|
||||
FORCE_OFFSCREEN | RESET_CLIP | RESET_OPACITY);
|
||||
FORCE_OFFSCREEN | RESET_CLIP);
|
||||
|
||||
ops_set_program (builder, &self->cross_fade_program);
|
||||
op.op = OP_CHANGE_CROSS_FADE;
|
||||
@@ -3281,17 +3281,3 @@ gsk_gl_renderer_init (GskGLRenderer *self)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_gl_renderer_new:
|
||||
*
|
||||
* Creates a new #GskRenderer using OpenGL. This is the default renderer
|
||||
* used by GTK.
|
||||
*
|
||||
* Returns: a new GL renderer
|
||||
**/
|
||||
GskRenderer *
|
||||
gsk_gl_renderer_new (void)
|
||||
{
|
||||
return g_object_new (GSK_TYPE_GL_RENDERER, NULL);
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2016 Endless
|
||||
* 2018 Timm Bäder <mail@baedert.org>
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Timm Bäder <mail@baedert.org>
|
||||
*/
|
||||
|
||||
#ifndef __GSK_GL_RENDERER_H__
|
||||
#define __GSK_GL_RENDERER_H__
|
||||
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_GL_RENDERER (gsk_gl_renderer_get_type ())
|
||||
|
||||
#define GSK_GL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_GL_RENDERER, GskGLRenderer))
|
||||
#define GSK_IS_GL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_GL_RENDERER))
|
||||
#define GSK_GL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_GL_RENDERER, GskGLRendererClass))
|
||||
#define GSK_IS_GL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_GL_RENDERER))
|
||||
#define GSK_GL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_GL_RENDERER, GskGLRendererClass))
|
||||
|
||||
typedef struct _GskGLRenderer GskGLRenderer;
|
||||
typedef struct _GskGLRendererClass GskGLRendererClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gsk_gl_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer * gsk_gl_renderer_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_GL_RENDERER_H__ */
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef __GSK_GL_RENDERER_PRIVATE_H__
|
||||
#define __GSK_GL_RENDERER_PRIVATE_H__
|
||||
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_GL_RENDERER (gsk_gl_renderer_get_type ())
|
||||
|
||||
#define GSK_GL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_GL_RENDERER, GskGLRenderer))
|
||||
#define GSK_IS_GL_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_GL_RENDERER))
|
||||
#define GSK_GL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_GL_RENDERER, GskGLRendererClass))
|
||||
#define GSK_IS_GL_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_GL_RENDERER))
|
||||
#define GSK_GL_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_GL_RENDERER, GskGLRendererClass))
|
||||
|
||||
typedef struct _GskGLRenderer GskGLRenderer;
|
||||
typedef struct _GskGLRendererClass GskGLRendererClass;
|
||||
|
||||
GType gsk_gl_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_GL_RENDERER_PRIVATE_H__ */
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "gskgldriverprivate.h"
|
||||
#include "gskroundedrectprivate.h"
|
||||
#include "gskglrenderer.h"
|
||||
#include "gskglrendererprivate.h"
|
||||
#include "gskrendernodeprivate.h"
|
||||
|
||||
#define GL_N_VERTICES 6
|
||||
|
||||
@@ -26,11 +26,6 @@
|
||||
#include <gsk/gskroundedrect.h>
|
||||
#include <gsk/gsktransform.h>
|
||||
|
||||
#include <gsk/gskcairorenderer.h>
|
||||
#include <gsk/gl/gskglrenderer.h>
|
||||
#include <gsk/broadway/gskbroadwayrenderer.h>
|
||||
#include <gsk/vulkan/gskvulkanrenderer.h>
|
||||
|
||||
#include <gsk/gsktypes.h>
|
||||
#include <gsk/gskenumtypes.h>
|
||||
|
||||
|
||||
+1
-41
@@ -1,26 +1,6 @@
|
||||
/*
|
||||
* Copyright © 2016 Endless
|
||||
* 2018 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gskcairorenderer.h"
|
||||
#include "gskcairorendererprivate.h"
|
||||
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskrendererprivate.h"
|
||||
@@ -179,23 +159,3 @@ gsk_cairo_renderer_init (GskCairoRenderer *self)
|
||||
self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_cairo_renderer_new:
|
||||
*
|
||||
* Creates a new Cairo renderer.
|
||||
*
|
||||
* The Cairo renderer is the fallback renderer drawing in ways similar
|
||||
* to how GTK 3 drew its content. Its primary use is as comparison tool.
|
||||
*
|
||||
* The Cairo renderer is incomplete. It cannot render 3D transformed
|
||||
* content and will instead render an error marker. Its usage should be
|
||||
* avoided.
|
||||
*
|
||||
* Returns: a new Cairo renderer.
|
||||
**/
|
||||
GskRenderer *
|
||||
gsk_cairo_renderer_new (void)
|
||||
{
|
||||
return g_object_new (GSK_TYPE_CAIRO_RENDERER, NULL);
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2016 Endless
|
||||
* 2018 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GSK_CAIRO_RENDERER_H__
|
||||
#define __GSK_CAIRO_RENDERER_H__
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_CAIRO_RENDERER (gsk_cairo_renderer_get_type ())
|
||||
|
||||
#define GSK_CAIRO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_CAIRO_RENDERER, GskCairoRenderer))
|
||||
#define GSK_IS_CAIRO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_CAIRO_RENDERER))
|
||||
#define GSK_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_CAIRO_RENDERER, GskCairoRendererClass))
|
||||
#define GSK_IS_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_CAIRO_RENDERER))
|
||||
#define GSK_CAIRO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_CAIRO_RENDERER, GskCairoRendererClass))
|
||||
|
||||
typedef struct _GskCairoRenderer GskCairoRenderer;
|
||||
typedef struct _GskCairoRendererClass GskCairoRendererClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gsk_cairo_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer * gsk_cairo_renderer_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_CAIRO_RENDERER_H__ */
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef __GSK_CAIRO_RENDERER_PRIVATE_H__
|
||||
#define __GSK_CAIRO_RENDERER_PRIVATE_H__
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_CAIRO_RENDERER (gsk_cairo_renderer_get_type ())
|
||||
|
||||
#define GSK_CAIRO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_CAIRO_RENDERER, GskCairoRenderer))
|
||||
#define GSK_IS_CAIRO_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_CAIRO_RENDERER))
|
||||
#define GSK_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_CAIRO_RENDERER, GskCairoRendererClass))
|
||||
#define GSK_IS_CAIRO_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_CAIRO_RENDERER))
|
||||
#define GSK_CAIRO_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_CAIRO_RENDERER, GskCairoRendererClass))
|
||||
|
||||
typedef struct _GskCairoRenderer GskCairoRenderer;
|
||||
typedef struct _GskCairoRendererClass GskCairoRendererClass;
|
||||
|
||||
GType gsk_cairo_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_CAIRO_RENDERER_PRIVATE_H__ */
|
||||
+4
-4
@@ -36,9 +36,9 @@
|
||||
|
||||
#include "gskrendererprivate.h"
|
||||
|
||||
#include "gskcairorenderer.h"
|
||||
#include "gskcairorendererprivate.h"
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gl/gskglrenderer.h"
|
||||
#include "gl/gskglrendererprivate.h"
|
||||
#include "gskprofilerprivate.h"
|
||||
#include "gskrendernodeprivate.h"
|
||||
|
||||
@@ -55,10 +55,10 @@
|
||||
#include <gdk/wayland/gdkwayland.h>
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
#include "broadway/gskbroadwayrenderer.h"
|
||||
#include "broadway/gskbroadwayrendererprivate.h"
|
||||
#endif
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
#include "vulkan/gskvulkanrenderer.h"
|
||||
#include "vulkan/gskvulkanrendererprivate.h"
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
|
||||
+41
-8
@@ -42,7 +42,6 @@
|
||||
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskrendererprivate.h"
|
||||
#include "gskrendernodeparserprivate.h"
|
||||
|
||||
#include <graphene-gobject.h>
|
||||
|
||||
@@ -329,11 +328,19 @@ gsk_render_node_diff (GskRenderNode *node1,
|
||||
GBytes *
|
||||
gsk_render_node_serialize (GskRenderNode *node)
|
||||
{
|
||||
GVariant *node_variant, *variant;
|
||||
GBytes *result;
|
||||
char *str;
|
||||
|
||||
str = gsk_render_node_serialize_to_string (node);
|
||||
result = g_bytes_new_take (str, strlen (str));
|
||||
node_variant = gsk_render_node_serialize_node (node);
|
||||
|
||||
variant = g_variant_new ("(suuv)",
|
||||
GSK_RENDER_NODE_SERIALIZATION_ID,
|
||||
(guint32) GSK_RENDER_NODE_SERIALIZATION_VERSION,
|
||||
(guint32) gsk_render_node_get_node_type (node),
|
||||
node_variant);
|
||||
|
||||
result = g_variant_get_data_as_bytes (variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -387,13 +394,39 @@ gsk_render_node_write_to_file (GskRenderNode *node,
|
||||
* error.
|
||||
**/
|
||||
GskRenderNode *
|
||||
gsk_render_node_deserialize (GBytes *bytes,
|
||||
GskParseErrorFunc error_func,
|
||||
gpointer user_data)
|
||||
gsk_render_node_deserialize (GBytes *bytes,
|
||||
GError **error)
|
||||
{
|
||||
char *id_string;
|
||||
guint32 version, node_type;
|
||||
GVariant *variant, *node_variant;
|
||||
GskRenderNode *node = NULL;
|
||||
|
||||
node = gsk_render_node_deserialize_from_bytes (bytes, error_func, user_data);
|
||||
variant = g_variant_new_from_bytes (G_VARIANT_TYPE ("(suuv)"), bytes, FALSE);
|
||||
|
||||
g_variant_get (variant, "(suuv)", &id_string, &version, &node_type, &node_variant);
|
||||
|
||||
if (!g_str_equal (id_string, GSK_RENDER_NODE_SERIALIZATION_ID))
|
||||
{
|
||||
g_set_error (error, GSK_SERIALIZATION_ERROR, GSK_SERIALIZATION_UNSUPPORTED_FORMAT,
|
||||
"Data not in GskRenderNode serialization format.");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (version != GSK_RENDER_NODE_SERIALIZATION_VERSION)
|
||||
{
|
||||
g_set_error (error, GSK_SERIALIZATION_ERROR, GSK_SERIALIZATION_UNSUPPORTED_VERSION,
|
||||
"Format version %u not supported.", version);
|
||||
goto out;
|
||||
}
|
||||
|
||||
node = gsk_render_node_deserialize_node (node_type, node_variant, error);
|
||||
|
||||
out:
|
||||
g_free (id_string);
|
||||
g_variant_unref (node_variant);
|
||||
g_variant_unref (variant);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
+2
-8
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <gsk/gskroundedrect.h>
|
||||
#include <gsk/gsktypes.h>
|
||||
#include <gtk/css/gtkcss.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -53,10 +52,6 @@ struct _GskShadow
|
||||
float radius;
|
||||
};
|
||||
|
||||
typedef void (* GskParseErrorFunc) (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gsk_render_node_get_type (void) G_GNUC_CONST;
|
||||
|
||||
@@ -86,9 +81,8 @@ gboolean gsk_render_node_write_to_file (GskRenderNode *
|
||||
const char *filename,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gsk_render_node_deserialize (GBytes *bytes,
|
||||
GskParseErrorFunc error_func,
|
||||
gpointer user_data);
|
||||
GskRenderNode * gsk_render_node_deserialize (GBytes *bytes,
|
||||
GError **error);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderNode * gsk_debug_node_new (GskRenderNode *child,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
|
||||
#ifndef __GSK_RENDER_NODE_PARSER_PRIVATE_H__
|
||||
#define __GSK_RENDER_NODE_PARSER_PRIVATE_H__
|
||||
|
||||
#include "gskrendernode.h"
|
||||
|
||||
GskRenderNode * gsk_render_node_deserialize_from_bytes (GBytes *bytes,
|
||||
GskParseErrorFunc error_func,
|
||||
gpointer user_data);
|
||||
char * gsk_render_node_serialize_to_string (GskRenderNode *root);
|
||||
|
||||
#endif
|
||||
@@ -33,6 +33,9 @@ struct _GskRenderNodeClass
|
||||
void (* diff) (GskRenderNode *node1,
|
||||
GskRenderNode *node2,
|
||||
cairo_region_t *region);
|
||||
GVariant * (* serialize) (GskRenderNode *node);
|
||||
GskRenderNode * (* deserialize) (GVariant *variant,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
GskRenderNode * gsk_render_node_new (const GskRenderNodeClass *node_class,
|
||||
@@ -47,6 +50,11 @@ void gsk_render_node_diff_impossible (GskRenderNode *nod
|
||||
GskRenderNode *node2,
|
||||
cairo_region_t *region);
|
||||
|
||||
GVariant * gsk_render_node_serialize_node (GskRenderNode *node);
|
||||
GskRenderNode * gsk_render_node_deserialize_node (GskRenderNodeType type,
|
||||
GVariant *variant,
|
||||
GError **error);
|
||||
|
||||
GskRenderNode * gsk_cairo_node_new_for_surface (const graphene_rect_t *bounds,
|
||||
cairo_surface_t *surface);
|
||||
|
||||
|
||||
+5
-24
@@ -22,23 +22,22 @@ gsk_private_gl_shaders = [
|
||||
|
||||
gsk_public_sources = files([
|
||||
'gskdiff.c',
|
||||
'gskcairorenderer.c',
|
||||
'gskrenderer.c',
|
||||
'gskrendernode.c',
|
||||
'gskrendernodeimpl.c',
|
||||
'gskroundedrect.c',
|
||||
'gsktransform.c',
|
||||
'gl/gskglrenderer.c',
|
||||
])
|
||||
|
||||
gsk_private_sources = files([
|
||||
'gskcairoblur.c',
|
||||
'gskcairorenderer.c',
|
||||
'gskdebug.c',
|
||||
'gskprivate.c',
|
||||
'gskprofiler.c',
|
||||
'gskrendernodeparser.c',
|
||||
'gl/gskshaderbuilder.c',
|
||||
'gl/gskglprofiler.c',
|
||||
'gl/gskglrenderer.c',
|
||||
'gl/gskglglyphcache.c',
|
||||
'gl/gskglimage.c',
|
||||
'gl/gskgldriver.c',
|
||||
@@ -48,35 +47,17 @@ gsk_private_sources = files([
|
||||
])
|
||||
|
||||
gsk_public_headers = files([
|
||||
'gskcairorenderer.h',
|
||||
'gskenums.h',
|
||||
'gskrenderer.h',
|
||||
'gskrendernode.h',
|
||||
'gskroundedrect.h',
|
||||
'gsktransform.h',
|
||||
'gsktypes.h',
|
||||
'gsk-autocleanup.h',
|
||||
'gsk-autocleanup.h'
|
||||
])
|
||||
|
||||
install_headers(gsk_public_headers, 'gsk.h', subdir: 'gtk-4.0/gsk')
|
||||
|
||||
gsk_public_gl_headers = files([
|
||||
'gl/gskglrenderer.h'
|
||||
])
|
||||
install_headers(gsk_public_gl_headers, subdir: 'gtk-4.0/gsk/gl')
|
||||
gsk_public_headers += gsk_public_gl_headers
|
||||
|
||||
gsk_public_broadway_headers = files([
|
||||
'broadway/gskbroadwayrenderer.h'
|
||||
])
|
||||
install_headers(gsk_public_broadway_headers, subdir: 'gtk-4.0/gsk/broadway')
|
||||
gsk_public_headers += gsk_public_broadway_headers
|
||||
|
||||
gsk_public_vulkan_headers = files([
|
||||
'vulkan/gskvulkanrenderer.h'
|
||||
])
|
||||
install_headers(gsk_public_vulkan_headers, subdir: 'gtk-4.0/gsk/vulkan')
|
||||
gsk_public_headers += gsk_public_vulkan_headers
|
||||
|
||||
gsk_private_vulkan_shaders = []
|
||||
# This is an odd split because we use configure_file() below to workaround
|
||||
# a limitation in meson preventing using custom_target() with gnome.compile_resources()
|
||||
@@ -116,7 +97,7 @@ if have_vulkan
|
||||
endif # have_vulkan
|
||||
|
||||
if get_variable('broadway_enabled')
|
||||
gsk_public_sources += files([
|
||||
gsk_private_sources += files([
|
||||
'broadway/gskbroadwayrenderer.c',
|
||||
])
|
||||
endif
|
||||
|
||||
@@ -264,22 +264,22 @@ void main() {
|
||||
|
||||
vec4 result;
|
||||
switch(u_mode) {
|
||||
case 0: result = normal(top_color, bottom_color); break;
|
||||
case 1: result = multiply(top_color, bottom_color); break;
|
||||
case 2: result = screen(top_color, bottom_color); break;
|
||||
case 3: result = overlay(top_color, bottom_color); break;
|
||||
case 4: result = darken(top_color, bottom_color); break;
|
||||
case 5: result = lighten(top_color, bottom_color); break;
|
||||
case 6: result = color_dodge(top_color, bottom_color); break;
|
||||
case 7: result = color_burn(top_color, bottom_color); break;
|
||||
case 8: result = hard_light(top_color, bottom_color); break;
|
||||
case 9: result = soft_light(top_color, bottom_color); break;
|
||||
case 10: result = difference(top_color, bottom_color); break;
|
||||
case 11: result = exclusion(top_color, bottom_color); break;
|
||||
case 12: result = color(top_color, bottom_color); break;
|
||||
case 13: result = hue(top_color, bottom_color); break;
|
||||
case 14: result = saturation(top_color, bottom_color); break;
|
||||
case 15: result = luminosity(top_color, bottom_color); break;
|
||||
case 0: result = normal(bottom_color, top_color); break;
|
||||
case 1: result = multiply(bottom_color, top_color); break;
|
||||
case 2: result = screen(bottom_color, top_color); break;
|
||||
case 3: result = overlay(bottom_color, top_color); break;
|
||||
case 4: result = darken(bottom_color, top_color); break;
|
||||
case 5: result = lighten(bottom_color, top_color); break;
|
||||
case 6: result = color_dodge(bottom_color, top_color); break;
|
||||
case 7: result = color_burn(bottom_color, top_color); break;
|
||||
case 8: result = hard_light(bottom_color, top_color); break;
|
||||
case 9: result = soft_light(bottom_color, top_color); break;
|
||||
case 10: result = difference(bottom_color, top_color); break;
|
||||
case 11: result = exclusion(bottom_color, top_color); break;
|
||||
case 12: result = color(bottom_color, top_color); break;
|
||||
case 13: result = hue(bottom_color, top_color); break;
|
||||
case 14: result = saturation(bottom_color, top_color); break;
|
||||
case 15: result = luminosity(bottom_color, top_color); break;
|
||||
default: discard;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@ void main() {
|
||||
color.rgb *= color.a;
|
||||
|
||||
// u_source is drawn using cairo, so already pre-multiplied.
|
||||
color = vec4(color.rgb * diffuse.a * u_alpha,
|
||||
color.a * diffuse.a * u_alpha);
|
||||
color = vec4(u_color.rgb * diffuse.a * u_alpha, diffuse.a * color.a * u_alpha);
|
||||
|
||||
setOutputColor(color);
|
||||
}
|
||||
|
||||
@@ -364,22 +364,3 @@ gsk_vulkan_renderer_get_cached_glyph (GskVulkanRenderer *self,
|
||||
{
|
||||
return gsk_vulkan_glyph_cache_lookup (self->glyph_cache, FALSE, font, glyph, scale);
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_vulkan_renderer_new:
|
||||
*
|
||||
* Creates a new Vulkan renderer.
|
||||
*
|
||||
* The Vulkan renderer is a renderer that uses the Vulkan library for
|
||||
* rendering.
|
||||
*
|
||||
* This function is only available when GTK was compiled with Vulkan
|
||||
* support.
|
||||
*
|
||||
* Returns: a new Vulkan renderer
|
||||
**/
|
||||
GskRenderer *
|
||||
gsk_vulkan_renderer_new (void)
|
||||
{
|
||||
return g_object_new (GSK_TYPE_VULKAN_RENDERER, NULL);
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* 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 __GSK_VULKAN_RENDERER_H__
|
||||
#define __GSK_VULKAN_RENDERER_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_VULKAN_RENDERER (gsk_vulkan_renderer_get_type ())
|
||||
|
||||
#define GSK_VULKAN_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_VULKAN_RENDERER, GskVulkanRenderer))
|
||||
#define GSK_IS_VULKAN_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_VULKAN_RENDERER))
|
||||
#define GSK_VULKAN_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
|
||||
#define GSK_IS_VULKAN_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_VULKAN_RENDERER))
|
||||
#define GSK_VULKAN_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
|
||||
|
||||
typedef struct _GskVulkanRenderer GskVulkanRenderer;
|
||||
typedef struct _GskVulkanRendererClass GskVulkanRendererClass;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gsk_vulkan_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GskRenderer * gsk_vulkan_renderer_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GDK_WINDOWING_VULKAN */
|
||||
|
||||
#endif /* __GSK_VULKAN_RENDERER_H__ */
|
||||
@@ -1,11 +1,26 @@
|
||||
#ifndef __GSK_VULKAN_RENDERER_PRIVATE_H__
|
||||
#define __GSK_VULKAN_RENDERER_PRIVATE_H__
|
||||
|
||||
#include "gskvulkanrenderer.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <gsk/gskrenderer.h>
|
||||
|
||||
#include "gskvulkanimageprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_VULKAN_RENDERER (gsk_vulkan_renderer_get_type ())
|
||||
|
||||
#define GSK_VULKAN_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSK_TYPE_VULKAN_RENDERER, GskVulkanRenderer))
|
||||
#define GSK_IS_VULKAN_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSK_TYPE_VULKAN_RENDERER))
|
||||
#define GSK_VULKAN_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
|
||||
#define GSK_IS_VULKAN_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSK_TYPE_VULKAN_RENDERER))
|
||||
#define GSK_VULKAN_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
|
||||
|
||||
typedef struct _GskVulkanRenderer GskVulkanRenderer;
|
||||
typedef struct _GskVulkanRendererClass GskVulkanRendererClass;
|
||||
|
||||
GType gsk_vulkan_renderer_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GskVulkanImage * gsk_vulkan_renderer_ref_texture_image (GskVulkanRenderer *self,
|
||||
GdkTexture *texture,
|
||||
GskVulkanUploader *uploader);
|
||||
|
||||
@@ -243,8 +243,6 @@ gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook,
|
||||
GObject *object;
|
||||
AtkObject *atk_object;
|
||||
GtkNotebookPageAccessible *page;
|
||||
GtkNotebook *nb;
|
||||
GtkWidget *notebook_page;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_NOTEBOOK_ACCESSIBLE (notebook), NULL);
|
||||
g_return_val_if_fail (GTK_WIDGET (child), NULL);
|
||||
@@ -260,11 +258,9 @@ gtk_notebook_page_accessible_new (GtkNotebookAccessible *notebook,
|
||||
atk_object->layer = ATK_LAYER_WIDGET;
|
||||
|
||||
atk_object_set_parent (gtk_widget_get_accessible (child), atk_object);
|
||||
nb = GTK_NOTEBOOK (gtk_accessible_get_widget (page->priv->notebook));
|
||||
notebook_page = gtk_notebook_get_page (nb, child);
|
||||
|
||||
g_signal_connect (notebook_page,
|
||||
"notify::tab-label",
|
||||
g_signal_connect (gtk_accessible_get_widget (page->priv->notebook),
|
||||
"child-notify::tab-label",
|
||||
G_CALLBACK (notify_tab_label), page);
|
||||
|
||||
return atk_object;
|
||||
|
||||
@@ -1000,15 +1000,6 @@ gtk_css_parser_consume_url (GtkCssParser *self)
|
||||
return result;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_parser_has_number (GtkCssParser *self)
|
||||
{
|
||||
return gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SIGNED_NUMBER)
|
||||
|| gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SIGNLESS_NUMBER)
|
||||
|| gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SIGNED_INTEGER)
|
||||
|| gtk_css_parser_has_token (self, GTK_CSS_TOKEN_SIGNLESS_INTEGER);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_parser_consume_number (GtkCssParser *self,
|
||||
double *number)
|
||||
|
||||
@@ -118,7 +118,6 @@ gboolean gtk_css_parser_has_token (GtkCssParser
|
||||
GtkCssTokenType token_type);
|
||||
gboolean gtk_css_parser_has_ident (GtkCssParser *self,
|
||||
const char *ident);
|
||||
gboolean gtk_css_parser_has_number (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_integer (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_function (GtkCssParser *self,
|
||||
const char *name);
|
||||
|
||||
@@ -1376,7 +1376,6 @@ gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
|
||||
else
|
||||
{
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_DELIM, '\\');
|
||||
gtk_css_tokenizer_consume_ascii (tokenizer);
|
||||
gtk_css_tokenizer_parse_error (error, "Newline may not follow '\' escape character");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
+3
-1
@@ -161,7 +161,6 @@ gtk_box_class_init (GtkBoxClass *class)
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
|
||||
gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_FILLER);
|
||||
gtk_widget_class_set_css_name (widget_class, I_("box"));
|
||||
}
|
||||
@@ -345,9 +344,12 @@ static void
|
||||
gtk_box_init (GtkBox *box)
|
||||
{
|
||||
GtkBoxPrivate *priv = gtk_box_get_instance_private (box);
|
||||
GtkLayoutManager *box_layout = gtk_box_layout_new (GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (box), FALSE);
|
||||
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (box), box_layout);
|
||||
|
||||
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (box));
|
||||
}
|
||||
|
||||
+9
-16
@@ -153,9 +153,11 @@ populate_recent_section (GtkEmojiChooser *chooser)
|
||||
empty = FALSE;
|
||||
}
|
||||
|
||||
gtk_widget_set_visible (chooser->recent.box, !empty);
|
||||
gtk_widget_set_sensitive (chooser->recent.button, !empty);
|
||||
|
||||
if (!empty)
|
||||
{
|
||||
gtk_widget_show (chooser->recent.box);
|
||||
gtk_widget_set_sensitive (chooser->recent.button, TRUE);
|
||||
}
|
||||
g_variant_unref (variant);
|
||||
}
|
||||
|
||||
@@ -456,12 +458,15 @@ populate_emoji_chooser (gpointer data)
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
/* We scroll to the top on show, so check the right button for the 1st time */
|
||||
gtk_widget_set_state_flags (chooser->recent.button, GTK_STATE_FLAG_CHECKED, FALSE);
|
||||
|
||||
g_variant_iter_free (chooser->iter);
|
||||
chooser->iter = NULL;
|
||||
chooser->box = NULL;
|
||||
chooser->populate_idle = 0;
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -491,9 +496,6 @@ adj_value_changed (GtkAdjustment *adj,
|
||||
EmojiSection const *section = sections[i];
|
||||
GtkAllocation alloc;
|
||||
|
||||
if (!gtk_widget_get_visible (section->box))
|
||||
continue;
|
||||
|
||||
if (section->heading)
|
||||
gtk_widget_get_allocation (section->heading, &alloc);
|
||||
else
|
||||
@@ -609,13 +611,6 @@ search_changed (GtkEntry *entry,
|
||||
update_headings (chooser);
|
||||
}
|
||||
|
||||
static void
|
||||
stop_search (GtkEntry *entry,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_popover_popdown (GTK_POPOVER (data));
|
||||
}
|
||||
|
||||
static void
|
||||
setup_section (GtkEmojiChooser *chooser,
|
||||
EmojiSection *section,
|
||||
@@ -698,7 +693,6 @@ gtk_emoji_chooser_show (GtkWidget *widget)
|
||||
|
||||
adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (chooser->scrolled_window));
|
||||
gtk_adjustment_set_value (adj, 0);
|
||||
adj_value_changed (adj, chooser);
|
||||
|
||||
gtk_editable_set_text (GTK_EDITABLE (chooser->search_entry), "");
|
||||
}
|
||||
@@ -767,7 +761,6 @@ gtk_emoji_chooser_class_init (GtkEmojiChooserClass *klass)
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, emoji_activated);
|
||||
gtk_widget_class_bind_template_callback (widget_class, search_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, stop_search);
|
||||
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, long_pressed_cb);
|
||||
}
|
||||
|
||||
+29
-6
@@ -3447,19 +3447,42 @@ gtk_entry_enter_text (GtkEntry *entry,
|
||||
gtk_text_enter_text (GTK_TEXT (priv->text), text);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_entry_insert_emoji (GtkEntry *entry)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
GtkWidget *chooser;
|
||||
GdkRectangle rect;
|
||||
|
||||
if (gtk_widget_get_ancestor (GTK_WIDGET (entry), GTK_TYPE_EMOJI_CHOOSER) != NULL)
|
||||
return;
|
||||
|
||||
chooser = GTK_WIDGET (g_object_get_data (G_OBJECT (entry), "gtk-emoji-chooser"));
|
||||
if (!chooser)
|
||||
{
|
||||
chooser = gtk_emoji_chooser_new ();
|
||||
g_object_set_data (G_OBJECT (entry), "gtk-emoji-chooser", chooser);
|
||||
|
||||
gtk_popover_set_relative_to (GTK_POPOVER (chooser), GTK_WIDGET (entry));
|
||||
if (priv->show_emoji_icon)
|
||||
{
|
||||
gtk_entry_get_icon_area (entry, GTK_ENTRY_ICON_SECONDARY, &rect);
|
||||
gtk_popover_set_pointing_to (GTK_POPOVER (chooser), &rect);
|
||||
}
|
||||
g_signal_connect_swapped (chooser, "emoji-picked", G_CALLBACK (gtk_entry_enter_text), entry);
|
||||
}
|
||||
|
||||
gtk_popover_popup (GTK_POPOVER (chooser));
|
||||
}
|
||||
|
||||
static void
|
||||
pick_emoji (GtkEntry *entry,
|
||||
int icon,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
|
||||
|
||||
if (gtk_widget_get_ancestor (GTK_WIDGET (entry), GTK_TYPE_EMOJI_CHOOSER) != NULL)
|
||||
return;
|
||||
|
||||
if (icon == GTK_ENTRY_ICON_SECONDARY)
|
||||
g_signal_emit_by_name (priv->text, "insert-emoji");
|
||||
gtk_entry_insert_emoji (entry);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -422,8 +422,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
|
||||
_gtk_file_chooser_install_properties (gobject_class);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("filechooserbutton"));
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -499,6 +497,8 @@ gtk_file_chooser_button_init (GtkFileChooserButton *button)
|
||||
target_list,
|
||||
GDK_ACTION_COPY);
|
||||
gdk_content_formats_unref (target_list);
|
||||
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (button), gtk_bin_layout_new ());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8326,8 +8326,6 @@ gtk_file_chooser_widget_class_init (GtkFileChooserWidgetClass *class)
|
||||
gtk_widget_class_bind_template_callback (widget_class, widget_key_press_cb);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("filechooser"));
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -8469,6 +8467,8 @@ gtk_file_chooser_widget_init (GtkFileChooserWidget *impl)
|
||||
*/
|
||||
post_process_ui (impl);
|
||||
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (impl), gtk_bin_layout_new ());
|
||||
|
||||
profile_end ("end", NULL);
|
||||
}
|
||||
|
||||
|
||||
+2
-4
@@ -96,14 +96,11 @@ static void
|
||||
gtk_fixed_class_init (GtkFixedClass *klass)
|
||||
{
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
container_class->add = gtk_fixed_add;
|
||||
container_class->remove = gtk_fixed_remove;
|
||||
container_class->forall = gtk_fixed_forall;
|
||||
container_class->child_type = gtk_fixed_child_type;
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_FIXED_LAYOUT);
|
||||
}
|
||||
|
||||
static GType
|
||||
@@ -120,7 +117,8 @@ gtk_fixed_init (GtkFixed *self)
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (self), FALSE);
|
||||
gtk_widget_set_overflow (GTK_WIDGET (self), GTK_OVERFLOW_HIDDEN);
|
||||
|
||||
priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (self));
|
||||
priv->layout = gtk_fixed_layout_new ();
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (self), priv->layout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -107,6 +107,7 @@ gtk_gizmo_new (const char *css_name,
|
||||
{
|
||||
GtkGizmo *gizmo = GTK_GIZMO (g_object_new (GTK_TYPE_GIZMO,
|
||||
"css-name", css_name,
|
||||
"name", css_name,
|
||||
NULL));
|
||||
|
||||
gizmo->measure_func = measure_func;
|
||||
|
||||
+2
-3
@@ -380,8 +380,6 @@ gtk_grid_class_init (GtkGridClass *class)
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, obj_properties);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("grid"));
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_GRID_LAYOUT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -391,7 +389,8 @@ gtk_grid_init (GtkGrid *grid)
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (grid), FALSE);
|
||||
|
||||
priv->layout_manager = gtk_widget_get_layout_manager (GTK_WIDGET (grid));
|
||||
priv->layout_manager = gtk_grid_layout_new ();
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (grid), priv->layout_manager);
|
||||
|
||||
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (grid));
|
||||
|
||||
@@ -2045,7 +2045,6 @@ gtk_header_bar_set_decoration_layout (GtkHeaderBar *bar,
|
||||
|
||||
priv = gtk_header_bar_get_instance_private (bar);
|
||||
|
||||
g_free (priv->decoration_layout);
|
||||
priv->decoration_layout = g_strdup (layout);
|
||||
priv->decoration_layout_set = (layout != NULL);
|
||||
|
||||
|
||||
+2
-3
@@ -302,8 +302,6 @@ gtk_overlay_class_init (GtkOverlayClass *klass)
|
||||
GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
|
||||
|
||||
gtk_widget_class_set_css_name (widget_class, I_("overlay"));
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_OVERLAY_LAYOUT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -313,7 +311,8 @@ gtk_overlay_init (GtkOverlay *overlay)
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (overlay), FALSE);
|
||||
|
||||
priv->layout = gtk_widget_get_layout_manager (GTK_WIDGET (overlay));
|
||||
priv->layout = gtk_overlay_layout_new ();
|
||||
gtk_widget_set_layout_manager (GTK_WIDGET (overlay), priv->layout);
|
||||
}
|
||||
|
||||
static GtkBuildableIface *parent_buildable_iface;
|
||||
|
||||
+20
-64
@@ -497,7 +497,6 @@ struct _GtkWidgetClassPrivate
|
||||
GType accessible_type;
|
||||
AtkRole accessible_role;
|
||||
const char *css_name;
|
||||
GType layout_manager_type;
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -2741,7 +2740,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (instance);
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GType layout_manager_type;
|
||||
|
||||
widget->priv = priv;
|
||||
|
||||
@@ -2810,10 +2808,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
|
||||
|
||||
if (g_type_is_a (G_TYPE_FROM_CLASS (g_class), GTK_TYPE_ROOT))
|
||||
priv->root = (GtkRoot *) widget;
|
||||
|
||||
layout_manager_type = gtk_widget_class_get_layout_manager_type (g_class);
|
||||
if (layout_manager_type != G_TYPE_INVALID)
|
||||
gtk_widget_set_layout_manager (widget, g_object_new (layout_manager_type, NULL));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5255,7 +5249,11 @@ _gtk_widget_captured_event (GtkWidget *widget,
|
||||
return TRUE;
|
||||
|
||||
event_copy = gdk_event_copy (event);
|
||||
translate_event_coordinates (event_copy, widget);
|
||||
if (!translate_event_coordinates (event_copy, widget))
|
||||
{
|
||||
g_object_unref (event_copy);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return_val = gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_CAPTURE);
|
||||
|
||||
@@ -5357,7 +5355,11 @@ gtk_widget_event_internal (GtkWidget *widget,
|
||||
|
||||
event_copy = gdk_event_copy (event);
|
||||
|
||||
translate_event_coordinates (event_copy, widget);
|
||||
if (!translate_event_coordinates (event_copy, widget))
|
||||
{
|
||||
g_object_unref (event_copy);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (widget == gtk_get_event_target (event_copy))
|
||||
return_val |= gtk_widget_run_controllers (widget, event_copy, GTK_PHASE_TARGET);
|
||||
@@ -6737,17 +6739,17 @@ gtk_widget_verify_invariants (GtkWidget *widget)
|
||||
|
||||
if (!priv->realized)
|
||||
g_warning ("%s %p is mapped but not realized",
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
gtk_widget_get_name (widget), widget);
|
||||
|
||||
if (!priv->visible)
|
||||
g_warning ("%s %p is mapped but not visible",
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
gtk_widget_get_name (widget), widget);
|
||||
|
||||
if (!GTK_IS_ROOT (widget))
|
||||
{
|
||||
if (!priv->child_visible)
|
||||
g_warning ("%s %p is mapped but not child_visible",
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
gtk_widget_get_name (widget), widget);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6797,8 +6799,8 @@ gtk_widget_verify_invariants (GtkWidget *widget)
|
||||
|
||||
if (priv->realized)
|
||||
g_warning ("%s %p is not realized but child %s %p is realized",
|
||||
parent ? G_OBJECT_TYPE_NAME (parent) : "no parent", parent,
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
parent ? gtk_widget_get_name (parent) : "no parent", parent,
|
||||
gtk_widget_get_name (widget), widget);
|
||||
}
|
||||
|
||||
if (parent &&
|
||||
@@ -6810,8 +6812,8 @@ gtk_widget_verify_invariants (GtkWidget *widget)
|
||||
|
||||
if (!priv->mapped)
|
||||
g_warning ("%s %p is mapped but visible child %s %p is not mapped",
|
||||
G_OBJECT_TYPE_NAME (parent), parent,
|
||||
G_OBJECT_TYPE_NAME (widget), widget);
|
||||
gtk_widget_get_name (parent), parent,
|
||||
gtk_widget_get_name (widget), widget);
|
||||
}
|
||||
else if (!GTK_IS_ROOT (widget))
|
||||
{
|
||||
@@ -6819,10 +6821,10 @@ gtk_widget_verify_invariants (GtkWidget *widget)
|
||||
|
||||
if (priv->mapped)
|
||||
g_warning ("%s %p is mapped but visible=%d child_visible=%d parent %s %p mapped=%d",
|
||||
G_OBJECT_TYPE_NAME (widget), widget,
|
||||
gtk_widget_get_name (widget), widget,
|
||||
priv->visible,
|
||||
priv->child_visible,
|
||||
parent ? G_OBJECT_TYPE_NAME (parent) : "no parent", parent,
|
||||
parent ? gtk_widget_get_name (parent) : "no parent", parent,
|
||||
parent ? parent->priv->mapped : FALSE);
|
||||
}
|
||||
}
|
||||
@@ -12984,7 +12986,7 @@ gtk_widget_snapshot (GtkWidget *widget,
|
||||
|
||||
if (_gtk_widget_get_alloc_needed (widget))
|
||||
{
|
||||
g_warning ("Trying to snapshot %s %p without a current allocation", G_OBJECT_TYPE_NAME (widget), widget);
|
||||
g_warning ("Trying to snapshot %s %p without a current allocation", gtk_widget_get_name (widget), widget);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -13573,52 +13575,6 @@ gtk_widget_get_height (GtkWidget *widget)
|
||||
return priv->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_class_set_layout_manager_type:
|
||||
* @widget_class: class to set the layout manager type for
|
||||
* @type: The object type that implements the #GtkLayoutManager for @widget_class
|
||||
*
|
||||
* Sets the type to be used for creating layout managers for widgets of
|
||||
* @widget_class. The given @type must be a subtype of #GtkLayoutManager.
|
||||
*
|
||||
* This function should only be called from class init functions of widgets.
|
||||
**/
|
||||
void
|
||||
gtk_widget_class_set_layout_manager_type (GtkWidgetClass *widget_class,
|
||||
GType type)
|
||||
{
|
||||
GtkWidgetClassPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET_CLASS (widget_class));
|
||||
g_return_if_fail (g_type_is_a (type, GTK_TYPE_LAYOUT_MANAGER));
|
||||
|
||||
priv = widget_class->priv;
|
||||
|
||||
priv->layout_manager_type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_class_get_layout_manager_type:
|
||||
* @widget_class: a #GtkWidgetClass
|
||||
*
|
||||
* Retrieves the type of the #GtkLayoutManager used by the #GtkWidget class.
|
||||
*
|
||||
* See also: gtk_widget_class_set_layout_manager_type()
|
||||
*
|
||||
* Returns: a #GtkLayoutManager subclass, or %G_TYPE_INVALID
|
||||
*/
|
||||
GType
|
||||
gtk_widget_class_get_layout_manager_type (GtkWidgetClass *widget_class)
|
||||
{
|
||||
GtkWidgetClassPrivate *priv;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_WIDGET_CLASS (widget_class), G_TYPE_INVALID);
|
||||
|
||||
priv = widget_class->priv;
|
||||
|
||||
return priv->layout_manager_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_set_layout_manager:
|
||||
* @widget: a #GtkWidget
|
||||
|
||||
@@ -414,12 +414,6 @@ void gtk_widget_set_layout_manager (GtkWidget *widge
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkLayoutManager * gtk_widget_get_layout_manager (GtkWidget *widget);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_class_set_layout_manager_type (GtkWidgetClass *widget_class,
|
||||
GType type);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_widget_class_get_layout_manager_type (GtkWidgetClass *widget_class);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_add_accelerator (GtkWidget *widget,
|
||||
const gchar *accel_signal,
|
||||
|
||||
+69
-9
@@ -503,8 +503,6 @@ static void gtk_window_do_popup (GtkWindow *window,
|
||||
static void gtk_window_style_updated (GtkWidget *widget);
|
||||
static void gtk_window_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state);
|
||||
static void _gtk_window_set_is_active (GtkWindow *window,
|
||||
gboolean is_active);
|
||||
|
||||
static GListStore *toplevel_list = NULL;
|
||||
static guint window_signals[LAST_SIGNAL] = { 0 };
|
||||
@@ -6232,6 +6230,47 @@ get_active_region_type (GtkWindow *window, gint x, gint y)
|
||||
return GTK_WINDOW_REGION_CONTENT;
|
||||
}
|
||||
|
||||
static void
|
||||
do_focus_change (GtkWidget *widget,
|
||||
gboolean in)
|
||||
{
|
||||
GdkSeat *seat;
|
||||
GdkDevice *device;
|
||||
GdkEvent *event;
|
||||
GtkRoot *root;
|
||||
GtkStateFlags flags;
|
||||
|
||||
seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
|
||||
device = gdk_seat_get_keyboard (seat);
|
||||
|
||||
event = gdk_event_new (GDK_FOCUS_CHANGE);
|
||||
gdk_event_set_display (event, gtk_widget_get_display (widget));
|
||||
gdk_event_set_device (event, device);
|
||||
|
||||
event->any.type = GDK_FOCUS_CHANGE;
|
||||
event->any.surface = _gtk_widget_get_surface (widget);
|
||||
if (event->any.surface)
|
||||
g_object_ref (event->any.surface);
|
||||
event->focus_change.in = in;
|
||||
event->focus_change.mode = GDK_CROSSING_STATE_CHANGED;
|
||||
event->focus_change.detail = GDK_NOTIFY_ANCESTOR;
|
||||
|
||||
flags = GTK_STATE_FLAG_FOCUSED;
|
||||
root = gtk_widget_get_root (widget);
|
||||
if (!GTK_IS_WINDOW (root) || gtk_window_get_focus_visible (GTK_WINDOW (root)))
|
||||
flags |= GTK_STATE_FLAG_FOCUS_VISIBLE;
|
||||
|
||||
if (in)
|
||||
gtk_widget_set_state_flags (widget, flags, FALSE);
|
||||
else
|
||||
gtk_widget_unset_state_flags (widget, flags);
|
||||
|
||||
gtk_widget_set_has_focus (widget, in);
|
||||
gtk_widget_event (widget, event);
|
||||
|
||||
g_object_unref (event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window)
|
||||
{
|
||||
@@ -8907,7 +8946,7 @@ gtk_window_activate_key (GtkWindow *window,
|
||||
return gtk_window_activate_menubar (window, event);
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* _gtk_window_set_is_active:
|
||||
* @window: a #GtkWindow
|
||||
* @is_active: %TRUE if the window is in the currently active toplevel
|
||||
@@ -8916,19 +8955,40 @@ gtk_window_activate_key (GtkWindow *window,
|
||||
* of the currently active toplevel window (taking into account inter-process
|
||||
* embedding.)
|
||||
**/
|
||||
static void
|
||||
void
|
||||
_gtk_window_set_is_active (GtkWindow *window,
|
||||
gboolean is_active)
|
||||
{
|
||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||
|
||||
if (priv->is_active == is_active)
|
||||
return;
|
||||
g_return_if_fail (GTK_IS_WINDOW (window));
|
||||
|
||||
priv->is_active = is_active;
|
||||
is_active = is_active != FALSE;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_IS_ACTIVE]);
|
||||
_gtk_window_accessible_set_is_active (window, is_active);
|
||||
if (is_active != priv->is_active)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (window);
|
||||
|
||||
priv->is_active = is_active;
|
||||
|
||||
if (is_active)
|
||||
{
|
||||
if (priv->focus_widget &&
|
||||
priv->focus_widget != widget &&
|
||||
!gtk_widget_has_focus (priv->focus_widget))
|
||||
do_focus_change (priv->focus_widget, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->focus_widget &&
|
||||
priv->focus_widget != widget &&
|
||||
gtk_widget_has_focus (priv->focus_widget))
|
||||
do_focus_change (priv->focus_widget, FALSE);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (window), window_props[PROP_IS_ACTIVE]);
|
||||
_gtk_window_accessible_set_is_active (window, is_active);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,6 +47,9 @@ gboolean _gtk_window_group_widget_is_blocked_for_device (GtkWindowGroup *
|
||||
void _gtk_window_unset_focus_and_default (GtkWindow *window,
|
||||
GtkWidget *widget);
|
||||
|
||||
void _gtk_window_set_is_active (GtkWindow *window,
|
||||
gboolean is_active);
|
||||
|
||||
void _gtk_window_set_allocation (GtkWindow *window,
|
||||
int width,
|
||||
int height,
|
||||
|
||||
@@ -1083,8 +1083,6 @@ if build_gir
|
||||
gtk_introspection_sources = [
|
||||
gtk_public_headers,
|
||||
gtk_public_sources,
|
||||
gtk_deprecated_headers,
|
||||
gtk_deprecated_sources,
|
||||
a11y_headers,
|
||||
a11y_sources,
|
||||
gtktypebuiltins_h,
|
||||
|
||||
@@ -141,24 +141,8 @@ typedef enum {
|
||||
PROP_KIND_OBJECT,
|
||||
PROP_KIND_PACKING,
|
||||
PROP_KIND_CELL_PACKING,
|
||||
PROP_KIND_LAYOUT
|
||||
} PropKind;
|
||||
|
||||
static PropKind
|
||||
get_prop_kind (Element *element)
|
||||
{
|
||||
g_assert (g_str_equal (element->element_name, "property"));
|
||||
|
||||
if (g_str_equal (element->parent->element_name, "packing"))
|
||||
return PROP_KIND_PACKING;
|
||||
else if (g_str_equal (element->parent->element_name, "layout"))
|
||||
return PROP_KIND_LAYOUT;
|
||||
else if (g_str_equal (element->parent->element_name, "cell-packing"))
|
||||
return PROP_KIND_CELL_PACKING;
|
||||
else
|
||||
return PROP_KIND_OBJECT;
|
||||
}
|
||||
|
||||
/* A number of properties unfortunately can't be omitted even
|
||||
* if they are nominally set to their default value. In many
|
||||
* cases, this is due to subclasses not overriding the default
|
||||
@@ -181,8 +165,6 @@ needs_explicit_setting (GParamSpec *pspec,
|
||||
{ "GtkRadioButton", "draw-indicator", PROP_KIND_OBJECT },
|
||||
{ "GtkWidget", "hexpand", PROP_KIND_OBJECT },
|
||||
{ "GtkWidget", "vexpand", PROP_KIND_OBJECT },
|
||||
{ "GtkGrid", "top-attach", PROP_KIND_LAYOUT },
|
||||
{ "GtkGrid", "left-attach", PROP_KIND_LAYOUT },
|
||||
};
|
||||
gboolean found;
|
||||
gint k;
|
||||
@@ -197,7 +179,6 @@ needs_explicit_setting (GParamSpec *pspec,
|
||||
strcmp (pspec->name, props[k].property) == 0 &&
|
||||
kind == props[k].kind)
|
||||
{
|
||||
g_print ("explicit: %s::%s\n", class_name, pspec->name);
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -229,10 +210,6 @@ keep_for_rewrite (const char *class_name,
|
||||
{ "GtkGrid", "top-attach", PROP_KIND_PACKING },
|
||||
{ "GtkGrid", "width", PROP_KIND_PACKING },
|
||||
{ "GtkGrid", "height", PROP_KIND_PACKING },
|
||||
{ "GtkStack", "name", PROP_KIND_PACKING },
|
||||
{ "GtkStack", "title", PROP_KIND_PACKING },
|
||||
{ "GtkStack", "icon-name", PROP_KIND_PACKING },
|
||||
{ "GtkStack", "needs-attention", PROP_KIND_PACKING },
|
||||
};
|
||||
gboolean found;
|
||||
gint k;
|
||||
@@ -248,7 +225,6 @@ keep_for_rewrite (const char *class_name,
|
||||
strcmp (canonical_name, props[k].property) == 0 &&
|
||||
kind == props[k].kind)
|
||||
{
|
||||
g_print ("keep for rewrite: %s::%s\n", class_name, canonical_name);
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -333,18 +309,6 @@ canonicalize_key (gchar *key)
|
||||
}
|
||||
}
|
||||
|
||||
static struct {
|
||||
const char *class;
|
||||
const char *layout_manager;
|
||||
} layout_managers[] = {
|
||||
{ "GtkBox", "GtkBoxLayout" },
|
||||
{ "GtkGrid", "GtkGridLayout" },
|
||||
{ "GtkFixed", "GtkFixedLayout" },
|
||||
{ "GtkFileChooserButton", "GtkBinLayout" },
|
||||
{ "GtkFileChooserWidget", "GtkBinLayout" },
|
||||
{ "GtkOverlay", "GtkOverlayLayout" }
|
||||
};
|
||||
|
||||
static GParamSpec *
|
||||
get_property_pspec (MyParserData *data,
|
||||
const gchar *class_name,
|
||||
@@ -372,11 +336,9 @@ get_property_pspec (MyParserData *data,
|
||||
case PROP_KIND_OBJECT:
|
||||
pspec = g_object_class_find_property (class, canonical_name);
|
||||
break;
|
||||
|
||||
case PROP_KIND_PACKING:
|
||||
pspec = NULL;
|
||||
break;
|
||||
|
||||
case PROP_KIND_CELL_PACKING:
|
||||
{
|
||||
GObjectClass *cell_class;
|
||||
@@ -387,40 +349,6 @@ get_property_pspec (MyParserData *data,
|
||||
g_type_class_unref (cell_class);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_KIND_LAYOUT:
|
||||
{
|
||||
int i;
|
||||
const char *layout_manager = NULL;
|
||||
|
||||
pspec = NULL;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (layout_managers); i++)
|
||||
{
|
||||
if (g_str_equal (layout_managers[i].class, class_name))
|
||||
{
|
||||
layout_manager = layout_managers[i].layout_manager;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (layout_manager)
|
||||
{
|
||||
GtkLayoutManagerClass *layout_manager_class;
|
||||
|
||||
layout_manager_class = GTK_LAYOUT_MANAGER_CLASS (g_type_class_ref (g_type_from_name (layout_manager)));
|
||||
if (layout_manager_class->layout_child_type != G_TYPE_INVALID)
|
||||
{
|
||||
GObjectClass *layout_child_class;
|
||||
layout_child_class = g_type_class_ref (layout_manager_class->layout_child_type);
|
||||
pspec = g_object_class_find_property (layout_child_class, canonical_name);
|
||||
g_type_class_unref (layout_child_class);
|
||||
}
|
||||
g_type_class_unref (layout_manager_class);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
@@ -430,11 +358,8 @@ get_property_pspec (MyParserData *data,
|
||||
return pspec;
|
||||
}
|
||||
|
||||
static const char *get_class_name (Element *element);
|
||||
|
||||
static gboolean
|
||||
value_is_default (Element *element,
|
||||
MyParserData *data,
|
||||
value_is_default (MyParserData *data,
|
||||
GParamSpec *pspec,
|
||||
const gchar *value_string)
|
||||
{
|
||||
@@ -452,26 +377,7 @@ value_is_default (Element *element,
|
||||
ret = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* GtkWidget::visible has a 'smart' default */
|
||||
if (pspec->owner_type == GTK_TYPE_WIDGET &&
|
||||
g_str_equal (pspec->name, "visible"))
|
||||
{
|
||||
const char *class_name = get_class_name (element);
|
||||
GType type = g_type_from_name (class_name);
|
||||
gboolean default_value;
|
||||
|
||||
if (g_type_is_a (type, GTK_TYPE_ROOT) ||
|
||||
g_type_is_a (type, GTK_TYPE_POPOVER))
|
||||
default_value = FALSE;
|
||||
else
|
||||
default_value = TRUE;
|
||||
|
||||
ret = g_value_get_boolean (&value) == default_value;
|
||||
}
|
||||
else
|
||||
ret = g_param_value_defaults (pspec, &value);
|
||||
}
|
||||
ret = g_param_value_defaults (pspec, &value);
|
||||
|
||||
g_value_reset (&value);
|
||||
|
||||
@@ -564,7 +470,11 @@ property_is_boolean (Element *element,
|
||||
int i;
|
||||
PropKind kind;
|
||||
|
||||
kind = get_prop_kind (element);
|
||||
if (g_str_equal (element->parent->element_name, "packing"))
|
||||
kind = PROP_KIND_PACKING;
|
||||
else
|
||||
kind = PROP_KIND_OBJECT;
|
||||
|
||||
class_name = get_class_name (element);
|
||||
property_name = "";
|
||||
|
||||
@@ -594,7 +504,13 @@ property_can_be_omitted (Element *element,
|
||||
GParamSpec *pspec;
|
||||
PropKind kind;
|
||||
|
||||
kind = get_prop_kind (element);
|
||||
if (g_str_equal (element->parent->element_name, "packing"))
|
||||
kind = PROP_KIND_PACKING;
|
||||
else if (g_str_equal (element->parent->element_name, "cell-packing"))
|
||||
kind = PROP_KIND_CELL_PACKING;
|
||||
else
|
||||
kind = PROP_KIND_OBJECT;
|
||||
|
||||
class_name = get_class_name (element);
|
||||
property_name = "";
|
||||
value_string = element->data;
|
||||
@@ -612,7 +528,7 @@ property_can_be_omitted (Element *element,
|
||||
property_name = (const gchar *)element->attribute_values[i];
|
||||
}
|
||||
|
||||
if (data->convert3to4 &&
|
||||
if (data->convert3to4 &&
|
||||
keep_for_rewrite (class_name, property_name, kind))
|
||||
return FALSE; /* keep, will be rewritten */
|
||||
|
||||
@@ -629,10 +545,9 @@ property_can_be_omitted (Element *element,
|
||||
const char *kind_str[] = {
|
||||
"",
|
||||
"Packing ",
|
||||
"Cell ",
|
||||
"Layout "
|
||||
"Cell "
|
||||
};
|
||||
|
||||
|
||||
g_printerr (_("%s: %sproperty %s::%s not found\n"),
|
||||
data->input_filename, kind_str[kind], class_name, property_name);
|
||||
return FALSE;
|
||||
@@ -641,7 +556,7 @@ property_can_be_omitted (Element *element,
|
||||
if (needs_explicit_setting (pspec, kind))
|
||||
return FALSE;
|
||||
|
||||
return value_is_default (element, data, pspec, value_string);
|
||||
return value_is_default (data, pspec, value_string);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -672,7 +587,10 @@ property_has_been_removed (Element *element,
|
||||
gint i, k;
|
||||
PropKind kind;
|
||||
|
||||
kind = get_prop_kind (element);
|
||||
if (g_str_equal (element->parent->element_name, "packing"))
|
||||
kind = PROP_KIND_PACKING;
|
||||
else
|
||||
kind = PROP_KIND_OBJECT;
|
||||
|
||||
class_name = get_class_name (element);
|
||||
property_name = "";
|
||||
@@ -1328,7 +1246,6 @@ rewrite_grid_layout (Element *element,
|
||||
}
|
||||
}
|
||||
|
||||
/* returns TRUE to remove the element from the parent */
|
||||
static gboolean
|
||||
simplify_element (Element *element,
|
||||
MyParserData *data)
|
||||
@@ -1365,6 +1282,58 @@ simplify_element (Element *element,
|
||||
property_can_be_omitted (element, data))
|
||||
return TRUE;
|
||||
|
||||
if (data->convert3to4)
|
||||
{
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkStack"))
|
||||
rewrite_stack (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkAssistant"))
|
||||
rewrite_assistant (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkNotebook"))
|
||||
rewrite_notebook (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
(g_str_equal (get_class_name (element), "GtkActionBar") ||
|
||||
g_str_equal (get_class_name (element), "GtkHeaderBar")))
|
||||
rewrite_pack_type (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkPopoverMenu"))
|
||||
rewrite_child_prop_to_prop (element, data, "submenu", "name");
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkToolbar"))
|
||||
rewrite_child_prop_to_prop (element, data, "expand", "expand-item");
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkToolbar"))
|
||||
rewrite_child_prop_to_prop (element, data, "homogeneous", "homogeneous");
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkPaned"))
|
||||
rewrite_paned (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkOverlay"))
|
||||
rewrite_layout_props (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkGrid"))
|
||||
rewrite_grid_layout (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkFixed"))
|
||||
rewrite_layout_props (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "property") &&
|
||||
property_has_been_removed (element, data))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -1374,154 +1343,6 @@ simplify_tree (MyParserData *data)
|
||||
simplify_element (data->root, data);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
rewrite_element (Element *element,
|
||||
MyParserData *data)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
l = element->children;
|
||||
while (l)
|
||||
{
|
||||
GList *next = l->next;
|
||||
Element *child = l->data;
|
||||
if (rewrite_element (child, data))
|
||||
{
|
||||
element->children = g_list_remove (element->children, child);
|
||||
free_element (child);
|
||||
}
|
||||
l = next;
|
||||
}
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkStack"))
|
||||
rewrite_stack (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkAssistant"))
|
||||
rewrite_assistant (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkNotebook"))
|
||||
rewrite_notebook (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
(g_str_equal (get_class_name (element), "GtkActionBar") ||
|
||||
g_str_equal (get_class_name (element), "GtkHeaderBar")))
|
||||
rewrite_pack_type (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkPopoverMenu"))
|
||||
rewrite_child_prop_to_prop (element, data, "submenu", "name");
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkToolbar"))
|
||||
rewrite_child_prop_to_prop (element, data, "expand", "expand-item");
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkToolbar"))
|
||||
rewrite_child_prop_to_prop (element, data, "homogeneous", "homogeneous");
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkPaned"))
|
||||
rewrite_paned (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkOverlay"))
|
||||
rewrite_layout_props (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkGrid"))
|
||||
rewrite_grid_layout (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "object") &&
|
||||
g_str_equal (get_class_name (element), "GtkFixed"))
|
||||
rewrite_layout_props (element, data);
|
||||
|
||||
if (g_str_equal (element->element_name, "property") &&
|
||||
property_has_been_removed (element, data))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
rewrite_tree (MyParserData *data)
|
||||
{
|
||||
rewrite_element (data->root, data);
|
||||
}
|
||||
|
||||
/* For properties which have changed their default
|
||||
* value between 3 and 4, we make sure that their
|
||||
* old default value is present in the tree before
|
||||
* simplifying it.
|
||||
*
|
||||
* So far, this is just GtkWidget::visible,
|
||||
* changing its default from 0 to 1.
|
||||
*/
|
||||
static void
|
||||
add_old_default_properties (Element *element,
|
||||
MyParserData *data)
|
||||
{
|
||||
const char *class_name;
|
||||
GType type;
|
||||
|
||||
if (!g_str_equal (element->element_name, "object"))
|
||||
return;
|
||||
|
||||
class_name = get_class_name (element);
|
||||
type = g_type_from_name (class_name);
|
||||
if (g_type_is_a (type, GTK_TYPE_WIDGET))
|
||||
{
|
||||
GList *l;
|
||||
gboolean has_visible = FALSE;
|
||||
|
||||
for (l = element->children; l; l = l->next)
|
||||
{
|
||||
Element *prop = l->data;
|
||||
const char *name = get_attribute_value (prop, "name");
|
||||
|
||||
if (g_str_equal (prop->element_name, "property") &&
|
||||
g_str_equal (name, "visible"))
|
||||
has_visible = TRUE;
|
||||
}
|
||||
|
||||
if (!has_visible)
|
||||
{
|
||||
Element *new_prop = g_new0 (Element, 1);
|
||||
new_prop->parent = element;
|
||||
new_prop->element_name = g_strdup ("property");
|
||||
new_prop->attribute_names = g_new0 (char *, 2);
|
||||
new_prop->attribute_names[0] = g_strdup ("name");
|
||||
new_prop->attribute_values = g_new0 (char *, 2);
|
||||
new_prop->attribute_values[0] = g_strdup ("visible");
|
||||
new_prop->data = g_strdup ("0");
|
||||
element->children = g_list_prepend (element->children, new_prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
enhance_element (Element *element,
|
||||
MyParserData *data)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
add_old_default_properties (element, data);
|
||||
|
||||
for (l = element->children; l; l = l->next)
|
||||
{
|
||||
Element *child = l->data;
|
||||
enhance_element (child, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
enhance_tree (MyParserData *data)
|
||||
{
|
||||
enhance_element (data->root, data);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_element (Element *element,
|
||||
FILE *output,
|
||||
@@ -1563,7 +1384,7 @@ dump_element (Element *element,
|
||||
g_fprintf (output, "</%s>\n", element->element_name);
|
||||
}
|
||||
else
|
||||
g_fprintf (output, "/>\n");
|
||||
g_fprintf (output, "/>\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1623,11 +1444,6 @@ simplify_file (const char *filename,
|
||||
|
||||
data.builder = gtk_builder_new ();
|
||||
|
||||
if (data.convert3to4)
|
||||
{
|
||||
enhance_tree (&data);
|
||||
rewrite_tree (&data);
|
||||
}
|
||||
simplify_tree (&data);
|
||||
|
||||
dump_tree (&data);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="search_entry">
|
||||
<signal name="search-changed" handler="search_changed"/>
|
||||
<signal name="stop-search" handler="stop_search"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
project('gtk', 'c',
|
||||
version: '3.96.0',
|
||||
version: '3.94.0',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=1',
|
||||
|
||||
@@ -43,7 +43,6 @@ demos/gtk-demo/stack.ui
|
||||
demos/gtk-demo/theming.ui
|
||||
demos/icon-browser/menus.ui
|
||||
demos/icon-browser/window.ui
|
||||
demos/node-editor/node-editor-window.ui
|
||||
demos/widget-factory/menus.ui
|
||||
demos/widget-factory/widget-factory.c
|
||||
demos/widget-factory/widget-factory.ui
|
||||
@@ -341,10 +340,6 @@ testsuite/reftests/window-height-for-width.ref.ui
|
||||
testsuite/reftests/window-height-for-width.ui
|
||||
testsuite/reftests/window-show-contents-on-map.ref.ui
|
||||
testsuite/reftests/window-show-contents-on-map.ui
|
||||
testsuite/tools/simplify-data-3to4/assistant.ui
|
||||
testsuite/tools/simplify-data-3to4/grid.ui
|
||||
testsuite/tools/simplify-data-3to4/notebook.ui
|
||||
testsuite/tools/simplify-data-3to4/stack.ui
|
||||
testsuite/tools/simplify-data/test3.ui
|
||||
tests/visuals/inline-toolbar-horizontal.ui
|
||||
tests/visuals/inline-toolbar-vertical.ui
|
||||
|
||||
+2836
-3165
File diff suppressed because it is too large
Load Diff
@@ -43,7 +43,6 @@ demos/gtk-demo/stack.ui
|
||||
demos/gtk-demo/theming.ui
|
||||
demos/icon-browser/menus.ui
|
||||
demos/icon-browser/window.ui
|
||||
demos/node-editor/node-editor-window.ui
|
||||
demos/widget-factory/menus.ui
|
||||
demos/widget-factory/widget-factory.c
|
||||
demos/widget-factory/widget-factory.ui
|
||||
@@ -301,10 +300,6 @@ testsuite/reftests/window-height-for-width.ref.ui
|
||||
testsuite/reftests/window-height-for-width.ui
|
||||
testsuite/reftests/window-show-contents-on-map.ref.ui
|
||||
testsuite/reftests/window-show-contents-on-map.ui
|
||||
testsuite/tools/simplify-data-3to4/assistant.ui
|
||||
testsuite/tools/simplify-data-3to4/grid.ui
|
||||
testsuite/tools/simplify-data-3to4/notebook.ui
|
||||
testsuite/tools/simplify-data-3to4/stack.ui
|
||||
testsuite/tools/simplify-data/test3.ui
|
||||
tests/visuals/inline-toolbar-horizontal.ui
|
||||
tests/visuals/inline-toolbar-vertical.ui
|
||||
|
||||
+3
-14
@@ -13,19 +13,6 @@ static GOptionEntry options[] = {
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
deserialize_error_func (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
char *section_str = gtk_css_section_to_string (section);
|
||||
|
||||
g_warning ("Error at %s: %s", section_str, error->message);
|
||||
|
||||
free (section_str);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@@ -79,7 +66,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
start = g_get_monotonic_time ();
|
||||
node = gsk_render_node_deserialize (bytes, deserialize_error_func, NULL);
|
||||
node = gsk_render_node_deserialize (bytes, &error);
|
||||
end = g_get_monotonic_time ();
|
||||
if (benchmark)
|
||||
{
|
||||
@@ -91,6 +78,8 @@ main(int argc, char **argv)
|
||||
|
||||
if (node == NULL)
|
||||
{
|
||||
g_printerr ("Invalid node file: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
+1
-13
@@ -108,18 +108,6 @@ gtk_node_view_class_init (GtkNodeViewClass *klass)
|
||||
widget_class->snapshot = gtk_node_view_snapshot;
|
||||
}
|
||||
|
||||
static void
|
||||
deserialize_error_func (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
char *section_str = gtk_css_section_to_string (section);
|
||||
|
||||
g_warning ("Error at %s: %s", section_str, error->message);
|
||||
|
||||
free (section_str);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
@@ -164,7 +152,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
|
||||
bytes = g_bytes_new_take (contents, len);
|
||||
GTK_NODE_VIEW (nodeview)->node = gsk_render_node_deserialize (bytes, deserialize_error_func, NULL);
|
||||
GTK_NODE_VIEW (nodeview)->node = gsk_render_node_deserialize (bytes, &error);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
if (GTK_NODE_VIEW (nodeview)->node == NULL)
|
||||
|
||||
@@ -7,21 +7,25 @@
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label">Start 1</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="start">
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="label">Start 2</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkButton" id="button3">
|
||||
<property name="label">End 1</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkButton" id="button4">
|
||||
<property name="label">End 2</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkButton" id="button5">
|
||||
|
||||
@@ -55,7 +55,7 @@ window1
|
||||
name: Hello World!
|
||||
member-of: button4
|
||||
button3
|
||||
state: enabled focusable sensitive showing visible
|
||||
state: checked enabled focusable sensitive showing visible
|
||||
toolkit: gtk
|
||||
<AtkComponent>
|
||||
layer: widget
|
||||
@@ -73,7 +73,7 @@ window1
|
||||
name: Hello World!
|
||||
member-of: button4
|
||||
button3
|
||||
state: checked enabled focusable sensitive showing visible
|
||||
state: enabled focusable sensitive showing visible
|
||||
toolkit: gtk
|
||||
<AtkComponent>
|
||||
layer: widget
|
||||
|
||||
@@ -687,7 +687,7 @@ window1
|
||||
<AtkText>
|
||||
text: Custom
|
||||
character count: 6
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -822,7 +822,7 @@ window1
|
||||
<AtkText>
|
||||
text:
|
||||
character count: 0
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -920,7 +920,7 @@ window1
|
||||
<AtkText>
|
||||
text: S
|
||||
character count: 1
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -960,7 +960,7 @@ window1
|
||||
<AtkText>
|
||||
text: V
|
||||
character count: 1
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -1046,7 +1046,7 @@ window1
|
||||
<AtkText>
|
||||
text: H
|
||||
character count: 1
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -1118,7 +1118,7 @@ window1
|
||||
<AtkText>
|
||||
text: A
|
||||
character count: 1
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -30,7 +30,7 @@ window1
|
||||
<AtkText>
|
||||
text: Combo:
|
||||
character count: 6
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -117,7 +117,7 @@ window1
|
||||
<AtkText>
|
||||
text:
|
||||
character count: 0
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -204,7 +204,7 @@ window1
|
||||
<AtkText>
|
||||
text:
|
||||
character count: 0
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -30,7 +30,7 @@ window1
|
||||
<AtkText>
|
||||
text: entry:
|
||||
character count: 6
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -71,7 +71,7 @@ window1
|
||||
<AtkText>
|
||||
text: password entry:
|
||||
character count: 15
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -112,7 +112,7 @@ window1
|
||||
<AtkText>
|
||||
text: spinbutton:
|
||||
character count: 11
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -196,7 +196,7 @@ window1
|
||||
<AtkText>
|
||||
text: *************
|
||||
character count: 13
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -238,7 +238,7 @@ window1
|
||||
<AtkText>
|
||||
text: icons
|
||||
character count: 5
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -31,7 +31,7 @@ window1
|
||||
<AtkText>
|
||||
text: Hello World!
|
||||
character count: 12
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
<object class="GtkButton" id="button1">
|
||||
<property name="label" translatable="yes">Yes</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkButton" id="page2">
|
||||
<property name="label" translatable="yes">No</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
@@ -57,7 +57,7 @@ window1
|
||||
<AtkText>
|
||||
text: Some important info
|
||||
character count: 19
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -20,7 +20,7 @@ window1
|
||||
<AtkText>
|
||||
text: Go to the GTK+ website or >google it
|
||||
character count: 36
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -48,7 +48,7 @@ window1
|
||||
<AtkText>
|
||||
text: Row One
|
||||
character count: 7
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -97,7 +97,7 @@ window1
|
||||
<AtkText>
|
||||
text: Row Two
|
||||
character count: 7
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -156,7 +156,7 @@ window1
|
||||
<AtkText>
|
||||
text: Row Tree
|
||||
character count: 8
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -30,7 +30,7 @@ window1
|
||||
<AtkText>
|
||||
text:
|
||||
character count: 0
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -106,7 +106,7 @@ window1
|
||||
<AtkText>
|
||||
text: Information
|
||||
character count: 11
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -146,7 +146,7 @@ window1
|
||||
<AtkText>
|
||||
text: More Information
|
||||
character count: 16
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -30,7 +30,7 @@ window1
|
||||
<AtkText>
|
||||
text: Entry:
|
||||
character count: 6
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -33,7 +33,7 @@ window1
|
||||
<AtkText>
|
||||
text: Left
|
||||
character count: 4
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -73,7 +73,7 @@ window1
|
||||
<AtkText>
|
||||
text: Right
|
||||
character count: 5
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -29,7 +29,7 @@ window1
|
||||
<AtkText>
|
||||
text:
|
||||
character count: 0
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -71,7 +71,7 @@ window1
|
||||
<AtkText>
|
||||
text: Some text
|
||||
character count: 9
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
@@ -113,7 +113,7 @@ window1
|
||||
<AtkText>
|
||||
text:
|
||||
character count: 0
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
direction: <omitted>
|
||||
|
||||
@@ -76,7 +76,7 @@ window1
|
||||
<AtkText>
|
||||
text: One
|
||||
character count: 3
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
editable: false
|
||||
@@ -125,7 +125,7 @@ window1
|
||||
<AtkText>
|
||||
text: 234
|
||||
character count: 3
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
editable: false
|
||||
@@ -195,7 +195,7 @@ window1
|
||||
<AtkText>
|
||||
text: Two
|
||||
character count: 3
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
editable: false
|
||||
@@ -245,7 +245,7 @@ window1
|
||||
<AtkText>
|
||||
text: 567
|
||||
character count: 3
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
editable: false
|
||||
@@ -316,7 +316,7 @@ window1
|
||||
<AtkText>
|
||||
text: 40.000
|
||||
character count: 6
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
editable: false
|
||||
@@ -366,7 +366,7 @@ window1
|
||||
<AtkText>
|
||||
text: 999999
|
||||
character count: 6
|
||||
caret offset: -1
|
||||
caret offset: 0
|
||||
default attributes: bg-color: <omitted>
|
||||
bg-full-height: 0
|
||||
editable: false
|
||||
|
||||
@@ -347,12 +347,6 @@ test_data = [
|
||||
'min-height.ref.css',
|
||||
'min-width.css',
|
||||
'min-width.ref.css',
|
||||
'newline-after-backslash.css',
|
||||
'newline-after-backslash.errors',
|
||||
'newline-after-backslash.ref.css',
|
||||
'newline-after-backslash-original.css',
|
||||
'newline-after-backslash-original.errors',
|
||||
'newline-after-backslash-original.ref.css',
|
||||
'no-semicolon.css',
|
||||
'no-semicolon.errors',
|
||||
'no-semicolon.ref.css',
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
You can type here any CSS rule recognized by GTK.
|
||||
You can temporarily disable this custom CSS by clicking on the “Pause” button above.
|
||||
|
||||
Changes are applied instantly and globally, for the whole application.
|
||||
*/
|
||||
|
||||
|
||||
modelbutton.flat:hover {
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
popover arrow {
|
||||
background-color: lime;
|
||||
border-width: 2px;
|
||||
border-color: green;
|
||||
}
|
||||
|
||||
popover {
|
||||
}
|
||||
\
|
||||
popover contents {
|
||||
background-color: magenta;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
newline-after-backslash-original.css:21:1-2: error: GTK_CSS_PARSER_ERROR_SYNTAX
|
||||
@@ -1,18 +0,0 @@
|
||||
popover {
|
||||
}
|
||||
|
||||
popover arrow {
|
||||
background-color: rgb(0,255,0);
|
||||
border-bottom-color: rgb(0,128,0);
|
||||
border-bottom-width: 2px;
|
||||
border-left-color: rgb(0,128,0);
|
||||
border-left-width: 2px;
|
||||
border-right-color: rgb(0,128,0);
|
||||
border-right-width: 2px;
|
||||
border-top-color: rgb(0,128,0);
|
||||
border-top-width: 2px;
|
||||
}
|
||||
|
||||
modelbutton:hover.flat {
|
||||
background-color: rgb(255,0,0);
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
\
|
||||
@@ -1 +0,0 @@
|
||||
newline-after-backslash.css:1:1-2: error: GTK_CSS_PARSER_ERROR_SYNTAX
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 120 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 121 KiB |
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user