Compare commits

..

1 Commits

Author SHA1 Message Date
Matthias Clasen
47ffaefa25 testrevealer: Cover the new transitions
Add tests for all the swing transitions.
2019-03-29 10:51:00 -04:00
817 changed files with 36979 additions and 35899 deletions

View File

@@ -13,20 +13,15 @@ stages:
- subprojects/pango/
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/master:v4
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
stage: build
script:
- bash -x ./.gitlab-ci/test-docker.sh
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report.xml"
when: on_failure
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- "${CI_PROJECT_DIR}/_build/report.xml"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
cache:
key: "$CI_JOB_NAME"
<<: *cache-paths
@@ -58,49 +53,18 @@ msys2-mingw32:
script:
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
# Manual jobs, for branches and MRs
.flatpak-manual: &flatpak-manual
flatpak:demo:
variables:
APPID: org.gtk.Demo
<<: *flatpak-defaults
when: manual
# Only build Flatpak bundles automatically on master
.flatpak-master: &flatpak-master
flatpak:widget-factory:
variables:
APPID: org.gtk.WidgetFactory
<<: *flatpak-defaults
only:
- master
flatpak-manual:demo:
variables:
APPID: org.gtk.Demo4
<<: *flatpak-manual
flatpak-master:demo:
variables:
APPID: org.gtk.Demo4
<<: *flatpak-master
flatpak-manual:widget-factory:
variables:
APPID: org.gtk.WidgetFactory4
<<: *flatpak-manual
flatpak-master:widget-factory:
variables:
APPID: org.gtk.WidgetFactory4
<<: *flatpak-master
flatpak-manual:icon-browser:
variables:
APPID: org.gtk.IconBrowser4
<<: *flatpak-manual
flatpak-master:icon-browser:
variables:
APPID: org.gtk.IconBrowser4
<<: *flatpak-master
pages:
image: registry.gitlab.gnome.org/gnome/gtk/master:v4
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
stage: deploy
script:
- meson -Ddocumentation=true _build .

View File

@@ -11,7 +11,6 @@ RUN dnf -y install \
ccache \
colord-devel \
cups-devel \
dejavu-sans-mono-fonts \
desktop-file-utils \
elfutils-libelf-devel \
fribidi-devel \

View File

@@ -1,101 +0,0 @@
#!/usr/bin/env python3
import argparse
import datetime
import json
import os
import sys
import xml.etree.ElementTree as ET
aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUnit report')
aparser.add_argument('--project-name', metavar='NAME',
help='The project name',
default='unknown')
aparser.add_argument('--job-id', metavar='ID',
help='The job ID for the report',
default='Unknown')
aparser.add_argument('--branch', metavar='NAME',
help='Branch of the project being tested',
default='master')
aparser.add_argument('--output', metavar='FILE',
help='The output file, stdout by default',
type=argparse.FileType('w', encoding='UTF-8'),
default=sys.stdout)
aparser.add_argument('infile', metavar='FILE',
help='The input testlog.json, stdin by default',
type=argparse.FileType('r', encoding='UTF-8'),
default=sys.stdin)
args = aparser.parse_args()
outfile = args.output
testsuites = ET.Element('testsuites')
testsuites.set('id', '{}/{}'.format(args.job_id, args.branch))
testsuites.set('package', args.project_name)
testsuites.set('timestamp', datetime.datetime.utcnow().isoformat(timespec='minutes'))
suites = {}
for line in args.infile:
data = json.loads(line)
(full_suite, unit_name) = data['name'].split(' / ')
(project_name, suite_name) = full_suite.split(':')
duration = data['duration']
return_code = data['returncode']
log = data['stdout']
unit = {
'suite': suite_name,
'name': unit_name,
'duration': duration,
'returncode': return_code,
'stdout': log,
}
units = suites.setdefault(suite_name, [])
units.append(unit)
for name, units in suites.items():
print('Processing suite {} (units: {})'.format(name, len(units)))
def if_failed(unit):
if unit['returncode'] != 0:
return True
return False
def if_succeded(unit):
if unit['returncode'] == 0:
return True
return False
successes = list(filter(if_succeded, units))
failures = list(filter(if_failed, units))
print(' - {}: {} pass, {} fail'.format(name, len(successes), len(failures)))
testsuite = ET.SubElement(testsuites, 'testsuite')
testsuite.set('name', '{}/{}'.format(args.project_name, name))
testsuite.set('tests', str(len(units)))
testsuite.set('errors', str(len(failures)))
testsuite.set('failures', str(len(failures)))
for unit in successes:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('time', str(unit['duration']))
for unit in failures:
testcase = ET.SubElement(testsuite, 'testcase')
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
testcase.set('name', unit['name'])
testcase.set('time', str(unit['duration']))
failure = ET.SubElement(testcase, 'failure')
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
failure.set('name', unit['name'])
failure.set('type', 'error')
failure.text = unit['stdout']
output = ET.tostring(testsuites, encoding='unicode')
outfile.write(output)

View File

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

View File

@@ -24,24 +24,11 @@ cd _build
ninja
ccache --show-stats
set +e
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test \
--timeout-multiplier 2 \
--print-errorlogs \
--suite=gtk \
--no-suite=gtk:gsk \
--no-suite=gtk:reftest \
--no-suite=gtk:a11y
# Save the exit code
exit_code=$?
# We always want to run the report generator
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--job-id="${CI_JOB_NAME}" \
--output=report.xml \
meson-logs/testlog.json
exit $exit_code

95
NEWS
View File

@@ -1,98 +1,3 @@
Overview of Changes in GTK+ 3.96.0
==================================
* DND has been refactored. There are now separate GdkDrag and GdkDrop
objects. This work is still incomplete
* The GDK_SURFACE_SUBSURFACE surface type has been removed.
* Use of child surfaces has been greatly reduced. This work is still
incomplete
* The use of global coordinates in GDK apis has been reduced. This
work is still incomplete
* Events have been simplified and are just used for input
- expose events have been replaced by a GdkSurface::render signal
- configure events have been replaced by a GdkSurface::size-changed signal
- map events have been replaced by a GdkSurface::mapped property
- gdk_event_handler_set has been replaced by a GdkSurface::event signal
- key events no longer contain a string
- events on unmapped widgets are ignored
* Warping the pointer is no longer supported
* The Wayland backend now uses the Settings portal for GtkSettings
* The Wayland input module uses the text-input-unstable-v3 protocol
* The Broadway backend has been rewritten to work well with GSK
* The color chooser has a color picker
* GtkApplication tracks screensaver state and has a ::query-end signal
* The file chooser portal backend supports file filters
* A number of list models have been introduced, for internal use
and as public api:
- GtkMapListModel
- GtkSliceListModel
- GtkSortListModel
- GtkSelectionModel
- GtkSingleSelection
* Support for tabular menus and combo boxes has been dropped
* Key themes are no longer supported
* GtkInvisible has been dropped
* A GtkRoot interface has been added that is currently implemented
just by GtkWindow. This work is incomplete
* GtkWidgets can transform their children using projective linear
transformations. This functionality is available in CSS and
as GskTransform argument to gtk_widget_allocate. GtkFixed is
a container that exposes this functionality. For examples of this,
see the swing transition of GtkRevealer, the rotate transitions
of GtkStack or the Fixed Layout example in gtk-demo.
* GtkEntry functionality has been moved into a new GtkText widget,
the GtkEditable interface has been expanded, and new a new
GtkPasswordEntry widget has been introduced.
* Focus handling has been rewritten, and focus-change event
generation has been unified with crossing events.
* All demos and settings schemas have been renamed to avoid collisions
with GTK3.
* GtkWidget can now use a GtkLayoutManager for size allocation.
Layout managers can optionally use layout children holding layout
properties. GtkBinLayout, GtkBoxLayout, GtkGridLayout, GtkFixedLayout
and GtkCustomLayout are currently available, more layout manager
implementations will appear in the future.
* GtkAssistant, GtkStack and GtkNotebook now have publicly
accessible page objects for their children. The page objects
are also exposed via a list model.
* GtkContainer no longer supports child properties. All existing
child properties have been removed, converted to regular properties,
moved to layout properties or moved to child meta objects.
* A number of X11-specific GtkWindow and GdkSurface apis have been
removed
* GtkBuilder can specify object-valued properties inline.
* The gtk4-builder-tool simplify command has gained a --3to4 option
to convert GTK3 ui files to GTK4.
* The inspector can show child meta objects and layout properties.
Overview of Changes in GTK+ 3.94.0
==================================

View File

@@ -1,5 +1,5 @@
{
"app-id": "org.gtk.Demo4",
"app-id": "org.gtk.Demo",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
@@ -9,9 +9,10 @@
"finish-args": [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*",
"--talk-name=ca.desrt.conf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"cleanup": [
"/include",

View File

@@ -1,72 +0,0 @@
{
"app-id": "org.gtk.IconBrowser4",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
"command": "gtk4-icon-browser",
"tags": ["devel", "development", "nightly"],
"desktop-file-name-prefix": "(Development) ",
"finish-args": [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
],
"cleanup": [
"/include",
"/lib/pkgconfig", "/share/pkgconfig",
"/share/aclocal",
"/man", "/share/man", "/share/gtk-doc",
"*.la", ".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules": [
{
"name" : "wayland",
"buildsystem" : "autotools",
"builddir" : true,
"config-opts" : [
"--disable-documentation"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/wayland-project/wayland.git"
}
]
},
{
"name": "graphene",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib",
"-Dtests=false",
"-Dbenchmarks=false"
],
"sources": [
{
"type": "git",
"url": "https://github.com/ebassi/graphene.git"
}
]
},
{
"name": "gtk",
"buildsystem": "meson",
"builddir": true,
"config-opts": [
"--libdir=/app/lib"
],
"sources": [
{
"type": "git",
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
}
]
}
]
}

View File

@@ -1,5 +1,5 @@
{
"app-id": "org.gtk.WidgetFactory4",
"app-id": "org.gtk.WidgetFactory",
"runtime": "org.gnome.Platform",
"runtime-version": "master",
"sdk": "org.gnome.Sdk",
@@ -9,9 +9,10 @@
"finish-args": [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*",
"--talk-name=ca.desrt.conf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
],
"cleanup": [
"/include",

View File

@@ -19,7 +19,7 @@ if 'DESTDIR' not in os.environ:
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
subprocess.call(['gtk4-update-icon-cache', '-q', '-t' ,'-f',
subprocess.call(['gtk-update-icon-cache', '-q', '-t' ,'-f',
os.path.join(gtk_datadir, 'icons', 'hicolor')])
print('Updating module cache for print backends...')

View File

@@ -305,3 +305,13 @@
#mesondefine HAVE_PANGOFT
#mesondefine ISO_CODES_PREFIX
#mesondefine MALLOC_IS_ALIGNED16
#mesondefine HAVE_POSIX_MEMALIGN
#mesondefine HAVE_MEMALIGN
#mesondefine HAVE_ALIGNED_ALLOC
#mesondefine HAVE__ALIGNED_MALLOC

View File

@@ -212,7 +212,7 @@ activate_about (GSimpleAction *action,
"comments", "Program to demonstrate GTK functions.",
"authors", authors,
"documenters", documentors,
"logo-icon-name", "org.gtk.Demo4",
"logo-icon-name", "org.gtk.Demo",
"title", "About GTK Code Demos",
NULL);
}
@@ -370,7 +370,7 @@ demo_application_init (DemoApplication *app)
GSettings *settings;
GAction *action;
settings = g_settings_new ("org.gtk.Demo4");
settings = g_settings_new ("org.gtk.Demo");
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),
@@ -397,7 +397,7 @@ demo_application_window_store_state (DemoApplicationWindow *win)
{
GSettings *settings;
settings = g_settings_new ("org.gtk.Demo4");
settings = g_settings_new ("org.gtk.Demo");
g_settings_set (settings, "window-size", "(ii)", win->width, win->height);
g_settings_set_boolean (settings, "maximized", win->maximized);
g_settings_set_boolean (settings, "fullscreen", win->fullscreen);
@@ -409,7 +409,7 @@ demo_application_window_load_state (DemoApplicationWindow *win)
{
GSettings *settings;
settings = g_settings_new ("org.gtk.Demo4");
settings = g_settings_new ("org.gtk.Demo");
g_settings_get (settings, "window-size", "(ii)", &win->width, &win->height);
win->maximized = g_settings_get_boolean (settings, "maximized");
win->fullscreen = g_settings_get_boolean (settings, "fullscreen");
@@ -541,7 +541,7 @@ main (int argc, char *argv[])
GtkApplication *app;
app = GTK_APPLICATION (g_object_new (demo_application_get_type (),
"application-id", "org.gtk.Demo4.App",
"application-id", "org.gtk.Demo2",
"flags", G_APPLICATION_HANDLES_OPEN,
NULL));

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="DemoApplicationWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Application Class</property>
@@ -33,11 +32,11 @@
<property name="action-name">win.logo</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkInfoBar" id="infobar">
@@ -64,11 +63,11 @@
</child>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
@@ -80,20 +79,20 @@
<property name="buffer">buffer</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkStatusbar" id="status">
<property name="hexpand">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>
</child>

View File

@@ -52,7 +52,7 @@ do_application_demo (GtkWidget *toplevel)
if (watch == 0)
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
"org.gtk.Demo4.App",
"org.gtk.Demo2",
0,
on_name_appeared,
on_name_vanished,
@@ -80,8 +80,8 @@ do_application_demo (GtkWidget *toplevel)
else
{
g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
"org.gtk.Demo4.App",
"/org/gtk/Demo4/App",
"org.gtk.Demo2",
"/org/gtk/Demo2",
"org.gtk.Actions",
"Activate",
g_variant_new ("(sava{sv})", "quit", NULL, NULL),

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="appmenu">
<section>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="window">
@@ -17,11 +16,11 @@
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow">
@@ -29,22 +28,22 @@
<property name="vexpand">1</property>
<property name="shadow-type">in</property>
<property name="min-content-width">150</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkStackSwitcher">
<property name="halign">center</property>
<property name="hexpand">1</property>
<property name="stack">stack</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="stack">
@@ -67,53 +66,53 @@
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Duck</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Background</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="duck"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="gradient"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">
Blended picture</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column-span">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
@@ -121,12 +120,12 @@ Blended picture</property>
<style>
<class name="blend0"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column-span">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
</property>
@@ -146,53 +145,53 @@ Blended picture</property>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Red</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Blue</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="red"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="blue"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">
Blended picture</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="column-span">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage">
@@ -200,12 +199,12 @@ Blended picture</property>
<style>
<class name="blend1"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="column-span">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
</object>
</property>
@@ -228,33 +227,33 @@ Blended picture</property>
<style>
<class name="cyan"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="magenta"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage">
<style>
<class name="yellow"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage">
@@ -262,11 +261,11 @@ Blended picture</property>
<style>
<class name="blend2"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -275,11 +274,11 @@ Blended picture</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -288,11 +287,11 @@ Blended picture</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -301,11 +300,11 @@ Blended picture</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -314,21 +313,21 @@ Blended picture</property>
<attributes>
<attribute name="weight" value="bold"></attribute>
</attributes>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</property>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -13,22 +13,19 @@ show_parsing_error (GtkCssProvider *provider,
const GError *error,
GtkTextBuffer *buffer)
{
const GtkCssLocation *start_location, *end_location;
GtkTextIter start, end;
const char *tag_name;
start_location = gtk_css_section_get_start_location (section);
gtk_text_buffer_get_iter_at_line_index (buffer,
&start,
start_location->lines,
start_location->line_bytes);
end_location = gtk_css_section_get_end_location (section);
gtk_css_section_get_start_line (section),
gtk_css_section_get_start_position (section));
gtk_text_buffer_get_iter_at_line_index (buffer,
&end,
end_location->lines,
end_location->line_bytes);
gtk_css_section_get_end_line (section),
gtk_css_section_get_end_position (section));
if (error->domain == GTK_CSS_PARSER_WARNING)
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
tag_name = "warning";
else
tag_name = "error";

View File

@@ -13,23 +13,19 @@ show_parsing_error (GtkCssProvider *provider,
const GError *error,
GtkTextBuffer *buffer)
{
const GtkCssLocation *start_location, *end_location;
GtkTextIter start, end;
const char *tag_name;
start_location = gtk_css_section_get_start_location (section);
gtk_text_buffer_get_iter_at_line_index (buffer,
&start,
start_location->lines,
start_location->line_bytes);
end_location = gtk_css_section_get_end_location (section);
gtk_css_section_get_start_line (section),
gtk_css_section_get_start_position (section));
gtk_text_buffer_get_iter_at_line_index (buffer,
&end,
end_location->lines,
end_location->line_bytes);
gtk_css_section_get_end_line (section),
gtk_css_section_get_end_position (section));
if (error->domain == GTK_CSS_PARSER_WARNING)
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
tag_name = "warning";
else
tag_name = "error";

View File

@@ -12,23 +12,19 @@ show_parsing_error (GtkCssProvider *provider,
const GError *error,
GtkTextBuffer *buffer)
{
const GtkCssLocation *start_location, *end_location;
GtkTextIter start, end;
const char *tag_name;
start_location = gtk_css_section_get_start_location (section);
gtk_text_buffer_get_iter_at_line_index (buffer,
&start,
start_location->lines,
start_location->line_bytes);
end_location = gtk_css_section_get_end_location (section);
gtk_css_section_get_start_line (section),
gtk_css_section_get_start_position (section));
gtk_text_buffer_get_iter_at_line_index (buffer,
&end,
end_location->lines,
end_location->line_bytes);
gtk_css_section_get_end_line (section),
gtk_css_section_get_end_position (section));
if (error->domain == GTK_CSS_PARSER_WARNING)
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
tag_name = "warning";
else
tag_name = "error";

View File

@@ -11,22 +11,19 @@ show_parsing_error (GtkCssProvider *provider,
const GError *error,
GtkTextBuffer *buffer)
{
const GtkCssLocation *start_location, *end_location;
GtkTextIter start, end;
const char *tag_name;
start_location = gtk_css_section_get_start_location (section);
gtk_text_buffer_get_iter_at_line_index (buffer,
&start,
start_location->lines,
start_location->line_bytes);
end_location = gtk_css_section_get_end_location (section);
gtk_css_section_get_start_line (section),
gtk_css_section_get_start_position (section));
gtk_text_buffer_get_iter_at_line_index (buffer,
&end,
end_location->lines,
end_location->line_bytes);
gtk_css_section_get_end_line (section),
gtk_css_section_get_end_position (section));
if (error->domain == GTK_CSS_PARSER_WARNING)
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
tag_name = "warning";
else
tag_name = "error";

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GdkCursor" id="default_cursor">
<property name="name">default</property>

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -10,7 +10,7 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="org.gtk.Demo4-symbolic.svg"
sodipodi:docname="org.gtk.Demo-symbolic.svg"
height="16.03125"
id="svg7384"
inkscape:version="0.92.4 5da689c313, 2019-01-14"

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@@ -163,7 +163,6 @@
<file>expander.c</file>
<file>filtermodel.c</file>
<file>fishbowl.c</file>
<file>fixed.c</file>
<file>flowbox.c</file>
<file>foreigndrawing.c</file>
<file>font_features.c</file>
@@ -271,10 +270,7 @@
<file>demotaggedentry.c</file>
<file>demotaggedentry.h</file>
</gresource>
<gresource prefix="/fixed">
<file>fixed.css</file>
</gresource>
<gresource prefix="/org/gtk/Demo4">
<gresource prefix="/org/gtk/Demo">
<file>icons/16x16/actions/application-exit.png</file>
<file>icons/16x16/actions/document-new.png</file>
<file>icons/16x16/actions/document-open.png</file>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkListStore" id="liststore1">
<columns>

View File

@@ -243,7 +243,7 @@ pressed_cb (GtkGesture *gesture,
GtkWidget *child;
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
child = gtk_widget_pick (widget, x, y, GTK_PICK_DEFAULT);
child = gtk_widget_pick (widget, x, y);
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
{
@@ -320,7 +320,7 @@ released_cb (GtkGesture *gesture,
GtkWidget *child;
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
child = gtk_widget_pick (widget, x, y, 0);
child = gtk_widget_pick (widget, x, y);
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
{

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.16"/>
<object class="GtkListStore" id="liststore1">
@@ -45,11 +44,11 @@
<accessibility>
<relation type="label-for" target="treeview1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="treeview1">
@@ -84,11 +83,11 @@
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="treeview2">
@@ -135,11 +134,11 @@
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
@@ -151,11 +150,11 @@
<accessibility>
<relation type="label-for" target="treeview2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
@@ -167,11 +166,11 @@
<accessibility>
<relation type="label-for" target="treeview3"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkTreeView" id="treeview3">
@@ -200,11 +199,11 @@
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Fishbowl</property>
@@ -28,21 +27,25 @@
<object class="GtkLabel">
<property name="label">fps</property>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkLabel">
<property name="label" bind-source="bowl" bind-property="framerate"/>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkLabel">
<property name="label">Icons, </property>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkLabel">
<property name="label" bind-source="bowl" bind-property="count"/>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkToggleButton" id="changes_allow">
@@ -50,6 +53,7 @@
<property name="icon-name">changes-allow</property>
<property name="relief">none</property>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkToggleButton" id="changes_prevent">
@@ -58,6 +62,7 @@
<property name="icon-name">changes-prevent</property>
<property name="relief">none</property>
</object>
<packing/>
</child>
</object>
</child>

View File

@@ -1,167 +0,0 @@
/* Fixed layout
*
* GtkFixed is a container that allows placing and transforming
* widgets manually.
*/
#include <gtk/gtk.h>
/* This enumeration determines the paint order */
enum {
FACE_BACK,
FACE_LEFT,
FACE_BOTTOM,
FACE_RIGHT,
FACE_TOP,
FACE_FRONT,
N_FACES
};
/* Map face widgets to CSS classes */
static struct {
GtkWidget *face;
const char *css_class;
} faces[N_FACES] = {
[FACE_BACK] = { NULL, "back", },
[FACE_LEFT] = { NULL, "left", },
[FACE_RIGHT] = { NULL, "right", },
[FACE_TOP] = { NULL, "top", },
[FACE_BOTTOM] = { NULL, "bottom", },
[FACE_FRONT] = { NULL, "front", },
};
static GtkWidget *
create_faces (void)
{
GtkWidget *fixed = gtk_fixed_new ();
int face_size = 200;
float w, h, d, p;
gtk_widget_set_overflow (fixed, GTK_OVERFLOW_VISIBLE);
w = (float) face_size / 2.f;
h = (float) face_size / 2.f;
d = (float) face_size / 2.f;
p = face_size * 3.f;
for (int i = 0; i < N_FACES; i++)
{
GskTransform *transform = NULL;
/* Add a face */
faces[i].face = gtk_frame_new (NULL);
gtk_widget_set_size_request (faces[i].face, face_size, face_size);
gtk_style_context_add_class (gtk_widget_get_style_context (faces[i].face), faces[i].css_class);
gtk_container_add (GTK_CONTAINER (fixed), faces[i].face);
/* Set up the transformation for each face */
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (w, h));
transform = gsk_transform_perspective (transform, p);
transform = gsk_transform_rotate_3d (transform, -30.f, graphene_vec3_x_axis ());
transform = gsk_transform_rotate_3d (transform, 135.f, graphene_vec3_y_axis ());
transform = gsk_transform_translate_3d (transform, &GRAPHENE_POINT3D_INIT (0, 0, -face_size / 6.f));
switch (i)
{
case FACE_FRONT:
transform = gsk_transform_rotate_3d (transform, 0.f, graphene_vec3_y_axis ());
break;
case FACE_BACK:
transform = gsk_transform_rotate_3d (transform, -180.f, graphene_vec3_y_axis ());
break;
case FACE_RIGHT:
transform = gsk_transform_rotate_3d (transform, 90.f, graphene_vec3_y_axis ());
break;
case FACE_LEFT:
transform = gsk_transform_rotate_3d (transform, -90.f, graphene_vec3_y_axis ());
break;
case FACE_TOP:
transform = gsk_transform_rotate_3d (transform, 90.f, graphene_vec3_x_axis ());
break;
case FACE_BOTTOM:
transform = gsk_transform_rotate_3d (transform, -90.f, graphene_vec3_x_axis ());
break;
default:
break;
}
transform = gsk_transform_translate_3d (transform, &GRAPHENE_POINT3D_INIT (0, 0, d));
transform = gsk_transform_translate_3d (transform, &GRAPHENE_POINT3D_INIT (-w, -h, 0));
gtk_fixed_set_child_transform (GTK_FIXED (fixed), faces[i].face, transform);
gsk_transform_unref (transform);
}
return fixed;
}
static GtkWidget *demo_window = NULL;
static GtkCssProvider *provider = NULL;
static void
close_window (GtkWidget *widget)
{
/* Reset the state */
for (int i = 0; i < N_FACES; i++)
faces[i].face = NULL;
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider));
provider = NULL;
demo_window = NULL;
}
static GtkWidget *
create_demo_window (GtkWidget *do_widget)
{
GtkWidget *window, *sw, *fixed, *cube;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Fixed layout");
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), sw);
fixed = gtk_fixed_new ();
gtk_container_add (GTK_CONTAINER (sw), fixed);
gtk_widget_set_halign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
gtk_widget_set_valign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
cube = create_faces ();
gtk_container_add (GTK_CONTAINER (fixed), cube);
gtk_widget_set_overflow (fixed, GTK_OVERFLOW_VISIBLE);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/fixed/fixed.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
return window;
}
GtkWidget*
do_fixed (GtkWidget *do_widget)
{
if (demo_window == NULL)
demo_window = create_demo_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
else
gtk_widget_destroy (demo_window);
return demo_window;
}

View File

@@ -1,29 +0,0 @@
frame.front {
border: 2px solid white;
background-color: rgba(228, 0, 0, 0.8);
}
frame.back {
border: 2px solid white;
background-color: rgba(228, 0, 0, 0.8);
}
frame.right {
border: 2px solid white;
background-color: rgba(127, 231, 25, 0.8);
}
frame.left {
border: 2px solid white;
background-color: rgba(127, 231, 25, 0.8);
}
frame.top {
border: 2px solid white;
background-color: rgba(114, 159, 207, 0.8);
}
frame.bottom {
border: 2px solid white;
background-color: rgba(114, 159, 207, 0.8);
}

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.12"/>
<object class="GtkWindow" id="window">

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface domain="gtk40">
<object class="GtkMenu" id="menu1">
<child>
@@ -29,12 +28,12 @@
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="icon-name">image-missing</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="row-span">5</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
<property name="height">5</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
@@ -75,11 +74,11 @@
</style>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="content_label">
@@ -92,11 +91,11 @@
<accessibility>
<role type="static"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="resent_box">
@@ -119,11 +118,11 @@
<property name="uri">http://www.gtk.org</property>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box3">
@@ -182,11 +181,11 @@
</child>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="details_revealer">
@@ -251,11 +250,11 @@ FAVORITES</property>
</child>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
</object>
</child>

View File

@@ -58,7 +58,7 @@ activate_about (GSimpleAction *action,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK widgets",
"authors", authors,
"logo-icon-name", "org.gtk.Demo4",
"logo-icon-name", "org.gtk.Demo",
"title", "About GTK Demo",
NULL);
}
@@ -668,7 +668,7 @@ add_data_tab (const gchar *demoname)
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
"tab-expand", FALSE,
"tab-expand", TRUE,
NULL);
g_free (resource_name);
@@ -1212,7 +1212,7 @@ main (int argc, char **argv)
}
/* -- End of hack -- */
app = gtk_application_new ("org.gtk.Demo4", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
app = gtk_application_new ("org.gtk.Demo", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkTreeStore" id="treestore">
<columns>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="appmenu">
<section>

View File

@@ -24,7 +24,6 @@ demos = files([
'expander.c',
'filtermodel.c',
'fishbowl.c',
'fixed.c',
'foreigndrawing.c',
'gestures.c',
'glarea.c',
@@ -135,11 +134,11 @@ foreach size: ['scalable', 'symbolic']
endforeach
# desktop file
install_data('org.gtk.Demo4.desktop', install_dir: gtk_applicationsdir)
install_data('org.gtk.Demo.desktop', install_dir: gtk_applicationsdir)
# GSettings
install_data('org.gtk.Demo4.gschema.xml', install_dir: gtk_schemasdir)
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
gnome.compile_schemas()
# appdata
install_data('org.gtk.Demo4.appdata.xml', install_dir: gtk_appdatadir)
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<child type="titlebar">

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.Demo4.desktop</id>
<id>org.gtk.Demo.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Demo</name>

View File

@@ -2,7 +2,7 @@
Name=GTK Demo
Comment=GTK code examples and demonstrations
Exec=gtk4-demo
Icon=org.gtk.Demo4
Icon=org.gtk.Demo
Terminal=false
Type=Application
StartupNotify=true

View File

@@ -2,14 +2,14 @@
<schemalist>
<enum id='org.gtk.Demo4.Color'>
<enum id='org.gtk.Demo.Color'>
<value nick='red' value='0'/>
<value nick='green' value='1'/>
<value nick='blue' value='2'/>
</enum>
<schema id='org.gtk.Demo4' path='/org/gtk/Demo4/'>
<key name='color' enum='org.gtk.Demo4.Color'>
<schema id='org.gtk.Demo' path='/org/gtk/Demo/'>
<key name='color' enum='org.gtk.Demo.Color'>
<default>'red'</default>
</key>
<key name='window-size' type='(ii)'>

View File

@@ -57,7 +57,7 @@ do_overlay (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
gtk_widget_set_can_target (vbox, FALSE);
gtk_widget_set_can_pick (vbox, FALSE);
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);

View File

@@ -66,13 +66,13 @@ do_overlay2 (GtkWidget *do_widget)
image = gtk_picture_new_for_resource ("/overlay2/decor1.png");
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), image);
gtk_widget_set_can_target (image, FALSE);
gtk_widget_set_can_pick (image, FALSE);
gtk_widget_set_halign (image, GTK_ALIGN_START);
gtk_widget_set_valign (image, GTK_ALIGN_START);
image = gtk_picture_new_for_resource ("/overlay2/decor2.png");
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), image);
gtk_widget_set_can_target (image, FALSE);
gtk_widget_set_can_pick (image, FALSE);
gtk_widget_set_halign (image, GTK_ALIGN_END);
gtk_widget_set_valign (image, GTK_ALIGN_END);

View File

@@ -27,16 +27,10 @@ toggle_resize (GtkWidget *widget,
is_child1 = (child == gtk_paned_get_child1 (paned));
if (is_child1)
g_object_get (paned,
"resize-child1", &resize,
"shrink-child1", &shrink,
NULL);
else
g_object_get (paned,
"resize-child2", &resize,
"shrink-child2", &shrink,
NULL);
gtk_container_child_get (GTK_CONTAINER (paned), child,
"resize", &resize,
"shrink", &shrink,
NULL);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (parent), child);
@@ -61,16 +55,10 @@ toggle_shrink (GtkWidget *widget,
is_child1 = (child == gtk_paned_get_child1 (paned));
if (is_child1)
g_object_get (paned,
"resize-child1", &resize,
"shrink-child1", &shrink,
NULL);
else
g_object_get (paned,
"resize-child2", &resize,
"shrink-child2", &shrink,
NULL);
gtk_container_child_get (GTK_CONTAINER (paned), child,
"resize", &resize,
"shrink", &shrink,
NULL);
g_object_ref (child);
gtk_container_remove (GTK_CONTAINER (parent), child);

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkListStore" id="liststore1">
<columns>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="default-width">300</property>
@@ -18,11 +17,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer1">
@@ -34,11 +33,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer2">
@@ -50,11 +49,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer3">
@@ -65,11 +64,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer4">
@@ -81,11 +80,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer5">
@@ -97,11 +96,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer6">
@@ -113,11 +112,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">4</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer7">
@@ -128,11 +127,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">4</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer8">
@@ -144,11 +143,11 @@
<property name="icon-size">large</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">4</property>
@@ -32,11 +31,11 @@
<accessibility>
<relation type="label-for" target="scale_plain"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScale" id="scale_plain">
@@ -48,11 +47,11 @@
<accessibility>
<relation type="labelled-by" target="label_plain"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_marks">
@@ -61,11 +60,11 @@
<accessibility>
<relation type="label-for" target="scale_marks"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScale" id="scale_marks">
@@ -84,11 +83,11 @@
<accessibility>
<relation type="labelled-by" target="label_marks"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_discrete">
@@ -97,11 +96,11 @@
<accessibility>
<relation type="label-for" target="scale_discrete"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkScale" id="scale_discrete">
@@ -121,11 +120,11 @@
<mark value="3" position="bottom"/>
<mark value="4" position="bottom"/>
</marks>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts-boxes">
<property name="modal">1</property>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts-builder">
<property name="modal">1</property>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts-clocks">
<property name="modal">1</property>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkShortcutsWindow" id="shortcuts-gedit">
<property name="modal">1</property>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Shortcuts</property>

View File

@@ -65,7 +65,7 @@ do_sidebar (GtkWidget *do_widget)
{
if (i == 0)
{
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
widget = gtk_image_new_from_icon_name ("org.gtk.Demo");
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
}
else

View File

@@ -228,7 +228,7 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
int l, t, i;
int pos;
child = gtk_widget_pick (grid, x, y, GTK_PICK_DEFAULT);
child = gtk_widget_pick (grid, x, y);
if (!child)
{
@@ -236,7 +236,10 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
return;
}
gtk_grid_query_child (GTK_GRID (grid), child, &l, &t, NULL, NULL);
gtk_container_child_get (GTK_CONTAINER (grid), child,
"left-attach", &l,
"top-attach", &t,
NULL);
if (l == pos_x && t == pos_y)
{

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="basic_adjustment">
<property name="lower">-10000</property>
@@ -36,11 +35,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">basic_spin</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="basic_spin">
@@ -50,21 +49,21 @@
<property name="climb-rate">1</property>
<property name="digits">2</property>
<property name="numeric">1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="basic_label">
<property name="width-chars">10</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -72,11 +71,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">hex_spin</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="hex_spin">
@@ -86,21 +85,21 @@
<signal name="input" handler="hex_spin_input"/>
<signal name="output" handler="hex_spin_output"/>
<property name="wrap">1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="hex_label">
<property name="width-chars">10</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -108,11 +107,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">time_spin</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="time_spin">
@@ -122,21 +121,21 @@
<signal name="input" handler="time_spin_input"/>
<signal name="output" handler="time_spin_output"/>
<property name="wrap">1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="time_label">
<property name="width-chars">10</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -144,11 +143,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">month_spin</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkSpinButton" id="month_spin">
@@ -159,21 +158,21 @@
<property name="adjustment">month_adjustment</property>
<property name="wrap">1</property>
<property name="update-policy">if-valid</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="month_label">
<property name="width-chars">10</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window1">
<property name="title" translatable="yes">Stack</property>
@@ -8,11 +7,11 @@
<object class="GtkStackSwitcher">
<property name="stack">stack</property>
<property name="halign">center</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkStack" id="stack">
@@ -26,7 +25,7 @@
<object class="GtkImage">
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="icon-name">org.gtk.Demo4</property>
<property name="icon-name">org.gtk.Demo</property>
</object>
</property>
</object>
@@ -58,11 +57,11 @@
</property>
</object>
</child>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkGrid" id="grid">
<property name="row-spacing">10</property>

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@@ -10,7 +10,7 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
sodipodi:docname="org.gtk.IconBrowser4-symbolic.svg"
sodipodi:docname="org.gtk.IconBrowser-symbolic.svg"
height="16.03125"
id="svg7384"
inkscape:version="0.92.4 5da689c313, 2019-01-14"

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -68,6 +68,6 @@ IconBrowserApp *
icon_browser_app_new (void)
{
return g_object_new (ICON_BROWSER_APP_TYPE,
"application-id", "org.gtk.IconBrowser4",
"application-id", "org.gtk.IconBrowser",
NULL);
}

View File

@@ -285,6 +285,19 @@ populate (IconBrowserWindow *win)
g_strfreev (groups);
}
static gboolean
key_event_cb (GtkEventController *controller,
guint keyval,
guint keycode,
GdkModifierType state,
gpointer data)
{
IconBrowserWindow *win = data;
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar),
gtk_get_current_event ());
}
static void
copy_to_clipboard (GtkButton *button,
IconBrowserWindow *win)
@@ -439,6 +452,7 @@ static void
icon_browser_window_init (IconBrowserWindow *win)
{
GdkContentFormats *list;
GtkEventController *controller;
gtk_widget_init_template (GTK_WIDGET (win));
@@ -465,11 +479,13 @@ icon_browser_window_init (IconBrowserWindow *win)
g_signal_connect (win->searchbar, "notify::search-mode-enabled",
G_CALLBACK (search_mode_toggled), win);
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (win->searchbar),
GTK_WIDGET (win));
symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
controller = gtk_event_controller_key_new ();
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
gtk_widget_add_controller (GTK_WIDGET (win), controller);
populate (win);
}

View File

@@ -17,7 +17,7 @@ executable('gtk4-icon-browser',
link_args: extra_demo_ldflags,
install: true)
install_data('org.gtk.IconBrowser4.desktop', install_dir: gtk_applicationsdir)
install_data('org.gtk.IconBrowser.desktop', install_dir: gtk_applicationsdir)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')

View File

@@ -2,7 +2,7 @@
Name=Icon Browser
Comment=An application that shows themed icons
Exec=gtk4-icon-browser
Icon=org.gtk.IconBrowser4
Icon=org.gtk.IconBrowser
Terminal=false
Type=Application
StartupNotify=true

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="IconStore" id="store"/>
<object class="GtkTreeModelFilter" id="filter_model">
@@ -47,6 +46,7 @@
</object>
</child>
</object>
<packing/>
</child>
</object>
</child>
@@ -134,11 +134,11 @@
<accessibility>
<relation type="labelled-by" target="label1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image2">
@@ -147,11 +147,11 @@
<accessibility>
<relation type="labelled-by" target="label2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image3">
@@ -160,11 +160,11 @@
<accessibility>
<relation type="labelled-by" target="label3"/>
</accessibility>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image4">
@@ -173,11 +173,11 @@
<accessibility>
<relation type="labelled-by" target="label4"/>
</accessibility>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image5">
@@ -186,11 +186,11 @@
<accessibility>
<relation type="labelled-by" target="label5"/>
</accessibility>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">4</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="image6">
@@ -199,11 +199,11 @@
<accessibility>
<relation type="labelled-by" target="label6"/>
</accessibility>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">5</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
@@ -216,11 +216,11 @@
<accessibility>
<relation type="label-for" target="image1"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
@@ -233,11 +233,11 @@
<accessibility>
<relation type="label-for" target="image2"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
@@ -250,11 +250,11 @@
<accessibility>
<relation type="label-for" target="image3"/>
</accessibility>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label4">
@@ -267,11 +267,11 @@
<accessibility>
<relation type="label-for" target="image4"/>
</accessibility>
<layout>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label5">
@@ -284,11 +284,11 @@
<accessibility>
<relation type="label-for" target="image5"/>
</accessibility>
<layout>
<property name="left-attach">4</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">4</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label6">
@@ -301,11 +301,11 @@
<accessibility>
<relation type="label-for" target="image6"/>
</accessibility>
<layout>
<property name="left-attach">5</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">5</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -13,7 +13,7 @@ executable('gtk4-widget-factory',
install: true)
# desktop file
install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
install_data('org.gtk.WidgetFactory.desktop', install_dir: gtk_applicationsdir)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
@@ -25,4 +25,4 @@ foreach size: ['scalable', 'symbolic']
endforeach
# appdata
install_data('org.gtk.WidgetFactory4.appdata.xml', install_dir: gtk_appdatadir)
install_data('org.gtk.WidgetFactory.appdata.xml', install_dir: gtk_appdatadir)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>org.gtk.WidgetFactory4.desktop</id>
<id>org.gtk.WidgetFactory.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.0+</project_license>
<name>GTK Widget Factory</name>

View File

@@ -2,7 +2,7 @@
Name=Widget Factory
Comment=A showcase for GTK widgets, designed for testing themes.
Exec=gtk4-widget-factory
Icon=org.gtk.WidgetFactory4
Icon=org.gtk.WidgetFactory
Terminal=false
Type=Application
StartupNotify=true

View File

@@ -232,7 +232,7 @@ activate_about (GSimpleAction *action,
"website", "http://www.gtk.org",
"comments", "Program to demonstrate GTK themes and widgets",
"authors", authors,
"logo-icon-name", "org.gtk.WidgetFactory4",
"logo-icon-name", "org.gtk.WidgetFactory",
"title", "About GTK Widget Factory",
"system-information", s->str,
NULL);
@@ -1657,13 +1657,13 @@ activate (GApplication *app)
g_type_ensure (my_text_view_get_type ());
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory4/widget-factory.css");
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory/widget-factory.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_USER);
g_object_unref (provider);
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory4/widget-factory.ui");
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory/widget-factory.ui");
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
@@ -1944,7 +1944,7 @@ main (int argc, char *argv[])
};
gint status;
app = gtk_application_new ("org.gtk.WidgetFactory4", G_APPLICATION_NON_UNIQUE);
app = gtk_application_new ("org.gtk.WidgetFactory", G_APPLICATION_NON_UNIQUE);
g_action_map_add_action_entries (G_ACTION_MAP (app),
app_entries, G_N_ELEMENTS (app_entries),

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gtk/WidgetFactory4">
<gresource prefix="/org/gtk/WidgetFactory">
<file preprocess="xml-stripblanks">widget-factory.ui</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory4">
<gresource prefix="/org/gtk/WidgetFactory">
<file>widget-factory.css</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory4/gtk">
<gresource prefix="/org/gtk/WidgetFactory/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>
</gresource>
<gresource prefix="/org/gtk/WidgetFactory4">
<gresource prefix="/org/gtk/WidgetFactory">
<file>icons/16x16/actions/document-new.png</file>
<file>icons/16x16/actions/document-save.png</file>
<file>icons/16x16/actions/edit-find.png</file>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="gear_menu">
<section>
@@ -594,32 +593,32 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="label" translatable="yes">checkbutton</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton2">
<property name="label" translatable="yes">checkbutton</property>
<property name="can-focus">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton3">
<property name="label" translatable="yes">checkbutton</property>
<property name="inconsistent">1</property>
<property name="can-focus">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton4">
@@ -627,22 +626,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="sensitive">0</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton5">
<property name="label" translatable="yes">checkbutton</property>
<property name="sensitive">0</property>
<property name="can-focus">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton6">
@@ -650,22 +649,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="sensitive">0</property>
<property name="inconsistent">1</property>
<property name="can-focus">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton1">
<property name="label" translatable="yes">radiobutton</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton2">
@@ -673,11 +672,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<property name="group">radiobutton1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton3">
@@ -686,11 +685,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<property name="group">radiobutton1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton4">
@@ -698,11 +697,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="sensitive">0</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton5">
@@ -711,11 +710,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<property name="group">radiobutton3</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton6">
@@ -725,47 +724,46 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="can-focus">1</property>
<property name="active">1</property>
<property name="group">radiobutton3</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner1">
<property name="active">1</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner2">
<layout>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</layout>
</object>
<object class="GtkSpinner" id="spinner2"/>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner3">
<property name="active">1</property>
<property name="sensitive">0</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner4">
<property name="sensitive">0</property>
<layout>
<property name="left-attach">2</property>
<property name="top-attach">4</property>
</layout>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">4</property>
</packing>
</child>
</object>
</child>
@@ -1504,11 +1502,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="valign">center</property>
<property name="value">.5</property>
<property name="halign">center</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkScaleButton" id="mic-button">
@@ -1522,11 +1520,11 @@ microphone-sensitivity-medium-symbolic</property>
<property name="halign">center</property>
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>
@@ -1571,7 +1569,7 @@ microphone-sensitivity-medium-symbolic</property>
<property name="title">Logo</property>
<property name="child">
<object class="GtkImage" id="imageo">
<property name="icon-name">org.gtk.WidgetFactory4</property>
<property name="icon-name">gtk3-widget-factory</property>
<property name="pixel-size">256</property>
</object>
</property>
@@ -3195,20 +3193,20 @@ bad things might happen.</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="details_entry">
<property name="valign">baseline</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -3220,20 +3218,20 @@ bad things might happen.</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="more_details_entry">
<property name="valign">baseline</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -3245,22 +3243,22 @@ bad things might happen.</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkScale" id="level_scale">
<property name="valign">baseline</property>
<property name="draw-value">0</property>
<property name="adjustment">adjustment1</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
@@ -3272,21 +3270,21 @@ bad things might happen.</property>
<style>
<class name="dim-label"/>
</style>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="mode_switch">
<property name="halign">start</property>
<property name="valign">baseline</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
</object>
</child>
@@ -3344,11 +3342,11 @@ bad things might happen.</property>
<accessibility>
<relation type="label-for" target="open_popover_entry"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="description_label">
@@ -3358,11 +3356,11 @@ bad things might happen.</property>
<accessibility>
<relation type="label-for" target="open_popover_textview"/>
</accessibility>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
@@ -3379,11 +3377,11 @@ bad things might happen.</property>
</accessibility>
</object>
</child>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="open_popover_entry">
@@ -3391,11 +3389,11 @@ bad things might happen.</property>
<accessibility>
<relation type="labelled-by" target="title_label"/>
</accessibility>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="open_popover_button">
@@ -3407,11 +3405,11 @@ bad things might happen.</property>
<style>
<class name="suggested-action"/>
</style>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>

View File

@@ -502,6 +502,10 @@ gdk_device_get_n_keys
gdk_device_get_axes
gdk_device_get_seat
<SUBSECTION>
gdk_device_grab
gdk_device_ungrab
<SUBSECTION>
gdk_device_get_state
gdk_device_get_position
@@ -997,6 +1001,7 @@ gdk_wayland_display_get_wl_display
gdk_wayland_display_query_registry
gdk_wayland_surface_new_subsurface
gdk_wayland_surface_get_wl_surface
gdk_wayland_surface_set_use_custom_surface
GdkWaylandSurfaceExported
gdk_wayland_surface_export_handle
gdk_wayland_surface_unexport_handle

View File

@@ -152,8 +152,6 @@ gsk_transform_get_category
<SUBSECTION>
gsk_transform_print
gsk_transform_to_string
gsk_transform_parse
<SUBSECTION>
gsk_transform_to_matrix
gsk_transform_to_2d
gsk_transform_to_affine

View File

@@ -54,6 +54,16 @@ Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
</programlisting>
You can add password protection for your session by creating a file in
<filename>$XDG_CONFIG_HOME/broadway.passwd</filename> or <filename>$HOME/.config/broadway.passwd</filename>
with a crypt(3) style password hash.
A simple way to generate it is with openssl:
<programlisting>
openssl passwd -1 > ~/.config/broadway.passwd
</programlisting>
</para>
</refsect1>

View File

@@ -92,6 +92,7 @@
<xi:include href="xml/gtkheaderbar.xml" />
<xi:include href="xml/gtkoverlay.xml" />
<xi:include href="xml/gtkpaned.xml" />
<xi:include href="xml/gtklayout.xml" />
<xi:include href="xml/gtknotebook.xml" />
<xi:include href="xml/gtkexpander.xml" />
<xi:include href="xml/gtkorientable.xml" />
@@ -103,11 +104,7 @@
<title>Layout Managers</title>
<xi:include href="xml/gtklayoutmanager.xml" />
<xi:include href="xml/gtklayoutchild.xml" />
<xi:include href="xml/gtkbinlayout.xml" />
<xi:include href="xml/gtkboxlayout.xml" />
<xi:include href="xml/gtkcustomlayout.xml" />
<xi:include href="xml/gtkfixedlayout.xml" />
<xi:include href="xml/gtkgridlayout.xml" />
</chapter>
<chapter id="DisplayWidgets">

View File

@@ -744,8 +744,10 @@ gtk_combo_box_text_get_type
<TITLE>GtkContainer</TITLE>
GtkContainer
GtkContainerClass
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID
gtk_container_add
gtk_container_remove
gtk_container_add_with_properties
gtk_container_foreach
gtk_container_get_children
gtk_container_get_path_for_child
@@ -754,7 +756,19 @@ gtk_container_set_focus_vadjustment
gtk_container_get_focus_hadjustment
gtk_container_set_focus_hadjustment
gtk_container_child_type
gtk_container_child_get
gtk_container_child_set
gtk_container_child_get_property
gtk_container_child_set_property
gtk_container_child_get_valist
gtk_container_child_set_valist
gtk_container_child_notify
gtk_container_child_notify_by_pspec
gtk_container_forall
gtk_container_class_find_child_property
gtk_container_class_install_child_property
gtk_container_class_install_child_properties
gtk_container_class_list_child_properties
<SUBSECTION Standard>
GTK_CONTAINER
@@ -1725,6 +1739,27 @@ GtkLabelPrivate
GtkLabelSelectionInfo
</SECTION>
<SECTION>
<FILE>gtklayout</FILE>
<TITLE>GtkLayout</TITLE>
GtkLayout
gtk_layout_new
gtk_layout_put
gtk_layout_move
gtk_layout_set_size
gtk_layout_get_size
<SUBSECTION Standard>
GTK_LAYOUT
GTK_IS_LAYOUT
GTK_TYPE_LAYOUT
GTK_LAYOUT_CLASS
GTK_IS_LAYOUT_CLASS
GTK_LAYOUT_GET_CLASS
<SUBSECTION Private>
GtkLayoutPrivate
gtk_layout_get_type
</SECTION>
<SECTION>
<FILE>gtklinkbutton</FILE>
<TITLE>GtkLinkButton</TITLE>
@@ -2479,6 +2514,7 @@ gtk_search_bar_get_search_mode
gtk_search_bar_set_search_mode
gtk_search_bar_get_show_close_button
gtk_search_bar_set_show_close_button
gtk_search_bar_handle_event
gtk_search_bar_set_key_capture_widget
gtk_search_bar_get_key_capture_widget
<SUBSECTION Standard>
@@ -2497,6 +2533,7 @@ gtk_search_bar_get_type
<TITLE>GtkSearchEntry</TITLE>
GtkSearchEntry
gtk_search_entry_new
gtk_search_entry_handle_event
gtk_search_entry_set_key_capture_widget
gtk_search_entry_get_key_capture_widget
<SUBSECTION Standard>
@@ -4471,6 +4508,8 @@ gtk_widget_class_set_accessible_type
gtk_widget_class_set_accessible_role
gtk_widget_get_accessible
gtk_widget_child_focus
gtk_widget_child_notify
gtk_widget_freeze_child_notify
gtk_widget_get_child_visible
gtk_widget_get_parent
gtk_widget_get_settings
@@ -4480,6 +4519,7 @@ gtk_widget_get_display
gtk_widget_get_size_request
gtk_widget_set_child_visible
gtk_widget_set_size_request
gtk_widget_thaw_child_notify
gtk_widget_list_mnemonic_labels
gtk_widget_add_mnemonic_label
gtk_widget_remove_mnemonic_label
@@ -4507,7 +4547,6 @@ gtk_widget_compute_bounds
gtk_widget_compute_transform
gtk_widget_compute_point
gtk_widget_contains
GtkPickFlags
gtk_widget_pick
gtk_widget_get_can_default
gtk_widget_set_can_default
@@ -4516,8 +4555,8 @@ gtk_widget_set_can_focus
gtk_widget_get_focus_on_click
gtk_widget_set_focus_on_click
gtk_widget_set_focus_child
gtk_widget_get_can_target
gtk_widget_set_can_target
gtk_widget_get_can_pick
gtk_widget_set_can_pick
gtk_widget_get_has_surface
gtk_widget_set_has_surface
gtk_widget_get_sensitive
@@ -5016,6 +5055,8 @@ gtk_style_context_get_state
gtk_style_context_get_valist
gtk_style_context_get_section
gtk_style_context_get_color
gtk_style_context_get_background_color
gtk_style_context_get_border_color
gtk_style_context_get_border
gtk_style_context_get_padding
gtk_style_context_get_margin
@@ -5086,21 +5127,20 @@ gtk_css_provider_load_from_path
gtk_css_provider_load_from_resource
gtk_css_provider_new
gtk_css_provider_to_string
GTK_CSS_PARSER_ERROR
GtkCssParserError
GtkCssParserWarning
GTK_CSS_PROVIDER_ERROR
GtkCssProviderError
<SUBSECTION>
GtkCssLocation
GtkCssSection
gtk_css_section_new
gtk_css_section_ref
gtk_css_section_unref
gtk_css_section_print
gtk_css_section_to_string
GtkCssSectionType
gtk_css_section_get_end_line
gtk_css_section_get_end_position
gtk_css_section_get_file
gtk_css_section_get_parent
gtk_css_section_get_start_location
gtk_css_section_get_end_location
gtk_css_section_get_section_type
gtk_css_section_get_start_line
gtk_css_section_get_start_position
gtk_css_section_ref
gtk_css_section_unref
<SUBSECTION Standard>
GTK_TYPE_CSS_PROVIDER
GTK_CSS_PROVIDER
@@ -7175,85 +7215,3 @@ gtk_box_layout_get_baseline_position
GTK_TYPE_BOX_LAYOUT
gtk_box_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkcustomlayout</FILE>
GtkCustomLayout
GtkCustomRequestModeFunc
GtkCustomMeasureFunc
GtkCustomAllocateFunc
gtk_custom_layout_new
<SUBSECTION Standard>
GTK_TYPE_CUSTOM_LAYOUT
gtk_custom_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkbinlayout</FILE>
GtkBinLayout
gtk_bin_layout_new
<SUBSECTION Standard>
GTK_TYPE_BIN_LAYOUT
gtk_bin_layout_get_type
</SECTION>
<SECTION>
<FILE>gtkfixedlayout</FILE>
GtkFixedLayout
gtk_fixed_layout_new
<SUBSECTION>
GtkFixedLayoutChild
gtk_fixed_layout_child_set_position
gtk_fixed_layout_child_get_position
<SUBSECTION Standard>
GTK_TYPE_FIXED_LAYOUT
gtk_fixed_layout_get_type
GTK_TYPE_FIXED_LAYOUT_CHILD
gtk_fixed_layout_child_get_type
</SECTION>
<SECTION>
<FILE>gtkgridlayout</FILE>
GtkGridLayout
gtk_grid_layout_new
gtk_grid_layout_set_row_homogeneous
gtk_grid_layout_get_row_homogeneous
gtk_grid_layout_set_row_spacing
gtk_grid_layout_get_row_spacing
gtk_grid_layout_set_column_homogeneous
gtk_grid_layout_get_column_homogeneous
gtk_grid_layout_set_column_spacing
gtk_grid_layout_get_column_spacing
gtk_grid_layout_set_row_baseline_position
gtk_grid_layout_get_row_baseline_position
gtk_grid_layout_set_baseline_row
gtk_grid_layout_get_baseline_row
<SUBSECTION>
GtkGridLayoutChild
gtk_grid_layout_child_set_top_attach
gtk_grid_layout_child_get_top_attach
gtk_grid_layout_child_set_left_attach
gtk_grid_layout_child_get_left_attach
gtk_grid_layout_child_set_column_span
gtk_grid_layout_child_get_column_span
gtk_grid_layout_child_set_row_span
gtk_grid_layout_child_get_row_span
<SUBSECTION Standard>
GTK_TYPE_GRID_LAYOUT
gtk_grid_layout_get_type
GTK_TYPE_GRID_LAYOUT_CHILD
gtk_grid_layout_child_get_type
</SECTION>

View File

@@ -16,9 +16,7 @@ gtk_aspect_frame_get_type
gtk_assistant_get_type
gtk_assistant_page_get_type
gtk_bin_get_type
gtk_bin_layout_get_type
gtk_box_get_type
gtk_box_layout_get_type
gtk_builder_get_type
gtk_buildable_get_type
gtk_button_get_type
@@ -66,7 +64,6 @@ gtk_file_chooser_get_type
gtk_file_chooser_widget_get_type
gtk_file_filter_get_type
gtk_fixed_get_type
gtk_fixed_layout_get_type
gtk_flow_box_get_type
gtk_flow_box_child_get_type
gtk_font_button_get_type
@@ -86,8 +83,6 @@ gtk_gesture_swipe_get_type
gtk_gesture_zoom_get_type
gtk_gl_area_get_type
gtk_grid_get_type
gtk_grid_layout_child_get_type
gtk_grid_layout_get_type
gtk_header_bar_get_type
gtk_icon_theme_get_type
gtk_icon_view_get_type
@@ -97,8 +92,7 @@ gtk_im_context_simple_get_type
gtk_im_multicontext_get_type
gtk_info_bar_get_type
gtk_label_get_type
gtk_layout_child_get_type
gtk_layout_manager_get_type
gtk_layout_get_type
gtk_link_button_get_type
gtk_list_store_get_type
gtk_list_box_get_type

View File

@@ -665,16 +665,6 @@
pass-through == !can-pick.
</para>
</section>
<section>
<title>Use GtkFixed instead of GtkLayout</title>
<para>
Since GtkScrolledWindow can deal with widgets that do not implement
the GtkScrollable interface by automatically wrapping them into a
GtkViewport, GtkLayout is redundant, and has been removed in favor
of the existing GtkFixed container widget.
</para>
</section>
</section>
</chapter>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
@@ -17,19 +16,18 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="transitionlabel">
@@ -37,11 +35,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="transition">
@@ -50,11 +48,11 @@
<item translatable="yes" id="crossfade">Fade</item>
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
@@ -28,6 +27,7 @@
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkMenuButton" id="gears">
@@ -36,6 +36,7 @@
<class name="image-button"/>
</style>
</object>
<packing/>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
@@ -17,19 +16,18 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="transitionlabel">
@@ -37,11 +35,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="transition">
@@ -50,11 +48,11 @@
<item translatable="yes" id="crossfade">Fade</item>
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
@@ -17,19 +16,18 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="transitionlabel">
@@ -37,11 +35,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="transition">
@@ -50,11 +48,11 @@
<item translatable="yes" id="crossfade">Fade</item>
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
@@ -19,6 +18,7 @@
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing/>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
@@ -17,19 +16,18 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="transitionlabel">
@@ -37,11 +35,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="transition">
@@ -50,11 +48,11 @@
<item translatable="yes" id="crossfade">Fade</item>
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
@@ -19,6 +18,7 @@
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkMenuButton" id="gears">
@@ -27,6 +27,7 @@
<class name="image-button"/>
</style>
</object>
<packing/>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppPrefs" parent="GtkDialog">
<property name="title" translatable="yes">Preferences</property>
@@ -17,19 +16,18 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">font</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkFontButton" id="font">
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<object class="GtkFontButton" id="font"/>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="transitionlabel">
@@ -37,11 +35,11 @@
<property name="use-underline">1</property>
<property name="mnemonic-widget">transition</property>
<property name="xalign">1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="transition">
@@ -50,11 +48,11 @@
<item translatable="yes" id="crossfade">Fade</item>
<item translatable="yes" id="slide-left-right">Slide</item>
</items>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ExampleAppWindow" parent="GtkApplicationWindow">
<property name="title" translatable="yes">Example Application</property>
@@ -30,6 +29,7 @@
<property name="sensitive">0</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
<packing/>
</child>
<child type="end">
<object class="GtkMenuButton" id="gears">
@@ -38,6 +38,7 @@
<class name="image-button"/>
</style>
</object>
<packing/>
</child>
</object>
</child>

View File

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object id="window" class="GtkWindow">
<property name="title">Grid</property>
@@ -7,30 +6,30 @@
<child>
<object id="button1" class="GtkButton">
<property name="label">Button 1</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object id="button2" class="GtkButton">
<property name="label">Button 2</property>
<layout>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</layout>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object id="quit" class="GtkButton">
<property name="label">Quit</property>
<layout>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="column-span">2</property>
</layout>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
<property name="width">2</property>
</packing>
</child>
</object>
</child>

View File

@@ -8,7 +8,6 @@
#include "broadway-output.h"
//#define DEBUG_NODE_SENDING
//#define DEBUG_NODE_SENDING_REMOVE
/************************************************************************
* Basic I/O primitives *
@@ -114,7 +113,7 @@ broadway_output_set_next_serial (BroadwayOutput *output,
************************************************************************/
static void
append_uint8 (BroadwayOutput *output, guint8 c)
append_char (BroadwayOutput *output, char c)
{
g_string_append_c (output->buf, c);
}
@@ -173,7 +172,7 @@ patch_uint32 (BroadwayOutput *output, guint32 v, gsize offset)
static void
write_header(BroadwayOutput *output, char op)
{
append_uint8 (output, op);
append_char (output, op);
append_uint32 (output, output->serial++);
}
@@ -318,25 +317,15 @@ static void
append_type (BroadwayOutput *output, guint32 type, BroadwayNode *node)
{
#ifdef DEBUG_NODE_SENDING
g_print ("%*s%s(%d/%d)", append_node_depth*2, "", broadway_node_type_names[type], node->id, node->output_id);
g_print ("%*s%s", append_node_depth*2, "", broadway_node_type_names[type]);
if (type == BROADWAY_NODE_TEXTURE)
g_print (" tx=%u", node->data[4]);
g_print (" %u", node->data[4]);
g_print ("\n");
#endif
append_uint32 (output, type);
}
static BroadwayNode *
lookup_old_node (GHashTable *old_node_lookup,
guint32 id)
{
if (old_node_lookup)
return g_hash_table_lookup (old_node_lookup, GINT_TO_POINTER (id));
return NULL;
}
/***********************************
* This outputs the tree to the client, while at the same time diffing
@@ -358,230 +347,59 @@ lookup_old_node (GHashTable *old_node_lookup,
static void
append_node (BroadwayOutput *output,
BroadwayNode *node,
GHashTable *old_node_lookup)
BroadwayNode *old_node,
gboolean all_parents_are_kept)
{
guint32 i;
BroadwayNode *reused_node;
append_node_depth++;
reused_node = lookup_old_node (old_node_lookup, node->id);
if (reused_node)
if (old_node != NULL && broadway_node_equal (node, old_node))
{
broadway_node_mark_deep_consumed (reused_node, TRUE);
append_type (output, BROADWAY_NODE_REUSE, node);
append_uint32 (output, node->output_id);
}
else
{
append_type (output, node->type, node);
append_uint32 (output, node->output_id);
for (i = 0; i < node->n_data; i++)
append_uint32 (output, node->data[i]);
for (i = 0; i < node->n_children; i++)
append_node (output,
node->children[i],
old_node_lookup);
if (broadway_node_deep_equal (node, old_node))
{
append_type (output, BROADWAY_NODE_KEEP_ALL, node);
goto out;
}
if (all_parents_are_kept)
{
append_type (output, BROADWAY_NODE_KEEP_THIS, node);
append_uint32 (output, node->n_children);
for (i = 0; i < node->n_children; i++)
append_node (output, node->children[i],
i < old_node->n_children ? old_node->children[i] : NULL,
TRUE);
goto out;
}
}
append_type (output, node->type, node);
for (i = 0; i < node->n_data; i++)
append_uint32 (output, node->data[i]);
for (i = 0; i < node->n_children; i++)
append_node (output,
node->children[i],
(old_node != NULL && i < old_node->n_children) ? old_node->children[i] : NULL,
FALSE);
out:
append_node_depth--;
}
static gboolean
should_reuse_node (BroadwayOutput *output,
BroadwayNode *node,
BroadwayNode *old_node)
{
int i;
guint32 new_texture;
if (old_node->reused)
return FALSE;
if (node->type != old_node->type)
return FALSE;
if (broadway_node_equal (node, old_node))
return TRUE;
switch (node->type) {
case BROADWAY_NODE_TRANSFORM:
#ifdef DEBUG_NODE_SENDING
g_print ("Patching transform node %d/%d\n",
old_node->id, old_node->output_id);
#endif
append_uint32 (output, BROADWAY_NODE_OP_PATCH_TRANSFORM);
append_uint32 (output, old_node->output_id);
for (i = 0; i < node->n_data; i++)
append_uint32 (output, node->data[i]);
return TRUE;
case BROADWAY_NODE_TEXTURE:
/* Check that the size, etc is the same */
for (i = 0; i < 4; i++)
if (node->data[i] != old_node->data[i])
return FALSE;
new_texture = node->data[4];
#ifdef DEBUG_NODE_SENDING
g_print ("Patching texture node %d/%d to tx=%d\n",
old_node->id, old_node->output_id,
new_texture);
#endif
append_uint32 (output, BROADWAY_NODE_OP_PATCH_TEXTURE);
append_uint32 (output, old_node->output_id);
append_uint32 (output, new_texture);
return TRUE;
break;
default:
return FALSE;
}
}
static BroadwayNode *
append_node_ops (BroadwayOutput *output,
BroadwayNode *node,
BroadwayNode *parent,
BroadwayNode *previous_sibling,
BroadwayNode *old_node,
GHashTable *old_node_lookup)
{
BroadwayNode *reused_node;
guint32 i;
/* Maybe can be reused from the last tree. */
reused_node = lookup_old_node (old_node_lookup, node->id);
if (reused_node)
{
g_assert (node == reused_node);
g_assert (reused_node->reused);
g_assert (!reused_node->consumed); /* Should only be once in the tree, and not consumed otherwise */
broadway_node_mark_deep_consumed (reused_node, TRUE);
if (node == old_node)
{
/* The node in the old tree at the current position is the same, so
we need to do nothing, just don't delete it (which we won't since
its marked used) */
}
else
{
/* We can reuse it, bu it comes from a different place or
order, if so we need to move it in place */
#ifdef DEBUG_NODE_SENDING
g_print ("Move old node %d/%d to parent %d/%d after %d/%d\n",
reused_node->id, reused_node->output_id,
parent ? parent->id : 0,
parent ? parent->output_id : 0,
previous_sibling ? previous_sibling->id : 0,
previous_sibling ? previous_sibling->output_id : 0);
#endif
append_uint32 (output, BROADWAY_NODE_OP_MOVE_AFTER_CHILD);
append_uint32 (output, parent ? parent->output_id : 0);
append_uint32 (output, previous_sibling ? previous_sibling->output_id : 0);
append_uint32 (output, reused_node->output_id);
}
return reused_node;
}
/* If the next node in place is shallowly equal (but not necessarily
* deep equal) we reuse it and tweak its children as needed.
* Except we avoid this for reused node as those make more sense to reuse deeply.
*/
if (old_node && should_reuse_node (output, node, old_node))
{
int old_i = 0;
BroadwayNode *last_child = NULL;
old_node->consumed = TRUE; // Don't reuse again
// We rewrite this new node as it now represents the old node in the browser
node->output_id = old_node->output_id;
/* However, we might need to rewrite then children of old_node */
for (i = 0; i < node->n_children; i++)
{
BroadwayNode *child = node->children[i];
/* Find the next (or first) non-consumed old child, if any */
while (old_i < old_node->n_children &&
old_node->children[old_i]->consumed)
old_i++;
last_child =
append_node_ops (output,
child,
node, /* parent */
last_child,
(old_i < old_node->n_children) ? old_node->children[old_i] : NULL,
old_node_lookup);
}
/* Remaining old nodes are either reused elsewhere, or end up marked not consumed so are deleted at the end */
return old_node;
}
/* Fallback to create a new tree */
#ifdef DEBUG_NODE_SENDING
g_print ("Insert nodes in parent %d/%d, after sibling %d/%d\n",
parent ? parent->id : 0,
parent ? parent->output_id : 0,
previous_sibling ? previous_sibling->id : 0,
previous_sibling ? previous_sibling->output_id : 0);
#endif
append_uint32 (output, BROADWAY_NODE_OP_INSERT_NODE);
append_uint32 (output, parent ? parent->output_id : 0);
append_uint32 (output, previous_sibling ? previous_sibling->output_id : 0);
append_node(output, node, old_node_lookup);
return node;
}
/* Remove non-consumed nodes */
static void
append_node_removes (BroadwayOutput *output,
BroadwayNode *node)
{
// TODO: Use an array of nodes instead
if (!node->consumed)
{
#ifdef DEBUG_NODE_SENDING_REMOVE
g_print ("Remove old node non-consumed node %d/%d\n",
node->id, node->output_id);
#endif
append_uint32 (output, BROADWAY_NODE_OP_REMOVE_NODE);
append_uint32 (output, node->output_id);
}
for (int i = 0; i < node->n_children; i++)
append_node_removes (output, node->children[i]);
}
void
broadway_output_surface_set_nodes (BroadwayOutput *output,
int id,
BroadwayNode *root,
BroadwayNode *old_root,
GHashTable *old_node_lookup)
BroadwayNode *old_root)
{
gsize size_pos, start, end;
if (old_root)
{
broadway_node_mark_deep_consumed (old_root, FALSE);
broadway_node_mark_deep_reused (old_root, FALSE);
/* This will modify children of old_root if any are shared */
broadway_node_mark_deep_reused (root, TRUE);
}
/* Early return if nothing changed */
if (old_root != NULL &&
broadway_node_deep_equal (root, old_root))
return;
write_header (output, BROADWAY_OP_SET_NODES);
@@ -592,11 +410,9 @@ broadway_output_surface_set_nodes (BroadwayOutput *output,
start = output->buf->len;
#ifdef DEBUG_NODE_SENDING
g_print ("====== node ops for surface %d =======\n", id);
g_print ("====== node tree for %d =======\n", id);
#endif
append_node_ops (output, root, NULL, NULL, old_root, old_node_lookup);
if (old_root)
append_node_removes (output, old_root);
append_node (output, root, old_root, TRUE);
end = output->buf->len;
patch_uint32 (output, (end - start) / 4, size_pos);
}

View File

@@ -60,8 +60,7 @@ void broadway_output_set_transient_for (BroadwayOutput *output,
void broadway_output_surface_set_nodes (BroadwayOutput *output,
int id,
BroadwayNode *root,
BroadwayNode *old_root,
GHashTable *old_node_lookup);
BroadwayNode *old_root);
void broadway_output_upload_texture (BroadwayOutput *output,
guint32 id,
GBytes *texture);

View File

@@ -20,19 +20,13 @@ typedef enum { /* Sync changes with broadway.js */
BROADWAY_NODE_SHADOW = 8,
BROADWAY_NODE_OPACITY = 9,
BROADWAY_NODE_CLIP = 10,
BROADWAY_NODE_TRANSFORM = 11,
BROADWAY_NODE_DEBUG = 12,
BROADWAY_NODE_REUSE = 13,
BROADWAY_NODE_KEEP_ALL = 11,
BROADWAY_NODE_KEEP_THIS = 12,
BROADWAY_NODE_TRANSFORM = 13,
BROADWAY_NODE_DEBUG = 14,
BROADWAY_NODE_REUSE = 15,
} BroadwayNodeType;
typedef enum { /* Sync changes with broadway.js */
BROADWAY_NODE_OP_INSERT_NODE = 0,
BROADWAY_NODE_OP_REMOVE_NODE = 1,
BROADWAY_NODE_OP_MOVE_AFTER_CHILD = 2,
BROADWAY_NODE_OP_PATCH_TEXTURE = 3,
BROADWAY_NODE_OP_PATCH_TRANSFORM = 4,
} BroadwayNodeOpType;
static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
"TEXTURE",
"CONTAINER",
@@ -45,47 +39,51 @@ static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
"SHADOW",
"OPACITY",
"CLIP",
"TRANSFORM",
"KEEP_ALL",
"KEEP_THIS",
"TRANSLATE",
"DEBUG",
"REUSE",
};
typedef enum {
BROADWAY_EVENT_ENTER = 0,
BROADWAY_EVENT_LEAVE = 1,
BROADWAY_EVENT_POINTER_MOVE = 2,
BROADWAY_EVENT_BUTTON_PRESS = 3,
BROADWAY_EVENT_BUTTON_RELEASE = 4,
BROADWAY_EVENT_TOUCH = 5,
BROADWAY_EVENT_SCROLL = 6,
BROADWAY_EVENT_KEY_PRESS = 7,
BROADWAY_EVENT_KEY_RELEASE = 8,
BROADWAY_EVENT_GRAB_NOTIFY = 9,
BROADWAY_EVENT_UNGRAB_NOTIFY = 10,
BROADWAY_EVENT_CONFIGURE_NOTIFY = 11,
BROADWAY_EVENT_SCREEN_SIZE_CHANGED = 12,
BROADWAY_EVENT_FOCUS = 13,
BROADWAY_EVENT_ROUNDTRIP_NOTIFY = 14,
BROADWAY_EVENT_ENTER = 'e',
BROADWAY_EVENT_LEAVE = 'l',
BROADWAY_EVENT_POINTER_MOVE = 'm',
BROADWAY_EVENT_BUTTON_PRESS = 'b',
BROADWAY_EVENT_BUTTON_RELEASE = 'B',
BROADWAY_EVENT_TOUCH = 't',
BROADWAY_EVENT_SCROLL = 's',
BROADWAY_EVENT_KEY_PRESS = 'k',
BROADWAY_EVENT_KEY_RELEASE = 'K',
BROADWAY_EVENT_GRAB_NOTIFY = 'g',
BROADWAY_EVENT_UNGRAB_NOTIFY = 'u',
BROADWAY_EVENT_CONFIGURE_NOTIFY = 'w',
BROADWAY_EVENT_SCREEN_SIZE_CHANGED = 'd',
BROADWAY_EVENT_FOCUS = 'f',
BROADWAY_EVENT_ROUNDTRIP_NOTIFY = 'F',
} BroadwayEventType;
typedef enum {
BROADWAY_OP_GRAB_POINTER = 0,
BROADWAY_OP_UNGRAB_POINTER = 1,
BROADWAY_OP_NEW_SURFACE = 2,
BROADWAY_OP_SHOW_SURFACE = 3,
BROADWAY_OP_HIDE_SURFACE = 4,
BROADWAY_OP_RAISE_SURFACE = 5,
BROADWAY_OP_LOWER_SURFACE = 6,
BROADWAY_OP_DESTROY_SURFACE = 7,
BROADWAY_OP_MOVE_RESIZE = 8,
BROADWAY_OP_SET_TRANSIENT_FOR = 9,
BROADWAY_OP_DISCONNECTED = 10,
BROADWAY_OP_SURFACE_UPDATE = 11,
BROADWAY_OP_SET_SHOW_KEYBOARD = 12,
BROADWAY_OP_UPLOAD_TEXTURE = 13,
BROADWAY_OP_RELEASE_TEXTURE = 14,
BROADWAY_OP_SET_NODES = 15,
BROADWAY_OP_ROUNDTRIP = 16,
BROADWAY_OP_GRAB_POINTER = 'g',
BROADWAY_OP_UNGRAB_POINTER = 'u',
BROADWAY_OP_NEW_SURFACE = 's',
BROADWAY_OP_SHOW_SURFACE = 'S',
BROADWAY_OP_HIDE_SURFACE = 'H',
BROADWAY_OP_RAISE_SURFACE = 'r',
BROADWAY_OP_LOWER_SURFACE = 'R',
BROADWAY_OP_DESTROY_SURFACE = 'd',
BROADWAY_OP_MOVE_RESIZE = 'm',
BROADWAY_OP_SET_TRANSIENT_FOR = 'p',
BROADWAY_OP_PUT_RGB = 'i',
BROADWAY_OP_REQUEST_AUTH = 'l',
BROADWAY_OP_AUTH_OK = 'L',
BROADWAY_OP_DISCONNECTED = 'D',
BROADWAY_OP_SURFACE_UPDATE = 'b',
BROADWAY_OP_SET_SHOW_KEYBOARD = 'k',
BROADWAY_OP_UPLOAD_TEXTURE = 't',
BROADWAY_OP_RELEASE_TEXTURE = 'T',
BROADWAY_OP_SET_NODES = 'n',
BROADWAY_OP_ROUNDTRIP = 'F',
} BroadwayOpType;
typedef struct {

View File

@@ -115,7 +115,6 @@ struct BroadwayInput {
};
struct BroadwaySurface {
guint32 owner;
gint32 id;
gint32 x;
gint32 y;
@@ -225,33 +224,6 @@ broadway_node_deep_equal (BroadwayNode *a,
}
void
broadway_node_mark_deep_reused (BroadwayNode *node,
gboolean reused)
{
node->reused = reused;
for (int i = 0; i < node->n_children; i++)
broadway_node_mark_deep_reused (node->children[i], reused);
}
void
broadway_node_mark_deep_consumed (BroadwayNode *node,
gboolean consumed)
{
node->consumed = consumed;
for (int i = 0; i < node->n_children; i++)
broadway_node_mark_deep_consumed (node->children[i], consumed);
}
void
broadway_node_add_to_lookup (BroadwayNode *node,
GHashTable *node_lookup)
{
g_hash_table_insert (node_lookup, GINT_TO_POINTER(node->id), node);
for (int i = 0; i < node->n_children; i++)
broadway_node_add_to_lookup (node->children[i], node_lookup);
}
static void
broadway_server_init (BroadwayServer *server)
{
@@ -472,46 +444,9 @@ process_input_message (BroadwayServer *server,
BroadwayInputMsg *message)
{
gint32 client;
BroadwaySurface *surface;
update_event_state (server, message);
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
case BROADWAY_EVENT_LEAVE:
case BROADWAY_EVENT_POINTER_MOVE:
case BROADWAY_EVENT_BUTTON_PRESS:
case BROADWAY_EVENT_BUTTON_RELEASE:
case BROADWAY_EVENT_SCROLL:
case BROADWAY_EVENT_GRAB_NOTIFY:
case BROADWAY_EVENT_UNGRAB_NOTIFY:
surface = broadway_server_lookup_surface (server, message->pointer.event_surface_id);
break;
case BROADWAY_EVENT_TOUCH:
surface = broadway_server_lookup_surface (server, message->touch.event_surface_id);
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
surface = broadway_server_lookup_surface (server, message->configure_notify.id);
break;
case BROADWAY_EVENT_ROUNDTRIP_NOTIFY:
surface = broadway_server_lookup_surface (server, message->roundtrip_notify.id);
break;
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
/* TODO: Send to keys focused clients only... */
case BROADWAY_EVENT_FOCUS:
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
default:
surface = NULL;
break;
}
if (surface)
client = surface->owner;
else
client = -1;
client = -1;
if (is_pointer_event (message) &&
server->pointer_grab_surface_id != -1)
client = server->pointer_grab_client_id;
@@ -622,7 +557,6 @@ parse_input_message (BroadwayInput *input, const unsigned char *message)
msg.base.type = ntohl (*p++);
msg.base.serial = ntohl (*p++);
time_ = ntohl (*p++);
if (time_ == 0) {
@@ -704,19 +638,12 @@ parse_input_message (BroadwayInput *input, const unsigned char *message)
if (rt->id == msg.roundtrip_notify.id &&
rt->tag == msg.roundtrip_notify.tag)
break;
{
server->outstanding_roundtrips = g_list_delete_link (server->outstanding_roundtrips, l);
g_free (rt);
break;
}
}
if (l == NULL)
g_warning ("Got unexpected rountrip reply for id %d, tag %d\n", msg.roundtrip_notify.id, msg.roundtrip_notify.tag);
else
{
BroadwayOutstandingRoundtrip *rt = l->data;
server->outstanding_roundtrips = g_list_delete_link (server->outstanding_roundtrips, l);
g_free (rt);
}
break;
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
@@ -1826,7 +1753,6 @@ decode_nodes (BroadwayServer *server,
g_ref_count_init (&node->refcount);
node->type = type;
node->id = id;
node->output_id = id;
node->texture_id = 0;
node->n_children = n_children;
node->children = (BroadwayNode **)((char *)node + sizeof(BroadwayNode) + (size - 1) * sizeof(guint32));
@@ -1858,6 +1784,17 @@ decode_nodes (BroadwayServer *server,
return node;
}
static void
init_node_lookup (BroadwaySurface *surface,
BroadwayNode *node)
{
int i;
g_hash_table_insert (surface->node_lookup, GINT_TO_POINTER(node->id), node);
for (i = 0; i < node->n_children; i++)
init_node_lookup (surface, node->children[i]);
}
/* passes ownership of nodes */
void
broadway_server_surface_update_nodes (BroadwayServer *server,
@@ -1879,8 +1816,7 @@ broadway_server_surface_update_nodes (BroadwayServer *server,
if (server->output != NULL)
broadway_output_surface_set_nodes (server->output, surface->id,
root,
surface->nodes,
surface->node_lookup);
surface->nodes);
if (surface->nodes)
broadway_node_unref (server, surface->nodes);
@@ -1888,7 +1824,8 @@ broadway_server_surface_update_nodes (BroadwayServer *server,
surface->nodes = root;
g_hash_table_remove_all (surface->node_lookup);
broadway_node_add_to_lookup (root, surface->node_lookup);
init_node_lookup (surface, surface->nodes);
}
guint32
@@ -2066,7 +2003,6 @@ broadway_server_ungrab_pointer (BroadwayServer *server,
guint32
broadway_server_new_surface (BroadwayServer *server,
guint32 client,
int x,
int y,
int width,
@@ -2076,7 +2012,6 @@ broadway_server_new_surface (BroadwayServer *server,
BroadwaySurface *surface;
surface = g_new0 (BroadwaySurface, 1);
surface->owner = client;
surface->id = server->id_counter++;
surface->x = x;
surface->y = y;
@@ -2162,8 +2097,7 @@ broadway_server_resync_surfaces (BroadwayServer *server)
if (surface->nodes)
broadway_output_surface_set_nodes (server->output, surface->id,
surface->nodes,
NULL, NULL);
surface->nodes, NULL);
if (surface->visible)
broadway_output_show_surface (server->output, surface->id);

View File

@@ -25,16 +25,10 @@ struct _BroadwayNode {
grefcount refcount;
guint32 type;
guint32 id;
guint32 output_id;
guint32 hash; /* deep hash */
guint32 n_children;
BroadwayNode **children;
guint32 texture_id;
/* Scratch stuff used during diff */
gboolean reused;
gboolean consumed;
guint32 n_data;
guint32 data[1];
};
@@ -43,12 +37,6 @@ gboolean broadway_node_equal (BroadwayNode *
BroadwayNode *b);
gboolean broadway_node_deep_equal (BroadwayNode *a,
BroadwayNode *b);
void broadway_node_mark_deep_reused (BroadwayNode *node,
gboolean reused);
void broadway_node_mark_deep_consumed (BroadwayNode *node,
gboolean consumed);
void broadway_node_add_to_lookup (BroadwayNode *node,
GHashTable *node_lookup);
BroadwayServer *broadway_server_new (char *address,
int port,
const char *ssl_cert,
@@ -86,7 +74,6 @@ gint32 broadway_server_get_mouse_surface (BroadwayServer *
void broadway_server_set_show_keyboard (BroadwayServer *server,
gboolean show);
guint32 broadway_server_new_surface (BroadwayServer *server,
guint32 client,
int x,
int y,
int width,

View File

@@ -11,63 +11,59 @@ const BROADWAY_NODE_LINEAR_GRADIENT = 7;
const BROADWAY_NODE_SHADOW = 8;
const BROADWAY_NODE_OPACITY = 9;
const BROADWAY_NODE_CLIP = 10;
const BROADWAY_NODE_TRANSFORM = 11;
const BROADWAY_NODE_DEBUG = 12;
const BROADWAY_NODE_REUSE = 13;
const BROADWAY_NODE_KEEP_ALL = 11;
const BROADWAY_NODE_KEEP_THIS = 12;
const BROADWAY_NODE_TRANSFORM = 13;
const BROADWAY_NODE_DEBUG = 14;
const BROADWAY_NODE_REUSE = 15;
const BROADWAY_NODE_OP_INSERT_NODE = 0;
const BROADWAY_NODE_OP_REMOVE_NODE = 1;
const BROADWAY_NODE_OP_MOVE_AFTER_CHILD = 2;
const BROADWAY_NODE_OP_PATCH_TEXTURE = 3;
const BROADWAY_NODE_OP_PATCH_TRANSFORM = 4;
const BROADWAY_OP_GRAB_POINTER = 'g';
const BROADWAY_OP_UNGRAB_POINTER = 'u';
const BROADWAY_OP_NEW_SURFACE = 's';
const BROADWAY_OP_SHOW_SURFACE = 'S';
const BROADWAY_OP_HIDE_SURFACE = 'H';
const BROADWAY_OP_RAISE_SURFACE = 'r';
const BROADWAY_OP_LOWER_SURFACE = 'R';
const BROADWAY_OP_DESTROY_SURFACE = 'd';
const BROADWAY_OP_MOVE_RESIZE = 'm';
const BROADWAY_OP_SET_TRANSIENT_FOR = 'p';
const BROADWAY_OP_PUT_RGB = 'i';
const BROADWAY_OP_REQUEST_AUTH = 'l';
const BROADWAY_OP_AUTH_OK = 'L';
const BROADWAY_OP_DISCONNECTED = 'D';
const BROADWAY_OP_SURFACE_UPDATE = 'b';
const BROADWAY_OP_SET_SHOW_KEYBOARD = 'k';
const BROADWAY_OP_UPLOAD_TEXTURE = 't';
const BROADWAY_OP_RELEASE_TEXTURE = 'T';
const BROADWAY_OP_SET_NODES = 'n';
const BROADWAY_OP_ROUNDTRIP = 'F';
const BROADWAY_OP_GRAB_POINTER = 0;
const BROADWAY_OP_UNGRAB_POINTER = 1;
const BROADWAY_OP_NEW_SURFACE = 2;
const BROADWAY_OP_SHOW_SURFACE = 3;
const BROADWAY_OP_HIDE_SURFACE = 4;
const BROADWAY_OP_RAISE_SURFACE = 5;
const BROADWAY_OP_LOWER_SURFACE = 6;
const BROADWAY_OP_DESTROY_SURFACE = 7;
const BROADWAY_OP_MOVE_RESIZE = 8;
const BROADWAY_OP_SET_TRANSIENT_FOR = 9;
const BROADWAY_OP_DISCONNECTED = 10;
const BROADWAY_OP_SURFACE_UPDATE = 11;
const BROADWAY_OP_SET_SHOW_KEYBOARD = 12;
const BROADWAY_OP_UPLOAD_TEXTURE = 13;
const BROADWAY_OP_RELEASE_TEXTURE = 14;
const BROADWAY_OP_SET_NODES = 15;
const BROADWAY_OP_ROUNDTRIP = 16;
const BROADWAY_EVENT_ENTER = 0;
const BROADWAY_EVENT_LEAVE = 1;
const BROADWAY_EVENT_POINTER_MOVE = 2;
const BROADWAY_EVENT_BUTTON_PRESS = 3;
const BROADWAY_EVENT_BUTTON_RELEASE = 4;
const BROADWAY_EVENT_TOUCH = 5;
const BROADWAY_EVENT_SCROLL = 6;
const BROADWAY_EVENT_KEY_PRESS = 7;
const BROADWAY_EVENT_KEY_RELEASE = 8;
const BROADWAY_EVENT_GRAB_NOTIFY = 9;
const BROADWAY_EVENT_UNGRAB_NOTIFY = 10;
const BROADWAY_EVENT_CONFIGURE_NOTIFY = 11;
const BROADWAY_EVENT_SCREEN_SIZE_CHANGED = 12;
const BROADWAY_EVENT_FOCUS = 13;
const BROADWAY_EVENT_ROUNDTRIP_NOTIFY = 14;
const BROADWAY_EVENT_ENTER = 'e';
const BROADWAY_EVENT_LEAVE = 'l';
const BROADWAY_EVENT_POINTER_MOVE = 'm';
const BROADWAY_EVENT_BUTTON_PRESS = 'b';
const BROADWAY_EVENT_BUTTON_RELEASE = 'B';
const BROADWAY_EVENT_TOUCH = 't';
const BROADWAY_EVENT_SCROLL = 's';
const BROADWAY_EVENT_KEY_PRESS = 'k';
const BROADWAY_EVENT_KEY_RELEASE = 'K';
const BROADWAY_EVENT_GRAB_NOTIFY = 'g';
const BROADWAY_EVENT_UNGRAB_NOTIFY = 'u';
const BROADWAY_EVENT_CONFIGURE_NOTIFY = 'w';
const BROADWAY_EVENT_SCREEN_SIZE_CHANGED = 'd';
const BROADWAY_EVENT_FOCUS = 'f';
const BROADWAY_EVENT_ROUNDTRIP_NOTIFY = 'F';
const DISPLAY_OP_REPLACE_CHILD = 0;
const DISPLAY_OP_APPEND_CHILD = 1;
const DISPLAY_OP_INSERT_AFTER_CHILD = 2;
const DISPLAY_OP_APPEND_ROOT = 3;
const DISPLAY_OP_SHOW_SURFACE = 4;
const DISPLAY_OP_HIDE_SURFACE = 5;
const DISPLAY_OP_DELETE_NODE = 6;
const DISPLAY_OP_MOVE_NODE = 7;
const DISPLAY_OP_RESIZE_NODE = 8;
const DISPLAY_OP_RESTACK_SURFACES = 9;
const DISPLAY_OP_DELETE_SURFACE = 10;
const DISPLAY_OP_CHANGE_TEXTURE = 11;
const DISPLAY_OP_CHANGE_TRANSFORM = 12;
const DISPLAY_OP_APPEND_ROOT = 2;
const DISPLAY_OP_SHOW_SURFACE = 3;
const DISPLAY_OP_HIDE_SURFACE = 4;
const DISPLAY_OP_DELETE_NODE = 5;
const DISPLAY_OP_MOVE_NODE = 6;
const DISPLAY_OP_RESIZE_NODE = 7;
const DISPLAY_OP_RESTACK_SURFACES = 8;
const DISPLAY_OP_DELETE_SURFACE = 9;
// GdkCrossingMode
const GDK_CROSSING_NORMAL = 0;
@@ -93,63 +89,6 @@ const GDK_HYPER_MASK = 1 << 27;
const GDK_META_MASK = 1 << 28;
const GDK_RELEASE_MASK = 1 << 30;
var useDataUrls = window.location.search.includes("datauri");
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
var b64_lookup = [];
var base64_code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for (var i = 0, len = base64_code.length; i < len; ++i) {
b64_lookup[i] = base64_code[i];
}
function tripletToBase64 (num) {
return b64_lookup[num >> 18 & 0x3F] +
b64_lookup[num >> 12 & 0x3F] +
b64_lookup[num >> 6 & 0x3F] +
b64_lookup[num & 0x3F];
}
function encodeBase64Chunk (uint8, start, end) {
var tmp;
var output = [];
for (var i = start; i < end; i += 3) {
tmp =
((uint8[i] << 16) & 0xFF0000) +
((uint8[i + 1] << 8) & 0xFF00) +
(uint8[i + 2] & 0xFF);
output.push(tripletToBase64(tmp));
}
return output.join('');
}
function bytesToDataUri(uint8) {
var tmp;
var len = uint8.length;
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
var parts = [];
var maxChunkLength = 16383; // must be multiple of 3
parts.push("data:image/png;base64,");
// go through the array every three bytes, we'll deal with trailing stuff later
for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
parts.push(encodeBase64Chunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)));
}
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1];
parts.push(b64_lookup[tmp >> 2] + b64_lookup[(tmp << 4) & 0x3F] + '==');
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
parts.push(b64_lookup[tmp >> 10] + b64_lookup[(tmp >> 4) & 0x3F] + b64_lookup[(tmp << 2) & 0x3F] + '=');
}
return parts.join('');
}
/* Helper functions for debugging */
var logDiv = null;
function log(str) {
@@ -259,15 +198,8 @@ function getButtonMask (button) {
}
function Texture(id, data) {
var url;
if (useDataUrls) {
url = bytesToDataUri(data);
} else {
var blob = new Blob([data],{type: "image/png"});
url = window.URL.createObjectURL(blob);
}
this.url = url;
var blob = new Blob([data],{type: "image/png"});
this.url = window.URL.createObjectURL(blob);
this.refcount = 1;
this.id = id;
@@ -285,9 +217,7 @@ Texture.prototype.ref = function() {
Texture.prototype.unref = function() {
this.refcount -= 1;
if (this.refcount == 0) {
if (this.url.startsWith("blob")) {
window.URL.revokeObjectURL(this.url);
}
window.URL.revokeObjectURL(this.url);
delete textures[this.id];
}
}
@@ -304,7 +234,6 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
surface.transientParent = 0;
surface.visible = false;
surface.imageData = null;
surface.nodes = {};
var div = document.createElement('div');
div.surface = surface;
@@ -367,13 +296,12 @@ function cmdLowerSurface(id)
moveToHelper(surface, 0);
}
function TransformNodes(node_data, div, nodes, display_commands) {
function TransformNodes(node_data, div, display_commands) {
this.node_data = node_data;
this.display_commands = display_commands;
this.data_pos = 0;
this.div = div;
this.outstanding = 1;
this.nodes = nodes;
}
TransformNodes.prototype.decode_uint32 = function() {
@@ -513,28 +441,6 @@ TransformNodes.prototype.decode_string = function() {
return utf8_to_string (utf8);
}
TransformNodes.prototype.decode_transform = function() {
var transform_type = this.decode_uint32();
if (transform_type == 0) {
var point = this.decode_point();
return "translate(" + px(point.x) + "," + px(point.y) + ")";
} else if (transform_type == 1) {
var m = new Array();
for (var i = 0; i < 16; i++) {
m[i] = this.decode_float ();
}
return "matrix3d(" +
m[0] + "," + m[1] + "," + m[2] + "," + m[3]+ "," +
m[4] + "," + m[5] + "," + m[6] + "," + m[7] + "," +
m[8] + "," + m[9] + "," + m[10] + "," + m[11] + "," +
m[12] + "," + m[13] + "," + m[14] + "," + m[15] + ")";
} else {
alert("Unexpected transform type " + transform_type);
}
}
function args() {
var argsLength = arguments.length;
var strings = [];
@@ -568,44 +474,27 @@ function set_rrect_style (div, rrect) {
div.style["border-bottom-left-radius"] = args(px(rrect.sizes[3].width), px(rrect.sizes[3].height));
}
TransformNodes.prototype.createDiv = function(id)
{
var div = document.createElement('div');
div.node_id = id;
this.nodes[id] = div;
return div;
}
TransformNodes.prototype.createImage = function(id)
{
var image = new Image();
image.node_id = id;
this.nodes[id] = image;
return image;
}
TransformNodes.prototype.insertNode = function(parent, previousSibling, is_toplevel)
TransformNodes.prototype.insertNode = function(parent, posInParent, oldNode)
{
var type = this.decode_uint32();
var id = this.decode_uint32();
var newNode = null;
var oldNode = null;
// We need to dup this because as we reuse children the original order is lost
var oldChildren = [];
if (oldNode) {
for (var i = 0; i < oldNode.children.length; i++)
oldChildren[i] = oldNode.children[i];
}
switch (type)
{
/* Reuse divs from last frame */
case BROADWAY_NODE_REUSE:
{
oldNode = this.nodes[id];
}
break;
/* Leaf nodes */
case BROADWAY_NODE_TEXTURE:
{
var rect = this.decode_rect();
var texture_id = this.decode_uint32();
var image = this.createImage(id);
var image = new Image();
image.width = rect.width;
image.height = rect.height;
image.style["position"] = "absolute";
@@ -622,7 +511,7 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
{
var rect = this.decode_rect();
var c = this.decode_color ();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
set_rect_style(div, rect);
div.style["background-color"] = c;
@@ -640,7 +529,7 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
for (var i = 0; i < 4; i++)
border_colors[i] = this.decode_color();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
rrect.bounds.width -= border_widths[1] + border_widths[3];
rrect.bounds.height -= border_widths[0] + border_widths[2];
@@ -667,7 +556,7 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
var spread = this.decode_float();
var blur = this.decode_float();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
set_rrect_style(div, rrect);
div.style["box-shadow"] = args(px(dx), px(dy), px(blur), px(spread), color);
@@ -684,7 +573,7 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
var spread = this.decode_float();
var blur = this.decode_float();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
set_rrect_style(div, rrect);
div.style["box-shadow"] = args("inset", px(dx), px(dy), px(blur), px(spread), color);
@@ -699,7 +588,7 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
var start = this.decode_point ();
var end = this.decode_point ();
var stops = this.decode_color_stops ();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
set_rect_style(div, rect);
@@ -743,13 +632,31 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
case BROADWAY_NODE_TRANSFORM:
{
var transform_string = this.decode_transform();
var transform_type = this.decode_uint32();
var transform_string;
var div = this.createDiv(id);
if (transform_type == 0) {
var point = this.decode_point();
transform_string = "translate(" + px(point.x) + "," + px(point.y) + ")";
} else if (transform_type == 1) {
var m = new Array();
for (var i = 0; i < 16; i++) {
m[i] = this.decode_float ();
}
transform_string =
"matrix3d(" +
m[0] + "," + m[1] + "," + m[2] + "," + m[3]+ "," +
m[4] + "," + m[5] + "," + m[6] + "," + m[7] + "," +
m[8] + "," + m[9] + "," + m[10] + "," + m[11] + "," +
m[12] + "," + m[13] + "," + m[14] + "," + m[15] + ")";
}
var div = document.createElement('div');
div.style["transform"] = transform_string;
div.style["transform-origin"] = "0px 0px";
this.insertNode(div, null, false);
this.insertNode(div, -1, oldChildren[0]);
newNode = div;
}
break;
@@ -757,11 +664,11 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
case BROADWAY_NODE_CLIP:
{
var rect = this.decode_rect();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
set_rect_style(div, rect);
div.style["overflow"] = "hidden";
this.insertNode(div, null, false);
this.insertNode(div, -1, oldChildren[0]);
newNode = div;
}
break;
@@ -769,11 +676,11 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
case BROADWAY_NODE_ROUNDED_CLIP:
{
var rrect = this.decode_rounded_rect();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
set_rrect_style(div, rrect);
div.style["overflow"] = "hidden";
this.insertNode(div, null, false);
this.insertNode(div, -1, oldChildren[0]);
newNode = div;
}
break;
@@ -781,13 +688,13 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
case BROADWAY_NODE_OPACITY:
{
var opacity = this.decode_float();
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
div.style["left"] = px(0);
div.style["top"] = px(0);
div.style["opacity"] = opacity;
this.insertNode(div, null, false);
this.insertNode(div, -1, oldChildren[0]);
newNode = div;
}
break;
@@ -803,13 +710,13 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
var blur = this.decode_float();
filters = filters + "drop-shadow(" + args (px(dx), px(dy), px(blur), color) + ")";
}
var div = this.createDiv(id);
var div = document.createElement('div');
div.style["position"] = "absolute";
div.style["left"] = px(0);
div.style["top"] = px(0);
div.style["filter"] = filters;
this.insertNode(div, null, false);
this.insertNode(div, -1, oldChildren[0]);
newNode = div;
}
break;
@@ -817,9 +724,9 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
case 14: // DEBUG
{
var str = this.decode_string();
var div = this.createDiv(id);
var div = document.createElement('div');
div.setAttribute('debug', str);
this.insertNode(div, null, false);
this.insertNode(div, -1, oldChildren[0]);
newNode = div;
}
break;
@@ -828,99 +735,74 @@ TransformNodes.prototype.insertNode = function(parent, previousSibling, is_tople
case BROADWAY_NODE_CONTAINER:
{
var div = this.createDiv(id);
var div = document.createElement('div');
var len = this.decode_uint32();
var lastChild = null;
for (var i = 0; i < len; i++) {
lastChild = this.insertNode(div, lastChild, false);
this.insertNode(div, -1, oldChildren[i]);
}
newNode = div;
}
break;
case BROADWAY_NODE_KEEP_ALL:
{
if (!oldNode)
alert("KEEP_ALL with no oldNode");
if (oldNode.parentNode != parent)
newNode = oldNode;
else
newNode = null;
}
break;
case BROADWAY_NODE_KEEP_THIS:
{
if (!oldNode)
alert("KEEP_THIS with no oldNode ");
/* We only get keep-this if all parents were kept, check this */
if (oldNode.parentNode != parent)
alert("Got KEEP_THIS for non-kept parent");
var len = this.decode_uint32();
var i;
for (i = 0; i < len; i++) {
this.insertNode(oldNode, i,
oldChildren[i]);
}
/* Remove children that are after the new length */
for (i = oldChildren.length - 1; i > len - 1; i--)
this.display_commands.push([DISPLAY_OP_DELETE_NODE, oldChildren[i]]);
/* NOTE: No need to modify the parent, we're keeping this node as is */
newNode = null;
}
break;
default:
alert("Unexpected node type " + type);
}
if (newNode) {
if (is_toplevel)
this.display_commands.push([DISPLAY_OP_INSERT_AFTER_CHILD, parent, previousSibling, newNode]);
else // It is safe to display directly because we have not added the toplevel to the document yet
parent.appendChild(newNode);
return newNode;
} else if (oldNode) {
// This must be delayed until display ops, because it will remove from the old parent
this.display_commands.push([DISPLAY_OP_INSERT_AFTER_CHILD, parent, previousSibling, oldNode]);
return oldNode;
if (posInParent >= 0 && parent.children[posInParent])
this.display_commands.push([DISPLAY_OP_REPLACE_CHILD, parent, newNode, parent.children[posInParent]]);
else
this.display_commands.push([DISPLAY_OP_APPEND_CHILD, parent, newNode]);
}
}
TransformNodes.prototype.execute = function(display_commands)
{
var root = this.div;
while (this.data_pos < this.node_data.byteLength) {
var op = this.decode_uint32();
var parentId, parent;
switch (op) {
case BROADWAY_NODE_OP_INSERT_NODE:
parentId = this.decode_uint32();
if (parentId == 0)
parent = root;
else {
parent = this.nodes[parentId];
if (parent == null)
console.log("Wanted to insert into parent " + parentId + " but it is unknown");
}
var previousChildId = this.decode_uint32();
var previousChild = null;
if (previousChildId != 0)
previousChild = this.nodes[previousChildId];
this.insertNode(parent, previousChild, true);
break;
case BROADWAY_NODE_OP_REMOVE_NODE:
var removeId = this.decode_uint32();
var remove = this.nodes[removeId];
delete this.nodes[removeId];
if (remove == null)
console.log("Wanted to delete node " + removeId + " but it is unknown");
this.display_commands.push([DISPLAY_OP_DELETE_NODE, remove]);
break;
case BROADWAY_NODE_OP_MOVE_AFTER_CHILD:
parentId = this.decode_uint32();
if (parentId == 0)
parent = root;
else
parent = this.nodes[parentId];
var previousChildId = this.decode_uint32();
var previousChild = null;
if (previousChildId != 0)
previousChild = this.nodes[previousChildId];
var toMoveId = this.decode_uint32();
var toMove = this.nodes[toMoveId];
this.display_commands.push([DISPLAY_OP_INSERT_AFTER_CHILD, parent, previousChild, toMove]);
break;
case BROADWAY_NODE_OP_PATCH_TEXTURE:
var textureNodeId = this.decode_uint32();
var textureNode = this.nodes[textureNodeId];
var textureId = this.decode_uint32();
var texture = textures[textureId].ref();
this.display_commands.push([DISPLAY_OP_CHANGE_TEXTURE, textureNode, texture]);
break;
case BROADWAY_NODE_OP_PATCH_TRANSFORM:
var transformNodeId = this.decode_uint32();
var transformNode = this.nodes[transformNodeId];
var transformString = this.decode_transform();
this.display_commands.push([DISPLAY_OP_CHANGE_TRANSFORM, transformNode, transformString]);
break;
}
}
var div = this.div;
this.insertNode(div, 0, div.firstChild, display_commands);
if (this.data_pos != this.node_data.byteLength)
alert ("Did not consume entire array (len " + this.node_data.byteLength + ")");
}
function cmdGrabPointer(id, ownerEvents)
{
doGrab(id, ownerEvents, false);
@@ -936,7 +818,7 @@ function cmdUngrabPointer()
function handleDisplayCommands(display_commands)
{
var div, parent;
var div;
var len = display_commands.length;
for (var i = 0; i < len; i++) {
var cmd = display_commands[i];
@@ -948,15 +830,6 @@ function handleDisplayCommands(display_commands)
case DISPLAY_OP_APPEND_CHILD:
cmd[1].appendChild(cmd[2]);
break;
case DISPLAY_OP_INSERT_AFTER_CHILD:
parent = cmd[1];
var afterThis = cmd[2];
div = cmd[3];
if (afterThis == null) // First
parent.insertBefore(div, parent.firstChild);
else
parent.insertBefore(div, afterThis.nextSibling);
break;
case DISPLAY_OP_APPEND_ROOT:
document.body.appendChild(cmd[1]);
break;
@@ -994,21 +867,7 @@ function handleDisplayCommands(display_commands)
var id = cmd[1];
delete surfaces[id];
break;
case DISPLAY_OP_CHANGE_TEXTURE:
var image = cmd[1];
var texture = cmd[2];
// We need a new closure here to have a separate copy of "template" for each iteration...
function a_block(t) {
image.src = t.url;
// Unref blob url when loaded
image.onload = function() { t.unref(); };
}(texture);
break;
case DISPLAY_OP_CHANGE_TRANSFORM:
var div = cmd[1];
var transform_string = cmd[2];
div.style["transform"] = transform_string;
break;
default:
alert("Unknown display op " + command);
}
@@ -1023,7 +882,7 @@ function handleCommands(cmd, display_commands, new_textures, modified_trees)
while (res && cmd.pos < cmd.length) {
var id, x, y, w, h, q, surface;
var saved_pos = cmd.pos;
var command = cmd.get_uint8();
var command = cmd.get_char();
lastSerial = cmd.get_32();
switch (command) {
case BROADWAY_OP_DISCONNECTED:
@@ -1117,7 +976,6 @@ function handleCommands(cmd, display_commands, new_textures, modified_trees)
display_commands.push([DISPLAY_OP_RESIZE_NODE, surface.div, surface.width, surface.height]);
}
sendConfigureNotify(surface);
break;
case BROADWAY_OP_RAISE_SURFACE:
@@ -1155,7 +1013,7 @@ function handleCommands(cmd, display_commands, new_textures, modified_trees)
var node_data = cmd.get_nodes ();
surface = surfaces[id];
var transform_nodes = new TransformNodes (node_data, surface.div, surface.nodes, display_commands);
var transform_nodes = new TransformNodes (node_data, surface.div, display_commands);
transform_nodes.execute();
}
break;
@@ -1259,8 +1117,8 @@ function BinCommands(message) {
this.pos = 0;
}
BinCommands.prototype.get_uint8 = function() {
return this.dataview.getUint8(this.pos++);
BinCommands.prototype.get_char = function() {
return String.fromCharCode(this.dataview.getUint8(this.pos++));
};
BinCommands.prototype.get_bool = function() {
return this.dataview.getUint8(this.pos++) != 0;
@@ -1327,7 +1185,7 @@ function sendInput(cmd, args)
if (inputSocket == null)
return;
var fullArgs = [cmd, lastSerial, lastTimeStamp].concat(args);
var fullArgs = [cmd.charCodeAt(0), lastSerial, lastTimeStamp].concat(args);
var buffer = new ArrayBuffer(fullArgs.length * 4);
var view = new DataView(buffer);
fullArgs.forEach(function(arg, i) {

View File

@@ -234,7 +234,7 @@ client_handle_request (BroadwayClient *client,
{
case BROADWAY_REQUEST_NEW_SURFACE:
reply_new_surface.id =
broadway_server_new_surface (server, client->id,
broadway_server_new_surface (server,
request->new_surface.x,
request->new_surface.y,
request->new_surface.width,

View File

@@ -38,7 +38,6 @@ typedef struct BroadwayInput BroadwayInput;
struct _GdkBroadwayServer {
GObject parent_instance;
GdkDisplay *display;
guint32 next_serial;
guint32 next_texture_id;
@@ -97,9 +96,7 @@ _gdk_broadway_server_get_next_serial (GdkBroadwayServer *server)
}
GdkBroadwayServer *
_gdk_broadway_server_new (GdkDisplay *display,
const char *display_name,
GError **error)
_gdk_broadway_server_new (const char *display, GError **error)
{
GdkBroadwayServer *server;
GSocketClient *client;
@@ -111,14 +108,14 @@ _gdk_broadway_server_new (GdkDisplay *display,
char *local_socket_type = NULL;
int port;
if (display_name == NULL)
display_name = ":0";
if (display == NULL)
display = ":0";
if (display_name[0] == ':' && g_ascii_isdigit(display_name[1]))
if (display[0] == ':' && g_ascii_isdigit(display[1]))
{
char *path, *basename;
port = strtol (display_name + strlen (":"), NULL, 10);
port = strtol (display + strlen (":"), NULL, 10);
basename = g_strdup_printf ("broadway%d.socket", port + 1);
path = g_build_filename (g_get_user_runtime_dir (), basename, NULL);
g_free (basename);
@@ -130,7 +127,7 @@ _gdk_broadway_server_new (GdkDisplay *display,
else
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("Broadway display type not supported: %s"), display_name);
_("Broadway display type not supported: %s"), display);
return NULL;
}
@@ -148,7 +145,6 @@ _gdk_broadway_server_new (GdkDisplay *display,
server = g_object_new (GDK_TYPE_BROADWAY_SERVER, NULL);
server->connection = connection;
server->display = display;
in = g_io_stream_get_input_stream (G_IO_STREAM (server->connection));
pollable = G_POLLABLE_INPUT_STREAM (in);
@@ -350,7 +346,7 @@ process_input_messages (GdkBroadwayServer *server)
server->incomming);
if (reply->base.type == BROADWAY_REPLY_EVENT)
_gdk_broadway_events_got_input (server->display, &reply->event.msg);
_gdk_broadway_events_got_input (&reply->event.msg);
else
g_warning ("Unhandled reply type %d", reply->base.type);
g_free (reply);

View File

@@ -14,8 +14,7 @@ typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;
#define GDK_IS_BROADWAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_SERVER))
#define GDK_BROADWAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServerClass))
GdkBroadwayServer *_gdk_broadway_server_new (GdkDisplay *display,
const char *display_name,
GdkBroadwayServer *_gdk_broadway_server_new (const char *display,
GError **error);
void _gdk_broadway_server_flush (GdkBroadwayServer *server);
void _gdk_broadway_server_sync (GdkBroadwayServer *server);

View File

@@ -174,7 +174,7 @@ _gdk_broadway_display_open (const gchar *display_name)
if (display_name == NULL)
display_name = g_getenv ("BROADWAY_DISPLAY");
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
broadway_display->server = _gdk_broadway_server_new (display_name, &error);
if (broadway_display->server == NULL)
{
g_printerr ("Unable to init Broadway server: %s\n", error->message);
@@ -386,31 +386,6 @@ gdk_broadway_display_ensure_texture (GdkDisplay *display,
return data->id;
}
static gboolean
flush_idle (gpointer data)
{
GdkDisplay *display = data;
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
broadway_display->idle_flush_id = 0;
gdk_display_flush (display);
return FALSE;
}
void
gdk_broadway_display_flush_in_idle (GdkDisplay *display)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
if (broadway_display->idle_flush_id == 0)
{
broadway_display->idle_flush_id = g_idle_add (flush_idle, g_object_ref (display));
g_source_set_name_by_id (broadway_display->idle_flush_id, "[gtk] flush_idle");
}
}
static void
gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
{

View File

@@ -56,8 +56,6 @@ struct _GdkBroadwayDisplay
GdkMonitor *monitor;
GHashTable *texture_cache;
guint idle_flush_id;
};
struct _GdkBroadwayDisplayClass

View File

@@ -83,14 +83,30 @@ gdk_event_source_check (GSource *source)
}
void
_gdk_broadway_events_got_input (GdkDisplay *display,
BroadwayInputMsg *message)
_gdk_broadway_events_got_input (BroadwayInputMsg *message)
{
GdkDisplay *display;
GdkBroadwayDisplay *display_broadway;
GdkSeat *seat;
GdkSurface *surface;
GdkEvent *event = NULL;
GList *node;
GSList *list, *d;
display = NULL;
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
for (d = list; d; d = d->next)
{
if (GDK_IS_BROADWAY_DISPLAY (d->data))
{
display = d->data;
break;
}
}
g_slist_free (list);
g_assert (display != NULL);
display_broadway = GDK_BROADWAY_DISPLAY (display);
seat = gdk_display_get_default_seat (display);
@@ -160,14 +176,14 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
break;
case BROADWAY_EVENT_BUTTON_PRESS:
case BROADWAY_EVENT_BUTTON_RELEASE:
if (message->base.type != BROADWAY_EVENT_BUTTON_PRESS &&
if (message->base.type != 'b' &&
_gdk_broadway_moveresize_handle_event (display, message))
break;
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->pointer.event_surface_id));
if (surface)
{
event = gdk_event_new (message->base.type == BROADWAY_EVENT_BUTTON_PRESS ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
event = gdk_event_new (message->base.type == 'b' ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
event->any.surface = g_object_ref (surface);
event->button.time = message->base.time;
event->button.x = message->pointer.win_x;
@@ -262,7 +278,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
GINT_TO_POINTER (message->key.surface_id));
if (surface)
{
event = gdk_event_new (message->base.type == BROADWAY_EVENT_KEY_PRESS ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
event = gdk_event_new (message->base.type == 'k' ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
event->any.surface = g_object_ref (surface);
event->key.time = message->base.time;
event->key.keyval = message->key.key;

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