Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 805f3bb123 |
@@ -43,7 +43,6 @@ style-check-diff:
|
||||
- .gitlab-ci/run-style-check-diff.sh
|
||||
|
||||
.build-fedora-default:
|
||||
extends: .only-default
|
||||
image: $FEDORA_IMAGE
|
||||
artifacts:
|
||||
when: always
|
||||
@@ -122,7 +121,6 @@ installed-tests:
|
||||
|
||||
|
||||
.mingw-defaults:
|
||||
extends: .only-default
|
||||
stage: build
|
||||
tags:
|
||||
- win32-ps
|
||||
@@ -146,31 +144,6 @@ msys2-mingw64:
|
||||
MSYSTEM: "MINGW64"
|
||||
CHERE_INVOKING: "yes"
|
||||
|
||||
macos:
|
||||
extends: .only-default
|
||||
only:
|
||||
- branches@GNOME/gtk
|
||||
stage: build
|
||||
tags:
|
||||
- macos
|
||||
needs: []
|
||||
before_script:
|
||||
- bash .gitlab-ci/show-execution-environment.sh
|
||||
- pip3 install --user meson==0.56
|
||||
- pip3 install --user ninja
|
||||
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
|
||||
script:
|
||||
- meson -Dx11-backend=false
|
||||
-Dintrospection=disabled
|
||||
-Dcpp_std=c++11
|
||||
-Dpixman:tests=disabled
|
||||
_build
|
||||
- ninja -C _build
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
|
||||
.flatpak-defaults:
|
||||
image: $FLATPAK_IMAGE
|
||||
stage: flatpak
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux -o pipefail
|
||||
|
||||
xcodebuild -version || :
|
||||
xcodebuild -showsdks || :
|
||||
|
||||
system_profiler SPSoftwareDataType || :
|
||||
@@ -1,83 +1,3 @@
|
||||
Overview of Changes in 4.0.1
|
||||
============================
|
||||
|
||||
* GtkPopover
|
||||
- Center titles
|
||||
- Fix menu item alignment with submenus
|
||||
|
||||
* GtkVideo
|
||||
- Fix up autoplay semantics
|
||||
- Respect pixel aspect ratio
|
||||
- Get GL textures from gstreamer
|
||||
|
||||
* GtkCenterLayout
|
||||
- Fix handling of expanding center child
|
||||
|
||||
* GtkSettings
|
||||
- Change gtk-cursor-aspect-ratio to double
|
||||
- Fix the default value of gtk-print-backends
|
||||
|
||||
* GtkGestureStylus
|
||||
- Convert motion history to surface coordinates
|
||||
|
||||
* GL renderer
|
||||
- Various optimizations
|
||||
- Avoid leaking shader objects
|
||||
|
||||
* Adwaita
|
||||
- Fine-tune flat buttons
|
||||
- Improve contrast of dim-label
|
||||
- Improve contrast of controls in headers
|
||||
|
||||
* Docs
|
||||
- Add various missing types
|
||||
- Add DND examples
|
||||
- Correct css docs for several widgets
|
||||
- Improve GtkVideo docs
|
||||
- Update migration docs for GtkClipboard
|
||||
- Improve migration docs for event controllers
|
||||
- Add migration docs for GtkBuilder
|
||||
|
||||
* gtk4-builder-tool
|
||||
- Remove GtkCheckButton::draw-indicator
|
||||
- Fix a buffer overrun
|
||||
- Remove GtkToolbar::toolbar-style
|
||||
|
||||
* Demos
|
||||
- Don't put the search bar in the scroll area
|
||||
- Make the OpenGL demos work with OpenGL ES
|
||||
|
||||
* X11
|
||||
- Fix a possible crash
|
||||
|
||||
* Build
|
||||
- Fix vulkan reference in pc file
|
||||
- Fix build with certain Vulkan versions
|
||||
|
||||
* Windows:
|
||||
- Fix build with Visual Studio 2013
|
||||
|
||||
* OS X:
|
||||
- Fix build on OS X
|
||||
- Fix crash on Mojave
|
||||
- Fix a window sizing issue
|
||||
- Fix build on OS X 10.12
|
||||
- Add a CI build
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Galician
|
||||
German
|
||||
Japanese
|
||||
Lithuanian
|
||||
Persian
|
||||
Punjabi
|
||||
Romanian
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in GTK 4.0
|
||||
==============================
|
||||
|
||||
|
||||
@@ -98,9 +98,6 @@ create_page1 (GtkWidget *assistant)
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
||||
entry = gtk_entry_new ();
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
|
||||
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
|
||||
-1);
|
||||
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
|
||||
gtk_widget_set_valign (entry, GTK_ALIGN_CENTER);
|
||||
gtk_box_append (GTK_BOX (box), entry);
|
||||
|
||||
@@ -119,12 +119,13 @@ create_label (void)
|
||||
static GtkWidget *
|
||||
create_video (void)
|
||||
{
|
||||
GtkWidget *w = gtk_video_new ();
|
||||
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
GtkWidget *w = gtk_picture_new_for_paintable (GDK_PAINTABLE (stream));
|
||||
|
||||
gtk_widget_set_size_request (w, 64, 64);
|
||||
gtk_video_set_loop (GTK_VIDEO (w), TRUE);
|
||||
gtk_video_set_autoplay (GTK_VIDEO (w), TRUE);
|
||||
gtk_video_set_resource (GTK_VIDEO (w), "/images/gtk-logo.webm");
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
gtk_media_stream_play (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
@@ -787,8 +787,6 @@ gtk_gears_realize (GtkWidget *widget)
|
||||
glLinkProgram(program);
|
||||
glGetProgramInfoLog(program, sizeof msg, NULL, msg);
|
||||
g_debug ("program info: %s\n", msg);
|
||||
glDetachShader (program, v);
|
||||
glDetachShader (program, f);
|
||||
glDeleteShader (v);
|
||||
glDeleteShader (f);
|
||||
|
||||
|
||||
@@ -3298,6 +3298,7 @@ bad things might happen.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkSizeGroup" id="basement-indicators"/>
|
||||
<menu id="new_style_menu_model">
|
||||
<section>
|
||||
<attribute name="display-hint">circular-buttons</attribute>
|
||||
|
||||
@@ -146,9 +146,6 @@ images = [
|
||||
'images/nwse_resize_cursor.png',
|
||||
'images/zoom_in_cursor.png',
|
||||
'images/zoom_out_cursor.png',
|
||||
'images/popup-anchors.png',
|
||||
'images/popup-flip.png',
|
||||
'images/popup-slide.png',
|
||||
]
|
||||
|
||||
src_dir = [ gdkinc ]
|
||||
|
||||
@@ -41,41 +41,35 @@
|
||||
<command>gtk4-builder-tool</command> can perform various operations
|
||||
on GtkBuilder .ui files.
|
||||
</para>
|
||||
<para>
|
||||
The <option>validate</option> command validates the .ui file and reports
|
||||
errors to stderr.
|
||||
</para>
|
||||
<para>
|
||||
The <option>enumerate</option> command lists all the named objects that
|
||||
are created in the .ui file.
|
||||
</para>
|
||||
<para>
|
||||
The <option>preview</option> command displays the .ui file. This command
|
||||
accepts options to specify the ID of the toplevel object and a .css file
|
||||
to use.
|
||||
</para>
|
||||
<para>
|
||||
The <option>simplify</option> command simplifies the .ui file by removing
|
||||
properties that are set to their default values and writes the resulting XML
|
||||
to stdout, or back to the input file.
|
||||
</para>
|
||||
<para>
|
||||
When the <option>--3to4</option> is specified, <option>simplify</option>
|
||||
interprets the input as a GTK 3 ui file and attempts to convert it to GTK 4
|
||||
equivalents. It performs various conversions, such as renaming properties,
|
||||
translating child properties to layout properties, rewriting the setup for
|
||||
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
|
||||
</para>
|
||||
<para>
|
||||
You should always test the modified .ui files produced by gtk4-builder-tool
|
||||
before using them in production.
|
||||
</para>
|
||||
<para>
|
||||
Note in particular that the conversion
|
||||
done with <option>--3to4</option> is meant as a starting point for a port
|
||||
from GTK 3 to GTK 4. It is expected that you will have to do manual fixups
|
||||
after the initial conversion.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Commands</title>
|
||||
<para>The following commands are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>validate</option></term>
|
||||
<listitem><para>Validates the .ui file and report errors to stderr.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>simplify</option></term>
|
||||
<listitem><para>Simplifies the .ui file by removing properties that
|
||||
are set to their default values and write the resulting XML to stdout,
|
||||
or back to the input file.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>enumerate</option></term>
|
||||
<listitem><para>Lists all the named objects that are created in the .ui file.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>preview</option></term>
|
||||
<listitem><para>Preview the .ui file. This command accepts options
|
||||
to specify the ID of an object and a .css file to use.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Simplify Options</title>
|
||||
|
||||
@@ -61,13 +61,6 @@
|
||||
<listitem><para>Write png files to <replaceable>DIRECTORY</replaceable>
|
||||
instead of the current working directory.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--debug</term>
|
||||
<listitem><para>Generate png files of the various channels during
|
||||
the conversion. If these files are not monochrome green, they
|
||||
are often helpful in pinpointing the problematic parts of
|
||||
the source svg.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -4668,6 +4668,7 @@ GTK_WINDOW_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkWindowPrivate
|
||||
gtk_window_get_type
|
||||
GtkWindowGeometryInfo
|
||||
gtk_window_remove_embedded_xid
|
||||
gtk_window_add_embedded_xid
|
||||
GtkWindowKeysForeachFunc
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
@@ -413,6 +413,10 @@ images = [
|
||||
'images/password-entry.png',
|
||||
'images/picture.png',
|
||||
'images/popover.png',
|
||||
'images/popup-anchors.png',
|
||||
'images/popup-at.svg',
|
||||
'images/popup-flip.png',
|
||||
'images/popup-slide.png',
|
||||
'images/printdialog.png',
|
||||
'images/progressbar.png',
|
||||
'images/right-center.png',
|
||||
|
||||
@@ -264,6 +264,14 @@ therefore can no longer be used to break reference cycles. A typical sign
|
||||
of a reference cycle involving a toplevel window is when closing the window
|
||||
does not make the application quit.
|
||||
|
||||
A good rule to follow is: If you set a widget pointer with
|
||||
gtk_widget_class_bind_template_child() in class_init(), you need to
|
||||
unparent it in dispose(). The slight complication here is that you need
|
||||
to respect the widget hierarchy while doing so. Ie if you set both `field1`
|
||||
and `field2`, but `field1` is an ancestor of `field2`, then you only need
|
||||
to unparent `field1` — doing so will remove the the entire subtree below
|
||||
`field1`, including `field2`.
|
||||
|
||||
### Stop using GdkScreen
|
||||
|
||||
The GdkScreen object has been removed in GTK 4. Most of its APIs already
|
||||
@@ -399,7 +407,7 @@ and gdk_keymap_get_entries_for_keyval().
|
||||
GTK 3 has the idea that use of modifiers may differ between different
|
||||
platforms, and has a #GdkModifierIntent api to let platforms provide
|
||||
hint about how modifiers are expected to be used. It also promoted
|
||||
the use of `<Primary>` instead of `<Control>` to specify accelerators that
|
||||
the use of <Primary> instead of <Control> to specify accelerators that
|
||||
adapt to platform conventions.
|
||||
|
||||
In GTK 4, the meaning of modifiers has been fixed, and backends are
|
||||
@@ -418,88 +426,13 @@ GDK_CONTROL_MASK|GDK_ALT_MASK
|
||||
: Prevent text input
|
||||
|
||||
Consequently, #GdkModifierIntent and related APIs have been removed,
|
||||
and `<Control>` is preferred over `<Primary>` in accelerators.
|
||||
and <Control> is preferred over <Primary> in accelerators.
|
||||
|
||||
A related change is that GTK 4 no longer supports the use of archaic
|
||||
X11 'real' modifiers with the names Mod1,..., Mod5, and %GDK_MOD1_MASK
|
||||
has been renamed to %GDK_ALT_MASK.
|
||||
|
||||
### Replace GtkClipboard with GdkClipboard
|
||||
|
||||
The `GtkClipboard` API has been removed, and replaced by #GdkClipboard.
|
||||
There is not direct 1:1 mapping between the old an the new API, so it cannot
|
||||
be a mechanical replacement; the new API is based on object types and #GValue
|
||||
like object properties, instead of opaque identifiers, so it should be easier
|
||||
to use.
|
||||
|
||||
For instance, the example below copies the contents of an entry into the
|
||||
clipboard:
|
||||
|
||||
```
|
||||
static void
|
||||
copy_text (GtkWidget *widget)
|
||||
{
|
||||
GtkEditable *editable = GTK_EDITABLE (widget);
|
||||
|
||||
// Initialize a GValue with the contents of the widget
|
||||
GValue value = G_VALUE_INIT;
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
g_value_set_string (&value, gtk_editable_get_text (editable));
|
||||
|
||||
// Store the value in the clipboard object
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
|
||||
gdk_clipboard_set_value (clipboard, &value);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
```
|
||||
|
||||
whereas the example below pastes the contents into the entry:
|
||||
|
||||
```
|
||||
static void
|
||||
paste_text (GtkWidget *widget)
|
||||
{
|
||||
GtkEditable *editable = GTK_EDITABLE (widget);
|
||||
|
||||
// Initialize a GValue to receive text
|
||||
GValue value = G_VALUE_INIT;
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
|
||||
// Get the content provider for the clipboard, and ask it for text
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
|
||||
GdkContentProvider *provider = gdk_clipboard_get_content (clipboard);
|
||||
|
||||
// If the content provider does not contain text, we are not interested
|
||||
if (!gdk_content_provider_get_value (provider, &value, NULL))
|
||||
return;
|
||||
|
||||
const char *str = g_value_get_string (&value);
|
||||
|
||||
gtk_editable_set_text (editable, str);
|
||||
|
||||
g_value_unset (&value);
|
||||
}
|
||||
```
|
||||
|
||||
The convenience API for specific target types in `GtkClipboard` has been
|
||||
replaced by their corresponding GType:
|
||||
|
||||
| GtkClipboard | GType |
|
||||
| ----------------------------------- | ---------------------- |
|
||||
| `gtk_clipboard_request_text()` | `G_TYPE_STRING` |
|
||||
| `gtk_clipboard_request_rich_text()` | `GTK_TYPE_TEXT_BUFFER` |
|
||||
| `gtk_clipboard_request_image()` | `GDK_TYPE_PIXBUF` |
|
||||
| `gtk_clipboard_request_uris()` |` GDK_TYPE_FILE_LIST` |
|
||||
|
||||
**Note**: Support for rich text serialization across different processes
|
||||
for #GtkTextBuffer is not available any more.
|
||||
|
||||
If you are copying the contents of an image, it is recommended to use
|
||||
GDK_TYPE_PAINTABLE instead of GDK_TYPE_PIXBUF, to minimize the amount of
|
||||
potential copies.
|
||||
|
||||
### Stop using `gtk_get_current_...` APIs
|
||||
### Stop using gtk_get_current_... APIs
|
||||
|
||||
The function gtk_get_current_event() and its variants have been
|
||||
replaced by equivalent event controller APIs:
|
||||
@@ -515,25 +448,6 @@ option. You should always review the resulting changes.
|
||||
The <requires> tag now supports for the 'lib' attribute the
|
||||
'gtk' value only, instead of the 'gtk+' one previously.
|
||||
|
||||
## Adapt to GtkBuilder API changes
|
||||
|
||||
gtk_builder_connect_signals() no longer exists. Instead, signals are
|
||||
always connected automatically. If you need to add user data to your
|
||||
signals, gtk_builder_set_current_object() must be called. An important
|
||||
caveat is that you have to do this before loading any XML. This means if
|
||||
you need to use gtk_builder_set_current_object(), you can no longer use
|
||||
gtk_builder_new_from_file(), gtk_builder_new_from_resource(), or
|
||||
gtk_builder_new_from_string(). Instead, you must use vanilla gtk_builder_new(),
|
||||
then call gtk_builder_set_current_object(), then load the XML using
|
||||
gtk_builder_add_from_file(), gtk_builder_add_from_resource(), or
|
||||
gtk_builder_add_from_string(). You must check the return value for
|
||||
failure and manually abort with g_error() if something went wrong.
|
||||
|
||||
You only have to worry about this if you were previously using
|
||||
gtk_builder_connect_signals(). If you are using templates, then
|
||||
gtk_widget_init_template() will call gtk_builder_set_current_object()
|
||||
for you, so templates work like before.
|
||||
|
||||
### Adapt to event controller API changes
|
||||
|
||||
A few changes to the event controller and #GtkGesture APIs
|
||||
@@ -544,23 +458,6 @@ Another is that #GtkGestureMultiPress has been renamed to #GtkGestureClick,
|
||||
and has lost its area property. A #GtkEventControllerFocus has been
|
||||
split off from #GtkEventcontrollerKey.
|
||||
|
||||
In GTK 3, #GtkEventController:widget was a construct-only property, so
|
||||
a #GtkWidget was provided whenever constructing a #GtkEventController.
|
||||
In GTK 4, #GtkEventController:widget is now read-only. Use
|
||||
gtk_widget_add_controller() to add an event controller to a widget.
|
||||
|
||||
In GTK 3, widgets did not own their event controllers, and event
|
||||
controllers did not own their widgets, so developers were responsible
|
||||
for manually keeping event controllers alive for the lifetime of their
|
||||
associated widgets. In GTK 4, widgets own their event controllers.
|
||||
gtk_widget_add_controller() takes ownership of the event controller, so
|
||||
there is no longer any need to store a reference to the event controller
|
||||
after it has been added to a widget.
|
||||
|
||||
Although not normally needed, an event controller could be removed from
|
||||
a widget in GTK 3 by destroying the event controller with g_object_unref().
|
||||
In GTK 4, you must use gtk_widget_remove_controller().
|
||||
|
||||
### Focus handling changes
|
||||
|
||||
The semantics of the #GtkWidget:can-focus property have changed.
|
||||
|
||||
@@ -611,7 +611,17 @@ _gdk_device_set_associated_device (GdkDevice *device,
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
g_return_if_fail (associated == NULL || GDK_IS_DEVICE (associated));
|
||||
|
||||
g_set_object (&device->associated, associated);
|
||||
if (device->associated == associated)
|
||||
return;
|
||||
|
||||
if (device->associated)
|
||||
{
|
||||
g_object_unref (device->associated);
|
||||
device->associated = NULL;
|
||||
}
|
||||
|
||||
if (associated)
|
||||
device->associated = g_object_ref (associated);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -280,7 +280,7 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
|
||||
* implementation must use gdk_draw_context_get_frame_region() to query the
|
||||
* region that must be drawn.
|
||||
*
|
||||
* When using GTK, the widget system automatically places calls to
|
||||
* When using GTK+, the widget system automatically places calls to
|
||||
* gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
|
||||
* use of #GskRenderers, so application code does not need to call these
|
||||
* functions explicitly.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static gsize g_define_type_id__volatile = 0;
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
|
||||
@@ -210,7 +210,7 @@ gdk_event_init (GdkEvent *self)
|
||||
GType
|
||||
gdk_event_get_type (void)
|
||||
{
|
||||
static gsize event_type__volatile;
|
||||
static volatile gsize event_type__volatile;
|
||||
|
||||
if (g_once_init_enter (&event_type__volatile))
|
||||
{
|
||||
@@ -374,7 +374,7 @@ static GType gdk_event_types[GDK_EVENT_LAST];
|
||||
GType \
|
||||
type_name ## _get_type (void) \
|
||||
{ \
|
||||
static gsize gdk_define_event_type_id__volatile; \
|
||||
static volatile gsize gdk_define_event_type_id__volatile; \
|
||||
if (g_once_init_enter (&gdk_define_event_type_id__volatile)) \
|
||||
{ \
|
||||
GType gdk_define_event_type_id = \
|
||||
@@ -452,7 +452,7 @@ gdk_event_init_types_once (void)
|
||||
void
|
||||
gdk_event_init_types (void)
|
||||
{
|
||||
static gsize event_types__volatile;
|
||||
static volatile gsize event_types__volatile;
|
||||
|
||||
if (g_once_init_enter (&event_types__volatile))
|
||||
{
|
||||
|
||||
@@ -107,9 +107,6 @@ make_program (GdkGLContextProgram *program,
|
||||
|
||||
glLinkProgram (program->program);
|
||||
|
||||
glDetachShader (program->program, vertex_shader);
|
||||
glDetachShader (program->program, fragment_shader);
|
||||
|
||||
glDeleteShader (vertex_shader);
|
||||
glDeleteShader (fragment_shader);
|
||||
|
||||
|
||||
@@ -30,37 +30,6 @@
|
||||
* Popups are positioned relative to their parent surface.
|
||||
* The GdkPopupLayout struct contains information that is
|
||||
* necessary to do so.
|
||||
*
|
||||
* The positioning requires a negotiation with the windowing system,
|
||||
* since it depends on external constraints, such as the position of
|
||||
* the parent surface, and the screen dimensions.
|
||||
*
|
||||
* The basic ingredients are a rectangle on the parent surface,
|
||||
* and the anchor on both that rectangle and the popup. The anchors
|
||||
* specify a side or corner to place next to each other.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* For cases where placing the anchors next to each other would make
|
||||
* the popup extend offscreen, the layout includes some hints for how
|
||||
* to resolve this problem. The hints may suggest to flip the anchor
|
||||
* position to the other side, or to 'slide' the popup along a side,
|
||||
* or to resize it.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* 
|
||||
*
|
||||
* These hints may be combined.
|
||||
*
|
||||
* Ultimatively, it is up to the windowing system to determine the position
|
||||
* and size of the popup. You can learn about the result by calling
|
||||
* gdk_popup_get_position_x(), gdk_popup_get_position_y(),
|
||||
* gdk_popup_get_rect_anchor() and gdk_popup_get_surface_anchor() after the
|
||||
* popup has been presented. This can be used to adjust the rendering. For
|
||||
* example, GtkPopover changes its arrow position accordingly. But you have
|
||||
* to be careful avoid changing the size of the popover, or it has to be
|
||||
* presented again.
|
||||
*/
|
||||
|
||||
struct _GdkPopupLayout
|
||||
|
||||
@@ -436,10 +436,9 @@ gdk_seat_tool_removed (GdkSeat *seat,
|
||||
}
|
||||
|
||||
GdkDeviceTool *
|
||||
gdk_seat_get_tool (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 hw_id,
|
||||
GdkDeviceToolType type)
|
||||
gdk_seat_get_tool (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 hw_id)
|
||||
{
|
||||
GdkDeviceTool *match = NULL;
|
||||
GList *tools, *l;
|
||||
@@ -450,7 +449,7 @@ gdk_seat_get_tool (GdkSeat *seat,
|
||||
{
|
||||
GdkDeviceTool *tool = l->data;
|
||||
|
||||
if (tool->serial == serial && tool->hw_id == hw_id && tool->type == type)
|
||||
if (tool->serial == serial && tool->hw_id == hw_id)
|
||||
{
|
||||
match = tool;
|
||||
break;
|
||||
|
||||
@@ -49,7 +49,7 @@ struct _GdkSeatDefaultPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GdkSeatDefault, gdk_seat_default, GDK_TYPE_SEAT)
|
||||
|
||||
static void
|
||||
gdk_seat_default_dispose (GObject *object)
|
||||
gdk_seat_dispose (GObject *object)
|
||||
{
|
||||
GdkSeatDefault *seat = GDK_SEAT_DEFAULT (object);
|
||||
GdkSeatDefaultPrivate *priv = gdk_seat_default_get_instance_private (seat);
|
||||
@@ -79,7 +79,11 @@ gdk_seat_default_dispose (GObject *object)
|
||||
g_object_unref (l->data);
|
||||
}
|
||||
|
||||
g_clear_pointer (&priv->tools, g_ptr_array_unref);
|
||||
if (priv->tools)
|
||||
{
|
||||
g_ptr_array_unref (priv->tools);
|
||||
priv->tools = NULL;
|
||||
}
|
||||
|
||||
g_list_free (priv->physical_pointers);
|
||||
g_list_free (priv->physical_keyboards);
|
||||
@@ -303,7 +307,7 @@ gdk_seat_default_class_init (GdkSeatDefaultClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GdkSeatClass *seat_class = GDK_SEAT_CLASS (klass);
|
||||
|
||||
object_class->dispose = gdk_seat_default_dispose;
|
||||
object_class->dispose = gdk_seat_dispose;
|
||||
|
||||
seat_class->get_capabilities = gdk_seat_default_get_capabilities;
|
||||
|
||||
@@ -438,7 +442,7 @@ gdk_seat_default_remove_tool (GdkSeatDefault *seat,
|
||||
|
||||
priv = gdk_seat_default_get_instance_private (seat);
|
||||
|
||||
if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id, tool->type))
|
||||
if (tool != gdk_seat_get_tool (GDK_SEAT (seat), tool->serial, tool->hw_id))
|
||||
return;
|
||||
|
||||
g_signal_emit_by_name (seat, "tool-removed", tool);
|
||||
|
||||
@@ -75,10 +75,9 @@ void gdk_seat_tool_removed (GdkSeat *seat,
|
||||
GdkDeviceTool *tool);
|
||||
|
||||
GdkDeviceTool *
|
||||
gdk_seat_get_tool (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 hw_id,
|
||||
GdkDeviceToolType type);
|
||||
gdk_seat_get_tool (GdkSeat *seat,
|
||||
guint64 serial,
|
||||
guint64 hw_id);
|
||||
|
||||
GdkGrabStatus gdk_seat_grab (GdkSeat *seat,
|
||||
GdkSurface *surface,
|
||||
|
||||
@@ -95,143 +95,7 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkVulkanContext, gdk_vulkan_context, GDK_TYPE
|
||||
const char *
|
||||
gdk_vulkan_strerror (VkResult result)
|
||||
{
|
||||
/* If your compiler brought you here with a warning about missing
|
||||
* enumeration values, you're running a newer Vulkan version than
|
||||
* the GTK developers (or you are a GTK developer) and have
|
||||
* encountered a newly added Vulkan error message.
|
||||
* You want to add it to this enum now.
|
||||
*
|
||||
* Because the Vulkan people don't make adding this too easy, here's
|
||||
* the process to manage it:
|
||||
* 1. go to
|
||||
* https://github.com/KhronosGroup/Vulkan-Headers/blob/master/include/vulkan/vulkan_core.h
|
||||
* 2. Find the line where this enum value was added.
|
||||
* 3. Click the commit that added this line.
|
||||
* 4. The commit you're looking at now should also change
|
||||
* VK_HEADER_VERSION, find that number.
|
||||
* 5. Use that number in the #ifdef when adding the enum value to
|
||||
* this enum.
|
||||
* 6. For the error message, look at the specification (the one
|
||||
* that includes all extensions) at
|
||||
* https://www.khronos.org/registry/vulkan/specs/1.0-extensions/html/vkspec.html#VkResult
|
||||
* 7. If this value has not been added to the specification yet,
|
||||
* search for the error message in the text of specification.
|
||||
* Often it will have a description that can be used as an error
|
||||
* message.
|
||||
* 8. If that didn't lead to one (or you are lazy), just use the
|
||||
* literal string of the enum value as the error message. A
|
||||
* GTK developer will add the correct one once it's added to the
|
||||
* specification.
|
||||
*/
|
||||
switch (result)
|
||||
{
|
||||
case VK_SUCCESS:
|
||||
return "Command successfully completed.";
|
||||
case VK_NOT_READY:
|
||||
return "A fence or query has not yet completed.";
|
||||
case VK_TIMEOUT:
|
||||
return "A wait operation has not completed in the specified time.";
|
||||
case VK_EVENT_SET:
|
||||
return "An event is signaled.";
|
||||
case VK_EVENT_RESET:
|
||||
return "An event is unsignaled.";
|
||||
case VK_INCOMPLETE:
|
||||
return "A return array was too small for the result.";
|
||||
case VK_SUBOPTIMAL_KHR:
|
||||
return "A swapchain no longer matches the surface properties exactly, but can still be used to present to the surface successfully.";
|
||||
case VK_ERROR_OUT_OF_HOST_MEMORY:
|
||||
return "A host memory allocation has failed.";
|
||||
case VK_ERROR_OUT_OF_DEVICE_MEMORY:
|
||||
return "A device memory allocation has failed.";
|
||||
case VK_ERROR_INITIALIZATION_FAILED:
|
||||
return "Initialization of an object could not be completed for implementation-specific reasons.";
|
||||
case VK_ERROR_DEVICE_LOST:
|
||||
return "The logical or physical device has been lost.";
|
||||
case VK_ERROR_MEMORY_MAP_FAILED:
|
||||
return "Mapping of a memory object has failed.";
|
||||
case VK_ERROR_LAYER_NOT_PRESENT:
|
||||
return "A requested layer is not present or could not be loaded.";
|
||||
case VK_ERROR_EXTENSION_NOT_PRESENT:
|
||||
return "A requested extension is not supported.";
|
||||
case VK_ERROR_FEATURE_NOT_PRESENT:
|
||||
return "A requested feature is not supported.";
|
||||
case VK_ERROR_INCOMPATIBLE_DRIVER:
|
||||
return "The requested version of Vulkan is not supported by the driver or is otherwise incompatible for implementation-specific reasons.";
|
||||
case VK_ERROR_TOO_MANY_OBJECTS:
|
||||
return "Too many objects of the type have already been created.";
|
||||
case VK_ERROR_FORMAT_NOT_SUPPORTED:
|
||||
return "A requested format is not supported on this device.";
|
||||
#if VK_HEADER_VERSION >= 24
|
||||
case VK_ERROR_FRAGMENTED_POOL:
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory.";
|
||||
#endif
|
||||
case VK_ERROR_SURFACE_LOST_KHR:
|
||||
return "A surface is no longer available.";
|
||||
case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR:
|
||||
return "The requested window is already in use by Vulkan or another API in a manner which prevents it from being used again.";
|
||||
case VK_ERROR_OUT_OF_DATE_KHR:
|
||||
return "A surface has changed in such a way that it is no longer compatible with the swapchain.";
|
||||
case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR:
|
||||
return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image.";
|
||||
case VK_ERROR_VALIDATION_FAILED_EXT:
|
||||
return "The application caused the validation layer to fail.";
|
||||
case VK_ERROR_INVALID_SHADER_NV:
|
||||
return "One or more shaders failed to compile or link.";
|
||||
#if VK_HEADER_VERSION >= 39
|
||||
case VK_ERROR_OUT_OF_POOL_MEMORY_KHR:
|
||||
return "A pool memory allocation has failed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 54
|
||||
case VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR:
|
||||
return "An external handle is not a valid handle of the specified type.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 64
|
||||
case VK_ERROR_NOT_PERMITTED_EXT:
|
||||
return "The caller does not have sufficient privileges.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 72
|
||||
case VK_ERROR_FRAGMENTATION_EXT:
|
||||
return "A descriptor pool creation has failed due to fragmentation";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 89
|
||||
case VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT:
|
||||
return "Invalid DRM format modifier plane layout";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 97
|
||||
case VK_ERROR_INVALID_DEVICE_ADDRESS_EXT:
|
||||
return "Invalid device address";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 105
|
||||
case VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
|
||||
return "An operation on a swapchain created with VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT failed as it did not have exclusive full-screen access.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 131
|
||||
case VK_ERROR_UNKNOWN:
|
||||
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION >= 135
|
||||
#if VK_HEADER_VERSION < 162
|
||||
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
|
||||
return "This error was removed by the Vulkan gods.";
|
||||
#endif
|
||||
case VK_THREAD_IDLE_KHR:
|
||||
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
|
||||
case VK_THREAD_DONE_KHR:
|
||||
return "A deferred operation is not complete but there is no work remaining to assign to additional threads.";
|
||||
case VK_OPERATION_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and at least some of the work was deferred.";
|
||||
case VK_OPERATION_NOT_DEFERRED_KHR:
|
||||
return "A deferred operation was requested and no operations were deferred.";
|
||||
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
|
||||
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
|
||||
#endif
|
||||
#if VK_HEADER_VERSION < 140
|
||||
case VK_RESULT_RANGE_SIZE:
|
||||
#endif
|
||||
case VK_RESULT_MAX_ENUM:
|
||||
default:
|
||||
return "Unknown Vulkan error.";
|
||||
}
|
||||
return "Unknown Vulkan error.";
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -306,7 +170,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not query surface capabilities: %s", gdk_vulkan_strerror (res));
|
||||
"Could not query surface capabilities: %d", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -403,7 +267,7 @@ gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
else
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create swapchain for this surface: %s", gdk_vulkan_strerror (res));
|
||||
"Could not create swapchain for this surface: %d", res);
|
||||
priv->swapchain = VK_NULL_HANDLE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -579,7 +443,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create surface for this surface: %s", gdk_vulkan_strerror (res));
|
||||
"Could not create surface for this surface: %d", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -590,7 +454,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not check if queue family supports this surface: %s", gdk_vulkan_strerror (res));
|
||||
"Could not check if queue family supports this surface: %d", res);
|
||||
}
|
||||
else if (!supported)
|
||||
{
|
||||
@@ -1118,7 +982,7 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
"Could not create a Vulkan instance: %s", gdk_vulkan_strerror (res));
|
||||
"Could not create a Vulkan instance: %d", res);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,10 +38,6 @@
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
typedef NSString *CALayerContentsGravity;
|
||||
#endif
|
||||
|
||||
@implementation GdkMacosWindow
|
||||
|
||||
-(BOOL)windowShouldClose:(id)sender
|
||||
@@ -470,7 +466,7 @@ typedef NSString *CALayerContentsGravity;
|
||||
|
||||
inTrackManualResize = YES;
|
||||
|
||||
mouse_location = convert_nspoint_to_screen (self, [self mouseLocationOutsideOfEventStream]);
|
||||
mouse_location = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
mdx = initialResizeLocation.x - mouse_location.x;
|
||||
mdy = initialResizeLocation.y - mouse_location.y;
|
||||
|
||||
@@ -592,7 +588,7 @@ typedef NSString *CALayerContentsGravity;
|
||||
}
|
||||
|
||||
initialResizeFrame = [self frame];
|
||||
initialResizeLocation = convert_nspoint_to_screen (self, [self mouseLocationOutsideOfEventStream]);
|
||||
initialResizeLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
}
|
||||
|
||||
-(NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
|
||||
typedef NSString *NSPasteboardType;
|
||||
#endif
|
||||
|
||||
#define GDK_TYPE_MACOS_CLIPBOARD (_gdk_macos_clipboard_get_type())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GdkMacosClipboard, _gdk_macos_clipboard, GDK, MACOS_CLIPBOARD, GdkClipboard)
|
||||
|
||||
@@ -40,56 +40,8 @@ typedef struct
|
||||
guint done : 1;
|
||||
} WriteRequest;
|
||||
|
||||
enum {
|
||||
TYPE_STRING,
|
||||
TYPE_PBOARD,
|
||||
TYPE_URL,
|
||||
TYPE_FILE_URL,
|
||||
TYPE_COLOR,
|
||||
TYPE_TIFF,
|
||||
TYPE_PNG,
|
||||
TYPE_LAST
|
||||
};
|
||||
|
||||
#define PTYPE(k) (get_pasteboard_type(TYPE_##k))
|
||||
|
||||
static NSPasteboardType pasteboard_types[TYPE_LAST];
|
||||
|
||||
G_DEFINE_TYPE (GdkMacosClipboard, _gdk_macos_clipboard, GDK_TYPE_CLIPBOARD)
|
||||
|
||||
static NSPasteboardType
|
||||
get_pasteboard_type (int type)
|
||||
{
|
||||
static gsize initialized = FALSE;
|
||||
|
||||
g_assert (type >= 0);
|
||||
g_assert (type < TYPE_LAST);
|
||||
|
||||
if (g_once_init_enter (&initialized))
|
||||
{
|
||||
pasteboard_types[TYPE_PNG] = NSPasteboardTypePNG;
|
||||
pasteboard_types[TYPE_STRING] = NSPasteboardTypeString;
|
||||
pasteboard_types[TYPE_TIFF] = NSPasteboardTypeTIFF;
|
||||
pasteboard_types[TYPE_COLOR] = NSPasteboardTypeColor;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
pasteboard_types[TYPE_PBOARD] = NSStringPboardType;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
|
||||
pasteboard_types[TYPE_URL] = NSPasteboardTypeURL;
|
||||
pasteboard_types[TYPE_FILE_URL] = NSPasteboardTypeFileURL;
|
||||
#else
|
||||
pasteboard_types[TYPE_URL] = [[NSString alloc] initWithUTF8String:"public.url"];
|
||||
pasteboard_types[TYPE_FILE_URL] = [[NSString alloc] initWithUTF8String:"public.file-url"];
|
||||
#endif
|
||||
|
||||
g_once_init_leave (&initialized, TRUE);
|
||||
}
|
||||
|
||||
return pasteboard_types[type];
|
||||
}
|
||||
|
||||
static void
|
||||
write_request_free (WriteRequest *wr)
|
||||
{
|
||||
@@ -104,17 +56,17 @@ _gdk_macos_clipboard_from_ns_type (NSPasteboardType type)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if ([type isEqualToString:PTYPE(STRING)] ||
|
||||
[type isEqualToString:PTYPE(PBOARD)])
|
||||
if ([type isEqualToString:NSPasteboardTypeString] ||
|
||||
[type isEqualToString:NSStringPboardType])
|
||||
return g_intern_string ("text/plain;charset=utf-8");
|
||||
else if ([type isEqualToString:PTYPE(URL)] ||
|
||||
[type isEqualToString:PTYPE(FILE_URL)])
|
||||
else if ([type isEqualToString:NSPasteboardTypeURL] ||
|
||||
[type isEqualToString:NSPasteboardTypeFileURL])
|
||||
return g_intern_string ("text/uri-list");
|
||||
else if ([type isEqualToString:PTYPE(COLOR)])
|
||||
else if ([type isEqualToString:NSPasteboardTypeColor])
|
||||
return g_intern_string ("application/x-color");
|
||||
else if ([type isEqualToString:PTYPE(TIFF)])
|
||||
else if ([type isEqualToString:NSPasteboardTypeTIFF])
|
||||
return g_intern_string ("image/tiff");
|
||||
else if ([type isEqualToString:PTYPE(PNG)])
|
||||
else if ([type isEqualToString:NSPasteboardTypePNG])
|
||||
return g_intern_string ("image/png");
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
@@ -131,25 +83,25 @@ _gdk_macos_clipboard_to_ns_type (const char *mime_type,
|
||||
|
||||
if (g_strcmp0 (mime_type, "text/plain;charset=utf-8") == 0)
|
||||
{
|
||||
return PTYPE(STRING);
|
||||
return NSPasteboardTypeString;
|
||||
}
|
||||
else if (g_strcmp0 (mime_type, "text/uri-list") == 0)
|
||||
{
|
||||
if (alternate)
|
||||
*alternate = PTYPE(URL);
|
||||
return PTYPE(FILE_URL);
|
||||
*alternate = NSPasteboardTypeURL;
|
||||
return NSPasteboardTypeFileURL;
|
||||
}
|
||||
else if (g_strcmp0 (mime_type, "application/x-color") == 0)
|
||||
{
|
||||
return PTYPE(COLOR);
|
||||
return NSPasteboardTypeColor;
|
||||
}
|
||||
else if (g_strcmp0 (mime_type, "image/tiff") == 0)
|
||||
{
|
||||
return PTYPE(TIFF);
|
||||
return NSPasteboardTypeTIFF;
|
||||
}
|
||||
else if (g_strcmp0 (mime_type, "image/png") == 0)
|
||||
{
|
||||
return PTYPE(PNG);
|
||||
return NSPasteboardTypePNG;
|
||||
}
|
||||
|
||||
return nil;
|
||||
@@ -268,7 +220,7 @@ _gdk_macos_clipboard_read_async (GdkClipboard *clipboard,
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if ([[self->pasteboard types] containsObject:PTYPE(FILE_URL)])
|
||||
if ([[self->pasteboard types] containsObject:NSPasteboardTypeFileURL])
|
||||
{
|
||||
GString *str = g_string_new (NULL);
|
||||
NSArray *files = [self->pasteboard propertyListForType:NSFilenamesPboardType];
|
||||
@@ -315,12 +267,12 @@ _gdk_macos_clipboard_read_async (GdkClipboard *clipboard,
|
||||
}
|
||||
else if (strcmp (mime_type, "image/tiff") == 0)
|
||||
{
|
||||
NSData *data = [self->pasteboard dataForType:PTYPE(TIFF)];
|
||||
NSData *data = [self->pasteboard dataForType:NSPasteboardTypeTIFF];
|
||||
stream = create_stream_from_nsdata (data);
|
||||
}
|
||||
else if (strcmp (mime_type, "image/png") == 0)
|
||||
{
|
||||
NSData *data = [self->pasteboard dataForType:PTYPE(PNG)];
|
||||
NSData *data = [self->pasteboard dataForType:NSPasteboardTypePNG];
|
||||
stream = create_stream_from_nsdata (data);
|
||||
}
|
||||
|
||||
|
||||
@@ -700,7 +700,7 @@ get_surface_point_from_screen_point (GdkSurface *surface,
|
||||
NSPoint point;
|
||||
|
||||
nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (surface));
|
||||
point = convert_nspoint_from_screen (nswindow, screen_point);
|
||||
point = [nswindow convertPointFromScreen:screen_point];
|
||||
|
||||
*x = point.x;
|
||||
*y = surface->height - point.y;
|
||||
@@ -762,7 +762,7 @@ get_surface_from_ns_event (GdkMacosDisplay *self,
|
||||
GdkSurface *surface = NULL;
|
||||
NSWindow *nswindow = [nsevent window];
|
||||
|
||||
if (GDK_IS_MACOS_WINDOW (nswindow))
|
||||
if (nswindow)
|
||||
{
|
||||
GdkMacosBaseView *view;
|
||||
NSPoint point, view_point;
|
||||
@@ -821,7 +821,7 @@ get_surface_from_ns_event (GdkMacosDisplay *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
*screen_point = convert_nspoint_to_screen ([nsevent window], point);
|
||||
*screen_point = [(GdkMacosWindow *)[nsevent window] convertPointToScreen:point];
|
||||
*x = point.x;
|
||||
*y = surface->height - point.y;
|
||||
}
|
||||
@@ -974,11 +974,11 @@ find_surface_for_ns_event (GdkMacosDisplay *self,
|
||||
g_assert (x != NULL);
|
||||
g_assert (y != NULL);
|
||||
|
||||
view = (GdkMacosBaseView *)[[nsevent window] contentView];
|
||||
|
||||
if (!(surface = get_surface_from_ns_event (self, nsevent, &point, x, y)))
|
||||
return NULL;
|
||||
|
||||
view = (GdkMacosBaseView *)[GDK_MACOS_SURFACE (surface)->window contentView];
|
||||
|
||||
_gdk_macos_display_from_display_coords (self, point.x, point.y, &x_tmp, &y_tmp);
|
||||
|
||||
switch ((int)[nsevent type])
|
||||
|
||||
@@ -145,7 +145,6 @@ GetSubpixelLayout (CGDirectDisplayID screen_id)
|
||||
static char *
|
||||
GetLocalizedName (NSScreen *screen)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
GDK_BEGIN_MACOS_ALLOC_POOL;
|
||||
|
||||
NSString *str;
|
||||
@@ -159,9 +158,6 @@ GetLocalizedName (NSScreen *screen)
|
||||
GDK_END_MACOS_ALLOC_POOL;
|
||||
|
||||
return g_steal_pointer (&name);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static char *
|
||||
|
||||
@@ -61,7 +61,6 @@ struct _GdkMacosSurface
|
||||
gint64 pending_frame_counter;
|
||||
|
||||
guint did_initial_present : 1;
|
||||
guint geometry_dirty : 1;
|
||||
};
|
||||
|
||||
struct _GdkMacosSurfaceClass
|
||||
|
||||
@@ -150,12 +150,6 @@ _gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (self->shadow_top == top &&
|
||||
self->shadow_right == right &&
|
||||
self->shadow_bottom == bottom &&
|
||||
self->shadow_left == left)
|
||||
return;
|
||||
|
||||
self->shadow_top = top;
|
||||
self->shadow_right = right;
|
||||
self->shadow_bottom = bottom;
|
||||
|
||||
@@ -81,7 +81,7 @@ _gdk_macos_toplevel_surface_unmaximize (GdkMacosToplevelSurface *self)
|
||||
[window zoom:window];
|
||||
}
|
||||
|
||||
static void
|
||||
static gboolean
|
||||
_gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
{
|
||||
@@ -107,7 +107,6 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
style_mask = [nswindow styleMask];
|
||||
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle workarea;
|
||||
@@ -159,11 +158,13 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
[nswindow setStyleMask:style_mask];
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
{
|
||||
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
}
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
@@ -229,6 +230,8 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
|
||||
_gdk_macos_surface_show (GDK_MACOS_SURFACE (self));
|
||||
|
||||
GDK_MACOS_SURFACE (self)->did_initial_present = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -370,87 +373,6 @@ _gdk_macos_toplevel_surface_hide (GdkSurface *surface)
|
||||
GDK_SURFACE_CLASS (_gdk_macos_toplevel_surface_parent_class)->hide (surface);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_gdk_macos_toplevel_surface_compute_size (GdkSurface *surface)
|
||||
{
|
||||
GdkMacosToplevelSurface *self = (GdkMacosToplevelSurface *)surface;
|
||||
NSWindow *nswindow = _gdk_macos_surface_get_native (GDK_MACOS_SURFACE (self));
|
||||
GdkToplevelSize size;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
int bounds_width, bounds_height;
|
||||
int width, height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
NSWindowStyleMask style_mask;
|
||||
|
||||
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
|
||||
|
||||
if (!GDK_MACOS_SURFACE (surface)->geometry_dirty)
|
||||
return FALSE;
|
||||
|
||||
GDK_MACOS_SURFACE (surface)->geometry_dirty = FALSE;
|
||||
|
||||
display = gdk_surface_get_display (surface);
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
style_mask = [nswindow styleMask];
|
||||
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle workarea;
|
||||
|
||||
gdk_macos_monitor_get_workarea (monitor, &workarea);
|
||||
bounds_width = workarea.width;
|
||||
bounds_height = workarea.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
|
||||
if (style_mask & NSWindowStyleMaskResizable)
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = width;
|
||||
geometry.max_height = geometry.min_height = height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
|
||||
size.shadow.top,
|
||||
size.shadow.right,
|
||||
size.shadow.bottom,
|
||||
size.shadow.left);
|
||||
|
||||
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
_gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_request_layout (GdkSurface *surface)
|
||||
{
|
||||
GDK_MACOS_SURFACE (surface)->geometry_dirty = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_macos_toplevel_surface_destroy (GdkSurface *surface,
|
||||
gboolean foreign_destroy)
|
||||
@@ -584,8 +506,6 @@ _gdk_macos_toplevel_surface_class_init (GdkMacosToplevelSurfaceClass *klass)
|
||||
|
||||
surface_class->destroy = _gdk_macos_toplevel_surface_destroy;
|
||||
surface_class->hide = _gdk_macos_toplevel_surface_hide;
|
||||
surface_class->compute_size = _gdk_macos_toplevel_surface_compute_size;
|
||||
surface_class->request_layout = _gdk_macos_toplevel_surface_request_layout;
|
||||
|
||||
gdk_toplevel_install_properties (object_class, LAST_PROP);
|
||||
}
|
||||
|
||||
@@ -40,36 +40,5 @@ struct _GdkPoint
|
||||
};
|
||||
typedef struct _GdkPoint GdkPoint;
|
||||
|
||||
static inline NSPoint
|
||||
convert_nspoint_from_screen (NSWindow *window,
|
||||
NSPoint point)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
return [window convertPointFromScreen:point];
|
||||
#else
|
||||
/* Apple documentation claims that convertPointFromScreen is available
|
||||
* on 10.12+. However, that doesn't seem to be the case when using it.
|
||||
* Instead, we'll just use it on modern 10.15 systems and fallback to
|
||||
* converting using rects on older systems.
|
||||
*/
|
||||
return [window convertRectFromScreen:NSMakeRect (point.x, point.y, 0, 0)].origin;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline NSPoint
|
||||
convert_nspoint_to_screen (NSWindow *window,
|
||||
NSPoint point)
|
||||
{
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_15_AND_LATER
|
||||
return [window convertPointToScreen:point];
|
||||
#else
|
||||
/* Apple documentation claims that convertPointToScreen is available
|
||||
* on 10.12+. However, that doesn't seem to be the case when using it.
|
||||
* Instead, we'll just use it on modern 10.15 systems and fallback to
|
||||
* converting using rects on older systems.
|
||||
*/
|
||||
return [window convertRectToScreen:NSMakeRect (point.x, point.y, 0, 0)].origin;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __GDK_MACOS_UTILS_PRIVATE_H__ */
|
||||
|
||||
@@ -242,22 +242,14 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "swap buffers");
|
||||
if (display_wayland->have_egl_swap_buffers_with_damage)
|
||||
{
|
||||
EGLint stack_rects[4 * 4]; /* 4 rects */
|
||||
EGLint *heap_rects = NULL;
|
||||
int i, j, n_rects = cairo_region_num_rectangles (painted);
|
||||
EGLint *rects = g_new (EGLint, n_rects * 4);
|
||||
cairo_rectangle_int_t rect;
|
||||
int surface_height = gdk_surface_get_height (surface);
|
||||
int scale = gdk_surface_get_scale_factor (surface);
|
||||
EGLint *rects;
|
||||
|
||||
if (n_rects < G_N_ELEMENTS (stack_rects) / 4)
|
||||
rects = (EGLint *)&stack_rects;
|
||||
else
|
||||
heap_rects = rects = g_new (EGLint, n_rects * 4);
|
||||
|
||||
for (i = 0, j = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
cairo_region_get_rectangle (painted, i, &rect);
|
||||
rects[j++] = rect.x * scale;
|
||||
rects[j++] = (surface_height - rect.height - rect.y) * scale;
|
||||
@@ -265,7 +257,7 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
rects[j++] = rect.height * scale;
|
||||
}
|
||||
eglSwapBuffersWithDamageEXT (display_wayland->egl_display, egl_surface, rects, n_rects);
|
||||
g_free (heap_rects);
|
||||
g_free (rects);
|
||||
}
|
||||
else
|
||||
eglSwapBuffers (display_wayland->egl_display, egl_surface);
|
||||
@@ -301,27 +293,27 @@ gdk_wayland_get_display (GdkWaylandDisplay *display_wayland)
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||
|
||||
if (getPlatformDisplay)
|
||||
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||
display_wayland->wl_display,
|
||||
NULL);
|
||||
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||
display_wayland->wl_display,
|
||||
NULL);
|
||||
if (dpy)
|
||||
return dpy;
|
||||
return dpy;
|
||||
}
|
||||
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||
|
||||
if (getPlatformDisplay)
|
||||
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||
display_wayland->wl_display,
|
||||
NULL);
|
||||
dpy = getPlatformDisplay (EGL_PLATFORM_WAYLAND_EXT,
|
||||
display_wayland->wl_display,
|
||||
NULL);
|
||||
if (dpy)
|
||||
return dpy;
|
||||
return dpy;
|
||||
}
|
||||
|
||||
return eglGetDisplay ((EGLNativeDisplayType) display_wayland->wl_display);
|
||||
@@ -394,7 +386,7 @@ find_eglconfig_for_surface (GdkSurface *surface,
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
EGLint attrs[MAX_EGL_ATTRS];
|
||||
EGLint count;
|
||||
EGLConfig config;
|
||||
EGLConfig *configs;
|
||||
int i = 0;
|
||||
|
||||
attrs[i++] = EGL_SURFACE_TYPE;
|
||||
@@ -415,8 +407,7 @@ find_eglconfig_for_surface (GdkSurface *surface,
|
||||
attrs[i++] = EGL_NONE;
|
||||
g_assert (i < MAX_EGL_ATTRS);
|
||||
|
||||
/* Pick first valid configuration i guess? */
|
||||
if (!eglChooseConfig (display_wayland->egl_display, attrs, &config, 1, &count) || count < 1)
|
||||
if (!eglChooseConfig (display_wayland->egl_display, attrs, NULL, 0, &count) || count < 1)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
|
||||
@@ -424,17 +415,31 @@ find_eglconfig_for_surface (GdkSurface *surface,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_assert (egl_config_out);
|
||||
*egl_config_out = config;
|
||||
configs = g_new (EGLConfig, count);
|
||||
|
||||
if (!eglChooseConfig (display_wayland->egl_display, attrs, configs, count, &count) || count < 1)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
|
||||
_("No available configurations for the given pixel format"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Pick first valid configuration i guess? */
|
||||
|
||||
if (egl_config_out != NULL)
|
||||
*egl_config_out = configs[0];
|
||||
|
||||
g_free (configs);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GdkGLContext *
|
||||
gdk_wayland_surface_create_gl_context (GdkSurface *surface,
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error)
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
@@ -521,10 +526,10 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
|
||||
else
|
||||
{
|
||||
if (display_wayland->have_egl_surfaceless_context)
|
||||
egl_surface = EGL_NO_SURFACE;
|
||||
egl_surface = EGL_NO_SURFACE;
|
||||
else
|
||||
egl_surface = gdk_wayland_surface_get_dummy_egl_surface (surface,
|
||||
context_wayland->egl_config);
|
||||
egl_surface = gdk_wayland_surface_get_dummy_egl_surface (surface,
|
||||
context_wayland->egl_config);
|
||||
}
|
||||
|
||||
if (!eglMakeCurrent (display_wayland->egl_display, egl_surface,
|
||||
|
||||
@@ -1097,16 +1097,15 @@ handle_property_change (GdkX11DeviceManagerXI2 *device_manager,
|
||||
if (ev->what != XIPropertyDeleted &&
|
||||
device_get_tool_serial_and_id (device, &serial_id, &tool_id))
|
||||
{
|
||||
GdkDeviceToolType tool_type;
|
||||
|
||||
seat = gdk_device_get_seat (device);
|
||||
tool_type = device_get_tool_type (device);
|
||||
tool = gdk_seat_get_tool (seat, serial_id, tool_id);
|
||||
|
||||
if (tool_type != GDK_DEVICE_TOOL_TYPE_UNKNOWN)
|
||||
if (!tool && serial_id > 0)
|
||||
{
|
||||
tool = gdk_seat_get_tool (seat, serial_id, tool_id, tool_type);
|
||||
GdkDeviceToolType tool_type;
|
||||
|
||||
if (!tool && serial_id > 0)
|
||||
tool_type = device_get_tool_type (device);
|
||||
if (tool_type != GDK_DEVICE_TOOL_TYPE_UNKNOWN)
|
||||
{
|
||||
tool = gdk_device_tool_new (serial_id, tool_id, tool_type, 0);
|
||||
gdk_seat_default_add_tool (GDK_SEAT_DEFAULT (seat), tool);
|
||||
|
||||
@@ -291,7 +291,7 @@ compute_toplevel_size (GdkSurface *surface,
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
if (!impl->toplevel_layout || gdk_toplevel_layout_get_resizable (impl->toplevel_layout))
|
||||
if (gdk_toplevel_layout_get_resizable (impl->toplevel_layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
|
||||
@@ -232,8 +232,6 @@ gsk_gl_shader_builder_create_program (GskGLShaderBuilder *self,
|
||||
glBindAttribLocation (program_id, 0, "aPosition");
|
||||
glBindAttribLocation (program_id, 1, "vUv");
|
||||
glLinkProgram (program_id);
|
||||
glDetachShader (program_id, vertex_id);
|
||||
glDetachShader (program_id, fragment_id);
|
||||
|
||||
glGetProgramiv (program_id, GL_LINK_STATUS, &status);
|
||||
if (status == GL_FALSE)
|
||||
@@ -254,9 +252,14 @@ gsk_gl_shader_builder_create_program (GskGLShaderBuilder *self,
|
||||
|
||||
glDeleteProgram (program_id);
|
||||
program_id = -1;
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
glDetachShader (program_id, vertex_id);
|
||||
glDeleteShader (vertex_id);
|
||||
|
||||
glDetachShader (program_id, fragment_id);
|
||||
glDeleteShader (fragment_id);
|
||||
|
||||
out:
|
||||
|
||||
@@ -22,7 +22,7 @@ static guint gsk_debug_flags;
|
||||
static void
|
||||
init_debug_flags (void)
|
||||
{
|
||||
static gsize gsk_debug_flags__set;
|
||||
static volatile gsize gsk_debug_flags__set;
|
||||
|
||||
if (g_once_init_enter (&gsk_debug_flags__set))
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static gsize g_define_type_id__volatile = 0;
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
|
||||
@@ -184,7 +184,7 @@ gsk_render_node_init (GskRenderNode *self)
|
||||
GType
|
||||
gsk_render_node_get_type (void)
|
||||
{
|
||||
static gsize render_node_type__volatile;
|
||||
static volatile gsize render_node_type__volatile;
|
||||
|
||||
if (g_once_init_enter (&render_node_type__volatile))
|
||||
{
|
||||
|
||||
@@ -5649,7 +5649,7 @@ gsk_render_node_init_types_once (void)
|
||||
void
|
||||
gsk_render_node_init_types (void)
|
||||
{
|
||||
static gsize register_types__volatile;
|
||||
static volatile gsize register_types__volatile;
|
||||
|
||||
if (g_once_init_enter (®ister_types__volatile))
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static gsize g_define_type_id__volatile = 0;
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
* @line_chars: Number of characters parsed since the last line
|
||||
* break
|
||||
*
|
||||
* #GtkCssLocation is used to present a location in a file - or other
|
||||
* @GtkCssLocation is used to present a location in a file - or other
|
||||
* source of data parsed by the CSS engine.
|
||||
*
|
||||
* The @bytes and @line_bytes offsets are meant to be used to
|
||||
|
||||
@@ -30,7 +30,6 @@ struct _GtkCssTokenizer
|
||||
{
|
||||
int ref_count;
|
||||
GBytes *bytes;
|
||||
GString *name_buffer;
|
||||
|
||||
const char *data;
|
||||
const char *end;
|
||||
@@ -96,13 +95,45 @@ gtk_css_token_clear (GtkCssToken *token)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_token_init (GtkCssToken *token,
|
||||
GtkCssTokenType type)
|
||||
gtk_css_token_initv (GtkCssToken *token,
|
||||
GtkCssTokenType type,
|
||||
va_list args)
|
||||
{
|
||||
token->type = type;
|
||||
|
||||
switch ((guint)type)
|
||||
switch (type)
|
||||
{
|
||||
case GTK_CSS_TOKEN_STRING:
|
||||
case GTK_CSS_TOKEN_IDENT:
|
||||
case GTK_CSS_TOKEN_FUNCTION:
|
||||
case GTK_CSS_TOKEN_AT_KEYWORD:
|
||||
case GTK_CSS_TOKEN_HASH_UNRESTRICTED:
|
||||
case GTK_CSS_TOKEN_HASH_ID:
|
||||
case GTK_CSS_TOKEN_URL:
|
||||
token->string.string = va_arg (args, char *);
|
||||
break;
|
||||
|
||||
case GTK_CSS_TOKEN_DELIM:
|
||||
token->delim.delim = va_arg (args, gunichar);
|
||||
break;
|
||||
|
||||
case GTK_CSS_TOKEN_SIGNED_INTEGER:
|
||||
case GTK_CSS_TOKEN_SIGNLESS_INTEGER:
|
||||
case GTK_CSS_TOKEN_SIGNED_NUMBER:
|
||||
case GTK_CSS_TOKEN_SIGNLESS_NUMBER:
|
||||
case GTK_CSS_TOKEN_PERCENTAGE:
|
||||
token->number.number = va_arg (args, double);
|
||||
break;
|
||||
|
||||
case GTK_CSS_TOKEN_SIGNED_INTEGER_DIMENSION:
|
||||
case GTK_CSS_TOKEN_SIGNLESS_INTEGER_DIMENSION:
|
||||
case GTK_CSS_TOKEN_DIMENSION:
|
||||
token->dimension.value = va_arg (args, double);
|
||||
token->dimension.dimension = va_arg (args, char *);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
case GTK_CSS_TOKEN_EOF:
|
||||
case GTK_CSS_TOKEN_WHITESPACE:
|
||||
case GTK_CSS_TOKEN_OPEN_PARENS:
|
||||
@@ -126,8 +157,6 @@ gtk_css_token_init (GtkCssToken *token,
|
||||
case GTK_CSS_TOKEN_BAD_URL:
|
||||
case GTK_CSS_TOKEN_COMMENT:
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,76 +515,15 @@ gtk_css_token_to_string (const GtkCssToken *token)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_token_init_string (GtkCssToken *token,
|
||||
GtkCssTokenType type,
|
||||
char *string)
|
||||
gtk_css_token_init (GtkCssToken *token,
|
||||
GtkCssTokenType type,
|
||||
...)
|
||||
{
|
||||
token->type = type;
|
||||
va_list args;
|
||||
|
||||
switch ((guint)type)
|
||||
{
|
||||
case GTK_CSS_TOKEN_STRING:
|
||||
case GTK_CSS_TOKEN_IDENT:
|
||||
case GTK_CSS_TOKEN_FUNCTION:
|
||||
case GTK_CSS_TOKEN_AT_KEYWORD:
|
||||
case GTK_CSS_TOKEN_HASH_UNRESTRICTED:
|
||||
case GTK_CSS_TOKEN_HASH_ID:
|
||||
case GTK_CSS_TOKEN_URL:
|
||||
token->string.string = string;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_token_init_delim (GtkCssToken *token,
|
||||
gunichar delim)
|
||||
{
|
||||
token->type = GTK_CSS_TOKEN_DELIM;
|
||||
token->delim.delim = delim;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_token_init_number (GtkCssToken *token,
|
||||
GtkCssTokenType type,
|
||||
double value)
|
||||
{
|
||||
token->type = type;
|
||||
|
||||
switch ((guint)type)
|
||||
{
|
||||
case GTK_CSS_TOKEN_SIGNED_INTEGER:
|
||||
case GTK_CSS_TOKEN_SIGNLESS_INTEGER:
|
||||
case GTK_CSS_TOKEN_SIGNED_NUMBER:
|
||||
case GTK_CSS_TOKEN_SIGNLESS_NUMBER:
|
||||
case GTK_CSS_TOKEN_PERCENTAGE:
|
||||
token->number.number = value;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_token_init_dimension (GtkCssToken *token,
|
||||
GtkCssTokenType type,
|
||||
double value,
|
||||
char *dimension)
|
||||
{
|
||||
token->type = type;
|
||||
|
||||
switch ((guint)type)
|
||||
{
|
||||
case GTK_CSS_TOKEN_SIGNED_INTEGER_DIMENSION:
|
||||
case GTK_CSS_TOKEN_SIGNLESS_INTEGER_DIMENSION:
|
||||
case GTK_CSS_TOKEN_DIMENSION:
|
||||
token->dimension.value = value;
|
||||
token->dimension.dimension = dimension;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
va_start (args, type);
|
||||
gtk_css_token_initv (token, type, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
GtkCssTokenizer *
|
||||
@@ -566,7 +534,6 @@ gtk_css_tokenizer_new (GBytes *bytes)
|
||||
tokenizer = g_slice_new0 (GtkCssTokenizer);
|
||||
tokenizer->ref_count = 1;
|
||||
tokenizer->bytes = g_bytes_ref (bytes);
|
||||
tokenizer->name_buffer = g_string_new (NULL);
|
||||
|
||||
tokenizer->data = g_bytes_get_data (bytes, NULL);
|
||||
tokenizer->end = tokenizer->data + g_bytes_get_size (bytes);
|
||||
@@ -591,7 +558,6 @@ gtk_css_tokenizer_unref (GtkCssTokenizer *tokenizer)
|
||||
if (tokenizer->ref_count > 0)
|
||||
return;
|
||||
|
||||
g_string_free (tokenizer->name_buffer, TRUE);
|
||||
g_bytes_unref (tokenizer->bytes);
|
||||
g_slice_free (GtkCssTokenizer, tokenizer);
|
||||
}
|
||||
@@ -602,7 +568,11 @@ gtk_css_tokenizer_get_location (GtkCssTokenizer *tokenizer)
|
||||
return &tokenizer->position;
|
||||
}
|
||||
|
||||
static void G_GNUC_PRINTF(2, 3)
|
||||
static void
|
||||
gtk_css_tokenizer_parse_error (GError **error,
|
||||
const char *format,
|
||||
...) G_GNUC_PRINTF(2, 3);
|
||||
static void
|
||||
gtk_css_tokenizer_parse_error (GError **error,
|
||||
const char *format,
|
||||
...)
|
||||
@@ -873,7 +843,7 @@ gtk_css_tokenizer_read_escape (GtkCssTokenizer *tokenizer)
|
||||
static char *
|
||||
gtk_css_tokenizer_read_name (GtkCssTokenizer *tokenizer)
|
||||
{
|
||||
g_string_set_size (tokenizer->name_buffer, 0);
|
||||
GString *string = g_string_new (NULL);
|
||||
|
||||
do {
|
||||
if (*tokenizer->data == '\\')
|
||||
@@ -881,7 +851,7 @@ gtk_css_tokenizer_read_name (GtkCssTokenizer *tokenizer)
|
||||
if (gtk_css_tokenizer_has_valid_escape (tokenizer))
|
||||
{
|
||||
gunichar value = gtk_css_tokenizer_read_escape (tokenizer);
|
||||
g_string_append_unichar (tokenizer->name_buffer, value);
|
||||
g_string_append_unichar (string, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -889,16 +859,16 @@ gtk_css_tokenizer_read_name (GtkCssTokenizer *tokenizer)
|
||||
|
||||
if (tokenizer->data == tokenizer->end)
|
||||
{
|
||||
g_string_append_unichar (tokenizer->name_buffer, 0xFFFD);
|
||||
g_string_append_unichar (string, 0xFFFD);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_css_tokenizer_consume_char (tokenizer, tokenizer->name_buffer);
|
||||
gtk_css_tokenizer_consume_char (tokenizer, string);
|
||||
}
|
||||
}
|
||||
else if (is_name (*tokenizer->data))
|
||||
{
|
||||
gtk_css_tokenizer_consume_char (tokenizer, tokenizer->name_buffer);
|
||||
gtk_css_tokenizer_consume_char (tokenizer, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -907,7 +877,7 @@ gtk_css_tokenizer_read_name (GtkCssTokenizer *tokenizer)
|
||||
}
|
||||
while (tokenizer->data != tokenizer->end);
|
||||
|
||||
return g_strndup (tokenizer->name_buffer->str, tokenizer->name_buffer->len);
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1000,7 +970,7 @@ gtk_css_tokenizer_read_url (GtkCssTokenizer *tokenizer,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_token_init_string (token, GTK_CSS_TOKEN_URL, g_string_free (url, FALSE));
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_URL, g_string_free (url, FALSE));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1029,12 +999,12 @@ gtk_css_tokenizer_read_ident_like (GtkCssTokenizer *tokenizer,
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_token_init_string (token, GTK_CSS_TOKEN_FUNCTION, name);
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_FUNCTION, name);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_token_init_string (token, GTK_CSS_TOKEN_IDENT, name);
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_IDENT, name);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1047,7 +1017,6 @@ gtk_css_tokenizer_read_numeric (GtkCssTokenizer *tokenizer,
|
||||
gint64 integer, fractional = 0, fractional_length = 1, exponent = 0;
|
||||
gboolean is_int = TRUE, has_sign = FALSE;
|
||||
const char *data = tokenizer->data;
|
||||
double value;
|
||||
|
||||
if (*data == '-')
|
||||
{
|
||||
@@ -1113,34 +1082,27 @@ gtk_css_tokenizer_read_numeric (GtkCssTokenizer *tokenizer,
|
||||
|
||||
gtk_css_tokenizer_consume (tokenizer, data - tokenizer->data, data - tokenizer->data);
|
||||
|
||||
value = sign * (integer + ((double) fractional / fractional_length)) * pow (10, exponent_sign * exponent);
|
||||
|
||||
if (gtk_css_tokenizer_has_identifier (tokenizer))
|
||||
{
|
||||
GtkCssTokenType type;
|
||||
|
||||
if (is_int)
|
||||
type = has_sign ? GTK_CSS_TOKEN_SIGNED_INTEGER_DIMENSION : GTK_CSS_TOKEN_SIGNLESS_INTEGER_DIMENSION;
|
||||
else
|
||||
type = GTK_CSS_TOKEN_DIMENSION;
|
||||
|
||||
gtk_css_token_init_dimension (token, type, value, gtk_css_tokenizer_read_name (tokenizer));
|
||||
gtk_css_token_init (token,
|
||||
is_int ? (has_sign ? GTK_CSS_TOKEN_SIGNED_INTEGER_DIMENSION : GTK_CSS_TOKEN_SIGNLESS_INTEGER_DIMENSION)
|
||||
: GTK_CSS_TOKEN_DIMENSION,
|
||||
sign * (integer + ((double) fractional / fractional_length)) * pow (10, exponent_sign * exponent),
|
||||
gtk_css_tokenizer_read_name (tokenizer));
|
||||
}
|
||||
else if (gtk_css_tokenizer_remaining (tokenizer) > 0 && *tokenizer->data == '%')
|
||||
{
|
||||
gtk_css_token_init_number (token, GTK_CSS_TOKEN_PERCENTAGE, value);
|
||||
gtk_css_token_init (token,
|
||||
GTK_CSS_TOKEN_PERCENTAGE,
|
||||
sign * (integer + ((double) fractional / fractional_length)) * pow (10, exponent_sign * exponent));
|
||||
gtk_css_tokenizer_consume_ascii (tokenizer);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkCssTokenType type;
|
||||
|
||||
if (is_int)
|
||||
type = has_sign ? GTK_CSS_TOKEN_SIGNED_INTEGER : GTK_CSS_TOKEN_SIGNLESS_INTEGER;
|
||||
else
|
||||
type = has_sign ? GTK_CSS_TOKEN_SIGNED_NUMBER : GTK_CSS_TOKEN_SIGNLESS_NUMBER;
|
||||
|
||||
gtk_css_token_init_number (token, type,value);
|
||||
gtk_css_token_init (token,
|
||||
is_int ? (has_sign ? GTK_CSS_TOKEN_SIGNED_INTEGER : GTK_CSS_TOKEN_SIGNLESS_INTEGER)
|
||||
: (has_sign ? GTK_CSS_TOKEN_SIGNED_NUMBER : GTK_CSS_TOKEN_SIGNLESS_NUMBER),
|
||||
sign * (integer + ((double) fractional / fractional_length)) * pow (10, exponent_sign * exponent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,7 +1110,7 @@ static void
|
||||
gtk_css_tokenizer_read_delim (GtkCssTokenizer *tokenizer,
|
||||
GtkCssToken *token)
|
||||
{
|
||||
gtk_css_token_init_delim (token, g_utf8_get_char (tokenizer->data));
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_DELIM, g_utf8_get_char (tokenizer->data));
|
||||
gtk_css_tokenizer_consume_char (tokenizer, NULL);
|
||||
}
|
||||
|
||||
@@ -1232,8 +1194,8 @@ gtk_css_tokenizer_read_string (GtkCssTokenizer *tokenizer,
|
||||
gtk_css_tokenizer_consume_char (tokenizer, string);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_css_token_init_string (token, GTK_CSS_TOKEN_STRING, g_string_free (string, FALSE));
|
||||
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_STRING, g_string_free (string, FALSE));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1317,13 +1279,13 @@ gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
|
||||
else
|
||||
type = GTK_CSS_TOKEN_HASH_UNRESTRICTED;
|
||||
|
||||
gtk_css_token_init_string (token,
|
||||
type,
|
||||
gtk_css_tokenizer_read_name (tokenizer));
|
||||
gtk_css_token_init (token,
|
||||
type,
|
||||
gtk_css_tokenizer_read_name (tokenizer));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_token_init_delim (token, '#');
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_DELIM, '#');
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -1399,13 +1361,13 @@ gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
|
||||
gtk_css_tokenizer_consume_ascii (tokenizer);
|
||||
if (gtk_css_tokenizer_has_identifier (tokenizer))
|
||||
{
|
||||
gtk_css_token_init_string (token,
|
||||
GTK_CSS_TOKEN_AT_KEYWORD,
|
||||
gtk_css_tokenizer_read_name (tokenizer));
|
||||
gtk_css_token_init (token,
|
||||
GTK_CSS_TOKEN_AT_KEYWORD,
|
||||
gtk_css_tokenizer_read_name (tokenizer));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_token_init_delim (token, '@');
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_DELIM, '@');
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -1421,7 +1383,7 @@ gtk_css_tokenizer_read_token (GtkCssTokenizer *tokenizer,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_css_token_init_delim (token, '\\');
|
||||
gtk_css_token_init (token, GTK_CSS_TOKEN_DELIM, '\\');
|
||||
gtk_css_tokenizer_consume_ascii (tokenizer);
|
||||
gtk_css_tokenizer_parse_error (error, "Newline may not follow '\' escape character");
|
||||
return FALSE;
|
||||
|
||||
@@ -63,7 +63,6 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_data (const char *data,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
const char *debug_output_to,
|
||||
GError **error);
|
||||
GdkPixbuf *gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
int width,
|
||||
|
||||
@@ -324,9 +324,7 @@ icon_loaded (GObject *object,
|
||||
|
||||
- (void)didChangeToggled
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
[self setState:gtk_menu_tracker_item_get_toggled (trackerItem) ? NSOnState : NSOffState];
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
[self setState:gtk_menu_tracker_item_get_toggled (trackerItem) ? NSControlStateValueOn : NSControlStateValueOff];
|
||||
}
|
||||
|
||||
- (void)didChangeAccel
|
||||
|
||||
@@ -541,27 +541,25 @@ gtk_at_context_create (GtkAccessibleRole accessible_role,
|
||||
gtk_a11y_env = g_getenv ("GTK_A11Y");
|
||||
if (gtk_a11y_env == NULL)
|
||||
gtk_a11y_env = "0";
|
||||
|
||||
if (g_ascii_strcasecmp (gtk_a11y_env, "help") == 0)
|
||||
{
|
||||
g_print ("Supported arguments for GTK_A11Y environment variable:\n");
|
||||
|
||||
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
|
||||
g_print (" atspi - Use the AT-SPI accessibility backend\n");
|
||||
#endif
|
||||
g_print (" test - Use the test accessibility backend\n");
|
||||
g_print (" none - Disable the accessibility backend\n");
|
||||
g_print (" help - Print this help\n\n");
|
||||
g_print ("Other arguments will cause a warning and be ignored.\n");
|
||||
|
||||
gtk_a11y_env = "0";
|
||||
}
|
||||
}
|
||||
|
||||
/* Short-circuit disabling the accessibility support */
|
||||
if (g_ascii_strcasecmp (gtk_a11y_env, "none") == 0)
|
||||
return NULL;
|
||||
|
||||
if (g_ascii_strcasecmp (gtk_a11y_env, "help") == 0)
|
||||
{
|
||||
g_print ("Supported arguments for GTK_A11Y environment variable:\n");
|
||||
|
||||
#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
|
||||
g_print (" atspi - Use the AT-SPI accessibility backend\n");
|
||||
#endif
|
||||
g_print (" test - Use the test accessibility backend\n");
|
||||
g_print (" none - Disable the accessibility backend\n");
|
||||
g_print (" help - Print this help\n\n");
|
||||
g_print ("Other arguments will cause a warning and be ignored.\n");
|
||||
}
|
||||
|
||||
GtkATContext *res = NULL;
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS (a11y_backends); i++)
|
||||
|
||||
@@ -107,7 +107,7 @@ gtk_bitset_unref (GtkBitset *self)
|
||||
* @self: a #GtkBitset
|
||||
* @value: the value to check
|
||||
*
|
||||
* Checks if the given @value has been added to @self
|
||||
* Checks if the given @value has been added to @bitset
|
||||
*
|
||||
* Returns: %TRUE if @self contains @value
|
||||
**/
|
||||
|
||||
@@ -346,7 +346,7 @@ gtk_box_new (GtkOrientation orientation,
|
||||
*/
|
||||
void
|
||||
gtk_box_set_homogeneous (GtkBox *box,
|
||||
gboolean homogeneous)
|
||||
gboolean homogeneous)
|
||||
{
|
||||
GtkBoxLayout *box_layout;
|
||||
|
||||
@@ -393,7 +393,7 @@ gtk_box_get_homogeneous (GtkBox *box)
|
||||
*/
|
||||
void
|
||||
gtk_box_set_spacing (GtkBox *box,
|
||||
int spacing)
|
||||
int spacing)
|
||||
{
|
||||
GtkBoxLayout *box_layout;
|
||||
|
||||
@@ -441,7 +441,7 @@ gtk_box_get_spacing (GtkBox *box)
|
||||
*/
|
||||
void
|
||||
gtk_box_set_baseline_position (GtkBox *box,
|
||||
GtkBaselinePosition position)
|
||||
GtkBaselinePosition position)
|
||||
{
|
||||
GtkBoxLayout *box_layout;
|
||||
|
||||
|
||||
@@ -1153,6 +1153,9 @@ gtk_builder_create_bindings (GtkBuilder *builder,
|
||||
* or gtk_builder_add_from_string() in order to merge multiple UI
|
||||
* descriptions into a single builder.
|
||||
*
|
||||
* Most users will probably want to use gtk_builder_new_from_file(),
|
||||
* gtk_builder_new_from_resource() or gtk_builder_new_from_string().
|
||||
*
|
||||
* Returns: a new (empty) #GtkBuilder object
|
||||
**/
|
||||
GtkBuilder *
|
||||
@@ -1170,9 +1173,7 @@ gtk_builder_new (void)
|
||||
* Parses a file containing a [GtkBuilder UI definition][BUILDER-UI]
|
||||
* and merges it with the current contents of @builder.
|
||||
*
|
||||
* This function is useful if you need to call gtk_builder_set_current_object()
|
||||
* to add user data to callbacks before loading GtkBuilder UI.
|
||||
* Otherwise, you probably want gtk_builder_new_from_file() instead.
|
||||
* Most users will probably want to use gtk_builder_new_from_file().
|
||||
*
|
||||
* If an error occurs, 0 will be returned and @error will be assigned a
|
||||
* #GError from the #GTK_BUILDER_ERROR, #G_MARKUP_ERROR or #G_FILE_ERROR
|
||||
@@ -1366,9 +1367,7 @@ gtk_builder_extend_with_template (GtkBuilder *builder,
|
||||
* Parses a resource file containing a [GtkBuilder UI definition][BUILDER-UI]
|
||||
* and merges it with the current contents of @builder.
|
||||
*
|
||||
* This function is useful if you need to call gtk_builder_set_current_object()
|
||||
* to add user data to callbacks before loading GtkBuilder UI.
|
||||
* Otherwise, you probably want gtk_builder_new_from_resource() instead.
|
||||
* Most users will probably want to use gtk_builder_new_from_resource().
|
||||
*
|
||||
* If an error occurs, 0 will be returned and @error will be assigned a
|
||||
* #GError from the #GTK_BUILDER_ERROR, #G_MARKUP_ERROR or #G_RESOURCE_ERROR
|
||||
@@ -1518,9 +1517,7 @@ gtk_builder_add_objects_from_resource (GtkBuilder *builder,
|
||||
* Parses a string containing a [GtkBuilder UI definition][BUILDER-UI]
|
||||
* and merges it with the current contents of @builder.
|
||||
*
|
||||
* This function is useful if you need to call gtk_builder_set_current_object()
|
||||
* to add user data to callbacks before loading GtkBuilder UI.
|
||||
* Otherwise, you probably want gtk_builder_new_from_string() instead.
|
||||
* Most users will probably want to use gtk_builder_new_from_string().
|
||||
*
|
||||
* Upon errors %FALSE will be returned and @error will be assigned a
|
||||
* #GError from the #GTK_BUILDER_ERROR, #G_MARKUP_ERROR or
|
||||
|
||||
@@ -365,17 +365,16 @@ static void free_object_info (ObjectInfo *info);
|
||||
static inline void
|
||||
state_push (ParserData *data, gpointer info)
|
||||
{
|
||||
g_ptr_array_add (data->stack, info);
|
||||
data->stack = g_slist_prepend (data->stack, info);
|
||||
}
|
||||
|
||||
static inline gpointer
|
||||
state_peek (ParserData *data)
|
||||
{
|
||||
if (!data->stack ||
|
||||
data->stack->len == 0)
|
||||
if (!data->stack)
|
||||
return NULL;
|
||||
|
||||
return g_ptr_array_index (data->stack, data->stack->len - 1);
|
||||
return data->stack->data;
|
||||
}
|
||||
|
||||
static inline gpointer
|
||||
@@ -385,9 +384,8 @@ state_pop (ParserData *data)
|
||||
|
||||
g_assert (data->stack);
|
||||
|
||||
old = state_peek (data);
|
||||
g_assert (old);
|
||||
data->stack->len --;
|
||||
old = data->stack->data;
|
||||
data->stack = g_slist_delete_link (data->stack, data->stack);
|
||||
return old;
|
||||
}
|
||||
#define state_peek_info(data, st) ((st*)state_peek(data))
|
||||
@@ -2079,7 +2077,7 @@ text (GtkBuildableParseContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!data->stack || data->stack->len == 0)
|
||||
if (!data->stack)
|
||||
return;
|
||||
|
||||
info = state_peek_info (data, CommonInfo);
|
||||
@@ -2120,6 +2118,41 @@ text (GtkBuildableParseContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_info (CommonInfo *info)
|
||||
{
|
||||
switch (info->tag_type)
|
||||
{
|
||||
case TAG_OBJECT:
|
||||
case TAG_TEMPLATE:
|
||||
free_object_info ((ObjectInfo *)info);
|
||||
break;
|
||||
case TAG_CHILD:
|
||||
free_child_info ((ChildInfo *)info);
|
||||
break;
|
||||
case TAG_BINDING:
|
||||
_free_binding_info ((BindingInfo *)info, NULL);
|
||||
break;
|
||||
case TAG_BINDING_EXPRESSION:
|
||||
free_binding_expression_info ((BindingExpressionInfo *) info);
|
||||
break;
|
||||
case TAG_PROPERTY:
|
||||
free_property_info ((PropertyInfo *)info);
|
||||
break;
|
||||
case TAG_SIGNAL:
|
||||
_free_signal_info ((SignalInfo *)info, NULL);
|
||||
break;
|
||||
case TAG_REQUIRES:
|
||||
free_requires_info ((RequiresInfo *)info, NULL);
|
||||
break;
|
||||
case TAG_EXPRESSION:
|
||||
free_expression_info ((ExpressionInfo *)info);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static const GtkBuildableParser parser = {
|
||||
start_element,
|
||||
end_element,
|
||||
@@ -2153,7 +2186,6 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
|
||||
data.domain = g_strdup (domain);
|
||||
data.object_ids = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify)g_free, NULL);
|
||||
data.stack = g_ptr_array_new ();
|
||||
|
||||
if (requested_objs)
|
||||
{
|
||||
@@ -2205,11 +2237,11 @@ _gtk_builder_parser_parse_buffer (GtkBuilder *builder,
|
||||
|
||||
out:
|
||||
|
||||
g_slist_free_full (data.stack, (GDestroyNotify)free_info);
|
||||
g_slist_free_full (data.custom_finalizers, (GDestroyNotify)free_subparser);
|
||||
g_slist_free (data.finalizers);
|
||||
g_free (data.domain);
|
||||
g_hash_table_destroy (data.object_ids);
|
||||
g_ptr_array_free (data.stack, TRUE);
|
||||
gtk_buildable_parse_context_free (&data.ctx);
|
||||
|
||||
/* restore the original domain */
|
||||
|
||||
@@ -173,7 +173,7 @@ typedef struct {
|
||||
const char *last_element;
|
||||
GtkBuilder *builder;
|
||||
char *domain;
|
||||
GPtrArray *stack;
|
||||
GSList *stack;
|
||||
SubParser *subparser;
|
||||
GtkBuildableParseContext ctx;
|
||||
const char *filename;
|
||||
@@ -190,6 +190,8 @@ typedef struct {
|
||||
GHashTable *object_ids;
|
||||
} ParserData;
|
||||
|
||||
typedef GType (*GTypeGetFunc) (void);
|
||||
|
||||
/* Things only GtkBuilder should use */
|
||||
GBytes * _gtk_buildable_parser_precompile (const char *text,
|
||||
gssize text_len,
|
||||
@@ -284,5 +286,8 @@ GObject *_gtk_builder_lookup_object (GtkBuilder *builder,
|
||||
int col);
|
||||
gboolean _gtk_builder_lookup_failed (GtkBuilder *builder,
|
||||
GError **error);
|
||||
GModule *gtk_builder_get_module (GtkBuilder *builder);
|
||||
|
||||
|
||||
|
||||
#endif /* __GTK_BUILDER_PRIVATE_H__ */
|
||||
|
||||
@@ -177,7 +177,7 @@ gtk_center_layout_distribute (GtkCenterLayout *self,
|
||||
center_pos = size - center_size - end_size - spacing;
|
||||
else if (center_expand)
|
||||
{
|
||||
center_size = size - 2 * (MAX (start_size, end_size) + spacing);
|
||||
center_size = size - 2 * MAX (start_size, end_size);
|
||||
center_pos = (size / 2) - (center_size / 2) + spacing;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ static inline gboolean gtk_counting_bloom_filter_may_contain (const GtkCounti
|
||||
*
|
||||
* The filter does not need to be freed.
|
||||
*/
|
||||
#define GTK_COUNTING_BLOOM_FILTER_INIT {{0}}
|
||||
#define GTK_COUNTING_BLOOM_FILTER_INIT { 0, }
|
||||
|
||||
/*
|
||||
* gtk_counting_bloom_filter_add:
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
* The most basic way to use a #GtkDropTarget to receive drops on a
|
||||
* widget is to create it via gtk_drop_target_new() passing in the
|
||||
* #GType of the data you want to receive and connect to the
|
||||
* #GtkDropTarget::drop signal to receive the data:
|
||||
* GtkDropTarget::drop signal to receive the data:
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static gboolean
|
||||
@@ -677,9 +677,9 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
* The value for this drop operation or %NULL if the data has not been
|
||||
* loaded yet or no drop operation is going on.
|
||||
*
|
||||
* Data may be available before the #GtkDropTarget::drop signal gets emitted -
|
||||
* for example when the #GtkDropTarget:preload property is set.
|
||||
* You can use the #GObject::notify signal to be notified of available data.
|
||||
* Data may be available before the GtkDropTarget::drop signal gets emitted -
|
||||
* for example when the GtkDropTarget:preload property is set.
|
||||
* You can use the GObject::notify signal to be notified of available data.
|
||||
*/
|
||||
properties[PROP_VALUE] =
|
||||
g_param_spec_boxed ("value",
|
||||
@@ -696,20 +696,20 @@ gtk_drop_target_class_init (GtkDropTargetClass *class)
|
||||
* @drop: the #GdkDrop
|
||||
*
|
||||
* The ::accept signal is emitted on the drop site when a drop operation
|
||||
* is about to begin.
|
||||
* is about to begin.
|
||||
* If the drop is not accepted, %FALSE will be returned and the drop target
|
||||
* will ignore the drop. If %TRUE is returned, the drop is accepted for now
|
||||
* but may be rejected later via a call to gtk_drop_target_reject() or
|
||||
* ultimately by returning %FALSE from #GtkDropTarget::drop.
|
||||
* ultimately by returning %FALSE from GtkDropTarget::drop
|
||||
*
|
||||
* The default handler for this signal decides whether to accept the drop
|
||||
* based on the formats provided by the @drop.
|
||||
*
|
||||
* If the decision whether the drop will be accepted or rejected depends
|
||||
* on the data, this function should return %TRUE, the #GtkDropTarget:preload
|
||||
* property should be set and the value should be inspected via the
|
||||
* #GObject::notify:value signal, calling gtk_drop_target_reject() if
|
||||
* required.
|
||||
* If the decision whether the drop will be accepted or rejected needs
|
||||
* inspecting the data, this function should return %TRUE, the
|
||||
* GtkDropTarget:preload property should be set and the value
|
||||
* should be inspected via the GObject::notify:value signal and then call
|
||||
* gtk_drop_target_reject().
|
||||
*
|
||||
* Returns: %TRUE if @drop is accepted
|
||||
*/
|
||||
@@ -874,6 +874,8 @@ gtk_drop_target_get_formats (GtkDropTarget *self)
|
||||
* @n_types: number of @types
|
||||
*
|
||||
* Sets the supported #GTypes for this drop target.
|
||||
*
|
||||
* The GtkDropTarget::drop signal will
|
||||
**/
|
||||
void
|
||||
gtk_drop_target_set_gtypes (GtkDropTarget *self,
|
||||
|
||||
@@ -249,7 +249,7 @@ struct _GtkExpressionWatch
|
||||
GType \
|
||||
type_name ## _get_type (void) \
|
||||
{ \
|
||||
static gsize gtk_define_expression_type_id__volatile; \
|
||||
static volatile gsize gtk_define_expression_type_id__volatile; \
|
||||
if (g_once_init_enter (>k_define_expression_type_id__volatile)) \
|
||||
{ \
|
||||
GType gtk_define_expression_type_id = \
|
||||
@@ -490,7 +490,7 @@ param_expression_values_cmp (GParamSpec *pspec,
|
||||
GType
|
||||
gtk_param_expression_get_type (void)
|
||||
{
|
||||
static gsize param_expression_type__volatile;
|
||||
static volatile gsize param_expression_type__volatile;
|
||||
|
||||
if (g_once_init_enter (¶m_expression_type__volatile))
|
||||
{
|
||||
@@ -598,7 +598,7 @@ gtk_expression_init (GtkExpression *self)
|
||||
GType
|
||||
gtk_expression_get_type (void)
|
||||
{
|
||||
static gsize expression_type__volatile;
|
||||
static volatile gsize expression_type__volatile;
|
||||
|
||||
if (g_once_init_enter (&expression_type__volatile))
|
||||
{
|
||||
|
||||
@@ -114,6 +114,9 @@ static void gtk_frame_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline);
|
||||
|
||||
static void gtk_frame_compute_child_allocation (GtkFrame *frame,
|
||||
GtkAllocation *child_allocation);
|
||||
static void gtk_frame_real_compute_child_allocation (GtkFrame *frame,
|
||||
GtkAllocation *child_allocation);
|
||||
|
||||
@@ -494,7 +497,7 @@ gtk_frame_size_allocate (GtkWidget *widget,
|
||||
GtkFramePrivate *priv = gtk_frame_get_instance_private (frame);
|
||||
GtkAllocation new_allocation;
|
||||
|
||||
GTK_FRAME_GET_CLASS (frame)->compute_child_allocation (frame, &new_allocation);
|
||||
gtk_frame_compute_child_allocation (frame, &new_allocation);
|
||||
|
||||
if (priv->label_widget &&
|
||||
gtk_widget_get_visible (priv->label_widget))
|
||||
@@ -526,6 +529,16 @@ gtk_frame_size_allocate (GtkWidget *widget,
|
||||
gtk_widget_size_allocate (priv->child, &new_allocation, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_frame_compute_child_allocation (GtkFrame *frame,
|
||||
GtkAllocation *child_allocation)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_FRAME (frame));
|
||||
g_return_if_fail (child_allocation != NULL);
|
||||
|
||||
GTK_FRAME_GET_CLASS (frame)->compute_child_allocation (frame, child_allocation);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_frame_real_compute_child_allocation (GtkFrame *frame,
|
||||
GtkAllocation *child_allocation)
|
||||
|
||||
@@ -759,7 +759,7 @@ gtk_gesture_class_init (GtkGestureClass *klass)
|
||||
"to trigger the gesture"),
|
||||
1, G_MAXUINT, 1,
|
||||
GTK_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
/**
|
||||
* GtkGesture::begin:
|
||||
* @gesture: the object which received the signal
|
||||
|
||||
@@ -51,8 +51,7 @@ enum {
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_DELAY_FACTOR = 1,
|
||||
LAST_PROP
|
||||
PROP_DELAY_FACTOR = 1
|
||||
};
|
||||
|
||||
struct _GtkGestureLongPressPrivate
|
||||
@@ -68,14 +67,15 @@ struct _GtkGestureLongPressPrivate
|
||||
};
|
||||
|
||||
static guint signals[N_SIGNALS] = { 0 };
|
||||
static GParamSpec *props[LAST_PROP] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkGestureLongPress, gtk_gesture_long_press, GTK_TYPE_GESTURE_SINGLE)
|
||||
|
||||
static void
|
||||
gtk_gesture_long_press_init (GtkGestureLongPress *gesture)
|
||||
{
|
||||
GtkGestureLongPressPrivate *priv = gtk_gesture_long_press_get_instance_private (gesture);
|
||||
GtkGestureLongPressPrivate *priv;
|
||||
|
||||
priv = gtk_gesture_long_press_get_instance_private (GTK_GESTURE_LONG_PRESS (gesture));
|
||||
priv->delay_factor = 1.0;
|
||||
}
|
||||
|
||||
@@ -275,14 +275,13 @@ gtk_gesture_long_press_class_init (GtkGestureLongPressClass *klass)
|
||||
gesture_class->cancel = gtk_gesture_long_press_cancel;
|
||||
gesture_class->sequence_state_changed = gtk_gesture_long_press_sequence_state_changed;
|
||||
|
||||
props[PROP_DELAY_FACTOR] =
|
||||
g_param_spec_double ("delay-factor",
|
||||
P_("Delay factor"),
|
||||
P_("Factor by which to modify the default timeout"),
|
||||
0.5, 2.0, 1.0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (object_class, LAST_PROP, props);
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DELAY_FACTOR,
|
||||
g_param_spec_double ("delay-factor",
|
||||
P_("Delay factor"),
|
||||
P_("Factor by which to modify the default timeout"),
|
||||
0.5, 2.0, 1.0,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkGestureLongPress::pressed:
|
||||
@@ -352,12 +351,9 @@ gtk_gesture_long_press_set_delay_factor (GtkGestureLongPress *gesture,
|
||||
g_return_if_fail (delay_factor >= 0.5);
|
||||
g_return_if_fail (delay_factor <= 2.0);
|
||||
|
||||
if (delay_factor == priv->delay_factor)
|
||||
return;
|
||||
|
||||
priv->delay_factor = delay_factor;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (gesture), props[PROP_DELAY_FACTOR]);
|
||||
g_object_notify (G_OBJECT (gesture), "delay-factor");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -322,8 +322,6 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
guint n_coords = 0, i;
|
||||
double surf_x, surf_y;
|
||||
GtkNative *native;
|
||||
GtkWidget *event_widget;
|
||||
GtkWidget *controller_widget;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_GESTURE_STYLUS (gesture), FALSE);
|
||||
g_return_val_if_fail (backlog != NULL && n_elems != NULL, FALSE);
|
||||
@@ -340,26 +338,28 @@ gtk_gesture_stylus_get_backlog (GtkGestureStylus *gesture,
|
||||
gtk_native_get_surface_transform (native, &surf_x, &surf_y);
|
||||
|
||||
backlog_array = g_array_new (FALSE, FALSE, sizeof (GdkTimeCoord));
|
||||
event_widget = gtk_get_event_widget (event);
|
||||
controller_widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
for (i = 0; i < n_coords; i++)
|
||||
{
|
||||
const GdkTimeCoord *time_coord = &history[i];
|
||||
GdkTimeCoord *time_coord = &history[i];
|
||||
graphene_point_t p;
|
||||
|
||||
if (gtk_widget_compute_point (event_widget, controller_widget,
|
||||
g_array_append_val (backlog_array, *time_coord);
|
||||
time_coord = &g_array_index (backlog_array, GdkTimeCoord, backlog_array->len - 1);
|
||||
|
||||
if (gtk_widget_compute_point (GTK_WIDGET (native),
|
||||
gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture)),
|
||||
&GRAPHENE_POINT_INIT (time_coord->axes[GDK_AXIS_X] - surf_x,
|
||||
time_coord->axes[GDK_AXIS_Y] - surf_y),
|
||||
&p))
|
||||
{
|
||||
GdkTimeCoord translated_coord = *time_coord;
|
||||
|
||||
translated_coord.axes[GDK_AXIS_X] = p.x;
|
||||
translated_coord.axes[GDK_AXIS_Y] = p.y;
|
||||
|
||||
g_array_append_val (backlog_array, translated_coord);
|
||||
time_coord->axes[GDK_AXIS_X] = p.x;
|
||||
time_coord->axes[GDK_AXIS_Y] = p.y;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
g_array_set_size (backlog_array, backlog_array->len - 1);
|
||||
}
|
||||
}
|
||||
|
||||
*n_elems = backlog_array->len;
|
||||
*backlog = (GdkTimeCoord *) g_array_free (backlog_array, FALSE);
|
||||
|
||||
@@ -167,7 +167,7 @@ create_window_controls (GtkHeaderBar *bar)
|
||||
g_object_bind_property (controls, "empty",
|
||||
controls, "visible",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
|
||||
gtk_box_prepend (GTK_BOX (bar->start_box), controls);
|
||||
gtk_box_append (GTK_BOX (bar->start_box), controls);
|
||||
bar->start_window_controls = controls;
|
||||
|
||||
controls = gtk_window_controls_new (GTK_PACK_END);
|
||||
|
||||
@@ -3133,7 +3133,7 @@ scan_directory (GtkIconTheme *self,
|
||||
|
||||
static GHashTable *
|
||||
scan_resource_directory (GtkIconTheme *self,
|
||||
const char *full_dir,
|
||||
char *full_dir,
|
||||
GtkStringSet *set)
|
||||
{
|
||||
GHashTable *icons = NULL;
|
||||
|
||||
@@ -24,9 +24,27 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void _gtk_label_mnemonics_visible_apply_recursively (GtkWidget *widget,
|
||||
gboolean mnemonics_visible);
|
||||
int _gtk_label_get_cursor_position (GtkLabel *label);
|
||||
int _gtk_label_get_selection_bound (GtkLabel *label);
|
||||
|
||||
int _gtk_label_get_n_links (GtkLabel *label);
|
||||
int _gtk_label_get_link_at (GtkLabel *label,
|
||||
int pos);
|
||||
void _gtk_label_activate_link (GtkLabel *label,
|
||||
int idx);
|
||||
const char *_gtk_label_get_link_uri (GtkLabel *label,
|
||||
int idx);
|
||||
void _gtk_label_get_link_extent (GtkLabel *label,
|
||||
int idx,
|
||||
int *start,
|
||||
int *end);
|
||||
gboolean _gtk_label_get_link_visited (GtkLabel *label,
|
||||
int idx);
|
||||
gboolean _gtk_label_get_link_focused (GtkLabel *label,
|
||||
int idx);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_LABEL_PRIVATE_H__ */
|
||||
|
||||
@@ -27,13 +27,10 @@
|
||||
* SECTION:gtkmediastream
|
||||
* @Short_description: Display media in GTK
|
||||
* @Title: GtkMediaStream
|
||||
* @See_also: #GdkPaintable, #GtkMediaFile
|
||||
* @See_also: #GdkPaintable
|
||||
*
|
||||
* #GtkMediaStream is the integration point for media playback inside GTK.
|
||||
*
|
||||
* GTK provides an implementation of the #GtkMediaStream interface that
|
||||
* is called #GtkMediaFile.
|
||||
*
|
||||
* Apart from application-facing API for stream playback, #GtkMediaStream
|
||||
* has a number of APIs that are only useful for implementations and should
|
||||
* not be used in applications:
|
||||
|
||||
@@ -319,7 +319,6 @@ gtk_menu_section_box_insert_func (GtkMenuTrackerItem *item,
|
||||
|
||||
widget = g_object_new (GTK_TYPE_MODEL_BUTTON,
|
||||
"popover", submenu,
|
||||
"indicator-size-group", box->indicators,
|
||||
NULL);
|
||||
g_object_bind_property (item, "label", widget, "text", G_BINDING_SYNC_CREATE);
|
||||
g_object_bind_property (item, "icon", widget, "icon", G_BINDING_SYNC_CREATE);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* Modified by the GTK+ Team and others 1997-2003. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@@ -113,6 +113,18 @@ struct _GtkMessageDialogClass
|
||||
GtkDialogClass parent_class;
|
||||
};
|
||||
|
||||
static void gtk_message_dialog_constructed (GObject *object);
|
||||
static void gtk_message_dialog_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_message_dialog_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gtk_message_dialog_add_buttons (GtkMessageDialog *message_dialog,
|
||||
GtkButtonsType buttons);
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_MESSAGE_TYPE,
|
||||
@@ -127,9 +139,148 @@ enum {
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkMessageDialog, gtk_message_dialog, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
gtk_message_dialog_class_init (GtkMessageDialogClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class;
|
||||
GObjectClass *gobject_class;
|
||||
|
||||
widget_class = GTK_WIDGET_CLASS (class);
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
|
||||
gobject_class->constructed = gtk_message_dialog_constructed;
|
||||
gobject_class->set_property = gtk_message_dialog_set_property;
|
||||
gobject_class->get_property = gtk_message_dialog_get_property;
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:message-type:
|
||||
*
|
||||
* The type of the message.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MESSAGE_TYPE,
|
||||
g_param_spec_enum ("message-type",
|
||||
P_("Message Type"),
|
||||
P_("The type of message"),
|
||||
GTK_TYPE_MESSAGE_TYPE,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BUTTONS,
|
||||
g_param_spec_enum ("buttons",
|
||||
P_("Message Buttons"),
|
||||
P_("The buttons shown in the message dialog"),
|
||||
GTK_TYPE_BUTTONS_TYPE,
|
||||
GTK_BUTTONS_NONE,
|
||||
GTK_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:text:
|
||||
*
|
||||
* The primary text of the message dialog. If the dialog has
|
||||
* a secondary text, this will appear as the title.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEXT,
|
||||
g_param_spec_string ("text",
|
||||
P_("Text"),
|
||||
P_("The primary text of the message dialog"),
|
||||
"",
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:use-markup:
|
||||
*
|
||||
* %TRUE if the primary text of the dialog includes Pango markup.
|
||||
* See pango_parse_markup().
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_USE_MARKUP,
|
||||
g_param_spec_boolean ("use-markup",
|
||||
P_("Use Markup"),
|
||||
P_("The primary text of the title includes Pango markup."),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:secondary-text:
|
||||
*
|
||||
* The secondary text of the message dialog.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SECONDARY_TEXT,
|
||||
g_param_spec_string ("secondary-text",
|
||||
P_("Secondary Text"),
|
||||
P_("The secondary text of the message dialog"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:secondary-use-markup:
|
||||
*
|
||||
* %TRUE if the secondary text of the dialog includes Pango markup.
|
||||
* See pango_parse_markup().
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SECONDARY_USE_MARKUP,
|
||||
g_param_spec_boolean ("secondary-use-markup",
|
||||
P_("Use Markup in secondary"),
|
||||
P_("The secondary text includes Pango markup."),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:message-area:
|
||||
*
|
||||
* The #GtkBox that corresponds to the message area of this dialog. See
|
||||
* gtk_message_dialog_get_message_area() for a detailed description of this
|
||||
* area.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MESSAGE_AREA,
|
||||
g_param_spec_object ("message-area",
|
||||
P_("Message area"),
|
||||
P_("GtkBox that holds the dialog’s primary and secondary labels"),
|
||||
GTK_TYPE_WIDGET,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/* Setup Composite data */
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkmessagedialog.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, label);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, secondary_label);
|
||||
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkMessageDialog, message_area);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_init (GtkMessageDialog *dialog)
|
||||
{
|
||||
GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
GtkWidget *action_area;
|
||||
GtkSettings *settings;
|
||||
gboolean use_caret;
|
||||
|
||||
priv->has_primary_markup = FALSE;
|
||||
priv->has_secondary_text = FALSE;
|
||||
priv->has_primary_markup = FALSE;
|
||||
priv->has_secondary_text = FALSE;
|
||||
priv->message_type = GTK_MESSAGE_OTHER;
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (dialog), "message");
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (dialog));
|
||||
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
||||
gtk_widget_set_halign (action_area, GTK_ALIGN_FILL);
|
||||
gtk_box_set_homogeneous (GTK_BOX (action_area), TRUE);
|
||||
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (dialog));
|
||||
g_object_get (settings, "gtk-keynav-use-caret", &use_caret, NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->label), use_caret);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_type (GtkMessageDialog *dialog,
|
||||
GtkMessageType type)
|
||||
GtkMessageType type)
|
||||
{
|
||||
GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
|
||||
@@ -141,159 +292,6 @@ setup_type (GtkMessageDialog *dialog,
|
||||
g_object_notify (G_OBJECT (dialog), "message-type");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_add_buttons (GtkMessageDialog *message_dialog,
|
||||
GtkButtonsType buttons)
|
||||
{
|
||||
GtkDialog* dialog = GTK_DIALOG (message_dialog);
|
||||
|
||||
switch (buttons)
|
||||
{
|
||||
case GTK_BUTTONS_NONE:
|
||||
/* nothing */
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK:
|
||||
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_CLOSE:
|
||||
gtk_dialog_add_button (dialog, _("_Close"), GTK_RESPONSE_CLOSE);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_CANCEL:
|
||||
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_YES_NO:
|
||||
gtk_dialog_add_button (dialog, _("_No"), GTK_RESPONSE_NO);
|
||||
gtk_dialog_add_button (dialog, _("_Yes"), GTK_RESPONSE_YES);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK_CANCEL:
|
||||
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Unknown GtkButtonsType");
|
||||
break;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (message_dialog), "buttons");
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG (object);
|
||||
GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MESSAGE_TYPE:
|
||||
setup_type (dialog, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_BUTTONS:
|
||||
gtk_message_dialog_add_buttons (dialog, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_TEXT:
|
||||
if (priv->has_primary_markup)
|
||||
gtk_label_set_markup (GTK_LABEL (priv->label), g_value_get_string (value));
|
||||
else
|
||||
gtk_label_set_text (GTK_LABEL (priv->label), g_value_get_string (value));
|
||||
break;
|
||||
case PROP_USE_MARKUP:
|
||||
if (priv->has_primary_markup != g_value_get_boolean (value))
|
||||
{
|
||||
priv->has_primary_markup = g_value_get_boolean (value);
|
||||
gtk_label_set_use_markup (GTK_LABEL (priv->label), priv->has_primary_markup);
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
case PROP_SECONDARY_TEXT:
|
||||
{
|
||||
const char *txt = g_value_get_string (value);
|
||||
|
||||
if (gtk_label_get_use_markup (GTK_LABEL (priv->secondary_label)))
|
||||
gtk_label_set_markup (GTK_LABEL (priv->secondary_label), txt);
|
||||
else
|
||||
gtk_label_set_text (GTK_LABEL (priv->secondary_label), txt);
|
||||
|
||||
if (txt)
|
||||
{
|
||||
priv->has_secondary_text = TRUE;
|
||||
gtk_widget_add_css_class (priv->label, "title");
|
||||
gtk_widget_show (priv->secondary_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->has_secondary_text = FALSE;
|
||||
gtk_widget_remove_css_class (priv->label, "title");
|
||||
gtk_widget_hide (priv->secondary_label);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_SECONDARY_USE_MARKUP:
|
||||
if (gtk_label_get_use_markup (GTK_LABEL (priv->secondary_label)) != g_value_get_boolean (value))
|
||||
{
|
||||
gtk_label_set_use_markup (GTK_LABEL (priv->secondary_label), g_value_get_boolean (value));
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG (object);
|
||||
GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MESSAGE_TYPE:
|
||||
g_value_set_enum (value, (GtkMessageType) priv->message_type);
|
||||
break;
|
||||
case PROP_TEXT:
|
||||
g_value_set_string (value, gtk_label_get_label (GTK_LABEL (priv->label)));
|
||||
break;
|
||||
case PROP_USE_MARKUP:
|
||||
g_value_set_boolean (value, priv->has_primary_markup);
|
||||
break;
|
||||
case PROP_SECONDARY_TEXT:
|
||||
if (priv->has_secondary_text)
|
||||
g_value_set_string (value,
|
||||
gtk_label_get_label (GTK_LABEL (priv->secondary_label)));
|
||||
else
|
||||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
case PROP_SECONDARY_USE_MARKUP:
|
||||
if (priv->has_secondary_text)
|
||||
g_value_set_boolean (value,
|
||||
gtk_label_get_use_markup (GTK_LABEL (priv->secondary_label)));
|
||||
else
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
case PROP_MESSAGE_AREA:
|
||||
g_value_set_object (value, priv->message_area);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_title (GObject *dialog,
|
||||
GParamSpec *pspec,
|
||||
@@ -340,137 +338,115 @@ gtk_message_dialog_constructed (GObject *object)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_class_init (GtkMessageDialogClass *class)
|
||||
static void
|
||||
gtk_message_dialog_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkWidgetClass *widget_class;
|
||||
GObjectClass *gobject_class;
|
||||
GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG (object);
|
||||
GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
|
||||
widget_class = GTK_WIDGET_CLASS (class);
|
||||
gobject_class = G_OBJECT_CLASS (class);
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MESSAGE_TYPE:
|
||||
setup_type (dialog, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_BUTTONS:
|
||||
gtk_message_dialog_add_buttons (dialog, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_TEXT:
|
||||
if (priv->has_primary_markup)
|
||||
gtk_label_set_markup (GTK_LABEL (priv->label),
|
||||
g_value_get_string (value));
|
||||
else
|
||||
gtk_label_set_text (GTK_LABEL (priv->label),
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
case PROP_USE_MARKUP:
|
||||
if (priv->has_primary_markup != g_value_get_boolean (value))
|
||||
{
|
||||
priv->has_primary_markup = g_value_get_boolean (value);
|
||||
gtk_label_set_use_markup (GTK_LABEL (priv->label), priv->has_primary_markup);
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
case PROP_SECONDARY_TEXT:
|
||||
{
|
||||
const char *txt = g_value_get_string (value);
|
||||
|
||||
gobject_class->constructed = gtk_message_dialog_constructed;
|
||||
gobject_class->set_property = gtk_message_dialog_set_property;
|
||||
gobject_class->get_property = gtk_message_dialog_get_property;
|
||||
if (gtk_label_get_use_markup (GTK_LABEL (priv->secondary_label)))
|
||||
gtk_label_set_markup (GTK_LABEL (priv->secondary_label), txt);
|
||||
else
|
||||
gtk_label_set_text (GTK_LABEL (priv->secondary_label), txt);
|
||||
|
||||
/**
|
||||
* GtkMessageDialog:message-type:
|
||||
*
|
||||
* The type of the message.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MESSAGE_TYPE,
|
||||
g_param_spec_enum ("message-type",
|
||||
P_("Message Type"),
|
||||
P_("The type of message"),
|
||||
GTK_TYPE_MESSAGE_TYPE,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_PARAM_READWRITE|G_PARAM_CONSTRUCT|G_PARAM_EXPLICIT_NOTIFY));
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_BUTTONS,
|
||||
g_param_spec_enum ("buttons",
|
||||
P_("Message Buttons"),
|
||||
P_("The buttons shown in the message dialog"),
|
||||
GTK_TYPE_BUTTONS_TYPE,
|
||||
GTK_BUTTONS_NONE,
|
||||
GTK_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY));
|
||||
/**
|
||||
* GtkMessageDialog:text:
|
||||
*
|
||||
* The primary text of the message dialog. If the dialog has
|
||||
* a secondary text, this will appear as the title.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEXT,
|
||||
g_param_spec_string ("text",
|
||||
P_("Text"),
|
||||
P_("The primary text of the message dialog"),
|
||||
"",
|
||||
GTK_PARAM_READWRITE));
|
||||
/**
|
||||
* GtkMessageDialog:use-markup:
|
||||
*
|
||||
* %TRUE if the primary text of the dialog includes Pango markup.
|
||||
* See pango_parse_markup().
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_USE_MARKUP,
|
||||
g_param_spec_boolean ("use-markup",
|
||||
P_("Use Markup"),
|
||||
P_("The primary text of the title includes Pango markup."),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
/**
|
||||
* GtkMessageDialog:secondary-text:
|
||||
*
|
||||
* The secondary text of the message dialog.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SECONDARY_TEXT,
|
||||
g_param_spec_string ("secondary-text",
|
||||
P_("Secondary Text"),
|
||||
P_("The secondary text of the message dialog"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE));
|
||||
/**
|
||||
* GtkMessageDialog:secondary-use-markup:
|
||||
*
|
||||
* %TRUE if the secondary text of the dialog includes Pango markup.
|
||||
* See pango_parse_markup().
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SECONDARY_USE_MARKUP,
|
||||
g_param_spec_boolean ("secondary-use-markup",
|
||||
P_("Use Markup in secondary"),
|
||||
P_("The secondary text includes Pango markup."),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
/**
|
||||
* GtkMessageDialog:message-area:
|
||||
*
|
||||
* The #GtkBox that corresponds to the message area of this dialog. See
|
||||
* gtk_message_dialog_get_message_area() for a detailed description of this
|
||||
* area.
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MESSAGE_AREA,
|
||||
g_param_spec_object ("message-area",
|
||||
P_("Message area"),
|
||||
P_("GtkBox that holds the dialog’s primary and secondary labels"),
|
||||
GTK_TYPE_WIDGET,
|
||||
GTK_PARAM_READABLE));
|
||||
if (txt)
|
||||
{
|
||||
priv->has_secondary_text = TRUE;
|
||||
gtk_widget_show (priv->secondary_label);
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->has_secondary_text = FALSE;
|
||||
gtk_widget_hide (priv->secondary_label);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PROP_SECONDARY_USE_MARKUP:
|
||||
if (gtk_label_get_use_markup (GTK_LABEL (priv->secondary_label)) != g_value_get_boolean (value))
|
||||
{
|
||||
gtk_label_set_use_markup (GTK_LABEL (priv->secondary_label), g_value_get_boolean (value));
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/ui/gtkmessagedialog.ui");
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, label);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkMessageDialog, secondary_label);
|
||||
gtk_widget_class_bind_template_child_internal_private (widget_class, GtkMessageDialog, message_area);
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_init (GtkMessageDialog *dialog)
|
||||
static void
|
||||
gtk_message_dialog_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG (object);
|
||||
GtkMessageDialogPrivate *priv = gtk_message_dialog_get_instance_private (dialog);
|
||||
GtkWidget *action_area;
|
||||
GtkSettings *settings;
|
||||
gboolean use_caret;
|
||||
|
||||
priv->has_primary_markup = FALSE;
|
||||
priv->has_secondary_text = FALSE;
|
||||
priv->has_primary_markup = FALSE;
|
||||
priv->has_secondary_text = FALSE;
|
||||
priv->message_type = GTK_MESSAGE_OTHER;
|
||||
|
||||
gtk_widget_add_css_class (GTK_WIDGET (dialog), "message");
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (dialog));
|
||||
action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
||||
gtk_widget_set_halign (action_area, GTK_ALIGN_FILL);
|
||||
gtk_box_set_homogeneous (GTK_BOX (action_area), TRUE);
|
||||
|
||||
settings = gtk_widget_get_settings (GTK_WIDGET (dialog));
|
||||
g_object_get (settings, "gtk-keynav-use-caret", &use_caret, NULL);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->label), use_caret);
|
||||
gtk_label_set_selectable (GTK_LABEL (priv->secondary_label), use_caret);
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MESSAGE_TYPE:
|
||||
g_value_set_enum (value, (GtkMessageType) priv->message_type);
|
||||
break;
|
||||
case PROP_TEXT:
|
||||
g_value_set_string (value, gtk_label_get_label (GTK_LABEL (priv->label)));
|
||||
break;
|
||||
case PROP_USE_MARKUP:
|
||||
g_value_set_boolean (value, priv->has_primary_markup);
|
||||
break;
|
||||
case PROP_SECONDARY_TEXT:
|
||||
if (priv->has_secondary_text)
|
||||
g_value_set_string (value,
|
||||
gtk_label_get_label (GTK_LABEL (priv->secondary_label)));
|
||||
else
|
||||
g_value_set_string (value, NULL);
|
||||
break;
|
||||
case PROP_SECONDARY_USE_MARKUP:
|
||||
if (priv->has_secondary_text)
|
||||
g_value_set_boolean (value,
|
||||
gtk_label_get_use_markup (GTK_LABEL (priv->secondary_label)));
|
||||
else
|
||||
g_value_set_boolean (value, FALSE);
|
||||
break;
|
||||
case PROP_MESSAGE_AREA:
|
||||
g_value_set_object (value, priv->message_area);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,9 +482,9 @@ gtk_message_dialog_new (GtkWindow *parent,
|
||||
|
||||
widget = g_object_new (GTK_TYPE_MESSAGE_DIALOG,
|
||||
"use-header-bar", FALSE,
|
||||
"message-type", type,
|
||||
"buttons", buttons,
|
||||
NULL);
|
||||
"message-type", type,
|
||||
"buttons", buttons,
|
||||
NULL);
|
||||
dialog = GTK_DIALOG (widget);
|
||||
|
||||
if (message_format)
|
||||
@@ -569,7 +545,7 @@ gtk_message_dialog_new (GtkWindow *parent,
|
||||
* gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog),
|
||||
* markup);
|
||||
* ]|
|
||||
*
|
||||
*
|
||||
* Returns: a new #GtkMessageDialog
|
||||
**/
|
||||
GtkWidget*
|
||||
@@ -606,7 +582,7 @@ gtk_message_dialog_new_with_markup (GtkWindow *parent,
|
||||
* gtk_message_dialog_set_markup:
|
||||
* @message_dialog: a #GtkMessageDialog
|
||||
* @str: markup string (see [Pango markup format][PangoMarkupFormat])
|
||||
*
|
||||
*
|
||||
* Sets the text of the message dialog to be @str, which is marked
|
||||
* up with the [Pango text markup language][PangoMarkupFormat].
|
||||
**/
|
||||
@@ -645,7 +621,6 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
|
||||
if (message_format)
|
||||
{
|
||||
priv->has_secondary_text = TRUE;
|
||||
gtk_widget_add_css_class (priv->label, "title");
|
||||
|
||||
va_start (args, message_format);
|
||||
msg = g_strdup_vprintf (message_format, args);
|
||||
@@ -659,7 +634,6 @@ gtk_message_dialog_format_secondary_text (GtkMessageDialog *message_dialog,
|
||||
else
|
||||
{
|
||||
priv->has_secondary_text = FALSE;
|
||||
gtk_widget_remove_css_class (priv->label, "title");
|
||||
gtk_widget_hide (priv->secondary_label);
|
||||
}
|
||||
}
|
||||
@@ -703,7 +677,6 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
|
||||
if (message_format)
|
||||
{
|
||||
priv->has_secondary_text = TRUE;
|
||||
gtk_widget_add_css_class (priv->label, "title");
|
||||
|
||||
va_start (args, message_format);
|
||||
msg = g_strdup_vprintf (message_format, args);
|
||||
@@ -717,7 +690,6 @@ gtk_message_dialog_format_secondary_markup (GtkMessageDialog *message_dialog,
|
||||
else
|
||||
{
|
||||
priv->has_secondary_text = FALSE;
|
||||
gtk_widget_remove_css_class (priv->label, "title");
|
||||
gtk_widget_hide (priv->secondary_label);
|
||||
}
|
||||
}
|
||||
@@ -745,3 +717,45 @@ gtk_message_dialog_get_message_area (GtkMessageDialog *message_dialog)
|
||||
return priv->message_area;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_message_dialog_add_buttons (GtkMessageDialog* message_dialog,
|
||||
GtkButtonsType buttons)
|
||||
{
|
||||
GtkDialog* dialog = GTK_DIALOG (message_dialog);
|
||||
|
||||
switch (buttons)
|
||||
{
|
||||
case GTK_BUTTONS_NONE:
|
||||
/* nothing */
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK:
|
||||
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_CLOSE:
|
||||
gtk_dialog_add_button (dialog, _("_Close"), GTK_RESPONSE_CLOSE);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_CANCEL:
|
||||
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_YES_NO:
|
||||
gtk_dialog_add_button (dialog, _("_No"), GTK_RESPONSE_NO);
|
||||
gtk_dialog_add_button (dialog, _("_Yes"), GTK_RESPONSE_YES);
|
||||
break;
|
||||
|
||||
case GTK_BUTTONS_OK_CANCEL:
|
||||
gtk_dialog_add_button (dialog, _("_Cancel"), GTK_RESPONSE_CANCEL);
|
||||
gtk_dialog_add_button (dialog, _("_OK"), GTK_RESPONSE_OK);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_warning ("Unknown GtkButtonsType");
|
||||
break;
|
||||
}
|
||||
|
||||
g_object_notify (G_OBJECT (message_dialog), "buttons");
|
||||
}
|
||||
|
||||
|
||||
@@ -1713,7 +1713,7 @@ gtk_print_operation_run_with_dialog (GtkPrintOperation *op,
|
||||
GtkPrintOperationPrivate *priv;
|
||||
IPrintDialogCallback *callback;
|
||||
HPROPSHEETPAGE prop_page;
|
||||
static gsize common_controls_initialized = 0;
|
||||
static volatile gsize common_controls_initialized = 0;
|
||||
|
||||
if (g_once_init_enter (&common_controls_initialized))
|
||||
{
|
||||
|
||||
@@ -307,8 +307,7 @@ GtkPageSetup *gtk_print_run_page_setup_dialog (GtkWindow
|
||||
|
||||
/**
|
||||
* GtkPageSetupDoneFunc:
|
||||
* @page_setup: the #GtkPageSetup that has been passed to
|
||||
* gtk_print_run_page_setup_dialog_async()
|
||||
* @page_setup: the #GtkPageSetup that has been
|
||||
* @data: (closure): user data that has been passed to
|
||||
* gtk_print_run_page_setup_dialog_async()
|
||||
*
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
GType
|
||||
_@enum_name@_get_type (void)
|
||||
{
|
||||
static gsize g_define_type_id__volatile = 0;
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
|
||||
@@ -368,6 +368,32 @@ gtk_render_layout (GtkStyleContext *context,
|
||||
gsk_render_node_unref (node);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_do_render_line (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x0,
|
||||
double y0,
|
||||
double x1,
|
||||
double y1)
|
||||
{
|
||||
const GdkRGBA *color;
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
cairo_set_line_width (cr, 1);
|
||||
|
||||
cairo_move_to (cr, x0 + 0.5, y0 + 0.5);
|
||||
cairo_line_to (cr, x1 + 0.5, y1 + 0.5);
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, color);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_render_line:
|
||||
* @context: a #GtkStyleContext
|
||||
@@ -387,25 +413,10 @@ gtk_render_line (GtkStyleContext *context,
|
||||
double x1,
|
||||
double y1)
|
||||
{
|
||||
const GdkRGBA *color;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (cr != NULL);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
||||
cairo_set_line_width (cr, 1);
|
||||
|
||||
cairo_move_to (cr, x0 + 0.5, y0 + 0.5);
|
||||
cairo_line_to (cr, x1 + 0.5, y1 + 0.5);
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, color);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
gtk_do_render_line (context, cr, x0, y0, x1, y1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1087,7 +1087,11 @@ static void
|
||||
indicator_set_over (Indicator *indicator,
|
||||
gboolean over)
|
||||
{
|
||||
g_clear_handle_id (&indicator->over_timeout_id, g_source_remove);
|
||||
if (indicator->over_timeout_id)
|
||||
{
|
||||
g_source_remove (indicator->over_timeout_id);
|
||||
indicator->over_timeout_id = 0;
|
||||
}
|
||||
|
||||
if (indicator->over == over)
|
||||
return;
|
||||
@@ -1166,8 +1170,11 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
|
||||
gtk_widget_is_ancestor (target, priv->hindicator.scrollbar) ||
|
||||
gtk_widget_is_ancestor (target, priv->vindicator.scrollbar)));
|
||||
|
||||
|
||||
g_clear_handle_id (&indicator->over_timeout_id, g_source_remove);
|
||||
if (indicator->over_timeout_id)
|
||||
{
|
||||
g_source_remove (indicator->over_timeout_id);
|
||||
indicator->over_timeout_id = 0;
|
||||
}
|
||||
|
||||
if (on_scrollbar)
|
||||
indicator_set_over (indicator, TRUE);
|
||||
@@ -1367,7 +1374,11 @@ scrolled_window_scroll (GtkScrolledWindow *scrolled_window,
|
||||
new_value);
|
||||
}
|
||||
|
||||
g_clear_handle_id (&priv->scroll_events_overshoot_id, g_source_remove);
|
||||
if (priv->scroll_events_overshoot_id)
|
||||
{
|
||||
g_source_remove (priv->scroll_events_overshoot_id);
|
||||
priv->scroll_events_overshoot_id = 0;
|
||||
}
|
||||
|
||||
if (!priv->smooth_scroll &&
|
||||
_gtk_scrolled_window_get_overshoot (scrolled_window, NULL, NULL))
|
||||
@@ -2599,7 +2610,12 @@ gtk_scrolled_window_dispose (GObject *object)
|
||||
|
||||
g_clear_pointer (&priv->hscrolling, gtk_kinetic_scrolling_free);
|
||||
g_clear_pointer (&priv->vscrolling, gtk_kinetic_scrolling_free);
|
||||
g_clear_handle_id (&priv->scroll_events_overshoot_id, g_source_remove);
|
||||
|
||||
if (priv->scroll_events_overshoot_id)
|
||||
{
|
||||
g_source_remove (priv->scroll_events_overshoot_id);
|
||||
priv->scroll_events_overshoot_id = 0;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_scrolled_window_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -3531,8 +3547,17 @@ gtk_scrolled_window_map (GtkWidget *widget)
|
||||
static void
|
||||
indicator_reset (Indicator *indicator)
|
||||
{
|
||||
g_clear_handle_id (&indicator->conceil_timer, g_source_remove);
|
||||
g_clear_handle_id (&indicator->over_timeout_id, g_source_remove);
|
||||
if (indicator->conceil_timer)
|
||||
{
|
||||
g_source_remove (indicator->conceil_timer);
|
||||
indicator->conceil_timer = 0;
|
||||
}
|
||||
|
||||
if (indicator->over_timeout_id)
|
||||
{
|
||||
g_source_remove (indicator->over_timeout_id);
|
||||
indicator->over_timeout_id = 0;
|
||||
}
|
||||
|
||||
if (indicator->scrollbar && indicator->tick_id)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <glib.h>
|
||||
|
||||
/*
|
||||
* Main functionality
|
||||
|
||||
@@ -95,6 +95,11 @@
|
||||
* to use gtk_widget_get_settings().
|
||||
*/
|
||||
|
||||
|
||||
#define DEFAULT_TIMEOUT_INITIAL 500
|
||||
#define DEFAULT_TIMEOUT_REPEAT 50
|
||||
#define DEFAULT_TIMEOUT_EXPAND 500
|
||||
|
||||
typedef struct _GtkSettingsClass GtkSettingsClass;
|
||||
typedef struct _GtkSettingsPropertyValue GtkSettingsPropertyValue;
|
||||
typedef struct _GtkSettingsValuePrivate GtkSettingsValuePrivate;
|
||||
@@ -236,7 +241,6 @@ static void
|
||||
gtk_settings_init (GtkSettings *settings)
|
||||
{
|
||||
GParamSpec **pspecs, **p;
|
||||
guint n_pspecs;
|
||||
guint i = 0;
|
||||
char *path;
|
||||
const char * const *config_dirs;
|
||||
@@ -251,11 +255,14 @@ gtk_settings_init (GtkSettings *settings)
|
||||
* notification for them (at least notification for internal properties
|
||||
* will instantly be caught)
|
||||
*/
|
||||
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), &n_pspecs);
|
||||
settings->property_values = g_new0 (GtkSettingsPropertyValue, n_pspecs);
|
||||
pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (settings), NULL);
|
||||
for (p = pspecs; *p; p++)
|
||||
if ((*p)->owner_type == G_OBJECT_TYPE (settings))
|
||||
i++;
|
||||
settings->property_values = g_new0 (GtkSettingsPropertyValue, i);
|
||||
i = 0;
|
||||
g_object_freeze_notify (G_OBJECT (settings));
|
||||
|
||||
i = 0;
|
||||
for (p = pspecs; *p; p++)
|
||||
{
|
||||
GParamSpec *pspec = *p;
|
||||
@@ -273,23 +280,27 @@ gtk_settings_init (GtkSettings *settings)
|
||||
g_free (pspecs);
|
||||
|
||||
path = g_build_filename (_gtk_get_data_prefix (), "share", "gtk-4.0", "settings.ini", NULL);
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
g_free (path);
|
||||
|
||||
path = g_build_filename (_gtk_get_sysconfdir (), "gtk-4.0", "settings.ini", NULL);
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
g_free (path);
|
||||
|
||||
config_dirs = g_get_system_config_dirs ();
|
||||
for (i = 0; config_dirs[i] != NULL; i++)
|
||||
{
|
||||
path = g_build_filename (config_dirs[i], "gtk-4.0", "settings.ini", NULL);
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
path = g_build_filename (g_get_user_config_dir (), "gtk-4.0", "settings.ini", NULL);
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_DEFAULT);
|
||||
g_free (path);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (settings));
|
||||
@@ -1684,7 +1695,8 @@ settings_update_theme (GtkSettings *settings)
|
||||
if (theme_dir)
|
||||
{
|
||||
path = g_build_filename (theme_dir, "settings.ini", NULL);
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_THEME);
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS))
|
||||
gtk_settings_load_from_key_file (settings, path, GTK_SETTINGS_SOURCE_THEME);
|
||||
g_free (path);
|
||||
}
|
||||
|
||||
@@ -1721,18 +1733,13 @@ gtk_settings_load_from_key_file (GtkSettings *settings,
|
||||
char **keys;
|
||||
gsize n_keys;
|
||||
int i;
|
||||
char *contents;
|
||||
gsize contents_len;
|
||||
|
||||
if (!g_file_get_contents (path, &contents, &contents_len, NULL))
|
||||
return;
|
||||
|
||||
error = NULL;
|
||||
keys = NULL;
|
||||
|
||||
keyfile = g_key_file_new ();
|
||||
|
||||
if (!g_key_file_load_from_data (keyfile, contents, contents_len, G_KEY_FILE_NONE, &error))
|
||||
if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, &error))
|
||||
{
|
||||
g_warning ("Failed to parse %s: %s", path, error->message);
|
||||
|
||||
@@ -1843,7 +1850,6 @@ gtk_settings_load_from_key_file (GtkSettings *settings,
|
||||
}
|
||||
|
||||
out:
|
||||
g_free (contents);
|
||||
g_strfreev (keys);
|
||||
g_key_file_free (keyfile);
|
||||
}
|
||||
|
||||
@@ -108,11 +108,24 @@ gtk_shortcut_manager_default_remove_controller (GtkShortcutManager *self,
|
||||
if (model)
|
||||
{
|
||||
GListModel *store;
|
||||
guint position;
|
||||
guint position, len;
|
||||
|
||||
store = gtk_flatten_list_model_get_model (model);
|
||||
if (g_list_store_find (G_LIST_STORE (store), controller, &position))
|
||||
#if 0 && GLIB_CHECK_VERSION(2,64,0)
|
||||
if (_g_list_store_find (G_LIST_STORE (store), controller, &position))
|
||||
g_list_store_remove (G_LIST_STORE (store), position);
|
||||
#else
|
||||
for (position = 0, len = g_list_model_get_n_items (store); position < len; position++)
|
||||
{
|
||||
GtkShortcutController *item = g_list_model_get_item (store, position);
|
||||
g_object_unref (item);
|
||||
if (item == controller)
|
||||
{
|
||||
g_list_store_remove (G_LIST_STORE (store), position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -399,6 +399,9 @@ gtk_shortcut_trigger_compare (gconstpointer trigger1,
|
||||
struct _GtkNeverTrigger
|
||||
{
|
||||
GtkShortcutTrigger parent_instance;
|
||||
|
||||
guint never;
|
||||
GdkModifierType modifiers;
|
||||
};
|
||||
|
||||
struct _GtkNeverTriggerClass
|
||||
|
||||
@@ -62,11 +62,11 @@ G_STMT_START { \
|
||||
G_STMT_START { \
|
||||
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
||||
GtkAccessibleProperty __p = (property); \
|
||||
char *value__ = gtk_test_accessible_check_property (__a, __p, __VA_ARGS__); \
|
||||
if (value__ == NULL) ; else { \
|
||||
char *msg__ = g_strdup_printf ("assertion failed: (" #accessible ".accessible-property(" #property ") == " # __VA_ARGS__ "): value = '%s'", value__); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg__); \
|
||||
g_free (msg__); \
|
||||
char *__value = gtk_test_accessible_check_property (__a, __p, __VA_ARGS__); \
|
||||
if (__value == NULL) ; else { \
|
||||
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-property(" #property ") == " # __VA_ARGS__ "): value = '%s'", __value); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
||||
g_free (__msg); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
@@ -84,11 +84,11 @@ G_STMT_START { \
|
||||
G_STMT_START { \
|
||||
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
||||
GtkAccessibleRelation __r = (relation); \
|
||||
char *value__ = gtk_test_accessible_check_relation (__a, __r, __VA_ARGS__); \
|
||||
if (value__ == NULL); else { \
|
||||
char *msg__ = g_strdup_printf ("assertion failed: (" #accessible ".accessible-relation(" #relation ") == " # __VA_ARGS__ "): value = '%s'", value__); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg__); \
|
||||
g_free (msg__); \
|
||||
char *__value = gtk_test_accessible_check_relation (__a, __r, __VA_ARGS__); \
|
||||
if (__value == NULL); else { \
|
||||
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-relation(" #relation ") == " # __VA_ARGS__ "): value = '%s'", __value); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
||||
g_free (__msg); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
@@ -106,11 +106,11 @@ G_STMT_START { \
|
||||
G_STMT_START { \
|
||||
GtkAccessible *__a = GTK_ACCESSIBLE (accessible); \
|
||||
GtkAccessibleState __s = (state); \
|
||||
char *value__ = gtk_test_accessible_check_state (__a, __s, __VA_ARGS__); \
|
||||
if (value__ == NULL); else { \
|
||||
char *msg__ = g_strdup_printf ("assertion failed: (" #accessible ".accessible-state(" #state ") == " # __VA_ARGS__ "): value = '%s'", value__); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg__); \
|
||||
g_free (msg__); \
|
||||
char *__value = gtk_test_accessible_check_state (__a, __s, __VA_ARGS__); \
|
||||
if (__value == NULL); else { \
|
||||
char *__msg = g_strdup_printf ("assertion failed: (" #accessible ".accessible-state(" #state ") == " # __VA_ARGS__ "): value = '%s'", __value); \
|
||||
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, __msg); \
|
||||
g_free (__msg); \
|
||||
} \
|
||||
} G_STMT_END
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
GType
|
||||
@enum_name@_get_type (void)
|
||||
{
|
||||
static gsize g_define_type_id__volatile = 0;
|
||||
static volatile gsize g_define_type_id__volatile = 0;
|
||||
|
||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
||||
{
|
||||
|
||||
@@ -36,19 +36,12 @@
|
||||
* SECTION:gtkvideo
|
||||
* @title: GtkVideo
|
||||
* @short_description: A widget for displaying video
|
||||
* @see_also: #GtkMediaControls, #GtkMediaStream
|
||||
* @see_also: #GtkMediaControls
|
||||
*
|
||||
* GtkVideo is a widget to show a #GtkMediaStream with media controls
|
||||
* as provided by #GtkMediaControls. If you just want to display a
|
||||
* video without controls, you can treat it like any other paintable
|
||||
* and for example put it into a #GtkPicture.
|
||||
* GtkVideo is a widget to show a #GtkMediaStream.
|
||||
*
|
||||
* GtkVideo aims to cover use cases such as previews, embedded animations,
|
||||
* etc. It supports autoplay, looping, and simple media controls. It does
|
||||
* not have support for video overlays, multichannel audio, device
|
||||
* selection, or input. If you are writing a full-fledged video player,
|
||||
* you may want to use the #GdkPaintable API and a media framework such
|
||||
* as Gstreamer directly.
|
||||
* It is commonly combined with #GtkMediaControls to give the
|
||||
* user a way to control the playback.
|
||||
*/
|
||||
|
||||
struct _GtkVideo
|
||||
@@ -138,9 +131,6 @@ gtk_video_unrealize (GtkWidget *widget)
|
||||
{
|
||||
GtkVideo *self = GTK_VIDEO (widget);
|
||||
|
||||
if (self->autoplay && self->media_stream)
|
||||
gtk_media_stream_pause (self->media_stream);
|
||||
|
||||
if (self->media_stream)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
@@ -159,9 +149,7 @@ gtk_video_map (GtkWidget *widget)
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_video_parent_class)->map (widget);
|
||||
|
||||
if (self->autoplay &&
|
||||
self->media_stream &&
|
||||
gtk_media_stream_is_prepared (self->media_stream))
|
||||
if (self->autoplay && self->media_stream)
|
||||
gtk_media_stream_play (self->media_stream);
|
||||
}
|
||||
|
||||
@@ -177,20 +165,11 @@ gtk_video_unmap (GtkWidget *widget)
|
||||
gtk_revealer_set_reveal_child (GTK_REVEALER (self->controls_revealer), FALSE);
|
||||
}
|
||||
|
||||
/* XXX: pause video here? */
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_video_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_video_hide (GtkWidget *widget)
|
||||
{
|
||||
GtkVideo *self = GTK_VIDEO (widget);
|
||||
|
||||
if (self->autoplay && self->media_stream)
|
||||
gtk_media_stream_pause (self->media_stream);
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_video_parent_class)->hide (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_video_set_focus_child (GtkWidget *widget,
|
||||
GtkWidget *child)
|
||||
@@ -289,7 +268,6 @@ gtk_video_class_init (GtkVideoClass *klass)
|
||||
widget_class->unrealize = gtk_video_unrealize;
|
||||
widget_class->map = gtk_video_map;
|
||||
widget_class->unmap = gtk_video_unmap;
|
||||
widget_class->hide = gtk_video_hide;
|
||||
widget_class->set_focus_child = gtk_video_set_focus_child;
|
||||
|
||||
gobject_class->dispose = gtk_video_dispose;
|
||||
@@ -569,9 +547,7 @@ gtk_video_notify_cb (GtkMediaStream *stream,
|
||||
gtk_video_update_playing (self);
|
||||
if (g_str_equal (pspec->name, "prepared"))
|
||||
{
|
||||
if (self->autoplay &&
|
||||
gtk_media_stream_is_prepared (stream) &&
|
||||
gtk_widget_get_mapped (GTK_WIDGET (self)))
|
||||
if (self->autoplay && gtk_media_stream_is_prepared (stream))
|
||||
gtk_media_stream_play (stream);
|
||||
}
|
||||
}
|
||||
@@ -600,8 +576,6 @@ gtk_video_set_media_stream (GtkVideo *self,
|
||||
|
||||
if (self->media_stream)
|
||||
{
|
||||
if (self->autoplay)
|
||||
gtk_media_stream_pause (self->media_stream);
|
||||
g_signal_handlers_disconnect_by_func (self->media_stream,
|
||||
gtk_video_notify_cb,
|
||||
self);
|
||||
@@ -631,9 +605,7 @@ gtk_video_set_media_stream (GtkVideo *self,
|
||||
"notify",
|
||||
G_CALLBACK (gtk_video_notify_cb),
|
||||
self);
|
||||
if (self->autoplay &&
|
||||
gtk_media_stream_is_prepared (stream) &&
|
||||
gtk_widget_get_mapped (GTK_WIDGET (self)))
|
||||
if (self->autoplay)
|
||||
gtk_media_stream_play (stream);
|
||||
}
|
||||
|
||||
@@ -688,13 +660,7 @@ gtk_video_set_file (GtkVideo *self,
|
||||
stream = gtk_media_file_new ();
|
||||
|
||||
if (gtk_widget_get_realized (GTK_WIDGET (self)))
|
||||
{
|
||||
GdkSurface *surface;
|
||||
|
||||
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
|
||||
gtk_media_stream_realize (stream, surface);
|
||||
gtk_media_file_set_file (GTK_MEDIA_FILE (stream), file);
|
||||
}
|
||||
gtk_media_file_set_file (GTK_MEDIA_FILE (stream), file);
|
||||
gtk_video_set_media_stream (self, stream);
|
||||
|
||||
g_object_unref (stream);
|
||||
|
||||
@@ -71,7 +71,7 @@ struct _GtkViewport
|
||||
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
|
||||
|
||||
/* GtkScrollablePolicy needs to be checked when
|
||||
* driving the scrollable adjustment values */
|
||||
guint hscroll_policy : 1;
|
||||
@@ -244,7 +244,9 @@ gtk_viewport_measure (GtkWidget *widget,
|
||||
{
|
||||
GtkViewport *viewport = GTK_VIEWPORT (widget);
|
||||
|
||||
if (viewport->child)
|
||||
*minimum = *natural = 0;
|
||||
|
||||
if (viewport->child && gtk_widget_get_visible (viewport->child))
|
||||
gtk_widget_measure (viewport->child,
|
||||
orientation,
|
||||
for_size,
|
||||
|
||||
@@ -158,8 +158,6 @@
|
||||
* instead.
|
||||
*/
|
||||
|
||||
typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *child;
|
||||
|
||||
@@ -44,6 +44,7 @@ G_BEGIN_DECLS
|
||||
#define GTK_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WINDOW, GtkWindowClass))
|
||||
|
||||
typedef struct _GtkWindowClass GtkWindowClass;
|
||||
typedef struct _GtkWindowGeometryInfo GtkWindowGeometryInfo;
|
||||
typedef struct _GtkWindowGroup GtkWindowGroup;
|
||||
typedef struct _GtkWindowGroupClass GtkWindowGroupClass;
|
||||
typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate;
|
||||
|
||||
@@ -838,24 +838,20 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml',
|
||||
|
||||
# Build the theme files
|
||||
sassc = find_program('sassc', required: false)
|
||||
if not sassc.found() and not get_option('sassc').disabled()
|
||||
if not sassc.found()
|
||||
subproject('sassc')
|
||||
sassc = find_program('sassc', required: get_option('sassc').enabled())
|
||||
sassc = find_program('sassc', required: true)
|
||||
endif
|
||||
|
||||
if sassc.found()
|
||||
sassc_opts = [ '-a', '-M', '-t', 'compact' ]
|
||||
sassc_opts = [ '-a', '-M', '-t', 'compact' ]
|
||||
|
||||
subdir('theme/Adwaita')
|
||||
subdir('theme/HighContrast')
|
||||
subdir('theme/Adwaita')
|
||||
subdir('theme/HighContrast')
|
||||
|
||||
theme_deps = [
|
||||
adwaita_theme_deps,
|
||||
hc_theme_deps,
|
||||
]
|
||||
else
|
||||
theme_deps = []
|
||||
endif
|
||||
theme_deps = [
|
||||
adwaita_theme_deps,
|
||||
hc_theme_deps,
|
||||
]
|
||||
|
||||
gtkresources = gnome.compile_resources('gtkresources',
|
||||
gtk_gresources_xml,
|
||||
|
||||
@@ -71,4 +71,3 @@ $switch_bg_color: $selected_bg_color;
|
||||
$switch_borders_color: if($variant == 'light',darken($switch_bg_color,15%),darken($switch_bg_color,30%));
|
||||
$focus_border_color: if($variant == 'light', transparentize($selected_bg_color, 0.5), transparentize($selected_bg_color, 0.3));
|
||||
$alt_focus_border_color: if($variant == 'light', transparentize(white, 0.2), transparentize(white,0.7));
|
||||
$dim_label_opacity: 0.55;
|
||||
|
||||
@@ -180,7 +180,7 @@ label {
|
||||
}
|
||||
|
||||
.dim-label {
|
||||
opacity: $dim_label_opacity;
|
||||
opacity: 0.55;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
@@ -1397,7 +1397,7 @@ windowcontrols {
|
||||
min-height: 0;
|
||||
&:hover {
|
||||
//special case hover colors inside a headerbar
|
||||
@include button(undecorated-hover,$c:darken($headerbar_bg_color,6%));
|
||||
@include button(undecorated-hover,$c:darken($headerbar_bg_color,10%));
|
||||
}
|
||||
&:active,
|
||||
&:checked { @include button(undecorated-active,$c:darken($headerbar_bg_color,10%)); }
|
||||
@@ -1831,10 +1831,7 @@ popover.background {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
separator {
|
||||
background-color: mix($bg_color, $borders_color, 30%);
|
||||
margin: 3px;
|
||||
}
|
||||
separator { margin: 3px; }
|
||||
|
||||
list separator { margin: 0; }
|
||||
}
|
||||
@@ -2350,8 +2347,6 @@ switch {
|
||||
|
||||
@include focus-ring($offset: 0, $outer: true);
|
||||
|
||||
headerbar & { background-color: darken($dark_fill,8%); } //3504
|
||||
|
||||
&:checked {
|
||||
color: $selected_fg_color;
|
||||
border-color: $switch_borders_color;
|
||||
@@ -2549,8 +2544,6 @@ treeview.view radio:selected { &:focus, & { @extend %radio; }} // This is a work
|
||||
border-radius: 3px;
|
||||
background-color: $dark_fill;
|
||||
|
||||
headerbar & { background-color: darken($dark_fill,8%); } //3504
|
||||
|
||||
&:disabled {
|
||||
background-color: $insensitive_bg_color;
|
||||
border-color: $insensitive_borders_color;
|
||||
|
||||
@@ -420,8 +420,9 @@
|
||||
text-shadow: none;
|
||||
@if $variant == 'light' {
|
||||
background-color: darken($c,14%);
|
||||
} @else {
|
||||
background-color: darken($c,1%);
|
||||
}
|
||||
@else {
|
||||
background-color: darken($c,10%);
|
||||
}
|
||||
}
|
||||
@else if $t==undecorated-active {
|
||||
|
||||
@@ -20,7 +20,3 @@ $insensitive_borders_color: mix($borders_color, $bg_color, 80%);
|
||||
//focus rings
|
||||
$focus_border_color: if($variant == 'light', transparentize($selected_bg_color, 0.2), transparentize(white, 0.4));
|
||||
$alt_focus_border_color: if($variant == 'light', white, transparentize(white,0.4));
|
||||
|
||||
$dim_label_opacity: 0.9;
|
||||
|
||||
$switch_borders_color: if($variant == 'light',darken($switch_bg_color,15%),lighten($switch_bg_color,15%));
|
||||
|
||||
@@ -35,11 +35,8 @@
|
||||
|
||||
static char *output_dir = NULL;
|
||||
|
||||
static gboolean debug;
|
||||
|
||||
static GOptionEntry args[] = {
|
||||
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &output_dir, N_("Output to this directory instead of cwd"), NULL },
|
||||
{ "debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Generate debug output") },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -68,7 +65,7 @@ main (int argc, char **argv)
|
||||
|
||||
g_set_prgname ("gtk-encode-symbolic-svg");
|
||||
|
||||
context = g_option_context_new ("[OPTION…] PATH WIDTHxHEIGHT");
|
||||
context = g_option_context_new ("PATH WIDTHxHEIGHT");
|
||||
g_option_context_add_main_entries (context, args, GETTEXT_PACKAGE);
|
||||
|
||||
g_option_context_parse (context, &argc, &argv, NULL);
|
||||
@@ -107,9 +104,7 @@ main (int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
basename = g_path_get_basename (path);
|
||||
|
||||
symbolic = gtk_make_symbolic_pixbuf_from_data (data, len, width, height, 1.0, debug ? basename : NULL, &error);
|
||||
symbolic = gtk_make_symbolic_pixbuf_from_data (data, len, width, height, 1.0, &error);
|
||||
if (symbolic == NULL)
|
||||
{
|
||||
g_printerr (_("Can’t load file: %s\n"), error->message);
|
||||
@@ -118,6 +113,8 @@ main (int argc, char **argv)
|
||||
|
||||
g_free (data);
|
||||
|
||||
basename = g_path_get_basename (path);
|
||||
|
||||
dot = strrchr (basename, '.');
|
||||
if (dot != NULL)
|
||||
*dot = 0;
|
||||
|
||||
@@ -429,7 +429,6 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
int width,
|
||||
int height,
|
||||
double scale,
|
||||
const char *debug_output_basename,
|
||||
GError **error)
|
||||
|
||||
{
|
||||
@@ -492,16 +491,6 @@ gtk_make_symbolic_pixbuf_from_data (const char *file_data,
|
||||
if (loaded == NULL)
|
||||
goto out;
|
||||
|
||||
if (debug_output_basename)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename = g_strdup_printf ("%s.debug%d.png", debug_output_basename, plane);
|
||||
g_print ("Writing %s\n", filename);
|
||||
gdk_pixbuf_save (loaded, filename, "png", NULL, NULL);
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
if (pixbuf == NULL)
|
||||
{
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
@@ -545,7 +534,7 @@ gtk_make_symbolic_pixbuf_from_resource (const char *path,
|
||||
|
||||
data = g_bytes_get_data (bytes, &size);
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, NULL, error);
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
@@ -566,7 +555,7 @@ gtk_make_symbolic_pixbuf_from_path (const char *path,
|
||||
if (!g_file_get_contents (path, &data, &size, error))
|
||||
return NULL;
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, NULL, error);
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
|
||||
|
||||
g_free (data);
|
||||
|
||||
@@ -587,7 +576,7 @@ gtk_make_symbolic_pixbuf_from_file (GFile *file,
|
||||
if (!g_file_load_contents (file, NULL, &data, &size, NULL, error))
|
||||
return NULL;
|
||||
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, NULL, error);
|
||||
pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error);
|
||||
|
||||
g_free (data);
|
||||
|
||||
|
||||
@@ -1723,20 +1723,6 @@ rewrite_toolbar (Element *element,
|
||||
|
||||
set_attribute_value (element, "class", "GtkBox");
|
||||
|
||||
for (l = element->children; l; l = l->next)
|
||||
{
|
||||
Element *child = l->data;
|
||||
|
||||
if (g_str_equal (child->element_name, "property") &&
|
||||
(has_attribute (child, "name", "toolbar_style") ||
|
||||
has_attribute (child, "name", "toolbar-style")))
|
||||
{
|
||||
element->children = g_list_remove (element->children, child);
|
||||
free_element (child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (l = element->children; l; l = l->next)
|
||||
{
|
||||
Element *child = l->data;
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
<property name="valign">start</property>
|
||||
<property name="wrap">1</property>
|
||||
<property name="max-width-chars">60</property>
|
||||
<style>
|
||||
<class name="title"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
project('gtk', 'c',
|
||||
version: '4.0.1',
|
||||
version: '4.0.0',
|
||||
default_options: [
|
||||
'buildtype=debugoptimized',
|
||||
'warning_level=1',
|
||||
@@ -348,8 +348,7 @@ endif
|
||||
gmodule_dep = dependency('gmodule-2.0', version: glib_req,
|
||||
fallback : ['glib', 'libgmodule_dep'])
|
||||
cairo_dep = dependency('cairo', version: cairo_req,
|
||||
fallback : ['cairo', 'libcairo_dep'],
|
||||
default_options: ['zlib=enabled'])
|
||||
fallback : ['cairo', 'libcairo_dep'])
|
||||
cairogobj_dep = dependency('cairo-gobject', version: cairo_req,
|
||||
fallback : ['cairo', 'libcairogobject_dep'])
|
||||
pango_dep = dependency('pango', version: pango_req,
|
||||
@@ -380,17 +379,10 @@ pixbuf_dep = dependency('gdk-pixbuf-2.0', version: gdk_pixbuf_req,
|
||||
epoxy_dep = dependency('epoxy', version: epoxy_req,
|
||||
fallback: ['libepoxy', 'libepoxy_dep'])
|
||||
harfbuzz_dep = dependency('harfbuzz', version: '>= 0.9', required: false,
|
||||
fallback: ['harfbuzz', 'libharfbuzz_dep'],
|
||||
default_options: ['coretext=enabled'])
|
||||
fallback: ['harfbuzz', 'libharfbuzz_dep'])
|
||||
xkbdep = dependency('xkbcommon', version: xkbcommon_req, required: wayland_enabled)
|
||||
if os_darwin
|
||||
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
|
||||
fallback: ['graphene', 'graphene_dep'],
|
||||
default_options: ['introspection=false'])
|
||||
else
|
||||
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
|
||||
fallback: ['graphene', 'graphene_dep'])
|
||||
endif
|
||||
graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req,
|
||||
fallback: ['graphene', 'graphene_dep'])
|
||||
iso_codes_dep = dependency('iso-codes', required: false)
|
||||
|
||||
gtk_doc_dep = dependency('gtk-doc', version: '>=1.33',
|
||||
|
||||
@@ -78,14 +78,9 @@ option('tracker',
|
||||
|
||||
option('colord',
|
||||
type: 'feature',
|
||||
value: 'disabled',
|
||||
value : 'disabled',
|
||||
description : 'Build colord support for the CUPS printing backend')
|
||||
|
||||
option('sassc',
|
||||
type: 'feature',
|
||||
value: 'auto',
|
||||
description: 'Rebuild themes using sassc')
|
||||
|
||||
# Documentation and introspection
|
||||
|
||||
option('gtk_doc',
|
||||
|
||||
@@ -217,7 +217,7 @@ gtk_ff_media_file_set_ffmpeg_error (GtkFfMediaFile *video,
|
||||
return;
|
||||
|
||||
if (av_strerror (av_errnum, s, sizeof (s) != 0))
|
||||
g_snprintf (s, sizeof (s), _("Unspecified error decoding video"));
|
||||
snprintf (s, sizeof (s), _("Unspecified error decoding video"));
|
||||
|
||||
gtk_media_stream_error (GTK_MEDIA_STREAM (video),
|
||||
G_IO_ERROR,
|
||||
|
||||
@@ -297,24 +297,6 @@ gtk_gst_media_file_update_audio (GtkMediaStream *stream,
|
||||
gst_player_set_volume (self->player, volume * volume * volume);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_gst_media_file_realize (GtkMediaStream *stream,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GtkGstMediaFile *self = GTK_GST_MEDIA_FILE (stream);
|
||||
|
||||
gtk_gst_paintable_realize (GTK_GST_PAINTABLE (self->paintable), surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_gst_media_file_unrealize (GtkMediaStream *stream,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GtkGstMediaFile *self = GTK_GST_MEDIA_FILE (stream);
|
||||
|
||||
gtk_gst_paintable_unrealize (GTK_GST_PAINTABLE (self->paintable), surface);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_gst_media_file_dispose (GObject *object)
|
||||
{
|
||||
@@ -345,8 +327,6 @@ gtk_gst_media_file_class_init (GtkGstMediaFileClass *klass)
|
||||
stream_class->pause = gtk_gst_media_file_pause;
|
||||
stream_class->seek = gtk_gst_media_file_seek;
|
||||
stream_class->update_audio = gtk_gst_media_file_update_audio;
|
||||
stream_class->realize = gtk_gst_media_file_realize;
|
||||
stream_class->unrealize = gtk_gst_media_file_unrealize;
|
||||
|
||||
gobject_class->dispose = gtk_gst_media_file_dispose;
|
||||
}
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkgstpaintableprivate.h"
|
||||
|
||||
#include "gtkgstsinkprivate.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gst/player/gstplayer-video-renderer.h>
|
||||
#include <gsk/gl/gskglrenderer.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -34,8 +33,6 @@ struct _GtkGstPaintable
|
||||
|
||||
GdkPaintable *image;
|
||||
double pixel_aspect_ratio;
|
||||
|
||||
GdkGLContext *context;
|
||||
};
|
||||
|
||||
struct _GtkGstPaintableClass
|
||||
@@ -116,34 +113,10 @@ gtk_gst_paintable_video_renderer_create_video_sink (GstPlayerVideoRenderer *rend
|
||||
GstPlayer *player)
|
||||
{
|
||||
GtkGstPaintable *self = GTK_GST_PAINTABLE (renderer);
|
||||
GstElement *sink, *glsinkbin;
|
||||
|
||||
#if GST_GL_HAVE_WINDOW_WIN32 && GST_GL_HAVE_PLATFORM_WGL && defined (GDK_WINDOWING_WIN32)
|
||||
/*
|
||||
* Unfortunately, we can't connect the GstGLContext with our GDKGLContext,
|
||||
* since gdk_gl_context_make_current(), which calls wglMakeCurrent(), does not
|
||||
* allow us to share WGL contexts across threads, which will cause a crash.
|
||||
* See MR !3034, so no WGL in the gstreamer media backend :(
|
||||
*/
|
||||
sink = g_object_new (GTK_TYPE_GST_SINK,
|
||||
return g_object_new (GTK_TYPE_GST_SINK,
|
||||
"paintable", self,
|
||||
NULL);
|
||||
return sink;
|
||||
#else
|
||||
sink = g_object_new (GTK_TYPE_GST_SINK,
|
||||
"paintable", self,
|
||||
"gl-context", self->context,
|
||||
NULL);
|
||||
|
||||
if (self->context == NULL)
|
||||
return sink;
|
||||
|
||||
glsinkbin = gst_element_factory_make ("glsinkbin", NULL);
|
||||
|
||||
g_object_set (glsinkbin, "sink", sink, NULL);
|
||||
|
||||
return glsinkbin;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -187,57 +160,6 @@ gtk_gst_paintable_new (void)
|
||||
return g_object_new (GTK_TYPE_GST_PAINTABLE, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_gst_paintable_realize (GtkGstPaintable *self,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GtkNative *native;
|
||||
GskRenderer *renderer;
|
||||
|
||||
if (self->context)
|
||||
return;
|
||||
|
||||
native = gtk_native_get_for_surface (surface);
|
||||
renderer = gtk_native_get_renderer (native);
|
||||
if (!GSK_IS_GL_RENDERER (renderer))
|
||||
{
|
||||
GST_INFO ("not using GL with a %s renderer\n", G_OBJECT_TYPE_NAME (renderer));
|
||||
return;
|
||||
}
|
||||
|
||||
self->context = gdk_surface_create_gl_context (surface, &error);
|
||||
if (self->context == NULL)
|
||||
{
|
||||
GST_INFO ("failed to create GDK GL context: %s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gdk_gl_context_realize (self->context, &error))
|
||||
{
|
||||
GST_INFO ("failed to realize GDK GL context: %s", error->message);
|
||||
g_clear_object (&self->context);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_gst_paintable_unrealize (GtkGstPaintable *self,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
/* XXX: We could be smarter here and:
|
||||
* - track how often we were realized with that surface
|
||||
* - track alternate surfaces
|
||||
*/
|
||||
if (self->context == NULL)
|
||||
return;
|
||||
|
||||
if (gdk_gl_context_get_surface (self->context) == surface)
|
||||
g_clear_object (&self->context);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_gst_paintable_set_paintable (GtkGstPaintable *self,
|
||||
GdkPaintable *paintable,
|
||||
|
||||