Compare commits
3 Commits
wip/otte/r
...
wip/ebassi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d01e12acb | ||
|
|
cd2c20251e | ||
|
|
54fe34f94a |
206
NEWS
206
NEWS
@@ -1,209 +1,3 @@
|
||||
Overview of Changes in GTK+ 3.89.2
|
||||
==================================
|
||||
|
||||
* gtk4-icon-browser works again
|
||||
|
||||
* gtk-encode symbolic works for icons with names containing dots
|
||||
|
||||
* GtkFlowBox and GtkListBox have been changed to no longer emit
|
||||
the ::selected-children-changed signal during destruction
|
||||
|
||||
* gtk-demo has gained an example for using PangoTabArray with GtkTextView
|
||||
|
||||
* We now support CSS border-spacing in GtkGrid, GtkBox and in gadgets
|
||||
|
||||
* The rendering in GDK and GSK has been further refactored. We now
|
||||
only draw toplevel windows, and we always redraw the whole window.
|
||||
|
||||
* A Vulkan implementation has been added in parallel to the GL one
|
||||
|
||||
* Dropped APIs:
|
||||
gdk_window_process_updates
|
||||
gdk_window_process_all_updates
|
||||
gdk_window_reparent
|
||||
support for native and foreign subwindows
|
||||
gsk_render_node_{append/prepend/insert} variations
|
||||
gsk_render_node_make_immutable
|
||||
gtk_cairo_should_draw_window
|
||||
gtk_snapshot_append
|
||||
GtkJunctionSides
|
||||
|
||||
* New APIs:
|
||||
gdk_rgba_is_clear
|
||||
gdk_rgba_is_opaque
|
||||
GdkDrawContext: A base class for vulkan and gl contexts
|
||||
Render node subclasses
|
||||
GskRoundedRect
|
||||
gtk_container_snapshot_child
|
||||
|
||||
* The GSK_USE_SOFTWARE environment variable has been generalized as GSK_RENDERER.
|
||||
Use GSK_RENDERER=help to learn about possible values. Other environment variables
|
||||
that have gained new possible values in clude GSK_DEBUG=vulkan and GTK_DEBUG=snapshot.
|
||||
|
||||
* Bugs fixed
|
||||
749012 GtkStack: Don't emit notify::visible-child during destruction
|
||||
771242 opening menu for certain types of GtkComboBox causes Gdk-CRITICAL assertion...
|
||||
772371 Take advantage of Unicode
|
||||
773299 Ensure GTK+-4.x builds and works on Windows (MSVC in particular)
|
||||
774265 No tilt for wintab devices
|
||||
774534 input shape and opaque region not applied without begin_paint()/end_paint()
|
||||
774686 GtkMenu does not unref all GtkCheckMenuItem it creates
|
||||
774695 GtkProgressbar needs full and empty classes
|
||||
774743 GtkNotebook does not unref all GtkBuiltinIcon it creates
|
||||
774760 inspector: ensure controller is a GtkGesture
|
||||
774784 Failed to get desktop session proxy is not an error!
|
||||
774790 GtkTextHandle does not unref all GtkAdjustment it references
|
||||
774893 Application font sizes scaling gets clamped to 1.00 when starting GtkInspector
|
||||
774915 Destroying the parent of a subsurface causes _gdk_window_destroy_hierarchy: ...
|
||||
774917 child subsurfaces need to be placed relative to their parent
|
||||
774939 GtkLabelAccessible: Initialize link before setting parent
|
||||
775038 Build: Add wayland to GSKs dependencies
|
||||
775212 GtkScaleButton does not unref all GtkAdjustment it references
|
||||
775316 gtk_drag_source_set_icon_pixbuf references the pixbuf received once too much
|
||||
775319 gdk_window_get_toplevel() fails to return the toplevel of a child subsurface
|
||||
775410 gsk/Makefile.am runs g-ir-scanner before libgsk-4.la is linked
|
||||
775525 gtk_flow_box_get_child_at_index shouldn't crash with an invalid index
|
||||
775651 GdkX11-4.0.gir, GdkWin32-4.0.gir, and Gsk-4.0.gir are generated before Gdk-4...
|
||||
776132 Mention the difference between gdk_window_create_similar_image_surface and c...
|
||||
776187 flowbox: Add gtk_flow_box_get_child_at_pos to gtk3
|
||||
776306 flowbox: Sometimes emits child-activated during rubberband selection
|
||||
|
||||
* Translation updates
|
||||
Czech
|
||||
German
|
||||
Hungarian
|
||||
Italian
|
||||
Kazakh
|
||||
Russian
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.89.1
|
||||
==================================
|
||||
|
||||
This release marks the first snapshot of development leading to GTK+ 4,
|
||||
it is unstable and expected to change drastically.
|
||||
|
||||
Do not use it in production.
|
||||
|
||||
GTK+ 3.89 is parallel-installable with the stable GTK+ 3.22.x releases.
|
||||
|
||||
The API documentation contains an initial migration guide for porting
|
||||
from GTK+ 3 to GTK+ 4.
|
||||
|
||||
Detailed changes:
|
||||
|
||||
* GSK has been integrated. Widgets are now rendered into
|
||||
GskRenderNodes, which then get drawn using GL
|
||||
|
||||
* GTK+ now installs a single shared library, libgtk.so, which includes
|
||||
GDK and GSK as well
|
||||
|
||||
* All installed binaries now use a consistent gtk4- prefix to avoid conflicts
|
||||
|
||||
* Dropped APIs:
|
||||
- all APIs that have been deprecated in GTK+ 3
|
||||
- (almost) all widget style properties
|
||||
- offscreen windows
|
||||
- -gtk-gradient in CSS
|
||||
- gdk_pixbuf_get_from_window and gdk_cairo_set_source_window
|
||||
|
||||
* Changed APIs:
|
||||
- GtkCssProvider load functions lost their GError argument
|
||||
|
||||
* New APIs:
|
||||
- GMenu items can now have a text-direction attribute
|
||||
- GtkShortcutsShortcut supports single-finger swipe gestures
|
||||
- gdk_display_is_rgba and gdk_display_is_composited
|
||||
- New GtkButton API to construct image buttons:
|
||||
gtk_button_new_from_icon_name
|
||||
gtk_button_set_icon_name
|
||||
- New GdkWindow constructors replacing gdk_window_new:
|
||||
gdk_window_new_toplevel
|
||||
gdk_window_new_popup
|
||||
gdk_window_new_temp
|
||||
gdk_window_new_child
|
||||
gdk_window_new_input
|
||||
gdk_wayland_window_new_subsurface
|
||||
- gtk_widget_measure replaces gtk_widget_get_preferred_...
|
||||
- gtk_widget_snapshot replaces gtk_widget_render
|
||||
- gtk_drawing_area_set_draw_func replaces the ::draw signal
|
||||
|
||||
* New examples in gtk4-demo:
|
||||
- Gestures
|
||||
- Fishbowl
|
||||
|
||||
* GtkInspector now has a frame recorder which shows detailed information
|
||||
about the widget to render node conversion
|
||||
|
||||
* Hi-DPI is now supported with the Windows backend
|
||||
|
||||
* gtk-builder-tool can now replace the input file
|
||||
|
||||
* Bugs fixed:
|
||||
756570 gtkplacesview no longer provides guidance on address formats
|
||||
767713 Fullscreen in wayland is buggy
|
||||
768531 wayland: Startup notification doesn't work on some apps (eg. gnome-terminal)...
|
||||
771205 Buttons with circular style class have a suddenly clipped shadow at the bottom
|
||||
771320 [Wayland] Maps widget is displayed at wrong position inside gnome-contacts
|
||||
771694 GtkSourceView completion popup window not shown, no grabbed seat found
|
||||
772075 GTK+ uses a lot more CPU under Wayland than under X11
|
||||
772345 placesviewrow: busy_spinner when visible offsets the rest of the widgets on the row
|
||||
772348 placesviewrow: busy_spinner when visible offsets the rest of the widgets on the row
|
||||
772683 Usage of FALSE instead of gint in glarea demo
|
||||
772695 Show the keyboard shortcuts from left to right even in RTL
|
||||
772770 [GtkShortcutsWindow] Support for single-finger swipe gestures
|
||||
772859 Fix memory leaks in implementations of common widgets
|
||||
772922 GtkMenu: Try using gdk_window_move_to_rect() more often
|
||||
772926 shortcutswindow: working version of set_section_name()
|
||||
773007 GtkFilechooser gives completion for non-matching extensions
|
||||
773082 overlay: Document availability of properties
|
||||
773113 tests: fix clipboard test by loading correct icon
|
||||
773180 Don't second-guess whether our GDK GL context is GLES
|
||||
773246 Typo in css color definitions documentation
|
||||
773299 Ensure GTK+-4.x builds and works on Windows (MSVC in particular)
|
||||
773474 Color chooser dialog opened with show-editor=TRUE has black header bar
|
||||
773587 recent-manager: Add a limit to the list's size
|
||||
773799 GtkLevelBar doesn't update blocks on discrete mode
|
||||
773857 gdkwindow-x11: Add support for gdk_window_fullscreen_on_monitor
|
||||
773885 pop down GtkPopover on pressing escape
|
||||
773903 Gtk+4: gtk.h and gtktextiter.h include private gtktextattributes.h
|
||||
773916 GtkComposeTable caches broken: using a same ~/.XCompose does not work twice in a row
|
||||
773954 gtkstylecontext: Clarify memory allocation behaviour of getters
|
||||
773979 GdkGLContext does not chain finalize handler
|
||||
774046 GtkSpinButton does not always unref priv->{up,down}_button
|
||||
774066 GtkHeaderBar does not unref all GtkBox and GtkSeparator it creates
|
||||
774097 GtkPrintOperation should not truncate job names
|
||||
774114 Window shadows are repainted even if only the contents of the window change
|
||||
774185 GtkPlacesSidebar does not unref itsel as many times as it references
|
||||
774347 Fails to build: unknown type name GdkColor
|
||||
774352 GtkAppChooserWidget does not unref all GAppInfo it references
|
||||
774475 wayland: gtk+ prevents using subsurfaces if the parent is not root
|
||||
774476 surfaces with no outputs get scale factor reset
|
||||
774490 Deprecated example for modify color or font
|
||||
774609 small fix to foreign drawing spinbutton demo
|
||||
774614 Wrong #include in Print docs
|
||||
774634 GtkPlacesView does not unref all GDaemonFileEnumerator it references
|
||||
774695 GtkProgressbar needs full and empty classes
|
||||
774699 wintab: list iteration regression causes odd-indexed devices to be ignored during...
|
||||
|
||||
* Translation updates
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Czech
|
||||
Danish
|
||||
French
|
||||
German
|
||||
Greek
|
||||
Hungarian
|
||||
Kazakh
|
||||
Lithuanian
|
||||
Polish
|
||||
|
||||
|
||||
=======================================================================
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.22.1
|
||||
==================================
|
||||
|
||||
|
||||
@@ -128,8 +128,6 @@ $(top_builddir)/build/win32/vs12/$(1).vcxproj: Makefile
|
||||
|
||||
$(CPP) -P - <$(top_srcdir)/build/win32/vs12/$(1).vcxprojin >$(top_builddir)/build/win32/vs12/$(1).vcxproj
|
||||
$(CPP) -P - <$(top_srcdir)/build/win32/vs12/$(1).vcxproj.filtersin >$(top_builddir)/build/win32/vs12/$(1).vcxproj.filters
|
||||
$(RM) $(1).vs12.sourcefiles
|
||||
$(RM) $(1).vs12.sourcefiles.filters
|
||||
|
||||
$(top_builddir)/build/win32/vs12/$(1).vs12.headers: Makefile
|
||||
-$(RM) $(top_builddir)/build/win32/vs12/$(1).vs12.headers
|
||||
|
||||
@@ -5,14 +5,14 @@ GENERATED_ITEMS = \
|
||||
gdk4-win32.vcxproj.filters \
|
||||
gdk4-broadway.vcxproj \
|
||||
gdk4-broadway.vcxproj.filters \
|
||||
broadwayd.vcxproj \
|
||||
broadwayd.vcxproj.filters \
|
||||
gdk-4.vcxproj \
|
||||
gdk-4.vcxproj.filters \
|
||||
gsk-4.vcxproj \
|
||||
gsk-4.vcxproj.filters \
|
||||
gtk-4.vcxproj \
|
||||
gtk-4.vcxproj.filters \
|
||||
gtk4-broadwayd.vcxproj \
|
||||
gtk4-broadwayd.vcxproj.filters \
|
||||
gtk4-demo.vcxproj \
|
||||
gtk4-demo.vcxproj.filters \
|
||||
gtk4-demo-application.vcxproj \
|
||||
@@ -38,14 +38,14 @@ EXTRA_DIST += \
|
||||
gdk4-win32.vcxproj.filtersin \
|
||||
gdk4-broadway.vcxprojin \
|
||||
gdk4-broadway.vcxproj.filtersin \
|
||||
broadwayd.vcxprojin \
|
||||
broadwayd.vcxproj.filtersin \
|
||||
gdk-4.vcxprojin \
|
||||
gdk-4.vcxproj.filtersin \
|
||||
gsk-4.vcxprojin \
|
||||
gsk-4.vcxproj.filtersin \
|
||||
gtk-4.vcxprojin \
|
||||
gtk-4.vcxproj.filtersin \
|
||||
gtk4-broadwayd.vcxprojin \
|
||||
gtk4-broadwayd.vcxproj.filtersin \
|
||||
gtk4-builder-tool.vcxproj \
|
||||
gtk4-builder-tool.vcxproj.filters \
|
||||
gtk4-encode-symbolic-svg.vcxproj \
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
#include "gtk4-broadwayd.vs12.sourcefiles.filters"
|
||||
#include "broadwayd.vs12.sourcefiles.filters"
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -163,7 +163,7 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
#include "gtk4-broadwayd.vs12.sourcefiles"
|
||||
#include "broadwayd.vs12.sourcefiles"
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="gtk4-prebuild.vcxproj">
|
||||
@@ -6,7 +6,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdk4-win32", "gdk4-win32.vc
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdk4-broadway", "gdk4-broadway.vcxproj", "{1DF4C475-4472-4EE4-AC2B-3AB5A4C1A453}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gtk4-broadwayd", "gtk4-broadwayd.vcxproj", "{E9687D21-E214-4A0C-9EB4-8B38EBB783E5}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "broadwayd", "broadwayd.vcxproj", "{E9687D21-E214-4A0C-9EB4-8B38EBB783E5}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gdk-4", "gdk-4.vcxproj", "{5AE8F5CE-9103-4951-AEDE-EA2F3B573BE8}"
|
||||
EndProject
|
||||
|
||||
@@ -225,10 +225,6 @@
|
||||
<Project>{95a4b53d-2773-4406-a2c1-8fd2840bbad8}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="gtk4-broadwayd.vcxproj">
|
||||
<Project>{e9687d21-e214-4a0c-9eb4-8b38ebb783e5}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="gtk4-demo-application.vcxproj">
|
||||
<Project>{be6b4973-c6ff-4c8f-8e97-a47793c50f44}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
@@ -237,6 +233,10 @@
|
||||
<Project>{343333c4-d46c-4c97-a986-959cca6f1de0}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="broadwayd.vcxproj">
|
||||
<Project>{e9687d21-e214-4a0c-9eb4-8b38ebb783e5}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="gtk4-encode-symbolic-svg.vcxproj">
|
||||
<Project>{f280bf1a-777a-4fb5-8005-dfbe04621edb}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
|
||||
@@ -29,8 +29,8 @@ EXTRA_DIST += \
|
||||
gtk4-icon-browser.vcxproj.filters \
|
||||
gtk4-install.vcxproj \
|
||||
gtk4-install.vcxproj.filters \
|
||||
gtk4-broadwayd.vcxproj \
|
||||
gtk4-broadwayd.vcxproj.filters \
|
||||
broadwayd.vcxproj \
|
||||
broadwayd.vcxproj.filters \
|
||||
gdk4-broadway.vcxproj \
|
||||
gdk4-broadway.vcxproj.filters \
|
||||
gtk4-build-defines.props \
|
||||
|
||||
39
configure.ac
39
configure.ac
@@ -10,7 +10,7 @@
|
||||
|
||||
m4_define([gtk_major_version], [3])
|
||||
m4_define([gtk_minor_version], [89])
|
||||
m4_define([gtk_micro_version], [2])
|
||||
m4_define([gtk_micro_version], [0])
|
||||
m4_define([gtk_interface_age], [0])
|
||||
m4_define([gtk_binary_age],
|
||||
[m4_eval(100 * gtk_minor_version + gtk_micro_version)])
|
||||
@@ -64,7 +64,7 @@ m4_define([wayland_protocols_required_version], [1.7])
|
||||
m4_define([mirclient_required_version], [0.22.0])
|
||||
m4_define([mircookie_required_version], [0.17.0])
|
||||
m4_define([epoxy_required_version], [1.0])
|
||||
m4_define([graphene_required_version], [1.5.1])
|
||||
m4_define([graphene_required_version], [1.2])
|
||||
GLIB_REQUIRED_VERSION=glib_required_version
|
||||
PANGO_REQUIRED_VERSION=pango_required_version
|
||||
ATK_REQUIRED_VERSION=atk_required_version
|
||||
@@ -297,11 +297,6 @@ AC_ARG_ENABLE(installed_tests,
|
||||
[enable_installed_tests=no])
|
||||
AM_CONDITIONAL(BUILDOPT_INSTALL_TESTS, test x$enable_installed_tests = xyes)
|
||||
|
||||
AC_ARG_ENABLE(vulkan,
|
||||
[AS_HELP_STRING([--enable-vulkan],
|
||||
[support Vulkan graphics API [default=maybe]])],,
|
||||
[enable_vulkan="maybe"])
|
||||
|
||||
AC_ARG_ENABLE(xkb,
|
||||
[AS_HELP_STRING([--enable-xkb],
|
||||
[support XKB extension [default=maybe]])],,
|
||||
@@ -1319,33 +1314,6 @@ else
|
||||
GDK_GIO_PACKAGE="gio-2.0 >= glib_required_version"
|
||||
fi
|
||||
|
||||
# Check for Vulkan support.
|
||||
|
||||
if test "x$enable_vulkan" != "xno"; then
|
||||
vulkan_error=""
|
||||
AC_CHECK_HEADER([vulkan/vulkan.h],
|
||||
[AC_CHECK_LIB([vulkan], [vkCreateInstance], [], [vulkan_error="Vulkan library not found"])],
|
||||
[vulkan_error="Vulkan header not found"])
|
||||
if test "x$vulkan_error" != "x"; then
|
||||
if "x$enable_vulkan" = "xyes"; then
|
||||
AC_MSG_ERROR($vulkan_error)
|
||||
else
|
||||
AC_MSG_WARN($vulkan_error)
|
||||
fi
|
||||
vulkan_result="no ($vulkan_error)"
|
||||
else
|
||||
GDK_EXTRA_LIBS="-lvulkan"
|
||||
GDK_WINDOWING="$GDK_WINDOWING
|
||||
#define GDK_RENDERING_VULKAN"
|
||||
AC_PATH_PROG([GLSLC], [glslc])
|
||||
vulkan_result="yes"
|
||||
fi
|
||||
else
|
||||
AC_MSG_WARN(Vulkan support explicitly disabled)
|
||||
vulkan_result="no (Vulkan support explicitly disabled)"
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_VULKAN, test "$vulkan_result" = "yes")
|
||||
|
||||
# Check for Pango flags
|
||||
|
||||
AC_MSG_CHECKING(Pango flags)
|
||||
@@ -1406,7 +1374,7 @@ GSK_EXTRA_LIBS=
|
||||
GSK_EXTRA_CFLAGS=
|
||||
|
||||
GSK_PACKAGES="gdk-pixbuf-2.0 >= gdk_pixbuf_required_version cairo >= cairo_required_version cairo-gobject >= cairo_required_version graphene-1.0 >= graphene_required_version"
|
||||
GSK_PRIVATE_PACKAGES="epoxy >= epoxy_required_version $WAYLAND_PACKAGES"
|
||||
GSK_PRIVATE_PACKAGES="epoxy >= epoxy_required_version"
|
||||
|
||||
PKG_CHECK_MODULES(GSK_DEP, $PANGO_PACKAGES $GSK_PACKAGES $GSK_PRIVATE_PACKAGES)
|
||||
GSK_DEP_LIBS="$GSK_EXTRA_LIBS $GSK_DEP_LIBS $MATH_LIB"
|
||||
@@ -2066,7 +2034,6 @@ echo " GDK backends: $GDK_BACKENDS"
|
||||
if test "$enable_x11_backend" = "yes"; then
|
||||
echo " X11 extensions: $X_EXTENSIONS"
|
||||
fi
|
||||
echo " Vulkan support: $vulkan_result"
|
||||
echo " Print backends: $PRINT_BACKENDS"
|
||||
echo " Dynamic modules: $build_dynamic_modules"
|
||||
echo " Included immodules: $included_immodules"
|
||||
|
||||
@@ -62,7 +62,6 @@ demos_base = \
|
||||
spinbutton.c \
|
||||
spinner.c \
|
||||
stack.c \
|
||||
tabs.c \
|
||||
textmask.c \
|
||||
textview.c \
|
||||
textscroll.c \
|
||||
|
||||
@@ -15,15 +15,15 @@ static GtkWidget *frame;
|
||||
|
||||
/* draw callback for the drawing area
|
||||
*/
|
||||
static void
|
||||
draw_function (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
draw_callback (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
cairo_paint (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -87,9 +87,11 @@ do_colorsel (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 200);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 200);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_function, NULL, NULL);
|
||||
|
||||
g_signal_connect (da, "draw", G_CALLBACK (draw_callback), NULL);
|
||||
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 200, 200);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
|
||||
@@ -51,17 +51,22 @@ css_text_changed (GtkTextBuffer *buffer,
|
||||
gtk_style_context_reset_widgets (gdk_screen_get_default ());
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_draw (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
drawing_area_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (da));
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_render_background (context, cr, 0, 0, width, height);
|
||||
gtk_render_frame (context, cr, 0, 0, width, height);
|
||||
gtk_render_background (context, cr,
|
||||
0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
gtk_render_frame (context, cr,
|
||||
0, 0,
|
||||
gtk_widget_get_allocated_width (widget),
|
||||
gtk_widget_get_allocated_height (widget));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -100,9 +105,8 @@ do_css_multiplebgs (GtkWidget *do_widget)
|
||||
|
||||
child = gtk_drawing_area_new ();
|
||||
gtk_widget_set_name (child, "canvas");
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (child),
|
||||
drawing_area_draw,
|
||||
NULL, NULL);
|
||||
g_signal_connect (child, "draw",
|
||||
G_CALLBACK (drawing_area_draw), NULL);
|
||||
gtk_container_add (GTK_CONTAINER (container), child);
|
||||
|
||||
child = gtk_button_new ();
|
||||
|
||||
@@ -190,7 +190,6 @@
|
||||
<file>stack.c</file>
|
||||
<file>spinbutton.c</file>
|
||||
<file>spinner.c</file>
|
||||
<file>tabs.c</file>
|
||||
<file>textview.c</file>
|
||||
<file>textscroll.c</file>
|
||||
<file>theming_style_classes.c</file>
|
||||
|
||||
@@ -50,15 +50,15 @@ scribble_configure_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
/* Redraw the screen from the surface */
|
||||
static void
|
||||
scribble_draw (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
scribble_draw (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
cairo_set_source_surface (cr, surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Draw a rectangle on the screen */
|
||||
@@ -136,14 +136,12 @@ scribble_motion_notify_event (GtkWidget *widget,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
checkerboard_draw (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
checkerboard_draw (GtkWidget *da,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
gint i, j, xcount, ycount;
|
||||
gint i, j, xcount, ycount, width, height;
|
||||
|
||||
#define CHECK_SIZE 10
|
||||
#define SPACING 2
|
||||
@@ -156,6 +154,8 @@ checkerboard_draw (GtkDrawingArea *da,
|
||||
*/
|
||||
|
||||
xcount = 0;
|
||||
width = gtk_widget_get_allocated_width (da);
|
||||
height = gtk_widget_get_allocated_height (da);
|
||||
i = SPACING;
|
||||
while (i < width)
|
||||
{
|
||||
@@ -180,6 +180,11 @@ checkerboard_draw (GtkDrawingArea *da,
|
||||
i += CHECK_SIZE + SPACING;
|
||||
++xcount;
|
||||
}
|
||||
|
||||
/* return TRUE because we've handled this event, so no
|
||||
* further processing is required.
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -228,11 +233,14 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), checkerboard_draw, NULL, NULL);
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (checkerboard_draw), NULL);
|
||||
|
||||
/*
|
||||
* Create the scribble area
|
||||
*/
|
||||
@@ -247,13 +255,15 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
|
||||
/* set a minimum size */
|
||||
gtk_widget_set_size_request (da, 100, 100);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), da);
|
||||
|
||||
/* Signals used to handle backing surface */
|
||||
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (scribble_draw), NULL);
|
||||
g_signal_connect (da,"configure-event",
|
||||
G_CALLBACK (scribble_configure_event), NULL);
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
char **icon_names = NULL;
|
||||
gsize n_icon_names = 0;
|
||||
|
||||
GtkWidget *allow_changes;
|
||||
|
||||
static void
|
||||
init_icon_names (GtkIconTheme *theme)
|
||||
{
|
||||
@@ -26,7 +24,7 @@ init_icon_names (GtkIconTheme *theme)
|
||||
|
||||
for (l = icon_list; l; l = l->next)
|
||||
{
|
||||
if (g_str_has_suffix (l->data, "symbolic"))
|
||||
if (g_str_has_suffix (l->data, "-symbolic"))
|
||||
continue;
|
||||
|
||||
g_ptr_array_add (icons, g_strdup (l->data));
|
||||
@@ -121,6 +119,7 @@ do_stats (GtkWidget *widget,
|
||||
stats->last_suggestion *= 2;
|
||||
else
|
||||
stats->last_suggestion = 1;
|
||||
*suggested_change = stats->last_suggestion;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -129,22 +128,17 @@ do_stats (GtkWidget *widget,
|
||||
else
|
||||
stats->last_suggestion = -1;
|
||||
stats->last_suggestion = MAX (stats->last_suggestion, 1 - (int) stats->item_counter[stats->stats_index]);
|
||||
*suggested_change = stats->last_suggestion;
|
||||
}
|
||||
|
||||
stats->stats_index = (stats->stats_index + 1) % N_STATS;
|
||||
stats->frame_counter[stats->stats_index] = 0;
|
||||
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
|
||||
stats->last_stats = frame_time;
|
||||
|
||||
if (suggested_change)
|
||||
*suggested_change = stats->last_suggestion;
|
||||
else
|
||||
stats->last_suggestion = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (suggested_change)
|
||||
*suggested_change = 0;
|
||||
*suggested_change = 0;
|
||||
}
|
||||
|
||||
stats->last_frame = frame_time;
|
||||
@@ -290,11 +284,9 @@ move_fish (GtkWidget *bowl,
|
||||
gpointer info_label)
|
||||
{
|
||||
gint64 elapsed;
|
||||
gint suggested_change = 0;
|
||||
gint suggested_change;
|
||||
|
||||
elapsed = do_stats (bowl,
|
||||
info_label,
|
||||
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allow_changes)) ? &suggested_change : NULL);
|
||||
elapsed = do_stats (bowl, info_label, &suggested_change);
|
||||
|
||||
gtk_container_foreach (GTK_CONTAINER (bowl), move_one_fish, &elapsed);
|
||||
|
||||
@@ -321,7 +313,6 @@ do_fishbowl (GtkWidget *do_widget)
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
|
||||
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
|
||||
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
@@ -329,10 +320,12 @@ do_fishbowl (GtkWidget *do_widget)
|
||||
|
||||
gtk_widget_realize (window);
|
||||
gtk_widget_add_tick_callback (bowl, move_fish, info_label, NULL);
|
||||
|
||||
//add_fish (bowl, 300);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
gtk_widget_show_all (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
|
||||
@@ -10,29 +10,7 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="info_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">0 icons - 0 fps</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="changes_allow">
|
||||
<property name="active">False</property>
|
||||
<property name="visible" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
|
||||
<property name="icon-name">changes-allow</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="changes_prevent">
|
||||
<property name="active" bind-source="changes_allow" bind-property="active" bind-flags="bidirectional|invert-boolean">True</property>
|
||||
<property name="visible" bind-source="changes_prevent" bind-property="active" bind-flags="invert-boolean">False</property>
|
||||
<property name="icon-name">changes-prevent</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="label">0 fish - 0 fps</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static void
|
||||
draw_color (GtkDrawingArea *drawingarea,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
draw_color (GtkWidget *drawingarea,
|
||||
cairo_t *cr,
|
||||
const char *color_name)
|
||||
{
|
||||
const char *color_name = data;
|
||||
GdkRGBA rgba;
|
||||
|
||||
if (gdk_rgba_parse (&rgba, color_name))
|
||||
@@ -25,6 +22,8 @@ draw_color (GtkDrawingArea *drawingarea,
|
||||
gdk_cairo_set_source_rgba (cr, &rgba);
|
||||
cairo_paint (cr);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
@@ -34,9 +33,8 @@ color_swatch_new (const gchar *color)
|
||||
|
||||
button = gtk_button_new ();
|
||||
area = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (area), 24);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (area), 24);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (area), draw_color, (gpointer) color, NULL);
|
||||
g_signal_connect (area, "draw", G_CALLBACK (draw_color), (gpointer) color);
|
||||
gtk_widget_set_size_request (area, 24, 24);
|
||||
gtk_container_add (GTK_CONTAINER (button), area);
|
||||
gtk_widget_show_all (button);
|
||||
|
||||
|
||||
@@ -881,18 +881,16 @@ draw_spinbutton (GtkWidget *widget,
|
||||
g_object_unref (spin_context);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_func (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
draw_cb (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (da);
|
||||
gint panewidth;
|
||||
gint panewidth, width, height;
|
||||
gint x, y;
|
||||
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
panewidth = width / 2;
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_set_source_rgb (cr, 0.9, 0.9, 0.9);
|
||||
@@ -946,6 +944,8 @@ draw_func (GtkDrawingArea *da,
|
||||
|
||||
y += height + 10;
|
||||
draw_combobox (widget, cr, 10 + panewidth, y, panewidth - 20, TRUE, &height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -968,12 +968,12 @@ do_foreigndrawing (GtkWidget *do_widget)
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
da = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 400);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 400);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
|
||||
gtk_widget_set_size_request (da, 400, 400);
|
||||
gtk_widget_set_hexpand (da, TRUE);
|
||||
gtk_widget_set_vexpand (da, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box), da);
|
||||
|
||||
g_signal_connect (da, "draw", G_CALLBACK (draw_cb), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -60,18 +60,20 @@ zoom_scale_changed (GtkGestureZoom *gesture,
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_draw (GtkDrawingArea *area,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
drawing_area_draw (GtkWidget *widget,
|
||||
cairo_t *cr)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
if (swipe_x != 0 || swipe_y != 0)
|
||||
{
|
||||
cairo_save (cr);
|
||||
cairo_set_line_width (cr, 6);
|
||||
cairo_move_to (cr, width / 2, height / 2);
|
||||
cairo_move_to (cr, allocation.width / 2,
|
||||
allocation.height / 2);
|
||||
cairo_rel_line_to (cr, swipe_x, swipe_y);
|
||||
cairo_set_source_rgba (cr, 1, 0, 0, 0.5);
|
||||
cairo_stroke (cr);
|
||||
@@ -85,7 +87,9 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
gdouble angle, scale;
|
||||
|
||||
cairo_get_matrix (cr, &matrix);
|
||||
cairo_matrix_translate (&matrix, width / 2, height / 2);
|
||||
cairo_matrix_translate (&matrix,
|
||||
allocation.width / 2,
|
||||
allocation.height / 2);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
@@ -112,8 +116,8 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
if (long_pressed)
|
||||
{
|
||||
cairo_save (cr);
|
||||
cairo_arc (cr,
|
||||
width / 2, height / 2,
|
||||
cairo_arc (cr, allocation.width / 2,
|
||||
allocation.height / 2,
|
||||
50, 0, 2 * G_PI);
|
||||
|
||||
cairo_set_source_rgba (cr, 0, 1, 0, 0.5);
|
||||
@@ -121,6 +125,8 @@ drawing_area_draw (GtkDrawingArea *area,
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -144,9 +150,8 @@ do_gestures (GtkWidget *do_widget)
|
||||
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK | GDK_TOUCH_MASK);
|
||||
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
|
||||
drawing_area_draw,
|
||||
NULL, NULL);
|
||||
g_signal_connect (drawing_area, "draw",
|
||||
G_CALLBACK (drawing_area_draw), NULL);
|
||||
|
||||
/* Swipe */
|
||||
gesture = gtk_gesture_swipe_new (drawing_area);
|
||||
|
||||
@@ -75,15 +75,15 @@ load_pixbufs (GError **error)
|
||||
}
|
||||
|
||||
/* Expose callback for the drawing area */
|
||||
static void
|
||||
draw_func (GtkDrawingArea *area,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gint
|
||||
draw_cb (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
gdk_cairo_set_source_pixbuf (cr, frame, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define CYCLE_TIME 3000000 /* 3 seconds */
|
||||
@@ -204,13 +204,14 @@ do_pixbufs (GtkWidget *do_widget)
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_size_request (window, back_width, back_height);
|
||||
|
||||
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
|
||||
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), back_width);
|
||||
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), back_height);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (draw_cb), NULL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
|
||||
|
||||
@@ -88,12 +88,10 @@ create_fancy_attr_list_for_layout (PangoLayout *layout)
|
||||
return attrs;
|
||||
}
|
||||
|
||||
static void
|
||||
rotated_text_draw (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
rotated_text_draw (GtkWidget *widget,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
#define RADIUS 150
|
||||
#define N_WORDS 5
|
||||
@@ -108,12 +106,15 @@ rotated_text_draw (GtkDrawingArea *da,
|
||||
PangoAttrList *attrs;
|
||||
|
||||
double device_radius;
|
||||
int width, height;
|
||||
int i;
|
||||
|
||||
/* Create a cairo context and set up a transformation matrix so that the user
|
||||
* space coordinates for the centered square where we draw are [-RADIUS, RADIUS],
|
||||
* [-RADIUS, RADIUS].
|
||||
* We first center, then change the scale. */
|
||||
width = gtk_widget_get_allocated_width (widget);
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
device_radius = MIN (width, height) / 2.;
|
||||
cairo_translate (cr,
|
||||
device_radius + (width - 2 * device_radius) / 2,
|
||||
@@ -127,7 +128,7 @@ rotated_text_draw (GtkDrawingArea *da,
|
||||
cairo_set_source (cr, pattern);
|
||||
|
||||
/* Create a PangoContext and set up our shape renderer */
|
||||
context = gtk_widget_create_pango_context (GTK_WIDGET (da));
|
||||
context = gtk_widget_create_pango_context (widget);
|
||||
pango_cairo_context_set_shape_renderer (context,
|
||||
fancy_shape_renderer,
|
||||
NULL, NULL);
|
||||
@@ -163,6 +164,8 @@ rotated_text_draw (GtkDrawingArea *da,
|
||||
g_object_unref (layout);
|
||||
g_object_unref (context);
|
||||
cairo_pattern_destroy (pattern);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -196,9 +199,8 @@ do_rotated_text (GtkWidget *do_widget)
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (drawing_area),
|
||||
GTK_STYLE_CLASS_VIEW);
|
||||
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area),
|
||||
rotated_text_draw,
|
||||
NULL, NULL);
|
||||
g_signal_connect (drawing_area, "draw",
|
||||
G_CALLBACK (rotated_text_draw), NULL);
|
||||
|
||||
/* And a label */
|
||||
label = gtk_label_new (text);
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
/* Text View/Tabs
|
||||
*
|
||||
* GtkTextView can position text at fixed positions, using tabs.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
GtkWidget *
|
||||
do_tabs (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *view;
|
||||
GtkWidget *sw;
|
||||
GtkTextBuffer *buffer;
|
||||
PangoTabArray *tabs;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Tabs");
|
||||
gtk_window_set_screen (GTK_WINDOW (window),
|
||||
gtk_widget_get_screen (do_widget));
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
|
||||
|
||||
tabs = pango_tab_array_new (3, TRUE);
|
||||
pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 0);
|
||||
pango_tab_array_set_tab (tabs, 1, PANGO_TAB_LEFT, 150);
|
||||
pango_tab_array_set_tab (tabs, 2, PANGO_TAB_LEFT, 300);
|
||||
gtk_text_view_set_tabs (GTK_TEXT_VIEW (view), tabs);
|
||||
pango_tab_array_free (tabs);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
gtk_text_buffer_set_text (buffer, "one\ttwo\tthree\nfour\tfive\tsix\nseven\teight\tnine", -1);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
gtk_container_add (GTK_CONTAINER (sw), view);
|
||||
|
||||
gtk_widget_show_all (sw);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -7,12 +7,10 @@
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static void
|
||||
draw_text (GtkDrawingArea *da,
|
||||
cairo_t *cr,
|
||||
int width,
|
||||
int height,
|
||||
gpointer data)
|
||||
static gboolean
|
||||
draw_text (GtkWidget *da,
|
||||
cairo_t *cr,
|
||||
gpointer data)
|
||||
{
|
||||
cairo_pattern_t *pattern;
|
||||
PangoLayout *layout;
|
||||
@@ -20,7 +18,7 @@ draw_text (GtkDrawingArea *da,
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
layout = gtk_widget_create_pango_layout (GTK_WIDGET (da), "Pango power!\nPango power!\nPango power!");
|
||||
layout = gtk_widget_create_pango_layout (da, "Pango power!\nPango power!\nPango power!");
|
||||
desc = pango_font_description_from_string ("sans bold 34");
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_font_description_free (desc);
|
||||
@@ -29,7 +27,9 @@ draw_text (GtkDrawingArea *da,
|
||||
pango_cairo_layout_path (cr, layout);
|
||||
g_object_unref (layout);
|
||||
|
||||
pattern = cairo_pattern_create_linear (0.0, 0.0, width, height);
|
||||
pattern = cairo_pattern_create_linear (0.0, 0.0,
|
||||
gtk_widget_get_allocated_width (da),
|
||||
gtk_widget_get_allocated_height (da));
|
||||
cairo_pattern_add_color_stop_rgb (pattern, 0.0, 1.0, 0.0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgb (pattern, 0.2, 1.0, 0.0, 0.0);
|
||||
cairo_pattern_add_color_stop_rgb (pattern, 0.3, 1.0, 1.0, 0.0);
|
||||
@@ -49,6 +49,8 @@ draw_text (GtkDrawingArea *da,
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@@ -70,7 +72,8 @@ do_textmask (GtkWidget *do_widget)
|
||||
da = gtk_drawing_area_new ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (window), da);
|
||||
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_text, NULL, NULL);
|
||||
g_signal_connect (da, "draw",
|
||||
G_CALLBACK (draw_text), NULL);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
||||
@@ -72,9 +72,8 @@
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparator">
|
||||
<object class="GtkVSeparator">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -111,6 +110,7 @@
|
||||
<property name="xpad">10</property>
|
||||
<property name="ypad">10</property>
|
||||
<property name="stock-size">5</property>
|
||||
<property name="follow-state">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
||||
@@ -413,7 +413,16 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="menu_model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="gear_image">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="icon_name">open-menu-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
@@ -528,7 +537,13 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<object class="GtkButton" id="button224">
|
||||
<property name="visible">1</property>
|
||||
<property name="can_focus">1</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="button224img">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="fill">0</property>
|
||||
@@ -1788,7 +1803,16 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="page2dismissi">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -1935,7 +1959,15 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="menu-model">dinner_menu</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
@@ -2134,7 +2166,16 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
<property name="margin-start">12</property>
|
||||
<property name="margin-end">12</property>
|
||||
<property name="icon-name">appointment-soon-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">appointment-soon-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -2991,7 +3032,16 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="draw-indicator">0</property>
|
||||
<property name="active">1</property>
|
||||
<property name="icon-name">view-grid-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">view-grid-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
@@ -3000,7 +3050,16 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="draw-indicator">0</property>
|
||||
<property name="group">grid_button</property>
|
||||
<property name="icon-name">view-list-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">view-list-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3008,10 +3067,17 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="circular_button">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3311,21 +3377,48 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkButton" id="cutbutton">
|
||||
<property name="visible">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-cut-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-cut-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="copybutton">
|
||||
<property name="visible">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-copy-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-copy-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="pastebutton">
|
||||
<property name="visible">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-paste-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-paste-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3335,7 +3428,16 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="icon-name">edit-delete-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="icon-name">edit-delete-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">1</property>
|
||||
@@ -3371,13 +3473,31 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">pan-start-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">pan-start-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3451,11 +3571,17 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<signal name="clicked" handler="tab_close_cb" object="closable_page_1"/>
|
||||
<style>
|
||||
<class name="small-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
@@ -3486,11 +3612,17 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="relief">none</property>
|
||||
<property name="focus-on-click">0</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<signal name="clicked" handler="tab_close_cb" object="closable_page_2"/>
|
||||
<style>
|
||||
<class name="small-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
@@ -3579,8 +3711,15 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="visible">1</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="popover">notebook_info_popover</property>
|
||||
<property name="icon-name">emblem-important-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<property name="visible">1</property>
|
||||
<property name="icon-name">emblem-important-symbolic</property>
|
||||
<property name="icon-size">1</property>
|
||||
</object>
|
||||
</child>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
<class name="circular"/>
|
||||
<class name="flat"/>
|
||||
</style>
|
||||
|
||||
@@ -34,16 +34,13 @@ IGNORE_HFILES= \
|
||||
gdkdisplaymanagerprivate.h \
|
||||
gdkdisplayprivate.h \
|
||||
gdkdndprivate.h \
|
||||
gdkdrawcontextprivate.h \
|
||||
gdkframeclockprivate.h \
|
||||
gdkglcontextprivate.h \
|
||||
gdkkeysprivate.h \
|
||||
gdkmonitorprivate.h \
|
||||
gdkscreenprivate.h \
|
||||
gdkseatdefaultprivate.h \
|
||||
gdkseatprivate.h \
|
||||
gdkvisualprivate.h \
|
||||
gdkvulkancontextprivate.h \
|
||||
keyname-table.h \
|
||||
win32 \
|
||||
x11 \
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
<xi:include href="xml/gdkframetimings.xml" />
|
||||
<xi:include href="xml/gdkdrawingcontext.xml" />
|
||||
<xi:include href="xml/gdkglcontext.xml" />
|
||||
<xi:include href="xml/gdkvulkancontext.xml" />
|
||||
<xi:include href="xml/events.xml" />
|
||||
<xi:include href="xml/event_structs.xml" />
|
||||
<xi:include href="xml/keys.xml" />
|
||||
|
||||
@@ -127,6 +127,7 @@ gdk_display_supports_clipboard_persistence
|
||||
gdk_display_store_clipboard
|
||||
gdk_display_supports_shapes
|
||||
gdk_display_supports_input_shapes
|
||||
gdk_display_supports_composite
|
||||
gdk_display_get_app_launch_context
|
||||
gdk_display_notify_startup_complete
|
||||
gdk_display_get_default_seat
|
||||
@@ -179,8 +180,21 @@ GdkScreen
|
||||
gdk_screen_get_default
|
||||
gdk_screen_get_root_window
|
||||
gdk_screen_get_display
|
||||
gdk_screen_get_number
|
||||
gdk_screen_get_toplevel_windows
|
||||
gdk_screen_get_n_monitors
|
||||
gdk_screen_get_primary_monitor
|
||||
gdk_screen_get_monitor_geometry
|
||||
gdk_screen_get_monitor_workarea
|
||||
gdk_screen_get_monitor_at_point
|
||||
gdk_screen_get_monitor_at_window
|
||||
gdk_screen_get_monitor_height_mm
|
||||
gdk_screen_get_monitor_width_mm
|
||||
gdk_screen_get_monitor_plug_name
|
||||
gdk_screen_get_monitor_scale_factor
|
||||
gdk_screen_get_setting
|
||||
gdk_screen_get_font_options
|
||||
gdk_screen_set_font_options
|
||||
gdk_screen_get_resolution
|
||||
gdk_screen_set_resolution
|
||||
|
||||
@@ -199,6 +213,7 @@ gdk_screen_get_type
|
||||
<SECTION>
|
||||
<TITLE>Pixbufs</TITLE>
|
||||
<FILE>pixbufs</FILE>
|
||||
gdk_pixbuf_get_from_window
|
||||
gdk_pixbuf_get_from_surface
|
||||
</SECTION>
|
||||
|
||||
@@ -208,8 +223,6 @@ gdk_pixbuf_get_from_surface
|
||||
GdkRGBA
|
||||
gdk_rgba_copy
|
||||
gdk_rgba_free
|
||||
gdk_rgba_is_clear
|
||||
gdk_rgba_is_opaque
|
||||
gdk_rgba_parse
|
||||
gdk_rgba_equal
|
||||
gdk_rgba_hash
|
||||
@@ -303,7 +316,10 @@ gdk_window_resize
|
||||
gdk_window_move_resize
|
||||
gdk_window_scroll
|
||||
gdk_window_move_region
|
||||
gdk_window_flush
|
||||
gdk_window_has_native
|
||||
gdk_window_ensure_native
|
||||
gdk_window_reparent
|
||||
gdk_window_raise
|
||||
gdk_window_lower
|
||||
gdk_window_restack
|
||||
@@ -319,13 +335,13 @@ gdk_window_beep
|
||||
gdk_window_get_scale_factor
|
||||
gdk_window_set_opaque_region
|
||||
gdk_window_create_gl_context
|
||||
gdk_window_create_vulkan_context
|
||||
gdk_window_mark_paint_from_clip
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_window_get_clip_region
|
||||
gdk_window_begin_draw_frame
|
||||
gdk_window_end_draw_frame
|
||||
gdk_window_should_draw
|
||||
gdk_window_get_visible_region
|
||||
|
||||
<SUBSECTION>
|
||||
@@ -336,6 +352,8 @@ gdk_window_invalidate_maybe_recurse
|
||||
gdk_window_get_update_area
|
||||
gdk_window_freeze_updates
|
||||
gdk_window_thaw_updates
|
||||
gdk_window_process_all_updates
|
||||
gdk_window_process_updates
|
||||
gdk_window_get_frame_clock
|
||||
|
||||
<SUBSECTION>
|
||||
@@ -356,6 +374,10 @@ gdk_window_input_shape_combine_region
|
||||
gdk_window_set_child_input_shapes
|
||||
gdk_window_merge_child_input_shapes
|
||||
gdk_window_set_title
|
||||
gdk_window_set_background
|
||||
gdk_window_set_background_rgba
|
||||
gdk_window_set_background_pattern
|
||||
gdk_window_get_background_pattern
|
||||
GDK_PARENT_RELATIVE
|
||||
gdk_window_set_cursor
|
||||
gdk_window_get_cursor
|
||||
@@ -516,12 +538,12 @@ gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_get_drawing_context
|
||||
gdk_cairo_set_source_rgba
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_set_source_window
|
||||
gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
gdk_cairo_region_create_from_surface
|
||||
gdk_cairo_surface_create_from_pixbuf
|
||||
gdk_cairo_draw_from_gl
|
||||
gdk_cairo_surface_upload_to_gl
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -659,7 +681,6 @@ gdk_device_get_last_event_window
|
||||
<SUBSECTION>
|
||||
gdk_device_tool_get_serial
|
||||
gdk_device_tool_get_tool_type
|
||||
gdk_device_tool_get_hardware_id
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_AXIS_USE
|
||||
@@ -679,8 +700,6 @@ GDK_TYPE_DEVICE
|
||||
GdkDeviceClass
|
||||
gdk_device_get_type
|
||||
gdk_device_type_get_type
|
||||
gdk_device_tool_get_type
|
||||
gdk_device_tool_new
|
||||
GDK_MAX_TIMECOORD_AXES
|
||||
</SECTION>
|
||||
|
||||
@@ -1260,22 +1279,6 @@ gdk_frame_timings_get_predicted_presentation_time
|
||||
gdk_frame_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkdrawcontext</FILE>
|
||||
GdkDrawContext
|
||||
gdk_draw_context_get_display
|
||||
gdk_draw_context_get_window
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAW_CONTEXT
|
||||
GDK_IS_DRAW_CONTEXT
|
||||
GDK_TYPE_DRAW_CONTEXT
|
||||
GDK_DRAW_CONTEXT_CLASS
|
||||
GDK_DRAW_CONTEXT_GET_CLASS
|
||||
GDK_IS_DRAW_CONTEXT_CLASS
|
||||
gdk_draw_context_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkglcontext</FILE>
|
||||
GdkGLContext
|
||||
@@ -1298,7 +1301,6 @@ gdk_gl_context_is_legacy
|
||||
<SUBSECTION>
|
||||
GdkGLError
|
||||
gdk_gl_context_realize
|
||||
gdk_gl_context_get_damage
|
||||
gdk_gl_context_make_current
|
||||
gdk_gl_context_get_current
|
||||
gdk_gl_context_clear_current
|
||||
@@ -1356,23 +1358,3 @@ GDK_TYPE_DRAWING_CONTEXT
|
||||
GDK_DRAWING_CONTEXT
|
||||
GDK_IS_DRAWING_CONTEXT
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkvulkancontext</FILE>
|
||||
GdkVulkanContext
|
||||
gdk_vulkan_context_get_device
|
||||
gdk_vulkan_context_get_draw_index
|
||||
gdk_vulkan_context_get_draw_semaphore
|
||||
gdk_vulkan_context_get_image
|
||||
gdk_vulkan_context_get_image_format
|
||||
gdk_vulkan_context_get_instance
|
||||
gdk_vulkan_context_get_n_images
|
||||
gdk_vulkan_context_get_physical_device
|
||||
gdk_vulkan_context_get_queue
|
||||
gdk_vulkan_context_get_queue_family_index
|
||||
|
||||
<SUBSECTION Standard>
|
||||
gdk_vulkan_context_get_type
|
||||
gdk_vulkan_error_quark
|
||||
gdk_vulkan_strerror
|
||||
</SECTION>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<title>API Reference</title>
|
||||
<xi:include href="xml/GskRenderer.xml" />
|
||||
<xi:include href="xml/GskRenderNode.xml" />
|
||||
<xi:include href="xml/GskRenderNodeIter.xml" />
|
||||
</reference>
|
||||
|
||||
<index id="api-index-full">
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
<SECTION>
|
||||
<FILE>GskRenderer</FILE>
|
||||
gsk_renderer_new_for_window
|
||||
gsk_renderer_get_for_display
|
||||
gsk_renderer_set_viewport
|
||||
gsk_renderer_get_viewport
|
||||
gsk_renderer_set_scale_factor
|
||||
gsk_renderer_get_scale_factor
|
||||
gsk_renderer_set_window
|
||||
gsk_renderer_get_window
|
||||
gsk_renderer_get_display
|
||||
gsk_renderer_realize
|
||||
gsk_renderer_unrealize
|
||||
gsk_renderer_begin_draw_frame
|
||||
gsk_renderer_end_draw_frame
|
||||
gsk_renderer_create_render_node
|
||||
gsk_renderer_render
|
||||
gsk_renderer_render_texture
|
||||
<SUBSECTION Standard>
|
||||
GSK_IS_RENDERER
|
||||
GSK_RENDERER
|
||||
@@ -27,39 +26,39 @@ GSK_TYPE_SCALING_FILTER
|
||||
<FILE>GskRenderNode</FILE>
|
||||
gsk_render_node_ref
|
||||
gsk_render_node_unref
|
||||
GskRenderNodeType
|
||||
gsk_render_node_get_node_type
|
||||
gsk_render_node_draw
|
||||
gsk_render_node_get_parent
|
||||
gsk_render_node_get_first_child
|
||||
gsk_render_node_get_last_child
|
||||
gsk_render_node_get_next_sibling
|
||||
gsk_render_node_get_previous_sibling
|
||||
gsk_render_node_append_child
|
||||
gsk_render_node_prepend_child
|
||||
gsk_render_node_insert_child_at_pos
|
||||
gsk_render_node_insert_child_before
|
||||
gsk_render_node_insert_child_after
|
||||
gsk_render_node_remove_child
|
||||
gsk_render_node_replace_child
|
||||
gsk_render_node_remove_all_children
|
||||
gsk_render_node_get_n_children
|
||||
gsk_render_node_contains
|
||||
gsk_render_node_set_bounds
|
||||
gsk_render_node_set_transform
|
||||
gsk_render_node_set_anchor_point
|
||||
gsk_render_node_set_opacity
|
||||
gsk_render_node_set_hidden
|
||||
gsk_render_node_is_hidden
|
||||
gsk_render_node_set_opaque
|
||||
gsk_render_node_is_opaque
|
||||
gsk_render_node_get_draw_context
|
||||
GskBlendMode
|
||||
gsk_render_node_set_blend_mode
|
||||
GskScalingFilter
|
||||
gsk_render_node_set_scaling_filters
|
||||
gsk_render_node_set_name
|
||||
gsk_render_node_get_name
|
||||
gsk_render_node_get_bounds
|
||||
gsk_color_node_new
|
||||
gsk_linear_gradient_node_new
|
||||
gsk_repeating_linear_gradient_node_new
|
||||
gsk_border_node_new
|
||||
gsk_texture_node_new
|
||||
gsk_inset_shadow_node_new
|
||||
gsk_outset_shadow_node_new
|
||||
gsk_cairo_node_new
|
||||
gsk_cairo_node_get_draw_context
|
||||
gsk_container_node_new
|
||||
gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_clip_node_new
|
||||
gsk_clip_node_get_child
|
||||
gsk_rounded_clip_node_new
|
||||
gsk_rounded_clip_node_get_child
|
||||
GskShadow
|
||||
gsk_shadow_node_new
|
||||
GskBlendMode
|
||||
gsk_blend_node_new
|
||||
gsk_cross_fade_node_new
|
||||
gsk_value_set_render_node
|
||||
gsk_value_take_render_node
|
||||
gsk_value_get_render_node
|
||||
gsk_value_dup_render_node
|
||||
<SUBSECTION Standard>
|
||||
GSK_IS_RENDER_NODE
|
||||
GSK_RENDER_NODE
|
||||
@@ -72,33 +71,16 @@ GSK_TYPE_BLEND_MODE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskTexture</FILE>
|
||||
gsk_texture_ref
|
||||
gsk_texture_unref
|
||||
gsk_texture_new_for_data
|
||||
gsk_texture_new_for_pixbuf
|
||||
gsk_texture_get_width
|
||||
gsk_texture_get_height
|
||||
gsk_texture_download
|
||||
<FILE>GskRenderNodeIter</FILE>
|
||||
gsk_render_node_iter_new
|
||||
gsk_render_node_iter_free
|
||||
gsk_render_node_iter_init
|
||||
gsk_render_node_iter_is_valid
|
||||
gsk_render_node_iter_prev
|
||||
gsk_render_node_iter_next
|
||||
gsk_render_node_iter_remove
|
||||
<SUBSECTION Standard>
|
||||
GskTexture
|
||||
gsk_texture_get_type
|
||||
GSK_TYPE_TEXTURE
|
||||
GSK_IS_TEXTURE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>GskRoundedRect</FILE>
|
||||
GskCorner
|
||||
GskRoundedRect
|
||||
gsk_rounded_rect_init
|
||||
gsk_rounded_rect_init_copy
|
||||
gsk_rounded_rect_init_from_rect
|
||||
gsk_rounded_rect_normalize
|
||||
gsk_rounded_rect_offset
|
||||
gsk_rounded_rect_shrink
|
||||
gsk_rounded_rect_is_rectilinear
|
||||
gsk_rounded_rect_contains_point
|
||||
gsk_rounded_rect_contains_rect
|
||||
gsk_rounded_rect_intersects_rect
|
||||
GSK_TYPE_RENDER_NODE_ITER
|
||||
GskRenderNodeIter
|
||||
gsk_render_node_iter_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
gsk_render_node_get_type
|
||||
gsk_render_node_iter_get_type
|
||||
gsk_renderer_get_type
|
||||
|
||||
@@ -31,48 +31,37 @@ IGNORE_HFILES = \
|
||||
gtkapplicationprivate.h \
|
||||
gtkbindingsprivate.h \
|
||||
gtkbitmaskprivate.h \
|
||||
gtkboxgadgetprivate.h \
|
||||
gtkboxprivate.h \
|
||||
gtkbuilderprivate.h \
|
||||
gtkbuiltiniconprivate.h \
|
||||
gtkbuttonprivate.h \
|
||||
gtkcairoblurprivate.h \
|
||||
gtkcellareaboxcontextprivate.h \
|
||||
gtkcheckbuttonprivate.h \
|
||||
gtkclipboardprivate.h \
|
||||
gtkcolorchooserprivate.h \
|
||||
gtkcoloreditorprivate.h \
|
||||
gtkcolorplaneprivate.h \
|
||||
gtkcolorscaleprivate.h \
|
||||
gtkcolorswatchprivate.h \
|
||||
gtkcolorutils.h \
|
||||
gtkcomboboxprivate.h \
|
||||
gtkcomposetable.h \
|
||||
gtkcontainerprivate.h \
|
||||
gtkcssanimatedstyleprivate.h \
|
||||
gtkcssanimationprivate.h \
|
||||
gtkcssarrayvalueprivate.h \
|
||||
gtkcssbgsizevalueprivate.h \
|
||||
gtkcssbordervalueprivate.h \
|
||||
gtkcsscalcvalueprivate.h \
|
||||
gtkcsscolorvalueprivate.h \
|
||||
gtkcsscornervalueprivate.h \
|
||||
gtkcsscustomgadgetprivate.h \
|
||||
gtkcsscustompropertyprivate.h \
|
||||
gtkcssdimensionvalueprivate.h \
|
||||
gtkcsseasevalueprivate.h \
|
||||
gtkcssenginevalueprivate.h \
|
||||
gtkcssenumvalueprivate.h \
|
||||
gtkcssgadgetprivate.h \
|
||||
gtkcssiconthemevalueprivate.h \
|
||||
gtkcssimagebuiltinprivate.h \
|
||||
gtkcssimagecrossfadeprivate.h \
|
||||
gtkcssimagefallbackprivate.h \
|
||||
gtkcssimagegradientprivate.h \
|
||||
gtkcssimageiconthemeprivate.h \
|
||||
gtkcssimagelinearprivate.h \
|
||||
gtkcssimageradialprivate.h \
|
||||
gtkcssimageprivate.h \
|
||||
gtkcssimagerecolorprivate.h \
|
||||
gtkcssimagescaledprivate.h \
|
||||
gtkcssimagesurfaceprivate.h \
|
||||
gtkcssimageurlprivate.h \
|
||||
@@ -84,10 +73,8 @@ IGNORE_HFILES = \
|
||||
gtkcsslookupprivate.h \
|
||||
gtkcssmatcherprivate.h \
|
||||
gtkcssnodeprivate.h \
|
||||
gtkcssnodestylecacheprivate.h \
|
||||
gtkcssnodedeclarationprivate.h \
|
||||
gtkcssnumbervalueprivate.h \
|
||||
gtkcsspalettevalueprivate.h \
|
||||
gtkcsspathnodeprivate.h \
|
||||
gtkcssparserprivate.h \
|
||||
gtkcsspositionvalueprivate.h \
|
||||
@@ -101,7 +88,6 @@ IGNORE_HFILES = \
|
||||
gtkcssshorthandpropertyprivate.h\
|
||||
gtkcssstaticstyleprivate.h \
|
||||
gtkcssstringvalueprivate.h \
|
||||
gtkcssstylechangeprivate.h \
|
||||
gtkcssstylefuncsprivate.h \
|
||||
gtkcssstyleprivate.h \
|
||||
gtkcssstylepropertyprivate.h \
|
||||
@@ -113,13 +99,9 @@ IGNORE_HFILES = \
|
||||
gtkcssunsetvalueprivate.h \
|
||||
gtkcssvalueprivate.h \
|
||||
gtkcsswidgetnodeprivate.h \
|
||||
gtkcsswin32sizevalueprivate.h \
|
||||
gtkdebugupdatesprivate.h \
|
||||
gtkdialogprivate.h \
|
||||
gtkdndprivate.h \
|
||||
gtkentryprivate.h \
|
||||
gtkeventcontrollerprivate.h \
|
||||
gtkfilechoosernativeprivate.h \
|
||||
gtkfilechooserprivate.h \
|
||||
gtkfilechooserwidgetprivate.h \
|
||||
gtkfontchooserprivate.h \
|
||||
@@ -134,13 +116,9 @@ IGNORE_HFILES = \
|
||||
gtkgesturezoomprivate.h \
|
||||
gtkheaderbarprivate.h \
|
||||
gtkhslaprivate.h \
|
||||
gtkiconprivate.h \
|
||||
gtkiconhelperprivate.h \
|
||||
gtkiconthemeprivate.h \
|
||||
gtkiconviewprivate.h \
|
||||
gtkimagedefinitionprivate.h \
|
||||
gtkimageprivate.h \
|
||||
gtkimcontextsimpleprivate.h \
|
||||
gtkimmoduleprivate.h \
|
||||
gtklabelprivate.h \
|
||||
gtklockbuttonprivate.h \
|
||||
@@ -160,12 +138,12 @@ IGNORE_HFILES = \
|
||||
gtkprinter-private.h \
|
||||
gtkprintoperation-private.h \
|
||||
gtkprivate.h \
|
||||
gtkprogresstrackerprivate.h \
|
||||
gtkrangeprivate.h \
|
||||
gtkrecentchooserprivate.h \
|
||||
gtkrenderbackgroundprivate.h \
|
||||
gtkrenderborderprivate.h \
|
||||
gtkrendericonprivate.h \
|
||||
gtkrenderprivate.h \
|
||||
gtkroundedboxprivate.h \
|
||||
gtkscaleprivate.h \
|
||||
gtksearchengine.h \
|
||||
@@ -176,31 +154,25 @@ IGNORE_HFILES = \
|
||||
gtksearchentryprivate.h \
|
||||
gtkselectionprivate.h \
|
||||
gtksettingsprivate.h \
|
||||
gtkshortcutsshortcutprivate.h \
|
||||
gtkshortcutswindowprivate.h \
|
||||
gtksidebarrowprivate.h \
|
||||
gtksizegroup-private.h \
|
||||
gtksizerequestcacheprivate.h \
|
||||
gtksnapshotprivate.h \
|
||||
gtkstyleanimationprivate.h \
|
||||
gtkstylecascadeprivate.h \
|
||||
gtkstylecontextprivate.h \
|
||||
gtkstylepropertyprivate.h \
|
||||
gtkstyleproviderprivate.h \
|
||||
gtktextattributes.h \
|
||||
gtktextattributesprivate.h \
|
||||
gtktextchildprivate.h \
|
||||
gtktexthandleprivate.h \
|
||||
gtktextiterprivate.h \
|
||||
gtktextmarkprivate.h \
|
||||
gtktexttagprivate.h \
|
||||
gtktextviewprivate.h \
|
||||
gtktogglebuttonprivate.h \
|
||||
gtktoolbarprivate.h \
|
||||
gtktoolpaletteprivate.h \
|
||||
gtktooltipprivate.h \
|
||||
gtktooltipwindowprivate.h \
|
||||
gtkutilsprivate.h \
|
||||
gtktreeprivate.h \
|
||||
gtkwidgetprivate.h \
|
||||
gtkwin32themeprivate.h \
|
||||
@@ -247,8 +219,6 @@ IGNORE_HFILES = \
|
||||
gtkprinteroption.h \
|
||||
gtkprinteroptionset.h \
|
||||
gtkprinteroptionwidget.h \
|
||||
gtkprinter-private.h \
|
||||
gtkprintoperation-portal.h \
|
||||
gtkprint-win32.h \
|
||||
gtkprintutils.h \
|
||||
gtkprivate.h \
|
||||
@@ -276,10 +246,7 @@ IGNORE_HFILES = \
|
||||
gtktreedatalist.h \
|
||||
gtktreemenu.h \
|
||||
gtktypebuiltins.h \
|
||||
gtkwidgetpathprivate.h \
|
||||
gtkwindow-decorate.h \
|
||||
gtkwin32drawprivate.h \
|
||||
gtkwin32themeprivate.h \
|
||||
xdgmime \
|
||||
xembed.h
|
||||
|
||||
@@ -310,6 +277,7 @@ MKHTML_OPTIONS="--path=\"$(abs_srcdir):$(top_srcdir)/examples\""
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE)
|
||||
content_files = \
|
||||
broadway.xml \
|
||||
broadwayd.xml \
|
||||
building.sgml \
|
||||
compiling.sgml \
|
||||
css-overview.xml \
|
||||
@@ -317,7 +285,6 @@ content_files = \
|
||||
drawing-model.xml \
|
||||
getting_started.xml \
|
||||
glossary.xml \
|
||||
gtk4-broadwayd.xml \
|
||||
gtk4-demo-application.xml \
|
||||
gtk4-demo.xml \
|
||||
gtk4-icon-browser.xml \
|
||||
@@ -518,17 +485,17 @@ EXTRA_DIST += version.xml.in gtk4.types.in
|
||||
########################################################################
|
||||
|
||||
man_MANS = \
|
||||
gtk4-broadwayd.1 \
|
||||
gtk4-builder-tool.1 \
|
||||
gtk4-query-immodules.1 \
|
||||
gtk4-update-icon-cache.1 \
|
||||
gtk4-encode-symbolic-svg.1 \
|
||||
gtk4-launch.1 \
|
||||
gtk4-demo.1 \
|
||||
gtk4-demo-application.1 \
|
||||
gtk4-encode-symbolic-svg.1 \
|
||||
gtk4-widget-factory.1 \
|
||||
gtk4-icon-browser.1 \
|
||||
gtk4-launch.1 \
|
||||
gtk4-query-immodules.1 \
|
||||
gtk4-query-settings.1 \
|
||||
gtk4-update-icon-cache.1 \
|
||||
gtk4-widget-factory.1
|
||||
broadwayd.1 \
|
||||
gtk4-builder-tool.1 \
|
||||
gtk4-query-settings.1
|
||||
|
||||
if ENABLE_MAN
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-broadwayd">
|
||||
<refentry id="broadwayd">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-broadwayd</title>
|
||||
<title>broadwayd</title>
|
||||
<productname>GTK+</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -17,19 +17,19 @@
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-broadwayd</refentrytitle>
|
||||
<refentrytitle>broadwayd</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-broadwayd</refname>
|
||||
<refname>broadwayd</refname>
|
||||
<refpurpose>Broadway display server</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-broadwayd</command>
|
||||
<command>broadwayd</command>
|
||||
<arg choice="opt">--port <replaceable>PORT</replaceable></arg>
|
||||
<arg choice="opt">--address <replaceable>ADDRESS</replaceable></arg>
|
||||
<arg choice="opt">--unixsocket <replaceable>ADDRESS</replaceable></arg>
|
||||
@@ -39,15 +39,15 @@
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-broadwayd</command> is a display server for the Broadway
|
||||
<command>broadwayd</command> is a display server for the Broadway
|
||||
GDK backend. It allows multiple GTK+ applications to display their
|
||||
windows in the same web browser, by connecting to gtk4-broadwayd.
|
||||
windows in the same web browser, by connecting to broadwayd.
|
||||
</para>
|
||||
<para>
|
||||
When using gtk4-broadwayd, specify the display number to use, prefixed
|
||||
When using broadwayd, specify the display number to use, prefixed
|
||||
with a colon, similar to X. The default display number is 0.
|
||||
<programlisting>
|
||||
gtk4-broadwayd :5
|
||||
broadwayd :5
|
||||
</programlisting>
|
||||
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
|
||||
Start your applications like this:
|
||||
@@ -456,15 +456,9 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<literallayout><code>〈transform〉 = matrix( 〈number〉 [ , 〈number〉 ]{5} ) |</code>
|
||||
<code> matrix3d( 〈number〉 [ , 〈number〉 ]{15} ) |</code>
|
||||
<code> translate( 〈length〉, 〈length〉 ) | translate3d( 〈length〉, 〈length〉, 〈length〉 ) |</code>
|
||||
<code> translateX( 〈length〉 ) | translateY( 〈length〉 ) | translateZ( 〈length〉 ) |</code>
|
||||
<code> scale( 〈number〉[ , 〈number〉 ]? ) | scale3d( 〈number〉, 〈number〉, 〈number〉) |</code>
|
||||
<code> scaleX( 〈number〉 ) | scaleY( 〈number〉 ) | scaleZ( 〈number〉 ) |</code>
|
||||
<code> rotate( 〈angle〉 ) | rotate3d( 〈number〉, 〈number〉, 〈number〉, 〈angle〉 ) |</code>
|
||||
<code> rotateX( 〈angle〉 ) | rotateY( 〈angle〉 ) | rotateZ( 〈angle〉 ) |</code>
|
||||
<code> skew( 〈angle〉 [ , 〈angle〉 ]? ) | skewX( 〈angle〉 ) | skewY( 〈angle〉 )</code>
|
||||
<literallayout><code>〈transform〉 = matrix( 〈number〉 [ , 〈number〉 ]{5} ) | translate( 〈length〉, 〈length〉 ) | translateX( 〈length〉 ) | translateY( 〈length〉 ) |</code>
|
||||
<code> scale( 〈number〉[ , 〈number〉 ]? ) | scaleX( 〈number〉 ) | scaleY( 〈number〉 ) | rotate( 〈angle〉 ) | skew( 〈angle〉 [ , 〈angle〉 ]? ) |</code>
|
||||
<code> skewX( 〈angle〉 ) | skewY( 〈angle〉 )</code>
|
||||
<code>〈color palette〉 = default | 〈name〉 〈color〉 [ , 〈name〉 〈color〉 ]*</code>
|
||||
</literallayout>
|
||||
|
||||
@@ -1375,33 +1369,5 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
|
||||
〈binding name〉 must have been assigned to a binding set with a @binding-set rule.
|
||||
</para>
|
||||
|
||||
<table pgwide="1">
|
||||
<title>Table-related properties</title>
|
||||
<tgroup cols="7">
|
||||
<colspec colnum="4" align="center"/>
|
||||
<colspec colnum="5" align="center"/>
|
||||
<thead>
|
||||
<row><entry>Name</entry><entry>Value</entry><entry>Initial</entry><entry>Inh.</entry><entry>Ani.</entry><entry>Reference</entry><entry>Notes</entry></row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry>border‑spacing</entry>
|
||||
<entry><code>〈length〉{1,2}</code></entry>
|
||||
<entry><code>0</code></entry>
|
||||
<entry>✓</entry>
|
||||
<entry>✓</entry>
|
||||
<entry><ulink url="https://www.w3.org/TR/CSS2/tables.html#separated-borders">CSS2</ulink>,
|
||||
<ulink url="https://www.w3.org/TR/2016/WD-css-tables-3-20161025/#border-spacing-property">CSS3</ulink></entry>
|
||||
<entry></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
|
||||
<para>
|
||||
The border-spacing property is respected by GtkBox and GtkGrid, and by box gadgets that
|
||||
are used internally in complex widgets.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
@@ -259,7 +259,6 @@
|
||||
<xi:include href="xml/gtktooltip.xml" />
|
||||
<xi:include href="xml/gtkviewport.xml" />
|
||||
<xi:include href="xml/gtkaccessible.xml" />
|
||||
<xi:include href="xml/gtksnapshot.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="AbstractObjects">
|
||||
@@ -364,7 +363,7 @@
|
||||
<xi:include href="gtk4-builder-tool.xml" />
|
||||
<xi:include href="gtk4-launch.xml" />
|
||||
<xi:include href="gtk4-query-settings.xml" />
|
||||
<xi:include href="gtk4-broadwayd.xml" />
|
||||
<xi:include href="broadwayd.xml" />
|
||||
</part>
|
||||
|
||||
<part id="platform-support">
|
||||
@@ -438,10 +437,6 @@
|
||||
<title>Index of new symbols in 3.22</title>
|
||||
<xi:include href="xml/api-index-3.22.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
<index id="api-index-3-90" role="3.90">
|
||||
<title>Index of new symbols in 3.90</title>
|
||||
<xi:include href="xml/api-index-3.90.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
|
||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
||||
|
||||
|
||||
@@ -250,6 +250,24 @@ GtkAssistantPrivate
|
||||
gtk_assistant_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkarrow</FILE>
|
||||
<TITLE>GtkArrow</TITLE>
|
||||
GtkArrow
|
||||
gtk_arrow_new
|
||||
gtk_arrow_set
|
||||
<SUBSECTION Standard>
|
||||
GTK_ARROW
|
||||
GTK_IS_ARROW
|
||||
GTK_TYPE_ARROW
|
||||
GTK_ARROW_CLASS
|
||||
GTK_IS_ARROW_CLASS
|
||||
GTK_ARROW_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkArrowPrivate
|
||||
gtk_arrow_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkaspectframe</FILE>
|
||||
<TITLE>GtkAspectFrame</TITLE>
|
||||
@@ -496,15 +514,27 @@ gtk_button_new
|
||||
gtk_button_new_with_label
|
||||
gtk_button_new_with_mnemonic
|
||||
gtk_button_new_from_icon_name
|
||||
gtk_button_pressed
|
||||
gtk_button_released
|
||||
gtk_button_clicked
|
||||
gtk_button_enter
|
||||
gtk_button_leave
|
||||
gtk_button_set_relief
|
||||
gtk_button_get_relief
|
||||
gtk_button_get_label
|
||||
gtk_button_set_label
|
||||
gtk_button_get_use_underline
|
||||
gtk_button_set_use_underline
|
||||
gtk_button_set_icon_name
|
||||
gtk_button_get_icon_name
|
||||
gtk_button_set_focus_on_click
|
||||
gtk_button_get_focus_on_click
|
||||
gtk_button_set_alignment
|
||||
gtk_button_get_alignment
|
||||
gtk_button_set_image
|
||||
gtk_button_get_image
|
||||
gtk_button_set_image_position
|
||||
gtk_button_get_image_position
|
||||
gtk_button_set_always_show_image
|
||||
gtk_button_get_always_show_image
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_BUTTON
|
||||
@@ -610,6 +640,8 @@ gtk_check_menu_item_get_type
|
||||
GtkColorButton
|
||||
gtk_color_button_new
|
||||
gtk_color_button_new_with_rgba
|
||||
gtk_color_button_set_rgba
|
||||
gtk_color_button_get_rgba
|
||||
gtk_color_button_set_title
|
||||
gtk_color_button_get_title
|
||||
<SUBSECTION Standard>
|
||||
@@ -624,6 +656,64 @@ gtk_color_button_get_type
|
||||
GtkColorButtonPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcolorsel</FILE>
|
||||
<TITLE>GtkColorSelection</TITLE>
|
||||
GtkColorSelection
|
||||
GtkColorSelectionClass
|
||||
gtk_color_selection_new
|
||||
gtk_color_selection_set_has_opacity_control
|
||||
gtk_color_selection_get_has_opacity_control
|
||||
gtk_color_selection_set_has_palette
|
||||
gtk_color_selection_get_has_palette
|
||||
gtk_color_selection_get_current_alpha
|
||||
gtk_color_selection_set_current_alpha
|
||||
gtk_color_selection_get_current_color
|
||||
gtk_color_selection_set_current_color
|
||||
gtk_color_selection_get_previous_alpha
|
||||
gtk_color_selection_set_previous_alpha
|
||||
gtk_color_selection_get_previous_color
|
||||
gtk_color_selection_set_previous_color
|
||||
gtk_color_selection_get_current_rgba
|
||||
gtk_color_selection_set_current_rgba
|
||||
gtk_color_selection_get_previous_rgba
|
||||
gtk_color_selection_set_previous_rgba
|
||||
gtk_color_selection_is_adjusting
|
||||
gtk_color_selection_palette_from_string
|
||||
gtk_color_selection_palette_to_string
|
||||
GtkColorSelectionChangePaletteFunc
|
||||
gtk_color_selection_set_change_palette_with_screen_hook
|
||||
GtkColorSelectionChangePaletteWithScreenFunc
|
||||
<SUBSECTION Standard>
|
||||
GTK_COLOR_SELECTION
|
||||
GTK_IS_COLOR_SELECTION
|
||||
GTK_TYPE_COLOR_SELECTION
|
||||
GTK_COLOR_SELECTION_CLASS
|
||||
GTK_IS_COLOR_SELECTION_CLASS
|
||||
GTK_COLOR_SELECTION_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkColorSelectionPrivate
|
||||
gtk_color_selection_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcolorseldlg</FILE>
|
||||
<TITLE>GtkColorSelectionDialog</TITLE>
|
||||
GtkColorSelectionDialog
|
||||
gtk_color_selection_dialog_new
|
||||
gtk_color_selection_dialog_get_color_selection
|
||||
<SUBSECTION Standard>
|
||||
GTK_COLOR_SELECTION_DIALOG
|
||||
GTK_IS_COLOR_SELECTION_DIALOG
|
||||
GTK_TYPE_COLOR_SELECTION_DIALOG
|
||||
GTK_COLOR_SELECTION_DIALOG_CLASS
|
||||
GTK_IS_COLOR_SELECTION_DIALOG_CLASS
|
||||
GTK_COLOR_SELECTION_DIALOG_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkColorSelectionDialogPrivate
|
||||
gtk_color_selection_dialog_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcombobox</FILE>
|
||||
<TITLE>GtkComboBox</TITLE>
|
||||
@@ -657,6 +747,10 @@ gtk_combo_box_popdown
|
||||
gtk_combo_box_get_popup_accessible
|
||||
gtk_combo_box_get_row_separator_func
|
||||
gtk_combo_box_set_row_separator_func
|
||||
gtk_combo_box_set_add_tearoffs
|
||||
gtk_combo_box_get_add_tearoffs
|
||||
gtk_combo_box_set_title
|
||||
gtk_combo_box_get_title
|
||||
gtk_combo_box_set_button_sensitivity
|
||||
gtk_combo_box_get_button_sensitivity
|
||||
gtk_combo_box_get_has_entry
|
||||
@@ -710,6 +804,7 @@ gtk_combo_box_text_get_type
|
||||
<TITLE>GtkContainer</TITLE>
|
||||
GtkContainer
|
||||
GtkContainerClass
|
||||
GTK_IS_RESIZE_CONTAINER
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID
|
||||
gtk_container_add
|
||||
gtk_container_remove
|
||||
@@ -724,6 +819,7 @@ gtk_container_get_focus_vadjustment
|
||||
gtk_container_set_focus_vadjustment
|
||||
gtk_container_get_focus_hadjustment
|
||||
gtk_container_set_focus_hadjustment
|
||||
gtk_container_resize_children
|
||||
gtk_container_child_type
|
||||
gtk_container_child_get
|
||||
gtk_container_child_set
|
||||
@@ -735,7 +831,6 @@ gtk_container_child_notify
|
||||
gtk_container_child_notify_by_pspec
|
||||
gtk_container_forall
|
||||
gtk_container_propagate_draw
|
||||
gtk_container_snapshot_child
|
||||
gtk_container_get_focus_chain
|
||||
gtk_container_set_focus_chain
|
||||
gtk_container_unset_focus_chain
|
||||
@@ -777,6 +872,8 @@ gtk_dialog_get_widget_for_response
|
||||
gtk_dialog_get_action_area
|
||||
gtk_dialog_get_content_area
|
||||
gtk_dialog_get_header_bar
|
||||
<SUBSECTION>
|
||||
gtk_alternative_dialog_button_order
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_DIALOG
|
||||
@@ -795,12 +892,6 @@ gtk_dialog_get_type
|
||||
<TITLE>GtkDrawingArea</TITLE>
|
||||
GtkDrawingArea
|
||||
gtk_drawing_area_new
|
||||
gtk_drawing_area_get_content_width
|
||||
gtk_drawing_area_set_content_width
|
||||
gtk_drawing_area_get_content_height
|
||||
gtk_drawing_area_set_content_height
|
||||
GtkDrawingAreaDrawFunc
|
||||
gtk_drawing_area_set_draw_func
|
||||
<SUBSECTION Standard>
|
||||
GTK_DRAWING_AREA
|
||||
GTK_IS_DRAWING_AREA
|
||||
@@ -850,6 +941,7 @@ gtk_entry_set_buffer
|
||||
gtk_entry_set_text
|
||||
gtk_entry_get_text
|
||||
gtk_entry_get_text_length
|
||||
gtk_entry_get_text_area
|
||||
gtk_entry_set_visibility
|
||||
gtk_entry_get_visibility
|
||||
gtk_entry_set_invisible_char
|
||||
@@ -1128,10 +1220,6 @@ gtk_file_chooser_select_file
|
||||
gtk_file_chooser_set_current_folder_file
|
||||
gtk_file_chooser_set_file
|
||||
gtk_file_chooser_unselect_file
|
||||
gtk_file_chooser_add_choice
|
||||
gtk_file_chooser_remove_choice
|
||||
gtk_file_chooser_set_choice
|
||||
gtk_file_chooser_get_choice
|
||||
<SUBSECTION Standard>
|
||||
GTK_FILE_CHOOSER
|
||||
GTK_IS_FILE_CHOOSER
|
||||
@@ -1559,7 +1647,6 @@ gtk_im_context_get_type
|
||||
GtkIMContextSimple
|
||||
gtk_im_context_simple_new
|
||||
gtk_im_context_simple_add_table
|
||||
gtk_im_context_simple_add_compose_file
|
||||
GTK_MAX_COMPOSE_LEN
|
||||
<SUBSECTION Standard>
|
||||
GTK_IM_CONTEXT_SIMPLE
|
||||
@@ -1744,9 +1831,11 @@ gtk_menu_set_accel_group
|
||||
gtk_menu_get_accel_group
|
||||
gtk_menu_set_accel_path
|
||||
gtk_menu_get_accel_path
|
||||
gtk_menu_set_title
|
||||
gtk_menu_get_title
|
||||
gtk_menu_set_monitor
|
||||
gtk_menu_get_monitor
|
||||
gtk_menu_place_on_monitor
|
||||
gtk_menu_get_tearoff_state
|
||||
gtk_menu_set_reserve_toggle_size
|
||||
gtk_menu_get_reserve_toggle_size
|
||||
<SUBSECTION>
|
||||
@@ -1754,6 +1843,7 @@ gtk_menu_popdown
|
||||
gtk_menu_reposition
|
||||
gtk_menu_get_active
|
||||
gtk_menu_set_active
|
||||
gtk_menu_set_tearoff_state
|
||||
gtk_menu_attach_to_widget
|
||||
gtk_menu_detach
|
||||
gtk_menu_get_attach_widget
|
||||
@@ -1833,6 +1923,8 @@ GtkMenuItemClass
|
||||
gtk_menu_item_new
|
||||
gtk_menu_item_new_with_label
|
||||
gtk_menu_item_new_with_mnemonic
|
||||
gtk_menu_item_set_right_justified
|
||||
gtk_menu_item_get_right_justified
|
||||
gtk_menu_item_get_label
|
||||
gtk_menu_item_set_label
|
||||
gtk_menu_item_get_use_underline
|
||||
@@ -2054,7 +2146,6 @@ GTK_IS_PANED_CLASS
|
||||
GTK_PANED_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GtkPanedPrivate
|
||||
gtk_paned_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -2203,9 +2294,11 @@ gtk_range_set_upper_stepper_sensitivity
|
||||
gtk_range_get_upper_stepper_sensitivity
|
||||
gtk_range_get_flippable
|
||||
gtk_range_set_flippable
|
||||
gtk_range_get_min_slider_size
|
||||
gtk_range_get_range_rect
|
||||
gtk_range_get_slider_range
|
||||
gtk_range_get_slider_size_fixed
|
||||
gtk_range_set_min_slider_size
|
||||
gtk_range_set_slider_size_fixed
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@@ -2653,6 +2746,8 @@ gtk_rc_property_parse_flags
|
||||
gtk_rc_property_parse_requisition
|
||||
gtk_rc_property_parse_border
|
||||
gtk_settings_reset_property
|
||||
GtkIMPreeditStyle
|
||||
GtkIMStatusStyle
|
||||
<SUBSECTION Standard>
|
||||
GtkSettingsClass
|
||||
GTK_IS_SETTINGS
|
||||
@@ -2812,6 +2907,24 @@ GtkLevelBarPrivate
|
||||
gtk_level_bar_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktearoffmenuitem</FILE>
|
||||
<TITLE>GtkTearoffMenuItem</TITLE>
|
||||
GtkTearoffMenuItem
|
||||
GtkTearoffMenuItemClass
|
||||
gtk_tearoff_menu_item_new
|
||||
<SUBSECTION Standard>
|
||||
GTK_TEAROFF_MENU_ITEM
|
||||
GTK_IS_TEAROFF_MENU_ITEM
|
||||
GTK_TYPE_TEAROFF_MENU_ITEM
|
||||
GTK_TEAROFF_MENU_ITEM_CLASS
|
||||
GTK_IS_TEAROFF_MENU_ITEM_CLASS
|
||||
GTK_TEAROFF_MENU_ITEM_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkTearoffMenuItemPrivate
|
||||
gtk_tearoff_menu_item_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktextbuffer</FILE>
|
||||
<TITLE>GtkTextBuffer</TITLE>
|
||||
@@ -3182,6 +3295,30 @@ gtk_text_child_anchor_get_type
|
||||
GtkTextBTree
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktoggleaction</FILE>
|
||||
<TITLE>GtkToggleAction</TITLE>
|
||||
GtkToggleAction
|
||||
gtk_toggle_action_new
|
||||
gtk_toggle_action_toggled
|
||||
gtk_toggle_action_set_active
|
||||
gtk_toggle_action_get_active
|
||||
gtk_toggle_action_set_draw_as_radio
|
||||
gtk_toggle_action_get_draw_as_radio
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_TOGGLE_ACTION
|
||||
GTK_TOGGLE_ACTION
|
||||
GTK_TOGGLE_ACTION_CLASS
|
||||
GTK_IS_TOGGLE_ACTION
|
||||
GTK_IS_TOGGLE_ACTION_CLASS
|
||||
GTK_TOGGLE_ACTION_GET_CLASS
|
||||
GtkToggleActionClass
|
||||
<SUBSECTION Private>
|
||||
gtk_toggle_action_get_type
|
||||
GtkToggleActionPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtktogglebutton</FILE>
|
||||
<TITLE>GtkToggleButton</TITLE>
|
||||
@@ -3997,6 +4134,8 @@ gtk_cell_view_set_model
|
||||
gtk_cell_view_get_model
|
||||
gtk_cell_view_set_displayed_row
|
||||
gtk_cell_view_get_displayed_row
|
||||
gtk_cell_view_set_background_color
|
||||
gtk_cell_view_set_background_rgba
|
||||
gtk_cell_view_set_draw_sensitive
|
||||
gtk_cell_view_get_draw_sensitive
|
||||
gtk_cell_view_set_fit_model
|
||||
@@ -4450,33 +4589,6 @@ GTK_VOLUME_BUTTON_GET_CLASS
|
||||
gtk_volume_button_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtksnapshot</FILE>
|
||||
<TITLE>GtkSnapshot</TITLE>
|
||||
GtkSnapshot
|
||||
gtk_snapshot_push
|
||||
gtk_snapshot_push_node
|
||||
gtk_snapshot_push_transform
|
||||
gtk_snapshot_push_clip
|
||||
gtk_snapshot_push_rounded_clip
|
||||
gtk_snapshot_pop
|
||||
gtk_snapshot_pop_and_append
|
||||
gtk_snapshot_set_transform
|
||||
gtk_snapshot_transform
|
||||
gtk_snapshot_translate_2d
|
||||
gtk_snapshot_append_node
|
||||
gtk_snapshot_append_cairo_node
|
||||
gtk_snapshot_append_texture_node
|
||||
gtk_snapshot_append_color_node
|
||||
gtk_snapshot_clips_rect
|
||||
gtk_snapshot_render_background
|
||||
gtk_snapshot_render_frame
|
||||
gtk_snapshot_render_focus
|
||||
gtk_snapshot_render_layout
|
||||
gtk_snapshot_render_insertion_cursor
|
||||
gtk_snapshot_render_icon
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkwidget</FILE>
|
||||
<TITLE>GtkWidget</TITLE>
|
||||
@@ -4485,6 +4597,7 @@ GtkWidgetClass
|
||||
GtkCallback
|
||||
GtkRequisition
|
||||
GtkAllocation
|
||||
GtkWidgetHelpType
|
||||
gtk_widget_new
|
||||
gtk_widget_destroy
|
||||
gtk_widget_in_destruction
|
||||
@@ -4537,9 +4650,16 @@ gtk_widget_set_device_enabled
|
||||
gtk_widget_get_device_enabled
|
||||
gtk_widget_get_toplevel
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_get_visual
|
||||
gtk_widget_set_visual
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
gtk_widget_hide_on_delete
|
||||
gtk_widget_set_style
|
||||
gtk_widget_ensure_style
|
||||
gtk_widget_get_style
|
||||
gtk_widget_reset_rc_styles
|
||||
gtk_widget_get_default_style
|
||||
gtk_widget_set_direction
|
||||
GtkTextDirection
|
||||
gtk_widget_get_direction
|
||||
@@ -4547,6 +4667,21 @@ gtk_widget_set_default_direction
|
||||
gtk_widget_get_default_direction
|
||||
gtk_widget_shape_combine_region
|
||||
gtk_widget_input_shape_combine_region
|
||||
gtk_widget_path
|
||||
gtk_widget_class_path
|
||||
gtk_widget_override_background_color
|
||||
gtk_widget_override_color
|
||||
gtk_widget_override_font
|
||||
gtk_widget_override_symbolic_color
|
||||
gtk_widget_override_cursor
|
||||
gtk_widget_modify_style
|
||||
gtk_widget_get_modifier_style
|
||||
gtk_widget_modify_fg
|
||||
gtk_widget_modify_bg
|
||||
gtk_widget_modify_text
|
||||
gtk_widget_modify_base
|
||||
gtk_widget_modify_font
|
||||
gtk_widget_modify_cursor
|
||||
gtk_widget_create_pango_context
|
||||
gtk_widget_get_pango_context
|
||||
gtk_widget_set_font_options
|
||||
@@ -4554,6 +4689,8 @@ gtk_widget_get_font_options
|
||||
gtk_widget_set_font_map
|
||||
gtk_widget_get_font_map
|
||||
gtk_widget_create_pango_layout
|
||||
gtk_widget_render_icon
|
||||
gtk_widget_render_icon_pixbuf
|
||||
gtk_widget_queue_draw_area
|
||||
gtk_widget_queue_draw_region
|
||||
gtk_widget_set_redraw_on_allocate
|
||||
@@ -4561,10 +4698,12 @@ gtk_widget_mnemonic_activate
|
||||
gtk_widget_class_install_style_property
|
||||
gtk_widget_class_find_style_property
|
||||
gtk_widget_class_list_style_properties
|
||||
gtk_widget_region_intersect
|
||||
gtk_widget_send_focus_change
|
||||
gtk_widget_style_get
|
||||
gtk_widget_style_get_property
|
||||
gtk_widget_style_get_valist
|
||||
gtk_widget_style_attach
|
||||
gtk_widget_class_set_accessible_type
|
||||
gtk_widget_class_set_accessible_role
|
||||
gtk_widget_get_accessible
|
||||
@@ -4601,6 +4740,7 @@ gtk_widget_trigger_tooltip_query
|
||||
gtk_widget_get_window
|
||||
gtk_widget_register_window
|
||||
gtk_widget_unregister_window
|
||||
gtk_cairo_should_draw_window
|
||||
gtk_cairo_transform_to_window
|
||||
gtk_widget_get_allocated_width
|
||||
gtk_widget_get_allocated_height
|
||||
@@ -4620,6 +4760,7 @@ gtk_widget_get_has_window
|
||||
gtk_widget_set_has_window
|
||||
gtk_widget_get_sensitive
|
||||
gtk_widget_is_sensitive
|
||||
GtkStateType
|
||||
gtk_widget_get_visible
|
||||
gtk_widget_is_visible
|
||||
gtk_widget_set_visible
|
||||
@@ -4630,6 +4771,7 @@ gtk_widget_has_default
|
||||
gtk_widget_has_focus
|
||||
gtk_widget_has_visible_focus
|
||||
gtk_widget_has_grab
|
||||
gtk_widget_has_rc_style
|
||||
gtk_widget_is_drawable
|
||||
gtk_widget_is_toplevel
|
||||
gtk_widget_set_window
|
||||
@@ -4738,6 +4880,7 @@ GtkWindowClass
|
||||
GtkWindowType
|
||||
gtk_window_new
|
||||
gtk_window_set_title
|
||||
gtk_window_set_wmclass
|
||||
gtk_window_set_resizable
|
||||
gtk_window_get_resizable
|
||||
gtk_window_add_accel_group
|
||||
@@ -4746,6 +4889,8 @@ gtk_window_activate_focus
|
||||
gtk_window_activate_default
|
||||
gtk_window_set_modal
|
||||
gtk_window_set_default_size
|
||||
gtk_window_set_default_geometry
|
||||
gtk_window_set_geometry_hints
|
||||
gtk_window_set_gravity
|
||||
gtk_window_get_gravity
|
||||
GtkWindowPosition
|
||||
@@ -4824,7 +4969,10 @@ gtk_window_get_group
|
||||
gtk_window_has_group
|
||||
gtk_window_get_window_type
|
||||
gtk_window_move
|
||||
gtk_window_parse_geometry
|
||||
gtk_window_reshow_with_initial_size
|
||||
gtk_window_resize
|
||||
gtk_window_resize_to_geometry
|
||||
gtk_window_set_default_icon_list
|
||||
gtk_window_set_default_icon
|
||||
gtk_window_set_default_icon_from_file
|
||||
@@ -4945,6 +5093,11 @@ gtk_get_micro_version
|
||||
gtk_get_binary_age
|
||||
gtk_get_interface_age
|
||||
gtk_check_version
|
||||
gtk_major_version
|
||||
gtk_minor_version
|
||||
gtk_micro_version
|
||||
gtk_binary_age
|
||||
gtk_interface_age
|
||||
|
||||
<SUBSECTION>
|
||||
GTK_MAJOR_VERSION
|
||||
@@ -5009,6 +5162,8 @@ GTK_STYLE_PROVIDER_PRIORITY_THEME
|
||||
GTK_STYLE_PROVIDER_PRIORITY_SETTINGS
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER
|
||||
gtk_style_provider_get_icon_factory
|
||||
gtk_style_provider_get_style
|
||||
gtk_style_provider_get_style_property
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_STYLE_PROVIDER
|
||||
@@ -5124,6 +5279,8 @@ gtk_style_context_new
|
||||
gtk_style_context_add_provider
|
||||
gtk_style_context_add_provider_for_screen
|
||||
gtk_style_context_get
|
||||
GtkJunctionSides
|
||||
gtk_style_context_get_junction_sides
|
||||
gtk_style_context_get_parent
|
||||
gtk_style_context_get_path
|
||||
gtk_style_context_get_property
|
||||
@@ -5141,12 +5298,16 @@ gtk_style_context_get_border_color
|
||||
gtk_style_context_get_border
|
||||
gtk_style_context_get_padding
|
||||
gtk_style_context_get_margin
|
||||
gtk_style_context_get_font
|
||||
gtk_style_context_state_is_running
|
||||
gtk_style_context_lookup_color
|
||||
gtk_style_context_remove_provider
|
||||
gtk_style_context_remove_provider_for_screen
|
||||
gtk_style_context_reset_widgets
|
||||
gtk_style_context_set_background
|
||||
gtk_style_context_restore
|
||||
gtk_style_context_save
|
||||
gtk_style_context_set_junction_sides
|
||||
gtk_style_context_set_parent
|
||||
gtk_style_context_set_path
|
||||
gtk_style_context_add_class
|
||||
@@ -5242,6 +5403,47 @@ gtk_css_provider_error_quark
|
||||
gtk_css_section_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtksymboliccolor</FILE>
|
||||
<TITLE>GtkSymbolicColor</TITLE>
|
||||
GtkSymbolicColor
|
||||
gtk_symbolic_color_new_literal
|
||||
gtk_symbolic_color_new_name
|
||||
gtk_symbolic_color_new_shade
|
||||
gtk_symbolic_color_new_alpha
|
||||
gtk_symbolic_color_new_mix
|
||||
gtk_symbolic_color_new_win32
|
||||
gtk_symbolic_color_ref
|
||||
gtk_symbolic_color_unref
|
||||
gtk_symbolic_color_resolve
|
||||
gtk_symbolic_color_to_string
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SYMBOLIC_COLOR
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_symbolic_color_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgradient</FILE>
|
||||
<TITLE>GtkGradient</TITLE>
|
||||
GtkGradient
|
||||
gtk_gradient_new_linear
|
||||
gtk_gradient_new_radial
|
||||
gtk_gradient_add_color_stop
|
||||
gtk_gradient_ref
|
||||
gtk_gradient_unref
|
||||
gtk_gradient_resolve
|
||||
gtk_gradient_resolve_for_context
|
||||
gtk_gradient_to_string
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GRADIENT
|
||||
|
||||
gtk_gradient_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkselection</FILE>
|
||||
<TITLE>Selections</TITLE>
|
||||
@@ -5365,6 +5567,7 @@ GtkTargetFlags
|
||||
GtkDragResult
|
||||
<SUBSECTION Destination Side>
|
||||
gtk_drag_dest_set
|
||||
gtk_drag_dest_set_proxy
|
||||
gtk_drag_dest_unset
|
||||
gtk_drag_dest_find_target
|
||||
gtk_drag_dest_get_target_list
|
||||
@@ -5380,6 +5583,7 @@ gtk_drag_get_source_widget
|
||||
gtk_drag_highlight
|
||||
gtk_drag_unhighlight
|
||||
<SUBSECTION Source Side>
|
||||
gtk_drag_begin
|
||||
gtk_drag_begin_with_coordinates
|
||||
gtk_drag_cancel
|
||||
gtk_drag_set_icon_widget
|
||||
@@ -5419,6 +5623,7 @@ gtk_binding_entry_add_signal
|
||||
gtk_binding_entry_add_signal_from_string
|
||||
gtk_binding_entry_skip
|
||||
gtk_binding_entry_remove
|
||||
gtk_binding_set_add_path
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -5943,7 +6148,6 @@ gtk_print_job_get_printer
|
||||
gtk_print_job_get_title
|
||||
gtk_print_job_get_status
|
||||
gtk_print_job_set_source_file
|
||||
gtk_print_job_set_source_fd
|
||||
gtk_print_job_get_surface
|
||||
gtk_print_job_send
|
||||
gtk_print_job_set_track_print_status
|
||||
@@ -6033,7 +6237,7 @@ gtk_mount_operation_get_parent
|
||||
gtk_mount_operation_set_screen
|
||||
gtk_mount_operation_get_screen
|
||||
gtk_show_uri
|
||||
gtk_show_uri_on_window
|
||||
gtk_show_uri_on_parent
|
||||
<SUBSECTION Standard>
|
||||
GTK_IS_MOUNT_OPERATION
|
||||
GTK_IS_MOUNT_OPERATION_CLASS
|
||||
@@ -6590,7 +6794,6 @@ GtkFlowBox
|
||||
gtk_flow_box_new
|
||||
gtk_flow_box_insert
|
||||
gtk_flow_box_get_child_at_index
|
||||
gtk_flow_box_get_child_at_pos
|
||||
gtk_flow_box_set_hadjustment
|
||||
gtk_flow_box_set_vadjustment
|
||||
|
||||
@@ -6674,6 +6877,8 @@ gtk_popover_set_constrain_to
|
||||
gtk_popover_get_constrain_to
|
||||
gtk_popover_set_modal
|
||||
gtk_popover_get_modal
|
||||
gtk_popover_set_transitions_enabled
|
||||
gtk_popover_get_transitions_enabled
|
||||
gtk_popover_set_default_widget
|
||||
gtk_popover_get_default_widget
|
||||
<SUBSECTION Standard>
|
||||
@@ -7041,7 +7246,6 @@ GTK_GET_SHORTCUTS_WINDOW_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkShortcutsWindowClass
|
||||
gtk_shortcuts_window_get_type
|
||||
GTK_SHORTCUTS_WINDOW_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -7057,7 +7261,6 @@ GTK_GET_SHORTCUTS_SECTION_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkShortcutsSectionClass
|
||||
gtk_shortcuts_section_get_type
|
||||
GTK_SHORTCUTS_SECTION_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -7073,7 +7276,6 @@ GTK_GET_SHORTCUTS_GROUP_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkShortcutsGroupClass
|
||||
gtk_shortcuts_group_get_type
|
||||
GTK_SHORTCUTS_GROUP_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -7090,26 +7292,4 @@ GTK_GET_SHORTCUTS_SHORTCUT_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkShortcutsShortcutClass
|
||||
gtk_shortcuts_shortcut_get_type
|
||||
gtk_shortcuts_shortcut_update_accel
|
||||
GTK_SHORTCUTS_SHORTCUT_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkshortcutlabel</FILE>
|
||||
GtkShortcutLabel
|
||||
gtk_shortcut_label_new
|
||||
gtk_shortcut_label_get_accelerator
|
||||
gtk_shortcut_label_get_disabled_text
|
||||
gtk_shortcut_label_set_accelerator
|
||||
gtk_shortcut_label_set_disabled_text
|
||||
|
||||
<SUBSECTION Private>
|
||||
GtkShortcutLabelClass
|
||||
gtk_shortcut_label_get_type
|
||||
GTK_TYPE_SHORTCUT_LABEL
|
||||
GTK_SHORTCUT_LABEL
|
||||
GTK_SHORTCUT_LABEL_CLASS
|
||||
GTK_SHORTCUT_LABEL_GET_CLASS
|
||||
GTK_IS_SHORTCUT_LABEL
|
||||
GTK_IS_SHORTCUT_LABEL_CLASS
|
||||
</SECTION>
|
||||
|
||||
@@ -52,14 +52,6 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Do not use widget style properties</title>
|
||||
<para>
|
||||
Style properties do not exist in GTK+ 4. You should stop using them in
|
||||
your custom CSS.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Review your window creation flags</title>
|
||||
<para>
|
||||
@@ -106,14 +98,6 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_window()</title>
|
||||
<para>
|
||||
These functions are not supported in GTK+ 4. Instead, either use backend-specific
|
||||
APIs, or render your widgets using gtk_widget_render().
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -126,17 +110,6 @@
|
||||
have been either impossible or impractical.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GdkWindow API changes</title>
|
||||
<para>
|
||||
The gdk_window_new() function has been replaced by a number of more
|
||||
specialized constructors: gdk_window_new_toplevel(), gdk_window_new_popup(),
|
||||
gdk_window_new_temp(), gdk_window_new_child(), gdk_window_new_input(),
|
||||
gdk_wayland_window_new_subsurface(). Use the appropriate ones to create
|
||||
your windows.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GtkStyleContext API changes</title>
|
||||
<para>
|
||||
@@ -148,15 +121,6 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GtkCssProvider API changes</title>
|
||||
<para>
|
||||
In GTK+ 4, the various #GtkCssProvider load functions have lost
|
||||
their #GError argument. If you want to handle CSS loading errors,
|
||||
use the #GtkCssProvider::parsing-error signal instead.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using GtkContainer::border-width</title>
|
||||
<para>
|
||||
@@ -185,35 +149,6 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Use gtk_widget_measure</title>
|
||||
<para>
|
||||
gtk_widget_measure replaces the various gtk_widget_get_preferred_ functions
|
||||
for querying sizes.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to drawing model changes</title>
|
||||
<para>
|
||||
This area has seen the most radical changes in the transition from GTK+ 3
|
||||
to GTK+ 4. Widgets no longer use a draw() function to render their contents
|
||||
to a cairo surface. Instead, they have a snapshot() function that creates
|
||||
one or more GskRenderNodes to represent their content. Third-party widgets
|
||||
that use a draw() function or a #GtkWidget::draw signal handler for custom
|
||||
drawing will need to be converted to use gtk_snapshot_append_cairo_node().
|
||||
</para>
|
||||
<para>
|
||||
The auxiliary #GtkSnapshot object has APIs to help with creating render
|
||||
nodes.
|
||||
</para>
|
||||
<para>
|
||||
If you are using a #GtkDrawingArea for custom drawing, you need to switch
|
||||
to using gtk_drawing_area_set_draw_func() to set a draw function. This is
|
||||
pretty much a direct replacement for a #GtkWidget::draw signal handler.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
||||
@@ -178,6 +178,18 @@ additional environment variables.
|
||||
<term>no-css-cache</term>
|
||||
<listitem><para>Bypass caching for CSS style properties</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>no-pixel-cache</term>
|
||||
<listitem><para>Disable the pixel cache</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>plugsocket</term>
|
||||
<listitem><para>Cross-process embedding</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>pixel-cache</term>
|
||||
<listitem><para>Pixel cache</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>printing</term>
|
||||
<listitem><para>Printing support</para></listitem>
|
||||
@@ -210,10 +222,6 @@ additional environment variables.
|
||||
<term>layout</term>
|
||||
<listitem><para>Show layout borders</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>snapshot</term>
|
||||
<listitem><para>Include debug render nodes in the generated snapshots</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
The special value <literal>all</literal> can be used to turn on all
|
||||
debug options. The special value <literal>help</literal> can be used
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdkx.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -137,10 +136,9 @@ static GdkPixbuf *
|
||||
take_window_shot (Window child,
|
||||
DecorationType decor)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
XWindowAttributes attrs;
|
||||
GdkWindow *window, *root_window;
|
||||
Window xid;
|
||||
Display *dpy;
|
||||
gint x_orig, y_orig;
|
||||
gint x = 0, y = 0;
|
||||
gint width, height;
|
||||
|
||||
@@ -152,39 +150,35 @@ take_window_shot (Window child,
|
||||
else
|
||||
xid = child;
|
||||
|
||||
dpy = gdk_x11_display_get_xdisplay (gdk_display_get_default ());
|
||||
XGetWindowAttributes (dpy, xid, &attrs);
|
||||
window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), xid);
|
||||
root_window = gdk_screen_get_root_window (gdk_window_get_screen (window));
|
||||
|
||||
width = attrs.width;
|
||||
height = attrs.height;
|
||||
width = gdk_window_get_width (window);
|
||||
height = gdk_window_get_height (window);
|
||||
gdk_window_get_origin (window, &x_orig, &y_orig);
|
||||
|
||||
if (attrs.x < 0)
|
||||
if (x_orig < 0)
|
||||
{
|
||||
x = - attrs.x;
|
||||
width = width + attrs.x;
|
||||
x = - x_orig;
|
||||
width = width + x_orig;
|
||||
x_orig = 0;
|
||||
}
|
||||
|
||||
if (attrs.y < 0)
|
||||
if (y_orig < 0)
|
||||
{
|
||||
y = - attrs.y;
|
||||
height = height + attrs.y;
|
||||
y = - y_orig;
|
||||
height = height + y_orig;
|
||||
y_orig = 0;
|
||||
}
|
||||
|
||||
if (attrs.x + x + width > WidthOfScreen (DefaultScreenOfDisplay (dpy)))
|
||||
width = WidthOfScreen (DefaultScreenOfDisplay (dpy)) - attrs.x - x;
|
||||
if (x_orig + width > gdk_window_get_width (root_window))
|
||||
width = gdk_window_get_width (root_window) - x_orig;
|
||||
|
||||
if (attrs.y + y + height > HeightOfScreen (DefaultScreenOfDisplay (dpy)))
|
||||
height = HeightOfScreen (DefaultScreenOfDisplay (dpy)) - attrs.y - y;
|
||||
if (y_orig + height > gdk_window_get_height (root_window))
|
||||
height = gdk_window_get_height (root_window) - y_orig;
|
||||
|
||||
surface = cairo_xlib_surface_create (dpy,
|
||||
xid,
|
||||
attrs.visual,
|
||||
attrs.width,
|
||||
attrs.height);
|
||||
tmp = gdk_pixbuf_get_from_surface (surface,
|
||||
x, y,
|
||||
width, height);
|
||||
cairo_surface_destroy (surface);
|
||||
tmp = gdk_pixbuf_get_from_window (window,
|
||||
x, y, width, height);
|
||||
|
||||
if (tmp != NULL)
|
||||
{
|
||||
@@ -209,8 +203,8 @@ take_window_shot (Window child,
|
||||
|
||||
static GList *toplevels;
|
||||
static guint shot_id;
|
||||
|
||||
static gboolean
|
||||
|
||||
window_is_csd (GdkWindow *window)
|
||||
{
|
||||
gboolean set;
|
||||
|
||||
@@ -67,7 +67,6 @@ gdk_public_h_sources = \
|
||||
gdkdisplay.h \
|
||||
gdkdisplaymanager.h \
|
||||
gdkdnd.h \
|
||||
gdkdrawcontext.h \
|
||||
gdkdrawingcontext.h \
|
||||
gdkevents.h \
|
||||
gdkframetimings.h \
|
||||
@@ -91,7 +90,6 @@ gdk_public_h_sources = \
|
||||
gdkthreads.h \
|
||||
gdktypes.h \
|
||||
gdkvisual.h \
|
||||
gdkvulkancontext.h \
|
||||
gdkwindow.h
|
||||
|
||||
gdk_h_sources = \
|
||||
@@ -108,7 +106,6 @@ gdk_private_headers = \
|
||||
gdkdisplaymanagerprivate.h \
|
||||
gdkdisplayprivate.h \
|
||||
gdkdndprivate.h \
|
||||
gdkdrawcontextprivate.h \
|
||||
gdkdrawingcontextprivate.h \
|
||||
gdkframeclockidle.h \
|
||||
gdkframeclockprivate.h \
|
||||
@@ -121,10 +118,10 @@ gdk_private_headers = \
|
||||
gdkintl.h \
|
||||
gdkkeysprivate.h \
|
||||
gdkvisualprivate.h \
|
||||
gdkvulkancontextprivate.h \
|
||||
gdkx.h
|
||||
|
||||
gdk_c_sources = \
|
||||
gdk-private.c \
|
||||
gdk.c \
|
||||
gdkapplaunchcontext.c \
|
||||
gdkcairo.c \
|
||||
@@ -137,7 +134,6 @@ gdk_c_sources = \
|
||||
gdkdisplay.c \
|
||||
gdkdisplaymanager.c \
|
||||
gdkdnd.c \
|
||||
gdkdrawcontext.c \
|
||||
gdkdrawingcontext.c \
|
||||
gdkevents.c \
|
||||
gdkframetimings.c \
|
||||
@@ -159,7 +155,6 @@ gdk_c_sources = \
|
||||
gdkseatdefault.c \
|
||||
gdkselection.c \
|
||||
gdkvisual.c \
|
||||
gdkvulkancontext.c \
|
||||
gdkwindow.c \
|
||||
gdkwindowimpl.c
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ LDADDS = $(GDK_DEP_LIBS) -lrt
|
||||
|
||||
noinst_LTLIBRARIES = libgdk-broadway.la
|
||||
|
||||
bin_PROGRAMS = gtk4-broadwayd
|
||||
bin_PROGRAMS = broadwayd
|
||||
|
||||
libgdkinclude_HEADERS = \
|
||||
gdkbroadway.h
|
||||
@@ -84,7 +84,7 @@ libgdk_broadway_la_LIBADD = \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
gtk4_broadwayd_SOURCES = \
|
||||
broadwayd_SOURCES = \
|
||||
broadway-protocol.h \
|
||||
broadwayd.c \
|
||||
broadway-server.h \
|
||||
@@ -95,9 +95,9 @@ gtk4_broadwayd_SOURCES = \
|
||||
broadway-output.c
|
||||
|
||||
if OS_WIN32
|
||||
gtk4_broadwayd_LDADD = $(GDK_DEP_LIBS) -lws2_32
|
||||
broadwayd_LDADD = $(GDK_DEP_LIBS) -lws2_32
|
||||
else
|
||||
gtk4_broadwayd_LDADD = $(GDK_DEP_LIBS) @SHM_LIBS@
|
||||
broadwayd_LDADD = $(GDK_DEP_LIBS) @SHM_LIBS@
|
||||
endif
|
||||
|
||||
MAINTAINERCLEANFILES = $(broadway_built_sources)
|
||||
@@ -106,7 +106,7 @@ EXTRA_DIST += $(broadway_built_sources)
|
||||
BUILT_SOURCES = $(broadway_built_sources)
|
||||
|
||||
# ------------------- MSVC Build Items ----------------
|
||||
MSVCPROJS = gdk4-broadway gtk4-broadwayd
|
||||
MSVCPROJS = gdk4-broadway broadwayd
|
||||
|
||||
gdk4_broadway_FILES = $(libgdk_broadway_la_SOURCES)
|
||||
gdk4_broadway_EXCLUDES = dummy
|
||||
@@ -116,14 +116,14 @@ gdk4_broadway_HEADERS_INST = $(libgdkbroadwayinclude_HEADERS)
|
||||
|
||||
gdk4_broadway_HEADERS_EXCLUDES = dummy
|
||||
|
||||
gtk4_broadwayd_FILES = $(gtk4_broadwayd_SOURCES)
|
||||
gtk4_broadwayd_EXCLUDES = dummy
|
||||
broadwayd_FILES = $(broadwayd_SOURCES)
|
||||
broadwayd_EXCLUDES = dummy
|
||||
|
||||
include $(top_srcdir)/build/Makefile.msvcproj
|
||||
|
||||
dist-hook: \
|
||||
$(top_builddir)/build/win32/vs12/gdk4-broadway.vcxproj \
|
||||
$(top_builddir)/build/win32/vs12/gtk4-broadwayd.vcxproj \
|
||||
$(top_builddir)/build/win32/vs12/broadwayd.vcxproj \
|
||||
$(top_builddir)/build/win32/vs12/gdk4-broadway.vs12.headers
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
||||
|
||||
@@ -449,7 +449,7 @@ main (int argc, char *argv[])
|
||||
{
|
||||
if (*argv[1] != ':')
|
||||
{
|
||||
g_printerr ("Usage gtk4-broadwayd [:DISPLAY]\n");
|
||||
g_printerr ("Usage broadwayd [:DISPLAY]\n");
|
||||
exit (1);
|
||||
}
|
||||
display = argv[1];
|
||||
|
||||
@@ -341,6 +341,8 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
|
||||
display_class->supports_cursor_alpha = _gdk_broadway_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = _gdk_broadway_display_supports_cursor_color;
|
||||
|
||||
display_class->before_process_all_updates = _gdk_broadway_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = _gdk_broadway_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
|
||||
display_class->create_window_impl = _gdk_broadway_display_create_window_impl;
|
||||
|
||||
@@ -116,6 +116,8 @@ void _gdk_broadway_display_get_default_cursor_size (GdkDisplay *display,
|
||||
void _gdk_broadway_display_get_maximal_cursor_size (GdkDisplay *display,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void _gdk_broadway_display_before_process_all_updates (GdkDisplay *display);
|
||||
void _gdk_broadway_display_after_process_all_updates (GdkDisplay *display);
|
||||
void _gdk_broadway_display_create_window_impl (GdkDisplay *display,
|
||||
GdkWindow *window,
|
||||
GdkWindow *real_parent,
|
||||
|
||||
@@ -385,6 +385,11 @@ _gdk_broadway_window_destroy (GdkWindow *window,
|
||||
impl->id);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_window_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
/* This function is called when the XWindow is really gone.
|
||||
*/
|
||||
static void
|
||||
@@ -503,11 +508,26 @@ gdk_window_broadway_move_resize (GdkWindow *window,
|
||||
window->resize_count++;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_broadway_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_broadway_raise (GdkWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_broadway_restack_under (GdkWindow *window,
|
||||
GList *native_siblings /* in requested order, first is bottom-most */)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_broadway_restack_toplevel (GdkWindow *window,
|
||||
GdkWindow *sibling,
|
||||
@@ -992,6 +1012,18 @@ gdk_broadway_window_set_functions (GdkWindow *window,
|
||||
return;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_broadway_window_get_shape (GdkWindow *window)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_broadway_window_get_input_shape (GdkWindow *window)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_window_end_paint (GdkWindow *window)
|
||||
{
|
||||
@@ -1459,6 +1491,16 @@ gdk_broadway_window_set_opacity (GdkWindow *window,
|
||||
opacity = 1;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_broadway_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
}
|
||||
|
||||
guint32
|
||||
gdk_broadway_get_last_seen_time (GdkWindow *window)
|
||||
{
|
||||
@@ -1484,8 +1526,10 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
||||
impl_class->get_events = gdk_window_broadway_get_events;
|
||||
impl_class->raise = gdk_window_broadway_raise;
|
||||
impl_class->lower = gdk_window_broadway_lower;
|
||||
impl_class->restack_under = gdk_window_broadway_restack_under;
|
||||
impl_class->restack_toplevel = gdk_window_broadway_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_broadway_move_resize;
|
||||
impl_class->reparent = gdk_window_broadway_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_broadway_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_broadway_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_broadway_get_root_coords;
|
||||
@@ -1493,6 +1537,9 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
||||
impl_class->shape_combine_region = gdk_window_broadway_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_window_broadway_input_shape_combine_region;
|
||||
impl_class->destroy = _gdk_broadway_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_broadway_window_destroy_foreign;
|
||||
impl_class->get_shape = gdk_broadway_window_get_shape;
|
||||
impl_class->get_input_shape = gdk_broadway_window_get_input_shape;
|
||||
impl_class->end_paint = gdk_broadway_window_end_paint;
|
||||
impl_class->beep = gdk_broadway_window_beep;
|
||||
|
||||
|
||||
22
gdk/gdk-private.c
Normal file
22
gdk/gdk-private.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "config.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
GdkPrivateVTable *
|
||||
gdk__private__ (void)
|
||||
{
|
||||
static GdkPrivateVTable table = {
|
||||
gdk_device_grab_info,
|
||||
gdk_display_open_default,
|
||||
gdk_add_option_entries,
|
||||
gdk_pre_parse,
|
||||
gdk_gl_get_flags,
|
||||
gdk_gl_set_flags,
|
||||
gdk_window_freeze_toplevel_updates,
|
||||
gdk_window_thaw_toplevel_updates,
|
||||
gdk_display_get_rendering_mode,
|
||||
gdk_display_set_rendering_mode,
|
||||
gdk_window_move_to_rect
|
||||
};
|
||||
|
||||
return &table;
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdk/gdkinternals.h"
|
||||
|
||||
#define GDK_PRIVATE_CALL(symbol) (gdk__private__ ()->symbol)
|
||||
|
||||
GdkDisplay * gdk_display_open_default (void);
|
||||
|
||||
gboolean gdk_device_grab_info (GdkDisplay *display,
|
||||
@@ -33,4 +35,38 @@ void gdk_window_move_to_rect (GdkWindow *window,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy);
|
||||
|
||||
typedef struct {
|
||||
/* add all private functions here, initialize them in gdk-private.c */
|
||||
gboolean (* gdk_device_grab_info) (GdkDisplay *display,
|
||||
GdkDevice *device,
|
||||
GdkWindow **grab_window,
|
||||
gboolean *owner_events);
|
||||
|
||||
GdkDisplay *(* gdk_display_open_default) (void);
|
||||
|
||||
void (* gdk_add_option_entries) (GOptionGroup *group);
|
||||
void (* gdk_pre_parse) (void);
|
||||
|
||||
GdkGLFlags (* gdk_gl_get_flags) (void);
|
||||
void (* gdk_gl_set_flags) (GdkGLFlags flags);
|
||||
|
||||
void (* gdk_window_freeze_toplevel_updates) (GdkWindow *window);
|
||||
void (* gdk_window_thaw_toplevel_updates) (GdkWindow *window);
|
||||
|
||||
GdkRenderingMode (* gdk_display_get_rendering_mode) (GdkDisplay *display);
|
||||
void (* gdk_display_set_rendering_mode) (GdkDisplay *display,
|
||||
GdkRenderingMode mode);
|
||||
|
||||
void (* gdk_window_move_to_rect) (GdkWindow *window,
|
||||
const GdkRectangle *rect,
|
||||
GdkGravity rect_anchor,
|
||||
GdkGravity window_anchor,
|
||||
GdkAnchorHints anchor_hints,
|
||||
gint rect_anchor_dx,
|
||||
gint rect_anchor_dy);
|
||||
} GdkPrivateVTable;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPrivateVTable * gdk__private__ (void);
|
||||
|
||||
#endif /* __GDK__PRIVATE_H__ */
|
||||
|
||||
21
gdk/gdk.c
21
gdk/gdk.c
@@ -150,11 +150,6 @@ static const GDebugKey gdk_gl_keys[] = {
|
||||
{ "gles", GDK_GL_GLES },
|
||||
};
|
||||
|
||||
static const GDebugKey gdk_vulkan_keys[] = {
|
||||
{ "disable", GDK_VULKAN_DISABLE },
|
||||
{ "validate", GDK_VULKAN_VALIDATE },
|
||||
};
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static const GDebugKey gdk_debug_keys[] = {
|
||||
{ "events", GDK_DEBUG_EVENTS },
|
||||
@@ -170,8 +165,7 @@ static const GDebugKey gdk_debug_keys[] = {
|
||||
{ "eventloop", GDK_DEBUG_EVENTLOOP },
|
||||
{ "frames", GDK_DEBUG_FRAMES },
|
||||
{ "settings", GDK_DEBUG_SETTINGS },
|
||||
{ "opengl", GDK_DEBUG_OPENGL },
|
||||
{ "vulkan", GDK_DEBUG_VULKAN }
|
||||
{ "opengl", GDK_DEBUG_OPENGL }
|
||||
};
|
||||
|
||||
static gboolean
|
||||
@@ -281,7 +275,7 @@ void
|
||||
gdk_pre_parse (void)
|
||||
{
|
||||
const char *rendering_mode;
|
||||
const gchar *gl_string, *vulkan_string;
|
||||
const gchar *gl_string;
|
||||
|
||||
gdk_initialized = TRUE;
|
||||
|
||||
@@ -310,11 +304,12 @@ gdk_pre_parse (void)
|
||||
(GDebugKey *) gdk_gl_keys,
|
||||
G_N_ELEMENTS (gdk_gl_keys));
|
||||
|
||||
vulkan_string = getenv("GDK_VULKAN");
|
||||
if (vulkan_string != NULL)
|
||||
_gdk_vulkan_flags = g_parse_debug_string (vulkan_string,
|
||||
(GDebugKey *) gdk_vulkan_keys,
|
||||
G_N_ELEMENTS (gdk_vulkan_keys));
|
||||
if (getenv ("GDK_NATIVE_WINDOWS"))
|
||||
{
|
||||
g_warning ("The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3.\n"
|
||||
"See the documentation for gdk_window_ensure_native() on how to get native windows.");
|
||||
g_unsetenv ("GDK_NATIVE_WINDOWS");
|
||||
}
|
||||
|
||||
rendering_mode = g_getenv ("GDK_RENDERING");
|
||||
if (rendering_mode)
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include <gdk/gdkdisplay.h>
|
||||
#include <gdk/gdkdisplaymanager.h>
|
||||
#include <gdk/gdkdnd.h>
|
||||
#include <gdk/gdkdrawcontext.h>
|
||||
#include <gdk/gdkdrawingcontext.h>
|
||||
#include <gdk/gdkenumtypes.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
@@ -62,7 +61,6 @@
|
||||
#include <gdk/gdkthreads.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkvisual.h>
|
||||
#include <gdk/gdkvulkancontext.h>
|
||||
#include <gdk/gdkwindow.h>
|
||||
|
||||
#include <gdk/gdk-autocleanup.h>
|
||||
|
||||
@@ -151,7 +151,7 @@ gdk_cairo_region (cairo_t *cr,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf)
|
||||
{
|
||||
@@ -198,9 +198,7 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
q[0] = p[2];
|
||||
q[1] = p[1];
|
||||
q[2] = p[0];
|
||||
q[3] = 0xFF;
|
||||
#else
|
||||
q[0] = 0xFF;
|
||||
q[1] = p[0];
|
||||
q[2] = p[1];
|
||||
q[3] = p[2];
|
||||
@@ -325,6 +323,40 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cairo_set_source_window:
|
||||
* @cr: a cairo context
|
||||
* @window: a #GdkWindow
|
||||
* @x: X coordinate of location to place upper left corner of @window
|
||||
* @y: Y coordinate of location to place upper left corner of @window
|
||||
*
|
||||
* Sets the given window as the source pattern for @cr.
|
||||
*
|
||||
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
|
||||
* so that the origin of @window is @x, @y. The window contains all its
|
||||
* subwindows when rendering.
|
||||
*
|
||||
* Note that the contents of @window are undefined outside of the
|
||||
* visible part of @window, so use this function with care.
|
||||
*
|
||||
* Since: 2.24
|
||||
*/
|
||||
void
|
||||
gdk_cairo_set_source_window (cairo_t *cr,
|
||||
GdkWindow *window,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
g_return_if_fail (cr != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
surface = _gdk_window_ref_cairo_surface (window);
|
||||
cairo_set_source_surface (cr, surface, x, y);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
/*
|
||||
* _gdk_cairo_surface_extents:
|
||||
* @surface: surface to measure
|
||||
|
||||
@@ -42,6 +42,11 @@ void gdk_cairo_set_source_pixbuf (cairo_t *cr,
|
||||
const GdkPixbuf *pixbuf,
|
||||
gdouble pixbuf_x,
|
||||
gdouble pixbuf_y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_cairo_set_source_window (cairo_t *cr,
|
||||
GdkWindow *window,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_cairo_rectangle (cairo_t *cr,
|
||||
|
||||
@@ -24,10 +24,6 @@
|
||||
#include "gdkmonitor.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
|
||||
@@ -124,16 +120,9 @@ struct _GdkDisplay
|
||||
guint double_click_time; /* Maximum time between clicks in msecs */
|
||||
guint double_click_distance; /* Maximum distance between clicks in pixels */
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkInstance vk_instance;
|
||||
VkDebugReportCallbackEXT vk_debug_callback;
|
||||
VkPhysicalDevice vk_physical_device;
|
||||
VkDevice vk_device;
|
||||
VkQueue vk_queue;
|
||||
uint32_t vk_queue_family_index;
|
||||
guint has_gl_extension_texture_non_power_of_two : 1;
|
||||
guint has_gl_extension_texture_rectangle : 1;
|
||||
|
||||
guint vulkan_refcount;
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
|
||||
@@ -147,8 +136,6 @@ struct _GdkDisplayClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
GType window_type; /* type for native windows for this display, set in class_init */
|
||||
GType vk_context_type; /* type for GdkVulkanContext, must be set if vk_extension_name != NULL */
|
||||
const char *vk_extension_name; /* Name of required windowing vulkan extension or %NULL (default) if Vulkan isn't supported */
|
||||
|
||||
const gchar * (*get_name) (GdkDisplay *display);
|
||||
GdkScreen * (*get_default_screen) (GdkDisplay *display);
|
||||
@@ -191,6 +178,9 @@ struct _GdkDisplayClass
|
||||
|
||||
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
|
||||
|
||||
void (*before_process_all_updates) (GdkDisplay *display);
|
||||
void (*after_process_all_updates) (GdkDisplay *display);
|
||||
|
||||
gulong (*get_next_serial) (GdkDisplay *display);
|
||||
|
||||
void (*notify_startup_complete) (GdkDisplay *display,
|
||||
|
||||
@@ -1,284 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkdrawcontext.c: base class for rendering system support
|
||||
*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
* SECTION:gdkdrawcontext
|
||||
* @Title: GdkDrawContext
|
||||
* @Short_description: Drawing context base class
|
||||
*
|
||||
* #GdkDrawContext is the base object used by contexts implementing different
|
||||
* rendering methods, such as #GdkGLContext or #GdkVulkanContext. It provides
|
||||
* shared functionality between those contexts.
|
||||
*
|
||||
* You will always interact with one of those subclasses.
|
||||
*/
|
||||
typedef struct _GdkDrawContextPrivate GdkDrawContextPrivate;
|
||||
|
||||
struct _GdkDrawContextPrivate {
|
||||
GdkWindow *window;
|
||||
|
||||
guint is_drawing : 1;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_DISPLAY,
|
||||
PROP_WINDOW,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
static GParamSpec *pspecs[LAST_PROP] = { NULL, };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkDrawContext, gdk_draw_context, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
gdk_draw_context_dispose (GObject *gobject)
|
||||
{
|
||||
GdkDrawContext *context = GDK_DRAW_CONTEXT (gobject);
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_clear_object (&priv->window);
|
||||
|
||||
G_OBJECT_CLASS (gdk_draw_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_draw_context_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDrawContext *context = GDK_DRAW_CONTEXT (gobject);
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
priv->window = g_value_dup_object (value);
|
||||
g_assert (priv->window != NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_draw_context_get_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDrawContext *context = GDK_DRAW_CONTEXT (gobject);
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, gdk_draw_context_get_display (context));
|
||||
break;
|
||||
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, priv->window);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_draw_context_class_init (GdkDrawContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gdk_draw_context_set_property;
|
||||
gobject_class->get_property = gdk_draw_context_get_property;
|
||||
gobject_class->dispose = gdk_draw_context_dispose;
|
||||
|
||||
/**
|
||||
* GdkDrawContext:display:
|
||||
*
|
||||
* The #GdkDisplay used to create the #GdkDrawContext.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
pspecs[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
P_("Display"),
|
||||
P_("The GDK display used to create the context"),
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkDrawContext:window:
|
||||
*
|
||||
* The #GdkWindow the gl context is bound to.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
pspecs[PROP_WINDOW] =
|
||||
g_param_spec_object ("window",
|
||||
P_("Window"),
|
||||
P_("The GDK window bound to the context"),
|
||||
GDK_TYPE_WINDOW,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, LAST_PROP, pspecs);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_draw_context_init (GdkDrawContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_draw_context_is_drawing:
|
||||
* @context: a #GdkDrawContext
|
||||
*
|
||||
* Returns %TRUE if @context is in the process of drawing to its window. In such
|
||||
* cases, it will have access to the window's backbuffer to render the new frame
|
||||
* onto it.
|
||||
*
|
||||
* Returns: %TRUE if the context is between begin_frame() and end_frame() calls.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
gboolean
|
||||
gdk_draw_context_is_drawing (GdkDrawContext *context)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
return priv->is_drawing;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_draw_context_begin_frame:
|
||||
* @context: a #GdkDrawContext
|
||||
* @region: (inout): The clip region that needs to be repainted
|
||||
*
|
||||
* Sets up @context and @drawing for a new drawing.
|
||||
*
|
||||
* The @context is free to update @region to the size that actually needs to
|
||||
* be repainted. Contexts that do not support partial blits for example may
|
||||
* want to invalidate the whole window instead.
|
||||
*
|
||||
* The function does not clear the background. Clearing the backgroud is the
|
||||
* job of the renderer. The contents of the backbuffer are undefined after this
|
||||
* function call.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkDrawContextPrivate *priv;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
|
||||
g_return_if_fail (region != NULL);
|
||||
|
||||
priv = gdk_draw_context_get_instance_private (context);
|
||||
priv->is_drawing = TRUE;
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, region);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_draw_context_end_frame:
|
||||
* @context: a #GdkDrawContext
|
||||
* @painted: The area that has been redrawn this frame
|
||||
* @damage: The area that we know is actually different from the last frame
|
||||
*
|
||||
* Copies the back buffer to the front buffer.
|
||||
*
|
||||
* This function may call `glFlush()` implicitly before returning; it
|
||||
* is not recommended to call `glFlush()` explicitly before calling
|
||||
* this function.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_end_frame (GdkDrawContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkDrawContextPrivate *priv;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, painted, damage);
|
||||
|
||||
priv = gdk_draw_context_get_instance_private (context);
|
||||
priv->is_drawing = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_context_get_display:
|
||||
* @context: a #GdkDrawContext
|
||||
*
|
||||
* Retrieves the #GdkDisplay the @context is created for
|
||||
*
|
||||
* Returns: (nullable) (transfer none): a #GdkDisplay or %NULL
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
GdkDisplay *
|
||||
gdk_draw_context_get_display (GdkDrawContext *context)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
|
||||
|
||||
return priv->window ? gdk_window_get_display (priv->window) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_context_get_window:
|
||||
* @context: a #GdkDrawContext
|
||||
*
|
||||
* Retrieves the #GdkWindow used by the @context.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): a #GdkWindow or %NULL
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
GdkWindow *
|
||||
gdk_draw_context_get_window (GdkDrawContext *context)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAW_CONTEXT (context), NULL);
|
||||
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkdrawcontext.h: base class for rendering system support
|
||||
*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DRAW_CONTEXT__
|
||||
#define __GDK_DRAW_CONTEXT__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_DRAW_CONTEXT (gdk_draw_context_get_type ())
|
||||
#define GDK_DRAW_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_DRAW_CONTEXT, GdkDrawContext))
|
||||
#define GDK_IS_DRAW_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_DRAW_CONTEXT))
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GType gdk_draw_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GdkDisplay * gdk_draw_context_get_display (GdkDrawContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GdkWindow * gdk_draw_context_get_window (GdkDrawContext *context);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DRAW_CONTEXT__ */
|
||||
@@ -1,59 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkdrawcontext.h: base class for rendering system support
|
||||
*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_DRAW_CONTEXT_PRIVATE__
|
||||
#define __GDK_DRAW_CONTEXT_PRIVATE__
|
||||
|
||||
#include "gdkdrawcontext.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
|
||||
#define GDK_IS_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAW_CONTEXT))
|
||||
#define GDK_DRAW_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
|
||||
|
||||
typedef struct _GdkDrawContextClass GdkDrawContextClass;
|
||||
|
||||
struct _GdkDrawContext
|
||||
{
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkDrawContextClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* begin_frame) (GdkDrawContext *context,
|
||||
cairo_region_t *update_area);
|
||||
void (* end_frame) (GdkDrawContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
};
|
||||
|
||||
gboolean gdk_draw_context_is_drawing (GdkDrawContext *context);
|
||||
void gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
cairo_region_t *region);
|
||||
void gdk_draw_context_end_frame (GdkDrawContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK__DRAW_CONTEXT_PRIVATE__ */
|
||||
@@ -46,24 +46,13 @@
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
typedef struct _GdkDrawingContextPrivate GdkDrawingContextPrivate;
|
||||
|
||||
struct _GdkDrawingContextPrivate {
|
||||
GdkWindow *window;
|
||||
GdkDrawContext *paint_context;
|
||||
|
||||
cairo_region_t *clip;
|
||||
cairo_t *cr;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GdkDrawingContext, gdk_drawing_context, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE (GdkDrawingContext, gdk_drawing_context, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_WINDOW,
|
||||
PROP_CLIP,
|
||||
PROP_PAINT_CONTEXT,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
@@ -74,18 +63,16 @@ static void
|
||||
gdk_drawing_context_dispose (GObject *gobject)
|
||||
{
|
||||
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (self);
|
||||
|
||||
/* Unset the drawing context, in case somebody is holding
|
||||
* onto the Cairo context
|
||||
*/
|
||||
if (priv->cr != NULL)
|
||||
gdk_cairo_set_drawing_context (priv->cr, NULL);
|
||||
if (self->cr != NULL)
|
||||
gdk_cairo_set_drawing_context (self->cr, NULL);
|
||||
|
||||
g_clear_object (&priv->window);
|
||||
g_clear_object (&priv->paint_context);
|
||||
g_clear_pointer (&priv->clip, cairo_region_destroy);
|
||||
g_clear_pointer (&priv->cr, cairo_destroy);
|
||||
g_clear_object (&self->window);
|
||||
g_clear_pointer (&self->clip, cairo_region_destroy);
|
||||
g_clear_pointer (&self->cr, cairo_destroy);
|
||||
|
||||
G_OBJECT_CLASS (gdk_drawing_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
@@ -97,27 +84,15 @@ gdk_drawing_context_set_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
priv->window = g_value_dup_object (value);
|
||||
if (priv->window == NULL)
|
||||
{
|
||||
g_critical ("The drawing context of type %s does not have a window "
|
||||
"associated to it. Drawing contexts can only be created "
|
||||
"using gdk_window_begin_draw_frame().",
|
||||
G_OBJECT_TYPE_NAME (gobject));
|
||||
return;
|
||||
}
|
||||
|
||||
case PROP_PAINT_CONTEXT:
|
||||
priv->paint_context = g_value_dup_object (value);
|
||||
self->window = g_value_dup_object (value);
|
||||
break;
|
||||
|
||||
case PROP_CLIP:
|
||||
priv->clip = g_value_dup_boxed (value);
|
||||
self->clip = g_value_dup_boxed (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -132,20 +107,15 @@ gdk_drawing_context_get_property (GObject *gobject,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, priv->window);
|
||||
g_value_set_object (value, self->window);
|
||||
break;
|
||||
|
||||
case PROP_CLIP:
|
||||
g_value_set_boxed (value, priv->clip);
|
||||
break;
|
||||
|
||||
case PROP_PAINT_CONTEXT:
|
||||
g_value_set_object (value, priv->paint_context);
|
||||
g_value_set_boxed (value, self->clip);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -153,11 +123,28 @@ gdk_drawing_context_get_property (GObject *gobject,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drawing_context_constructed (GObject *gobject)
|
||||
{
|
||||
GdkDrawingContext *self = GDK_DRAWING_CONTEXT (gobject);
|
||||
|
||||
if (self->window == NULL)
|
||||
{
|
||||
g_critical ("The drawing context of type %s does not have a window "
|
||||
"associated to it. Drawing contexts can only be created "
|
||||
"using gdk_window_begin_draw_frame().",
|
||||
G_OBJECT_TYPE_NAME (gobject));
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gdk_drawing_context_parent_class)->constructed (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drawing_context_class_init (GdkDrawingContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->constructed = gdk_drawing_context_constructed;
|
||||
gobject_class->set_property = gdk_drawing_context_set_property;
|
||||
gobject_class->get_property = gdk_drawing_context_get_property;
|
||||
gobject_class->dispose = gdk_drawing_context_dispose;
|
||||
@@ -188,19 +175,6 @@ gdk_drawing_context_class_init (GdkDrawingContextClass *klass)
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
/**
|
||||
* GdkDrawingContext:paint-context:
|
||||
*
|
||||
* The #GdkDrawContext used to draw or %NULL if Cairo is used.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
obj_property[PROP_PAINT_CONTEXT] =
|
||||
g_param_spec_object ("paint-context", "Paint context", "The context used to draw",
|
||||
GDK_TYPE_DRAW_CONTEXT,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, obj_property);
|
||||
}
|
||||
@@ -240,13 +214,10 @@ gdk_cairo_get_drawing_context (cairo_t *cr)
|
||||
|
||||
/**
|
||||
* gdk_drawing_context_get_cairo_context:
|
||||
* @context: a #GdkDrawingContext created with a %NULL paint context
|
||||
* @context:
|
||||
*
|
||||
* Retrieves a Cairo context to be used to draw on the #GdkWindow
|
||||
* that created the #GdkDrawingContext. The @context must have been
|
||||
* created without a #GdkDrawContext for this function to work. If
|
||||
* gdk_drawing_context_get_paint_context() does not return %NULL,
|
||||
* then this function will.
|
||||
* that created the #GdkDrawingContext.
|
||||
*
|
||||
* The returned context is guaranteed to be valid as long as the
|
||||
* #GdkDrawingContext is valid, that is between a call to
|
||||
@@ -254,42 +225,36 @@ gdk_cairo_get_drawing_context (cairo_t *cr)
|
||||
*
|
||||
* Returns: (transfer none): a Cairo context to be used to draw
|
||||
* the contents of the #GdkWindow. The context is owned by the
|
||||
* #GdkDrawingContext and should not be destroyed. %NULL is
|
||||
* returned when a paint context is in used.
|
||||
* #GdkDrawingContext and should not be destroyed
|
||||
*
|
||||
* Since: 3.22
|
||||
*/
|
||||
cairo_t *
|
||||
gdk_drawing_context_get_cairo_context (GdkDrawingContext *context)
|
||||
{
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (priv->window), NULL);
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (context->window), NULL);
|
||||
|
||||
if (priv->paint_context != NULL)
|
||||
return NULL;
|
||||
|
||||
if (priv->cr == NULL)
|
||||
if (context->cr == NULL)
|
||||
{
|
||||
cairo_region_t *region;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = _gdk_window_ref_cairo_surface (priv->window);
|
||||
priv->cr = cairo_create (surface);
|
||||
surface = _gdk_window_ref_cairo_surface (context->window);
|
||||
context->cr = cairo_create (surface);
|
||||
|
||||
gdk_cairo_set_drawing_context (priv->cr, context);
|
||||
gdk_cairo_set_drawing_context (context->cr, context);
|
||||
|
||||
region = gdk_window_get_current_paint_region (priv->window);
|
||||
cairo_region_union (region, priv->clip);
|
||||
gdk_cairo_region (priv->cr, region);
|
||||
cairo_clip (priv->cr);
|
||||
region = gdk_window_get_current_paint_region (context->window);
|
||||
cairo_region_union (region, context->clip);
|
||||
gdk_cairo_region (context->cr, region);
|
||||
cairo_clip (context->cr);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
return priv->cr;
|
||||
return context->cr;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,31 +270,9 @@ gdk_drawing_context_get_cairo_context (GdkDrawingContext *context)
|
||||
GdkWindow *
|
||||
gdk_drawing_context_get_window (GdkDrawingContext *context)
|
||||
{
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
|
||||
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drawing_context_get_paint_context:
|
||||
* @context: a #GdkDrawingContext
|
||||
*
|
||||
* Retrieves the paint context used to draw with.
|
||||
*
|
||||
* Returns: (transfer none): a #GdkDrawContext or %NULL
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
GdkDrawContext *
|
||||
gdk_drawing_context_get_paint_context (GdkDrawingContext *context)
|
||||
{
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
|
||||
|
||||
return priv->paint_context;
|
||||
return context->window;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,14 +288,12 @@ gdk_drawing_context_get_paint_context (GdkDrawingContext *context)
|
||||
cairo_region_t *
|
||||
gdk_drawing_context_get_clip (GdkDrawingContext *context)
|
||||
{
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), NULL);
|
||||
|
||||
if (priv->clip == NULL)
|
||||
if (context->clip == NULL)
|
||||
return NULL;
|
||||
|
||||
return cairo_region_copy (priv->clip);
|
||||
return cairo_region_copy (context->clip);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,14 +309,12 @@ gdk_drawing_context_get_clip (GdkDrawingContext *context)
|
||||
gboolean
|
||||
gdk_drawing_context_is_valid (GdkDrawingContext *context)
|
||||
{
|
||||
GdkDrawingContextPrivate *priv = gdk_drawing_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DRAWING_CONTEXT (context), FALSE);
|
||||
|
||||
if (priv->window == NULL)
|
||||
if (context->window == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (gdk_window_get_drawing_context (priv->window) != context)
|
||||
if (gdk_window_get_drawing_context (context->window) != context)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
||||
@@ -31,6 +31,7 @@ G_BEGIN_DECLS
|
||||
#define GDK_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_DRAWING_CONTEXT, GdkDrawingContext))
|
||||
#define GDK_IS_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_DRAWING_CONTEXT))
|
||||
|
||||
typedef struct _GdkDrawingContext GdkDrawingContext;
|
||||
typedef struct _GdkDrawingContextClass GdkDrawingContextClass;
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
@@ -38,8 +39,6 @@ GType gdk_drawing_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkWindow * gdk_drawing_context_get_window (GdkDrawingContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GdkDrawContext* gdk_drawing_context_get_paint_context (GdkDrawingContext *context);
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
cairo_region_t *gdk_drawing_context_get_clip (GdkDrawingContext *context);
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@ G_BEGIN_DECLS
|
||||
struct _GdkDrawingContext
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkWindow *window;
|
||||
|
||||
cairo_region_t *clip;
|
||||
cairo_t *cr;
|
||||
};
|
||||
|
||||
struct _GdkDrawingContextClass
|
||||
|
||||
365
gdk/gdkgl.c
365
gdk/gdkgl.c
@@ -340,11 +340,18 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
GdkGLContext *paint_context;
|
||||
cairo_surface_t *image;
|
||||
cairo_matrix_t matrix;
|
||||
int dx, dy, window_scale;
|
||||
gboolean trivial_transform;
|
||||
cairo_surface_t *group_target;
|
||||
GdkWindow *direct_window, *impl_window;
|
||||
guint framebuffer;
|
||||
int alpha_size = 0;
|
||||
cairo_region_t *clip_region;
|
||||
GdkGLContextPaintData *paint_data;
|
||||
int major, minor, version;
|
||||
|
||||
impl_window = window->impl_window;
|
||||
|
||||
window_scale = gdk_window_get_scale_factor (impl_window);
|
||||
|
||||
paint_context = gdk_window_get_paint_gl_context (window, NULL);
|
||||
if (paint_context == NULL)
|
||||
@@ -381,71 +388,324 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
return;
|
||||
}
|
||||
|
||||
group_target = cairo_get_group_target (cr);
|
||||
direct_window = cairo_surface_get_user_data (group_target, &direct_key);
|
||||
|
||||
cairo_get_matrix (cr, &matrix);
|
||||
|
||||
gdk_gl_context_get_version (paint_context, &major, &minor);
|
||||
version = major * 100 + minor;
|
||||
dx = matrix.x0;
|
||||
dy = matrix.y0;
|
||||
|
||||
/* TODO: Use glTexSubImage2D() and do a row-by-row copy to replace
|
||||
* the GL_UNPACK_ROW_LENGTH support
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (paint_context) &&
|
||||
!(version >= 300 || gdk_gl_context_has_unpack_subimage (paint_context)))
|
||||
goto out;
|
||||
/* Trivial == integer-only translation */
|
||||
trivial_transform =
|
||||
(double)dx == matrix.x0 && (double)dy == matrix.y0 &&
|
||||
matrix.xx == 1.0 && matrix.xy == 0.0 &&
|
||||
matrix.yx == 0.0 && matrix.yy == 1.0;
|
||||
|
||||
/* TODO: avoid reading back non-required data due to dest clip */
|
||||
image = cairo_surface_create_similar_image (cairo_get_target (cr),
|
||||
(alpha_size == 0) ? CAIRO_FORMAT_RGB24 : CAIRO_FORMAT_ARGB32,
|
||||
width, height);
|
||||
|
||||
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
|
||||
|
||||
framebuffer = paint_data->tmp_framebuffer;
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
|
||||
|
||||
if (source_type == GL_RENDERBUFFER)
|
||||
/* For direct paint of non-alpha renderbuffer, we can
|
||||
just do a bitblit */
|
||||
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_GL) == 0 &&
|
||||
source_type == GL_RENDERBUFFER &&
|
||||
alpha_size == 0 &&
|
||||
direct_window != NULL &&
|
||||
direct_window->current_paint.use_gl &&
|
||||
trivial_transform &&
|
||||
clip_region != NULL)
|
||||
{
|
||||
int unscaled_window_height;
|
||||
int i;
|
||||
|
||||
/* Create a framebuffer with the source renderbuffer and
|
||||
make it the current target for reads */
|
||||
framebuffer = paint_data->tmp_framebuffer;
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, source);
|
||||
glBindFramebufferEXT (GL_DRAW_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
/* Translate to impl coords */
|
||||
cairo_region_translate (clip_region, dx, dy);
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
|
||||
gdk_window_get_unscaled_size (impl_window, NULL, &unscaled_window_height);
|
||||
|
||||
/* We can use glDrawBuffer on OpenGL only; on GLES 2.0 we are already
|
||||
* double buffered so we don't need it...
|
||||
*/
|
||||
if (!gdk_gl_context_get_use_es (paint_context))
|
||||
glDrawBuffer (GL_BACK);
|
||||
else
|
||||
{
|
||||
int maj, min;
|
||||
|
||||
gdk_gl_context_get_version (paint_context, &maj, &min);
|
||||
|
||||
/* ... but on GLES 3.0 we can use the vectorized glDrawBuffers
|
||||
* call.
|
||||
*/
|
||||
if ((maj * 100 + min) >= 300)
|
||||
{
|
||||
static const GLenum buffers[] = { GL_BACK };
|
||||
|
||||
glDrawBuffers (G_N_ELEMENTS (buffers), buffers);
|
||||
}
|
||||
}
|
||||
|
||||
#define FLIP_Y(_y) (unscaled_window_height - (_y))
|
||||
|
||||
for (i = 0; i < cairo_region_num_rectangles (clip_region); i++)
|
||||
{
|
||||
cairo_rectangle_int_t clip_rect, dest;
|
||||
|
||||
cairo_region_get_rectangle (clip_region, i, &clip_rect);
|
||||
clip_rect.x *= window_scale;
|
||||
clip_rect.y *= window_scale;
|
||||
clip_rect.width *= window_scale;
|
||||
clip_rect.height *= window_scale;
|
||||
|
||||
glScissor (clip_rect.x, FLIP_Y (clip_rect.y + clip_rect.height),
|
||||
clip_rect.width, clip_rect.height);
|
||||
|
||||
dest.x = dx * window_scale;
|
||||
dest.y = dy * window_scale;
|
||||
dest.width = width * window_scale / buffer_scale;
|
||||
dest.height = height * window_scale / buffer_scale;
|
||||
|
||||
if (gdk_rectangle_intersect (&clip_rect, &dest, &dest))
|
||||
{
|
||||
int clipped_src_x = x + (dest.x - dx * window_scale);
|
||||
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
|
||||
glBlitFramebufferEXT(clipped_src_x, clipped_src_y,
|
||||
(clipped_src_x + dest.width), (clipped_src_y + dest.height),
|
||||
dest.x, FLIP_Y(dest.y + dest.height),
|
||||
dest.x + dest.width, FLIP_Y(dest.y),
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
if (impl_window->current_paint.flushed_region)
|
||||
{
|
||||
cairo_rectangle_int_t flushed_rect;
|
||||
|
||||
flushed_rect.x = dest.x / window_scale;
|
||||
flushed_rect.y = dest.y / window_scale;
|
||||
flushed_rect.width = (dest.x + dest.width + window_scale - 1) / window_scale - flushed_rect.x;
|
||||
flushed_rect.height = (dest.y + dest.height + window_scale - 1) / window_scale - flushed_rect.y;
|
||||
|
||||
cairo_region_union_rectangle (impl_window->current_paint.flushed_region,
|
||||
&flushed_rect);
|
||||
cairo_region_subtract_rectangle (impl_window->current_paint.need_blend_region,
|
||||
&flushed_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDisable (GL_SCISSOR_TEST);
|
||||
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
#undef FLIP_Y
|
||||
|
||||
}
|
||||
/* For direct paint of alpha or non-alpha textures we can use texturing */
|
||||
else if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_GL) == 0 &&
|
||||
source_type == GL_TEXTURE &&
|
||||
direct_window != NULL &&
|
||||
direct_window->current_paint.use_gl &&
|
||||
trivial_transform &&
|
||||
clip_region != NULL)
|
||||
{
|
||||
int unscaled_window_height;
|
||||
GLint texture_width;
|
||||
GLint texture_height;
|
||||
int i, n_rects, n_quads;
|
||||
GdkTexturedQuad *quads;
|
||||
cairo_rectangle_int_t clip_rect;
|
||||
|
||||
/* Translate to impl coords */
|
||||
cairo_region_translate (clip_region, dx, dy);
|
||||
|
||||
if (alpha_size != 0)
|
||||
{
|
||||
cairo_region_t *opaque_region, *blend_region;
|
||||
|
||||
opaque_region = cairo_region_copy (clip_region);
|
||||
cairo_region_subtract (opaque_region, impl_window->current_paint.flushed_region);
|
||||
cairo_region_subtract (opaque_region, impl_window->current_paint.need_blend_region);
|
||||
|
||||
if (!cairo_region_is_empty (opaque_region))
|
||||
gdk_gl_texture_from_surface (impl_window->current_paint.surface,
|
||||
opaque_region);
|
||||
|
||||
blend_region = cairo_region_copy (clip_region);
|
||||
cairo_region_intersect (blend_region, impl_window->current_paint.need_blend_region);
|
||||
|
||||
glEnable (GL_BLEND);
|
||||
if (!cairo_region_is_empty (blend_region))
|
||||
gdk_gl_texture_from_surface (impl_window->current_paint.surface,
|
||||
blend_region);
|
||||
|
||||
cairo_region_destroy (opaque_region);
|
||||
cairo_region_destroy (blend_region);
|
||||
}
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, source);
|
||||
|
||||
if (gdk_gl_context_get_use_es (paint_context))
|
||||
{
|
||||
texture_width = width;
|
||||
texture_height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &texture_width);
|
||||
glGetTexLevelParameteriv (GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texture_height);
|
||||
}
|
||||
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
glEnable (GL_SCISSOR_TEST);
|
||||
|
||||
gdk_window_get_unscaled_size (impl_window, NULL, &unscaled_window_height);
|
||||
|
||||
#define FLIP_Y(_y) (unscaled_window_height - (_y))
|
||||
|
||||
cairo_region_get_extents (clip_region, &clip_rect);
|
||||
|
||||
glScissor (clip_rect.x * window_scale, FLIP_Y ((clip_rect.y + clip_rect.height) * window_scale),
|
||||
clip_rect.width * window_scale, clip_rect.height * window_scale);
|
||||
|
||||
n_quads = 0;
|
||||
n_rects = cairo_region_num_rectangles (clip_region);
|
||||
quads = g_new (GdkTexturedQuad, n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t dest;
|
||||
|
||||
cairo_region_get_rectangle (clip_region, i, &clip_rect);
|
||||
|
||||
clip_rect.x *= window_scale;
|
||||
clip_rect.y *= window_scale;
|
||||
clip_rect.width *= window_scale;
|
||||
clip_rect.height *= window_scale;
|
||||
|
||||
dest.x = dx * window_scale;
|
||||
dest.y = dy * window_scale;
|
||||
dest.width = width * window_scale / buffer_scale;
|
||||
dest.height = height * window_scale / buffer_scale;
|
||||
|
||||
if (gdk_rectangle_intersect (&clip_rect, &dest, &dest))
|
||||
{
|
||||
int clipped_src_x = x + (dest.x - dx * window_scale);
|
||||
int clipped_src_y = y + (height - dest.height - (dest.y - dy * window_scale));
|
||||
GdkTexturedQuad quad = {
|
||||
dest.x, FLIP_Y(dest.y),
|
||||
dest.x + dest.width, FLIP_Y(dest.y + dest.height),
|
||||
clipped_src_x / (float)texture_width, (clipped_src_y + dest.height) / (float)texture_height,
|
||||
(clipped_src_x + dest.width) / (float)texture_width, clipped_src_y / (float)texture_height,
|
||||
};
|
||||
|
||||
quads[n_quads++] = quad;
|
||||
|
||||
if (impl_window->current_paint.flushed_region)
|
||||
{
|
||||
cairo_rectangle_int_t flushed_rect;
|
||||
|
||||
flushed_rect.x = dest.x / window_scale;
|
||||
flushed_rect.y = dest.y / window_scale;
|
||||
flushed_rect.width = (dest.x + dest.width + window_scale - 1) / window_scale - flushed_rect.x;
|
||||
flushed_rect.height = (dest.y + dest.height + window_scale - 1) / window_scale - flushed_rect.y;
|
||||
|
||||
cairo_region_union_rectangle (impl_window->current_paint.flushed_region,
|
||||
&flushed_rect);
|
||||
cairo_region_subtract_rectangle (impl_window->current_paint.need_blend_region,
|
||||
&flushed_rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (n_quads > 0)
|
||||
gdk_gl_texture_quads (paint_context, GL_TEXTURE_2D, n_quads, quads, FALSE);
|
||||
|
||||
g_free (quads);
|
||||
|
||||
if (alpha_size != 0)
|
||||
glDisable (GL_BLEND);
|
||||
|
||||
#undef FLIP_Y
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, source, 0);
|
||||
/* Software fallback */
|
||||
int major, minor, version;
|
||||
|
||||
gdk_gl_context_get_version (paint_context, &major, &minor);
|
||||
version = major * 100 + minor;
|
||||
|
||||
/* TODO: Use glTexSubImage2D() and do a row-by-row copy to replace
|
||||
* the GL_UNPACK_ROW_LENGTH support
|
||||
*/
|
||||
if (gdk_gl_context_get_use_es (paint_context) &&
|
||||
!(version >= 300 || gdk_gl_context_has_unpack_subimage (paint_context)))
|
||||
goto out;
|
||||
|
||||
/* TODO: avoid reading back non-required data due to dest clip */
|
||||
image = cairo_surface_create_similar_image (cairo_get_target (cr),
|
||||
(alpha_size == 0) ? CAIRO_FORMAT_RGB24 : CAIRO_FORMAT_ARGB32,
|
||||
width, height);
|
||||
|
||||
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
|
||||
|
||||
framebuffer = paint_data->tmp_framebuffer;
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, framebuffer);
|
||||
|
||||
if (source_type == GL_RENDERBUFFER)
|
||||
{
|
||||
/* Create a framebuffer with the source renderbuffer and
|
||||
make it the current target for reads */
|
||||
glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_RENDERBUFFER_EXT, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
glFramebufferTexture2DEXT (GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
|
||||
GL_TEXTURE_2D, source, 0);
|
||||
}
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 4);
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, cairo_image_surface_get_stride (image) / 4);
|
||||
|
||||
/* The implicit format conversion is going to make this path slower */
|
||||
if (!gdk_gl_context_get_use_es (paint_context))
|
||||
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
cairo_image_surface_get_data (image));
|
||||
else
|
||||
glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
cairo_image_surface_get_data (image));
|
||||
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
|
||||
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
cairo_surface_mark_dirty (image);
|
||||
|
||||
/* Invert due to opengl having different origin */
|
||||
cairo_scale (cr, 1, -1);
|
||||
cairo_translate (cr, 0, -height / buffer_scale);
|
||||
|
||||
cairo_set_source_surface (cr, image, 0, 0);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_surface_destroy (image);
|
||||
}
|
||||
|
||||
glPixelStorei (GL_PACK_ALIGNMENT, 4);
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, cairo_image_surface_get_stride (image) / 4);
|
||||
|
||||
/* The implicit format conversion is going to make this path slower */
|
||||
if (!gdk_gl_context_get_use_es (paint_context))
|
||||
glReadPixels (x, y, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
cairo_image_surface_get_data (image));
|
||||
else
|
||||
glReadPixels (x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE,
|
||||
cairo_image_surface_get_data (image));
|
||||
|
||||
glPixelStorei (GL_PACK_ROW_LENGTH, 0);
|
||||
|
||||
glBindFramebufferEXT (GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
cairo_surface_mark_dirty (image);
|
||||
|
||||
/* Invert due to opengl having different origin */
|
||||
cairo_scale (cr, 1, -1);
|
||||
cairo_translate (cr, 0, -height / buffer_scale);
|
||||
|
||||
cairo_set_source_surface (cr, image, 0, 0);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_surface_destroy (image);
|
||||
|
||||
out:
|
||||
if (clip_region)
|
||||
cairo_region_destroy (clip_region);
|
||||
|
||||
}
|
||||
|
||||
/* This is always called with the paint context current */
|
||||
@@ -466,7 +726,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
float umax, vmax;
|
||||
gboolean use_texture_rectangle;
|
||||
guint target;
|
||||
|
||||
paint_context = gdk_gl_context_get_current ();
|
||||
if ((_gdk_gl_flags & GDK_GL_SOFTWARE_DRAW_SURFACE) == 0 &&
|
||||
paint_context &&
|
||||
@@ -482,8 +741,10 @@ gdk_gl_texture_from_surface (cairo_surface_t *surface,
|
||||
gdk_window_get_unscaled_size (window, NULL, &unscaled_window_height);
|
||||
|
||||
sx = sy = 1;
|
||||
cairo_surface_get_device_scale (surface, &sx, &sy);
|
||||
cairo_surface_get_device_offset (surface, &device_x_offset, &device_y_offset);
|
||||
cairo_surface_get_device_scale (window->current_paint.surface, &sx, &sy);
|
||||
|
||||
cairo_surface_get_device_offset (surface,
|
||||
&device_x_offset, &device_y_offset);
|
||||
|
||||
glGenTextures (1, &texture_id);
|
||||
if (use_texture_rectangle)
|
||||
|
||||
@@ -88,6 +88,8 @@
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
typedef struct {
|
||||
GdkDisplay *display;
|
||||
GdkWindow *window;
|
||||
GdkGLContext *shared_context;
|
||||
|
||||
int major;
|
||||
@@ -112,6 +114,8 @@ typedef struct {
|
||||
enum {
|
||||
PROP_0,
|
||||
|
||||
PROP_DISPLAY,
|
||||
PROP_WINDOW,
|
||||
PROP_SHARED_CONTEXT,
|
||||
|
||||
LAST_PROP
|
||||
@@ -121,7 +125,7 @@ static GParamSpec *obj_pspecs[LAST_PROP] = { NULL, };
|
||||
|
||||
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, G_TYPE_OBJECT)
|
||||
|
||||
static GPrivate thread_current_context = G_PRIVATE_INIT (g_object_unref);
|
||||
|
||||
@@ -136,6 +140,8 @@ gdk_gl_context_dispose (GObject *gobject)
|
||||
if (current == context)
|
||||
g_private_replace (&thread_current_context, NULL);
|
||||
|
||||
g_clear_object (&priv->display);
|
||||
g_clear_object (&priv->window);
|
||||
g_clear_object (&priv->shared_context);
|
||||
|
||||
G_OBJECT_CLASS (gdk_gl_context_parent_class)->dispose (gobject);
|
||||
@@ -161,6 +167,34 @@ gdk_gl_context_set_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
{
|
||||
GdkDisplay *display = g_value_get_object (value);
|
||||
|
||||
if (display)
|
||||
g_object_ref (display);
|
||||
|
||||
if (priv->display)
|
||||
g_object_unref (priv->display);
|
||||
|
||||
priv->display = display;
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_WINDOW:
|
||||
{
|
||||
GdkWindow *window = g_value_get_object (value);
|
||||
|
||||
if (window)
|
||||
g_object_ref (window);
|
||||
|
||||
if (priv->window)
|
||||
g_object_unref (priv->window);
|
||||
|
||||
priv->window = window;
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_SHARED_CONTEXT:
|
||||
{
|
||||
GdkGLContext *context = g_value_get_object (value);
|
||||
@@ -185,6 +219,14 @@ gdk_gl_context_get_property (GObject *gobject,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
g_value_set_object (value, priv->display);
|
||||
break;
|
||||
|
||||
case PROP_WINDOW:
|
||||
g_value_set_object (value, priv->window);
|
||||
break;
|
||||
|
||||
case PROP_SHARED_CONTEXT:
|
||||
g_value_set_object (value, priv->shared_context);
|
||||
break;
|
||||
@@ -255,81 +297,44 @@ gdk_gl_context_real_realize (GdkGLContext *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_gl_context_real_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
|
||||
|
||||
return cairo_region_create_rectangle (&(GdkRectangle) {
|
||||
0, 0,
|
||||
gdk_window_get_width (window),
|
||||
gdk_window_get_height (window)
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkWindow *window;
|
||||
GdkGLContext *shared;
|
||||
cairo_region_t *damage;
|
||||
int ww, wh;
|
||||
|
||||
shared = gdk_gl_context_get_shared_context (context);
|
||||
if (shared)
|
||||
{
|
||||
gdk_draw_context_begin_frame (GDK_DRAW_CONTEXT (shared), region);
|
||||
return;
|
||||
}
|
||||
|
||||
damage = gdk_gl_context_get_damage (context);
|
||||
cairo_region_union (region, damage);
|
||||
cairo_region_destroy (damage);
|
||||
|
||||
window = gdk_draw_context_get_window (draw_context);
|
||||
ww = gdk_window_get_width (window) * gdk_window_get_scale_factor (window);
|
||||
wh = gdk_window_get_height (window) * gdk_window_get_scale_factor (window);
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
/* Initial setup */
|
||||
glClearColor (0.0f, 0.0f, 0.0f, 0.0f);
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDisable (GL_BLEND);
|
||||
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
glViewport (0, 0, ww, wh);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkGLContext *shared;
|
||||
|
||||
shared = gdk_gl_context_get_shared_context (context);
|
||||
if (shared)
|
||||
{
|
||||
gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (shared), painted, damage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_context_class_init (GdkGLContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
|
||||
klass->realize = gdk_gl_context_real_realize;
|
||||
klass->get_damage = gdk_gl_context_real_get_damage;
|
||||
|
||||
draw_context_class->begin_frame = gdk_gl_context_real_begin_frame;
|
||||
draw_context_class->end_frame = gdk_gl_context_real_end_frame;
|
||||
/**
|
||||
* GdkGLContext:display:
|
||||
*
|
||||
* The #GdkDisplay used to create the #GdkGLContext.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
obj_pspecs[PROP_DISPLAY] =
|
||||
g_param_spec_object ("display",
|
||||
P_("Display"),
|
||||
P_("The GDK display used to create the GL context"),
|
||||
GDK_TYPE_DISPLAY,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLContext:window:
|
||||
*
|
||||
* The #GdkWindow the gl context is bound to.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
obj_pspecs[PROP_WINDOW] =
|
||||
g_param_spec_object ("window",
|
||||
P_("Window"),
|
||||
P_("The GDK window bound to the GL context"),
|
||||
GDK_TYPE_WINDOW,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkGLContext:shared-context:
|
||||
@@ -363,27 +368,34 @@ gdk_gl_context_init (GdkGLContext *self)
|
||||
priv->use_es = -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_gl_context_get_damage:
|
||||
/*< private >
|
||||
* gdk_gl_context_end_frame:
|
||||
* @context: a #GdkGLContext
|
||||
* @painted: The area that has been redrawn this frame
|
||||
* @damage: The area that we know is actually different from the last frame
|
||||
*
|
||||
* Returns the part of the backbuffer that is known to be damaged and would
|
||||
* need to be redrawn. This is the area that needs to be respected in addition
|
||||
* to areas invalidated by GTK or the windowing system itself.
|
||||
* Copies the back buffer to the front buffer.
|
||||
*
|
||||
* Returns: The damage to the backbuffer
|
||||
**/
|
||||
cairo_region_t *
|
||||
gdk_gl_context_get_damage (GdkGLContext *context)
|
||||
* This function may call `glFlush()` implicitly before returning; it
|
||||
* is not recommended to call `glFlush()` explicitly before calling
|
||||
* this function.
|
||||
*
|
||||
* Since: 3.16
|
||||
*/
|
||||
void
|
||||
gdk_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), cairo_region_create ());
|
||||
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
|
||||
|
||||
return GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
|
||||
GDK_GL_CONTEXT_GET_CLASS (context)->end_frame (context, painted, damage);
|
||||
}
|
||||
|
||||
GdkGLContextPaintData *
|
||||
gdk_gl_context_get_paint_data (GdkGLContext *context)
|
||||
{
|
||||
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
if (priv->paint_data == NULL)
|
||||
@@ -870,7 +882,7 @@ gdk_gl_context_make_current (GdkGLContext *context)
|
||||
}
|
||||
}
|
||||
|
||||
if (gdk_display_make_gl_context_current (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), context))
|
||||
if (gdk_display_make_gl_context_current (priv->display, context))
|
||||
{
|
||||
g_private_replace (&thread_current_context, g_object_ref (context));
|
||||
gdk_gl_context_check_extensions (context);
|
||||
@@ -890,9 +902,11 @@ gdk_gl_context_make_current (GdkGLContext *context)
|
||||
GdkDisplay *
|
||||
gdk_gl_context_get_display (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), NULL);
|
||||
|
||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
return priv->display;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -908,9 +922,11 @@ gdk_gl_context_get_display (GdkGLContext *context)
|
||||
GdkWindow *
|
||||
gdk_gl_context_get_window (GdkGLContext *context)
|
||||
{
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_GL_CONTEXT (context), NULL);
|
||||
|
||||
return gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
|
||||
return priv->window;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -979,7 +995,9 @@ gdk_gl_context_clear_current (void)
|
||||
current = g_private_get (&thread_current_context);
|
||||
if (current != NULL)
|
||||
{
|
||||
if (gdk_display_make_gl_context_current (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (current)), NULL))
|
||||
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (current);
|
||||
|
||||
if (gdk_display_make_gl_context_current (priv->display, NULL))
|
||||
g_private_replace (&thread_current_context, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,6 @@ gboolean gdk_gl_context_get_use_es (GdkGLContext *
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
gboolean gdk_gl_context_realize (GdkGLContext *context,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
cairo_region_t * gdk_gl_context_get_damage (GdkGLContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
void gdk_gl_context_make_current (GdkGLContext *context);
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#define __GDK_GL_CONTEXT_PRIVATE_H__
|
||||
|
||||
#include "gdkglcontext.h"
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -34,18 +33,19 @@ typedef struct _GdkGLContextClass GdkGLContextClass;
|
||||
|
||||
struct _GdkGLContext
|
||||
{
|
||||
GdkDrawContext parent_instance;
|
||||
GObject parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkGLContextClass
|
||||
{
|
||||
GdkDrawContextClass parent_class;
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* realize) (GdkGLContext *context,
|
||||
GError **error);
|
||||
|
||||
cairo_region_t * (* get_damage) (GdkGLContext *context);
|
||||
|
||||
void (* end_frame) (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
gboolean (* texture_from_surface) (GdkGLContext *context,
|
||||
cairo_surface_t *surface,
|
||||
cairo_region_t *region);
|
||||
@@ -87,6 +87,9 @@ gboolean gdk_gl_context_use_texture_rectangle (GdkGLContext
|
||||
gboolean gdk_gl_context_has_framebuffer_blit (GdkGLContext *context);
|
||||
gboolean gdk_gl_context_has_frame_terminator (GdkGLContext *context);
|
||||
gboolean gdk_gl_context_has_unpack_subimage (GdkGLContext *context);
|
||||
void gdk_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -35,5 +35,4 @@ gchar *_gdk_display_name = NULL;
|
||||
gchar *_gdk_display_arg_name = NULL;
|
||||
gboolean _gdk_disable_multidevice = FALSE;
|
||||
guint _gdk_gl_flags = 0;
|
||||
guint _gdk_vulkan_flags = 0;
|
||||
GdkRenderingMode _gdk_rendering_mode = GDK_RENDERING_MODE_SIMILAR;
|
||||
|
||||
@@ -69,7 +69,6 @@ typedef enum {
|
||||
GDK_DEBUG_FRAMES = 1 << 11,
|
||||
GDK_DEBUG_SETTINGS = 1 << 12,
|
||||
GDK_DEBUG_OPENGL = 1 << 13,
|
||||
GDK_DEBUG_VULKAN = 1 << 14
|
||||
} GdkDebugFlag;
|
||||
|
||||
typedef enum {
|
||||
@@ -88,17 +87,11 @@ typedef enum {
|
||||
GDK_GL_GLES = 1 << 6
|
||||
} GdkGLFlags;
|
||||
|
||||
typedef enum {
|
||||
GDK_VULKAN_DISABLE = 1 << 0,
|
||||
GDK_VULKAN_VALIDATE = 1 << 1,
|
||||
} GdkVulkanFlags;
|
||||
|
||||
extern GList *_gdk_default_filters;
|
||||
extern GdkWindow *_gdk_parent_root;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
extern guint _gdk_gl_flags;
|
||||
extern guint _gdk_vulkan_flags;
|
||||
extern GdkRenderingMode _gdk_rendering_mode;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
@@ -192,6 +185,75 @@ struct _GdkWindow
|
||||
GList *filters;
|
||||
GList *children;
|
||||
GList children_list_node;
|
||||
GList *native_children;
|
||||
|
||||
/* The paint logic here is a bit complex because of our intermingling of
|
||||
* cairo and GL. Let's first go over the cairo-alone case:
|
||||
*
|
||||
* 1) gdk_window_begin_paint_region() is called with an update region. If
|
||||
* the backend wants it, we redirect drawing to a temporary surface
|
||||
* sized the same as the update region and set `surface_needs_composite`
|
||||
* to TRUE. Otherwise, we paint directly onto the real server-side window.
|
||||
*
|
||||
* 2) Things paint with cairo using GdkDrawingContext
|
||||
*
|
||||
* 3) When everything is painted, the user calls gdk_window_end_paint().
|
||||
* If there was a temporary surface, this is composited back onto the
|
||||
* real backing surface in the appropriate places.
|
||||
*
|
||||
* This is similar to double buffering, except we only have partial surfaces
|
||||
* of undefined contents, and instead of swapping between two buffers, we
|
||||
* create a new temporary buffer every time.
|
||||
*
|
||||
* When we add GL to the mix, we have this instead:
|
||||
*
|
||||
* 1) gdk_window_begin_paint_region() is called with an update region like
|
||||
* before. We always redirect cairo drawing to a temporary surface when
|
||||
* GL is enabled.
|
||||
*
|
||||
* 2) Things paint with cairo using GdkDrawingContext. Whenever
|
||||
* something paints, it calls gdk_window_mark_paint_from_clip() to mark
|
||||
* which regions it has painted in software. We'll learn what this does
|
||||
* soon.
|
||||
*
|
||||
* 3) Something paints with GL and uses gdk_cairo_draw_from_gl() to
|
||||
* composite back into the scene. We paint this onto the backing
|
||||
* store for the window *immediately* by using GL, rather than
|
||||
* painting to the temporary surface, and keep track of the area that
|
||||
* we've painted in `flushed_region`.
|
||||
*
|
||||
* 4) Something paints using software again. It calls
|
||||
* gdk_window_mark_paint_from_clip(), which subtracts the region it
|
||||
* has painted from `flushed_region` and adds the region to
|
||||
* `needs_blended_region`.
|
||||
*
|
||||
* 5) Something paints using GL again, using gdk_cairo_draw_from_gl().
|
||||
* It paints directly to the backing store, removes the region it
|
||||
* painted from `needs_blended_region`, and adds to `flushed_region`.
|
||||
*
|
||||
* 6) gdk_window_end_paint() is called. It composites the temporary surface
|
||||
* back to the window, using GL, except it doesn't bother copying
|
||||
* `flushed_region`, and when it paints `needs_blended_region`, it also
|
||||
* turns on GL blending.
|
||||
*
|
||||
* That means that at any point in time, we have three regions:
|
||||
*
|
||||
* * `region` - This is the original invalidated region and is never
|
||||
* touched.
|
||||
*
|
||||
* * `flushed_region` - This is the portion of `region` that has GL
|
||||
* contents that have been painted directly to the window, and
|
||||
* doesn't have any cairo drawing painted over it.
|
||||
*
|
||||
* * `needs_blended_region` - This is the portion of `region` that
|
||||
* GL contents that have part cairo drawing painted over it.
|
||||
* gdk_window_end_paint() will draw this region using blending.
|
||||
*
|
||||
* `flushed_region` and `needs_blended_region` never intersect, and the
|
||||
* rest of `region` that isn't covered by either is the "opaque region",
|
||||
* which is any area of cairo drawing that didn't ever intersect with GL.
|
||||
* We can paint these from GL without turning on blending.
|
||||
**/
|
||||
|
||||
struct {
|
||||
/* The temporary surface that we're painting to. This will be composited
|
||||
@@ -200,8 +262,11 @@ struct _GdkWindow
|
||||
cairo_surface_t *surface;
|
||||
|
||||
cairo_region_t *region;
|
||||
cairo_region_t *flushed_region;
|
||||
cairo_region_t *need_blend_region;
|
||||
|
||||
gboolean surface_needs_composite;
|
||||
gboolean use_gl;
|
||||
} current_paint;
|
||||
GdkGLContext *gl_paint_context;
|
||||
|
||||
@@ -343,9 +408,6 @@ void gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
GdkTexturedQuad *quads,
|
||||
gboolean flip_colors);
|
||||
|
||||
void gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf);
|
||||
|
||||
void gdk_cairo_surface_mark_as_direct (cairo_surface_t *surface,
|
||||
GdkWindow *window);
|
||||
cairo_region_t *gdk_cairo_region_from_clip (cairo_t *cr);
|
||||
|
||||
@@ -41,6 +41,92 @@
|
||||
* #GdkWindows and cairo surfaces.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_get_from_window:
|
||||
* @window: Source window
|
||||
* @src_x: Source X coordinate within @window
|
||||
* @src_y: Source Y coordinate within @window
|
||||
* @width: Width in pixels of region to get
|
||||
* @height: Height in pixels of region to get
|
||||
*
|
||||
* Transfers image data from a #GdkWindow and converts it to an RGB(A)
|
||||
* representation inside a #GdkPixbuf. In other words, copies
|
||||
* image data from a server-side drawable to a client-side RGB(A) buffer.
|
||||
* This allows you to efficiently read individual pixels on the client side.
|
||||
*
|
||||
* This function will create an RGB pixbuf with 8 bits per channel with
|
||||
* the size specified by the @width and @height arguments scaled by the
|
||||
* scale factor of @window. The pixbuf will contain an alpha channel if
|
||||
* the @window contains one.
|
||||
*
|
||||
* If the window is off the screen, then there is no image data in the
|
||||
* obscured/offscreen regions to be placed in the pixbuf. The contents of
|
||||
* portions of the pixbuf corresponding to the offscreen region are undefined.
|
||||
*
|
||||
* If the window you’re obtaining data from is partially obscured by
|
||||
* other windows, then the contents of the pixbuf areas corresponding
|
||||
* to the obscured regions are undefined.
|
||||
*
|
||||
* If the window is not mapped (typically because it’s iconified/minimized
|
||||
* or not on the current workspace), then %NULL will be returned.
|
||||
*
|
||||
* If memory can’t be allocated for the return value, %NULL will be returned
|
||||
* instead.
|
||||
*
|
||||
* (In short, there are several ways this function can fail, and if it fails
|
||||
* it returns %NULL; so check the return value.)
|
||||
*
|
||||
* Returns: (nullable) (transfer full): A newly-created pixbuf with a
|
||||
* reference count of 1, or %NULL on error
|
||||
*/
|
||||
GdkPixbuf *
|
||||
gdk_pixbuf_get_from_window (GdkWindow *src,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
cairo_surface_t *copy;
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *dest;
|
||||
int scale;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (src), NULL);
|
||||
g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
|
||||
|
||||
surface = _gdk_window_ref_cairo_surface (src);
|
||||
scale = gdk_window_get_scale_factor (src);
|
||||
|
||||
/* We do not know what happened to this surface outside of GDK.
|
||||
* Especially for foreign windows, they will have been modified
|
||||
* by external applications.
|
||||
* So be on the safe side and:
|
||||
*/
|
||||
cairo_surface_mark_dirty (surface);
|
||||
|
||||
if (cairo_surface_get_content (surface) & CAIRO_CONTENT_ALPHA)
|
||||
copy = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale);
|
||||
else
|
||||
copy = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width * scale, height * scale);
|
||||
|
||||
cairo_surface_set_device_scale (copy, scale, scale);
|
||||
|
||||
cr = cairo_create (copy);
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
||||
cairo_set_source_surface (cr, surface, -src_x, -src_y);
|
||||
cairo_paint (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
dest = gdk_pixbuf_get_from_surface (copy, 0, 0, width * scale, height * scale);
|
||||
|
||||
cairo_surface_destroy (copy);
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
static cairo_format_t
|
||||
gdk_cairo_format_for_content (cairo_content_t content)
|
||||
{
|
||||
@@ -158,7 +244,8 @@ convert_no_alpha (guchar *dest_data,
|
||||
*
|
||||
* Transfers image data from a #cairo_surface_t and converts it to an RGB(A)
|
||||
* representation inside a #GdkPixbuf. This allows you to efficiently read
|
||||
* individual pixels from cairo surfaces.
|
||||
* individual pixels from cairo surfaces. For #GdkWindows, use
|
||||
* gdk_pixbuf_get_from_window() instead.
|
||||
*
|
||||
* This function will create an RGB pixbuf with 8 bits per channel.
|
||||
* The pixbuf will contain an alpha channel if the @surface contains one.
|
||||
|
||||
@@ -36,6 +36,13 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf *gdk_pixbuf_get_from_window (GdkWindow *window,
|
||||
gint src_x,
|
||||
gint src_y,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkPixbuf *gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
||||
gint src_x,
|
||||
|
||||
@@ -90,40 +90,6 @@ gdk_rgba_free (GdkRGBA *rgba)
|
||||
g_slice_free (GdkRGBA, rgba);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_is_clear:
|
||||
* @rgba: a #GdkRGBA
|
||||
*
|
||||
* Checks if an @rgba value is transparent. That is, drawing with the value
|
||||
* would not produce any change.
|
||||
*
|
||||
* Returns: %TRUE if the @rgab is clear
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha < ((double) 0x00ff / (double) 0xffff);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_rgba_is_opaque:
|
||||
* @rgba: a #GdkRGBA
|
||||
*
|
||||
* Checks if an @rgba value is opaque. That is, drawing with the value
|
||||
* will not retain any results from previous contents.
|
||||
*
|
||||
* Returns: %TRUE if the @rgab is opaque
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha > ((double)0xff00 / (double)0xffff);
|
||||
}
|
||||
|
||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||
|
||||
/* Parses a single color component from a rgb() or rgba() specification
|
||||
|
||||
@@ -52,11 +52,6 @@ GdkRGBA * gdk_rgba_copy (const GdkRGBA *rgba);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_rgba_free (GdkRGBA *rgba);
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
gboolean gdk_rgba_is_clear (const GdkRGBA *rgba);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
gboolean gdk_rgba_is_opaque (const GdkRGBA *rgba);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
guint gdk_rgba_hash (gconstpointer p);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -144,10 +144,7 @@ typedef struct _GdkKeymap GdkKeymap;
|
||||
typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
|
||||
typedef struct _GdkSeat GdkSeat;
|
||||
|
||||
typedef struct _GdkDrawingContext GdkDrawingContext;
|
||||
typedef struct _GdkDrawContext GdkDrawContext;
|
||||
typedef struct _GdkGLContext GdkGLContext;
|
||||
typedef struct _GdkVulkanContext GdkVulkanContext;
|
||||
|
||||
/**
|
||||
* GdkByteOrder:
|
||||
@@ -489,21 +486,6 @@ typedef enum {
|
||||
GDK_GL_ERROR_LINK_FAILED
|
||||
} GdkGLError;
|
||||
|
||||
/**
|
||||
* GdkVulkanError:
|
||||
* @GDK_VULKAN_ERROR_UNSUPPORTED: Vulkan is not supported on this backend or has not been
|
||||
* compiled in.
|
||||
* @GDK_VULKAN_ERROR_NOT_AVAILABLE: Vulkan support is not available on this Window
|
||||
*
|
||||
* Error enumeration for #GdkVulkanContext.
|
||||
*
|
||||
* Since: 3.90
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
} GdkVulkanError;
|
||||
|
||||
/**
|
||||
* GdkWindowTypeHint:
|
||||
* @GDK_WINDOW_TYPE_HINT_NORMAL: Normal toplevel window.
|
||||
|
||||
@@ -1,864 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkvulkancontext.c: Vulkan wrappers
|
||||
*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkvulkancontext.h"
|
||||
|
||||
#include "gdkvulkancontextprivate.h"
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
||||
|
||||
struct _GdkVulkanContextPrivate {
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkSurfaceKHR surface;
|
||||
VkSurfaceFormatKHR image_format;
|
||||
|
||||
int swapchain_width, swapchain_height;
|
||||
VkSwapchainKHR swapchain;
|
||||
VkSemaphore draw_semaphore;
|
||||
|
||||
guint n_images;
|
||||
VkImage *images;
|
||||
#endif
|
||||
|
||||
guint32 draw_index;
|
||||
};
|
||||
|
||||
enum {
|
||||
IMAGES_UPDATED,
|
||||
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
static void gdk_vulkan_context_initable_init (GInitableIface *iface);
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GdkVulkanContext, gdk_vulkan_context, GDK_TYPE_DRAW_CONTEXT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gdk_vulkan_context_initable_init)
|
||||
G_ADD_PRIVATE (GdkVulkanContext))
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
|
||||
const char *
|
||||
gdk_vulkan_strerror (VkResult result)
|
||||
{
|
||||
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.";
|
||||
case VK_ERROR_FRAGMENTED_POOL:
|
||||
return "A requested pool allocation has failed due to fragmentation of the pool’s memory.";
|
||||
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.";
|
||||
default:
|
||||
return "Unknown Vulkan error.";
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_dispose (GObject *gobject)
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (gobject);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
GdkDisplay *display;
|
||||
VkDevice device;
|
||||
|
||||
g_clear_pointer (&priv->images, g_free);
|
||||
priv->n_images = 0;
|
||||
|
||||
device = gdk_vulkan_context_get_device (context);
|
||||
|
||||
if (priv->draw_semaphore != VK_NULL_HANDLE)
|
||||
{
|
||||
vkDestroySemaphore (device,
|
||||
priv->draw_semaphore,
|
||||
NULL);
|
||||
priv->draw_semaphore = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
if (priv->swapchain != VK_NULL_HANDLE)
|
||||
{
|
||||
vkDestroySwapchainKHR (device,
|
||||
priv->swapchain,
|
||||
NULL);
|
||||
priv->swapchain = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
if (priv->surface != VK_NULL_HANDLE)
|
||||
{
|
||||
vkDestroySurfaceKHR (gdk_vulkan_context_get_instance (context),
|
||||
priv->surface,
|
||||
NULL);
|
||||
priv->surface = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
/* display will be unset in gdk_draw_context_dispose() */
|
||||
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
if (display)
|
||||
gdk_display_unref_vulkan (display);
|
||||
|
||||
G_OBJECT_CLASS (gdk_vulkan_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_vulkan_context_check_swapchain (GdkVulkanContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
|
||||
VkSurfaceCapabilitiesKHR capabilities;
|
||||
VkCompositeAlphaFlagBitsKHR composite_alpha;
|
||||
VkSwapchainKHR new_swapchain;
|
||||
VkResult res;
|
||||
VkDevice device;
|
||||
|
||||
if (gdk_window_get_width (window) == priv->swapchain_width &&
|
||||
gdk_window_get_height (window) == priv->swapchain_height)
|
||||
return TRUE;
|
||||
|
||||
device = gdk_vulkan_context_get_device (context);
|
||||
|
||||
res = GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceCapabilitiesKHR, gdk_vulkan_context_get_physical_device (context),
|
||||
priv->surface,
|
||||
&capabilities);
|
||||
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));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR)
|
||||
composite_alpha = VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR;
|
||||
else if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR)
|
||||
composite_alpha = VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR;
|
||||
else if (capabilities.supportedCompositeAlpha & VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR)
|
||||
{
|
||||
/* let's hope the backend knows what it's doing */
|
||||
composite_alpha = VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE (VULKAN, g_warning ("Vulkan swapchain doesn't do transparency. Using opaque swapchain instead."));
|
||||
composite_alpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
|
||||
}
|
||||
|
||||
res = GDK_VK_CHECK (vkCreateSwapchainKHR, device,
|
||||
&(VkSwapchainCreateInfoKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.surface = priv->surface,
|
||||
.minImageCount = 2,
|
||||
.imageFormat = priv->image_format.format,
|
||||
.imageColorSpace = priv->image_format.colorSpace,
|
||||
.imageExtent = capabilities.currentExtent,
|
||||
.imageArrayLayers = 1,
|
||||
.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
|
||||
.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE,
|
||||
.queueFamilyIndexCount = 1,
|
||||
.pQueueFamilyIndices = (uint32_t[1]) {
|
||||
gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_queue_family_index
|
||||
},
|
||||
.preTransform = capabilities.currentTransform,
|
||||
.compositeAlpha = composite_alpha,
|
||||
.presentMode = VK_PRESENT_MODE_FIFO_KHR,
|
||||
.clipped = VK_FALSE,
|
||||
.oldSwapchain = priv->swapchain
|
||||
},
|
||||
NULL,
|
||||
&new_swapchain);
|
||||
|
||||
if (priv->swapchain != VK_NULL_HANDLE)
|
||||
{
|
||||
vkDestroySwapchainKHR (device,
|
||||
priv->swapchain,
|
||||
NULL);
|
||||
g_clear_pointer (&priv->images, g_free);
|
||||
priv->n_images = 0;
|
||||
}
|
||||
|
||||
if (res == VK_SUCCESS)
|
||||
{
|
||||
priv->swapchain_width = capabilities.currentExtent.width;
|
||||
priv->swapchain_height = capabilities.currentExtent.height;
|
||||
priv->swapchain = new_swapchain;
|
||||
|
||||
GDK_VK_CHECK (vkGetSwapchainImagesKHR, device,
|
||||
priv->swapchain,
|
||||
&priv->n_images,
|
||||
NULL);
|
||||
priv->images = g_new (VkImage, priv->n_images);
|
||||
GDK_VK_CHECK (vkGetSwapchainImagesKHR, device,
|
||||
priv->swapchain,
|
||||
&priv->n_images,
|
||||
priv->images);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create swapchain for this window: %s", gdk_vulkan_strerror (res));
|
||||
priv->swapchain = VK_NULL_HANDLE;
|
||||
priv->swapchain_width = 0;
|
||||
priv->swapchain_height = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_emit (context, signals[IMAGES_UPDATED], 0);
|
||||
|
||||
return res == VK_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||
priv->swapchain,
|
||||
UINT64_MAX,
|
||||
priv->draw_semaphore,
|
||||
VK_NULL_HANDLE,
|
||||
&priv->draw_index);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
GDK_VK_CHECK (vkQueuePresentKHR, gdk_vulkan_context_get_queue (context),
|
||||
&(VkPresentInfoKHR) {
|
||||
.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR,
|
||||
.waitSemaphoreCount = 1,
|
||||
.pWaitSemaphores = (VkSemaphore[]) {
|
||||
priv->draw_semaphore
|
||||
},
|
||||
.swapchainCount = 1,
|
||||
.pSwapchains = (VkSwapchainKHR[]) {
|
||||
priv->swapchain
|
||||
},
|
||||
.pImageIndices = (uint32_t[]) {
|
||||
priv->draw_index
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_class_init (GdkVulkanContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gdk_vulkan_context_dispose;
|
||||
|
||||
draw_context_class->begin_frame = gdk_vulkan_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_vulkan_context_end_frame;
|
||||
|
||||
/**
|
||||
* GdkVulkanContext::images-updated:
|
||||
* @context: the object on which the signal is emitted
|
||||
*
|
||||
* This signal is emitted when the images managed by this context have
|
||||
* changed. Usually this means that the swapchain had to be recreated,
|
||||
* for example in response to a change of the window size.
|
||||
*/
|
||||
signals[IMAGES_UPDATED] =
|
||||
g_signal_new (g_intern_static_string ("images-updated"),
|
||||
G_OBJECT_CLASS_TYPE (gobject_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_init (GdkVulkanContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_vulkan_context_real_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (initable);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
VkResult res;
|
||||
VkBool32 supported;
|
||||
uint32_t i;
|
||||
|
||||
if (!gdk_display_ref_vulkan (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), error))
|
||||
return FALSE;
|
||||
|
||||
res = GDK_VULKAN_CONTEXT_GET_CLASS (context)->create_surface (context, &priv->surface);
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not create surface for this window: %s", gdk_vulkan_strerror (res));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
res = GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceSupportKHR, gdk_vulkan_context_get_physical_device (context),
|
||||
gdk_vulkan_context_get_queue_family_index (context),
|
||||
priv->surface,
|
||||
&supported);
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not check if queue family supports this window: %s", gdk_vulkan_strerror (res));
|
||||
}
|
||||
else if (!supported)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"FIXME: Queue family does not support surface. Write code to try different queue family.");
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t n_formats;
|
||||
GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceFormatsKHR, gdk_vulkan_context_get_physical_device (context),
|
||||
priv->surface,
|
||||
&n_formats, NULL);
|
||||
VkSurfaceFormatKHR formats[n_formats];
|
||||
GDK_VK_CHECK (vkGetPhysicalDeviceSurfaceFormatsKHR, gdk_vulkan_context_get_physical_device (context),
|
||||
priv->surface,
|
||||
&n_formats, formats);
|
||||
for (i = 0; i < n_formats; i++)
|
||||
{
|
||||
if (formats[i].format == VK_FORMAT_B8G8R8A8_SRGB)
|
||||
break;
|
||||
}
|
||||
if (i == n_formats)
|
||||
{
|
||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"No supported image format found.");
|
||||
goto out_surface;
|
||||
}
|
||||
priv->image_format = formats[i];
|
||||
|
||||
if (!gdk_vulkan_context_check_swapchain (context, error))
|
||||
goto out_surface;
|
||||
|
||||
GDK_VK_CHECK (vkCreateSemaphore, gdk_vulkan_context_get_device (context),
|
||||
&(VkSemaphoreCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
|
||||
},
|
||||
NULL,
|
||||
&priv->draw_semaphore);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
out_surface:
|
||||
vkDestroySurfaceKHR (gdk_vulkan_context_get_instance (context),
|
||||
priv->surface,
|
||||
NULL);
|
||||
priv->surface = VK_NULL_HANDLE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_initable_init (GInitableIface *iface)
|
||||
{
|
||||
iface->init = gdk_vulkan_context_real_init;
|
||||
}
|
||||
|
||||
VkInstance
|
||||
gdk_vulkan_context_get_instance (GdkVulkanContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), NULL);
|
||||
|
||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_instance;
|
||||
}
|
||||
|
||||
VkPhysicalDevice
|
||||
gdk_vulkan_context_get_physical_device (GdkVulkanContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), NULL);
|
||||
|
||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_physical_device;
|
||||
}
|
||||
|
||||
VkDevice
|
||||
gdk_vulkan_context_get_device (GdkVulkanContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), NULL);
|
||||
|
||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_device;
|
||||
}
|
||||
|
||||
VkQueue
|
||||
gdk_vulkan_context_get_queue (GdkVulkanContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), NULL);
|
||||
|
||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_queue;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
gdk_vulkan_context_get_queue_family_index (GdkVulkanContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), 0);
|
||||
|
||||
return gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context))->vk_queue_family_index;
|
||||
}
|
||||
|
||||
VkFormat
|
||||
gdk_vulkan_context_get_image_format (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_FORMAT_UNDEFINED);
|
||||
|
||||
return priv->image_format.format;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
gdk_vulkan_context_get_n_images (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), 0);
|
||||
|
||||
return priv->n_images;
|
||||
}
|
||||
|
||||
VkImage
|
||||
gdk_vulkan_context_get_image (GdkVulkanContext *context,
|
||||
guint id)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_NULL_HANDLE);
|
||||
g_return_val_if_fail (id < priv->n_images, VK_NULL_HANDLE);
|
||||
|
||||
return priv->images[id];
|
||||
}
|
||||
|
||||
uint32_t
|
||||
gdk_vulkan_context_get_draw_index (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), 0);
|
||||
g_return_val_if_fail (gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)), 0);
|
||||
|
||||
return priv->draw_index;
|
||||
}
|
||||
|
||||
VkSemaphore
|
||||
gdk_vulkan_context_get_draw_semaphore (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), VK_NULL_HANDLE);
|
||||
g_return_val_if_fail (gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)), VK_NULL_HANDLE);
|
||||
|
||||
return priv->draw_semaphore;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
uint32_t i, j;
|
||||
|
||||
uint32_t n_devices;
|
||||
GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, NULL);
|
||||
VkPhysicalDevice devices[n_devices];
|
||||
GDK_VK_CHECK(vkEnumeratePhysicalDevices, display->vk_instance, &n_devices, devices);
|
||||
|
||||
if (n_devices == 0)
|
||||
{
|
||||
/* Give a different error for 0 devices so people know their drivers suck. */
|
||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"No Vulkan devices available.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < n_devices; i++)
|
||||
{
|
||||
VkPhysicalDeviceProperties props;
|
||||
|
||||
vkGetPhysicalDeviceProperties (devices[i], &props);
|
||||
|
||||
GDK_NOTE (VULKAN, g_print ("Vulkan Device %u:\n", i));
|
||||
GDK_NOTE (VULKAN, g_print (" %s (%u)\n", props.deviceName, props.deviceType));
|
||||
GDK_NOTE (VULKAN, g_print (" vendor ID: 0x%Xu\n", props.vendorID));
|
||||
GDK_NOTE (VULKAN, g_print (" device ID: 0x%Xu\n", props.deviceID));
|
||||
GDK_NOTE (VULKAN, g_print (" API version %u.%u.%u\n",
|
||||
VK_VERSION_MAJOR (props.apiVersion),
|
||||
VK_VERSION_MINOR (props.apiVersion),
|
||||
VK_VERSION_PATCH (props.apiVersion)));
|
||||
GDK_NOTE (VULKAN, g_print (" driver version %u.%u.%u\n",
|
||||
VK_VERSION_MAJOR (props.driverVersion),
|
||||
VK_VERSION_MINOR (props.driverVersion),
|
||||
VK_VERSION_PATCH (props.driverVersion)));
|
||||
|
||||
uint32_t n_queue_props;
|
||||
vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, NULL);
|
||||
VkQueueFamilyProperties queue_props[n_queue_props];
|
||||
vkGetPhysicalDeviceQueueFamilyProperties (devices[i], &n_queue_props, queue_props);
|
||||
|
||||
for (j = 0; j < n_queue_props; j++)
|
||||
{
|
||||
GDK_NOTE (VULKAN, g_print (" queue %u/%u: %s\n", j, n_queue_props, queue_props[j].queueFlags & VK_QUEUE_GRAPHICS_BIT ? "graphics" : "no graphics"));
|
||||
if (queue_props[j].queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||
{
|
||||
GDK_NOTE (VULKAN, g_print (" => trying this queue\n"));
|
||||
if (GDK_VK_CHECK (vkCreateDevice, devices[i],
|
||||
&(VkDeviceCreateInfo) {
|
||||
VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
|
||||
NULL,
|
||||
0,
|
||||
1,
|
||||
&(VkDeviceQueueCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
|
||||
.queueFamilyIndex = j,
|
||||
.queueCount = 1,
|
||||
.pQueuePriorities = (float []) { 1.0f },
|
||||
},
|
||||
0,
|
||||
NULL,
|
||||
1,
|
||||
(const char * const []) {
|
||||
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
|
||||
},
|
||||
},
|
||||
NULL,
|
||||
&display->vk_device) != VK_SUCCESS)
|
||||
continue;
|
||||
|
||||
display->vk_physical_device = devices[i];
|
||||
vkGetDeviceQueue(display->vk_device, j, 0, &display->vk_queue);
|
||||
display->vk_queue_family_index = j;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
"Could not find a Vulkan device with the required features.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static VkBool32
|
||||
gdk_vulkan_debug_report (VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objectType,
|
||||
uint64_t object,
|
||||
size_t location,
|
||||
int32_t messageCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMessage,
|
||||
void* pUserData)
|
||||
{
|
||||
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT)
|
||||
{
|
||||
g_critical ("Vulkan: %s: %s\n", pLayerPrefix, pMessage);
|
||||
}
|
||||
else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT)
|
||||
{
|
||||
g_critical ("Vulkan: %s: %s\n", pLayerPrefix, pMessage);
|
||||
}
|
||||
else if (flags & VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT)
|
||||
{
|
||||
g_warning ("Vulkan: %s: %s\n", pLayerPrefix, pMessage);
|
||||
}
|
||||
else if (flags & VK_DEBUG_REPORT_DEBUG_BIT_EXT)
|
||||
{
|
||||
g_debug ("Vulkan: %s: %s\n", pLayerPrefix, pMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("Vulkan: %s: %s\n", pLayerPrefix, pMessage);
|
||||
}
|
||||
|
||||
return VK_TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
uint32_t i;
|
||||
GPtrArray *used_extensions;
|
||||
GPtrArray *used_layers;
|
||||
gboolean validate = FALSE, have_debug_report = FALSE;
|
||||
VkResult res;
|
||||
|
||||
if (GDK_DISPLAY_GET_CLASS (display)->vk_extension_name == NULL)
|
||||
{
|
||||
g_set_error (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
"The %s backend has no Vulkan support.", G_OBJECT_TYPE_NAME (display));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
uint32_t n_extensions;
|
||||
GDK_VK_CHECK (vkEnumerateInstanceExtensionProperties, NULL, &n_extensions, NULL);
|
||||
VkExtensionProperties extensions[n_extensions];
|
||||
GDK_VK_CHECK (vkEnumerateInstanceExtensionProperties, NULL, &n_extensions, extensions);
|
||||
|
||||
used_extensions = g_ptr_array_new ();
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_SURFACE_EXTENSION_NAME);
|
||||
g_ptr_array_add (used_extensions, (gpointer) GDK_DISPLAY_GET_CLASS (display)->vk_extension_name);
|
||||
|
||||
for (i = 0; i < n_extensions; i++)
|
||||
{
|
||||
GDK_NOTE (VULKAN, g_print ("Extension available: %s v%u.%u.%u\n",
|
||||
extensions[i].extensionName,
|
||||
VK_VERSION_MAJOR (extensions[i].specVersion),
|
||||
VK_VERSION_MINOR (extensions[i].specVersion),
|
||||
VK_VERSION_PATCH (extensions[i].specVersion)));
|
||||
|
||||
if (g_str_equal (extensions[i].extensionName, VK_EXT_DEBUG_REPORT_EXTENSION_NAME))
|
||||
{
|
||||
g_ptr_array_add (used_extensions, (gpointer) VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
have_debug_report = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t n_layers;
|
||||
GDK_VK_CHECK (vkEnumerateInstanceLayerProperties, &n_layers, NULL);
|
||||
VkLayerProperties layers[n_layers];
|
||||
GDK_VK_CHECK (vkEnumerateInstanceLayerProperties, &n_layers, layers);
|
||||
|
||||
used_layers = g_ptr_array_new ();
|
||||
|
||||
for (i = 0; i < n_layers; i++)
|
||||
{
|
||||
GDK_NOTE (VULKAN, g_print ("Layer available: %s v%u.%u.%u (%s)\n",
|
||||
layers[i].layerName,
|
||||
VK_VERSION_MAJOR (layers[i].specVersion),
|
||||
VK_VERSION_MINOR (layers[i].specVersion),
|
||||
VK_VERSION_PATCH (layers[i].specVersion),
|
||||
layers[i].description));
|
||||
if ((_gdk_vulkan_flags & GDK_VULKAN_VALIDATE) &&
|
||||
g_str_equal (layers[i].layerName, "VK_LAYER_LUNARG_standard_validation"))
|
||||
{
|
||||
g_ptr_array_add (used_layers, (gpointer) "VK_LAYER_LUNARG_standard_validation");
|
||||
validate = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((_gdk_vulkan_flags & GDK_VULKAN_VALIDATE) && !validate)
|
||||
{
|
||||
g_warning ("Vulkan validation layers were requested, but not found. Running without.");
|
||||
}
|
||||
|
||||
res = GDK_VK_CHECK (vkCreateInstance, &(VkInstanceCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
|
||||
.pNext = NULL,
|
||||
.flags = 0,
|
||||
.pApplicationInfo = &(VkApplicationInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
.pNext = NULL,
|
||||
.pApplicationName = g_get_application_name (),
|
||||
.applicationVersion = 0,
|
||||
.pEngineName = "GTK+",
|
||||
.engineVersion = VK_MAKE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION, GDK_MICRO_VERSION),
|
||||
.apiVersion = VK_API_VERSION_1_0
|
||||
},
|
||||
.enabledLayerCount = used_layers->len,
|
||||
.ppEnabledLayerNames = (const char * const *) used_layers->pdata,
|
||||
.enabledExtensionCount = used_extensions->len,
|
||||
.ppEnabledExtensionNames = (const char * const *) used_extensions->pdata
|
||||
},
|
||||
NULL,
|
||||
&display->vk_instance);
|
||||
g_ptr_array_free (used_layers, TRUE);
|
||||
g_ptr_array_free (used_extensions, TRUE);
|
||||
|
||||
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));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (have_debug_report)
|
||||
{
|
||||
PFN_vkCreateDebugReportCallbackEXT vkCreateDebugReportCallbackEXT;
|
||||
|
||||
vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) vkGetInstanceProcAddr (display->vk_instance, "vkCreateDebugReportCallbackEXT" );
|
||||
GDK_VK_CHECK (vkCreateDebugReportCallbackEXT, display->vk_instance,
|
||||
&(VkDebugReportCallbackCreateInfoEXT) {
|
||||
.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT,
|
||||
.pNext = NULL,
|
||||
.flags = VK_DEBUG_REPORT_INFORMATION_BIT_EXT
|
||||
| VK_DEBUG_REPORT_WARNING_BIT_EXT
|
||||
| VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT
|
||||
| VK_DEBUG_REPORT_ERROR_BIT_EXT
|
||||
| VK_DEBUG_REPORT_DEBUG_BIT_EXT,
|
||||
.pfnCallback = gdk_vulkan_debug_report,
|
||||
.pUserData = NULL
|
||||
},
|
||||
NULL,
|
||||
&display->vk_debug_callback);
|
||||
}
|
||||
|
||||
if (!gdk_display_create_vulkan_device (display, error))
|
||||
{
|
||||
if (display->vk_debug_callback != VK_NULL_HANDLE)
|
||||
{
|
||||
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
|
||||
|
||||
vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) vkGetInstanceProcAddr (display->vk_instance, "vkDestroyDebugReportCallbackEXT");
|
||||
vkDestroyDebugReportCallbackEXT (display->vk_instance,
|
||||
display->vk_debug_callback,
|
||||
NULL);
|
||||
display->vk_debug_callback = VK_NULL_HANDLE;
|
||||
}
|
||||
vkDestroyInstance (display->vk_instance, NULL);
|
||||
display->vk_instance = VK_NULL_HANDLE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_display_ref_vulkan (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
if (display->vulkan_refcount == 0)
|
||||
{
|
||||
if (!gdk_display_create_vulkan_instance (display, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
display->vulkan_refcount++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_display_unref_vulkan (GdkDisplay *display)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
g_return_if_fail (display->vulkan_refcount > 0);
|
||||
|
||||
display->vulkan_refcount--;
|
||||
if (display->vulkan_refcount > 0)
|
||||
return;
|
||||
|
||||
vkDestroyDevice (display->vk_device, NULL);
|
||||
display->vk_device = VK_NULL_HANDLE;
|
||||
if (display->vk_debug_callback != VK_NULL_HANDLE)
|
||||
{
|
||||
PFN_vkDestroyDebugReportCallbackEXT vkDestroyDebugReportCallbackEXT;
|
||||
|
||||
vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) vkGetInstanceProcAddr (display->vk_instance, "vkDestroyDebugReportCallbackEXT");
|
||||
vkDestroyDebugReportCallbackEXT (display->vk_instance,
|
||||
display->vk_debug_callback,
|
||||
NULL);
|
||||
display->vk_debug_callback = VK_NULL_HANDLE;
|
||||
}
|
||||
vkDestroyInstance (display->vk_instance, NULL);
|
||||
display->vk_instance = VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
#else /* GDK_RENDERING_VULKAN */
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_class_init (GdkVulkanContextClass *klass)
|
||||
{
|
||||
signals[IMAGES_UPDATED] =
|
||||
g_signal_new (g_intern_static_string ("images-updated"),
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_init (GdkVulkanContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_vulkan_context_initable_init (GInitableIface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
@@ -1,80 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkvulkancontext.h: specific Vulkan wrappers
|
||||
*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_VULKAN_CONTEXT__
|
||||
#define __GDK_VULKAN_CONTEXT__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_VULKAN_CONTEXT (gdk_vulkan_context_get_type ())
|
||||
#define GDK_VULKAN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_VULKAN_CONTEXT, GdkVulkanContext))
|
||||
#define GDK_IS_VULKAN_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_VULKAN_CONTEXT))
|
||||
|
||||
#define GDK_VULKAN_ERROR (gdk_vulkan_error_quark ())
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GQuark gdk_vulkan_error_quark (void);
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GType gdk_vulkan_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
const char * gdk_vulkan_strerror (VkResult result);
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkInstance gdk_vulkan_context_get_instance (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkPhysicalDevice gdk_vulkan_context_get_physical_device (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkDevice gdk_vulkan_context_get_device (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkQueue gdk_vulkan_context_get_queue (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
uint32_t gdk_vulkan_context_get_queue_family_index (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkFormat gdk_vulkan_context_get_image_format (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
uint32_t gdk_vulkan_context_get_n_images (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkImage gdk_vulkan_context_get_image (GdkVulkanContext *context,
|
||||
guint id);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
uint32_t gdk_vulkan_context_get_draw_index (GdkVulkanContext *context);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
VkSemaphore gdk_vulkan_context_get_draw_semaphore (GdkVulkanContext *context);
|
||||
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_VULKAN_CONTEXT__ */
|
||||
@@ -1,93 +0,0 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* gdkvulkancontext-x11.h: specific Vulkan wrappers
|
||||
*
|
||||
* Copyright © 2016 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_VULKAN_CONTEXT_PRIVATE__
|
||||
#define __GDK_VULKAN_CONTEXT_PRIVATE__
|
||||
|
||||
#include "gdkvulkancontext.h"
|
||||
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
#include <vulkan/vulkan.h>
|
||||
#endif
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_VULKAN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_VULKAN_CONTEXT, GdkVulkanContextClass))
|
||||
#define GDK_IS_VULKAN_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VULKAN_CONTEXT))
|
||||
#define GDK_VULKAN_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VULKAN_CONTEXT, GdkVulkanContextClass))
|
||||
|
||||
typedef struct _GdkVulkanContextClass GdkVulkanContextClass;
|
||||
|
||||
struct _GdkVulkanContext
|
||||
{
|
||||
GdkDrawContext parent_instance;
|
||||
};
|
||||
|
||||
struct _GdkVulkanContextClass
|
||||
{
|
||||
GdkDrawContextClass parent_class;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkResult (* create_surface) (GdkVulkanContext *context,
|
||||
VkSurfaceKHR *surface);
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
|
||||
static inline VkResult
|
||||
gdk_vulkan_handle_result (VkResult res,
|
||||
const char *called_function)
|
||||
{
|
||||
if (res != VK_SUCCESS)
|
||||
{
|
||||
GDK_NOTE (VULKAN,g_printerr ("%s(): %s (%d)\n", called_function, gdk_vulkan_strerror (res), res));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
#define GDK_VK_CHECK(func, ...) gdk_vulkan_handle_result (func (__VA_ARGS__), G_STRINGIFY (func))
|
||||
|
||||
gboolean gdk_display_ref_vulkan (GdkDisplay *display,
|
||||
GError **error);
|
||||
void gdk_display_unref_vulkan (GdkDisplay *display);
|
||||
|
||||
#else /* !GDK_RENDERING_VULKAN */
|
||||
|
||||
static inline gboolean
|
||||
gdk_display_ref_vulkan (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
GDK_NOTE (VULKAN, g_print ("Support for Vulkan disabled at compile-time"));
|
||||
|
||||
g_set_error_literal (error, GDK_VULKAN_ERROR, GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
"Vulkan support was not enabled at compie time.");
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif /* !GDK_RENDERING_VULKAN */
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK__VULKAN_CONTEXT_PRIVATE__ */
|
||||
1619
gdk/gdkwindow.c
1619
gdk/gdkwindow.c
File diff suppressed because it is too large
Load Diff
@@ -471,6 +471,11 @@ void gdk_window_move_resize (GdkWindow *window,
|
||||
gint width,
|
||||
gint height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_raise (GdkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_lower (GdkWindow *window);
|
||||
@@ -511,6 +516,8 @@ void gdk_window_move_region (GdkWindow *window,
|
||||
const cairo_region_t *region,
|
||||
gint dx,
|
||||
gint dy);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_window_ensure_native (GdkWindow *window);
|
||||
|
||||
/*
|
||||
* This allows for making shaped (partially transparent) windows
|
||||
@@ -619,9 +626,8 @@ GDK_AVAILABLE_IN_3_16
|
||||
void gdk_window_mark_paint_from_clip (GdkWindow *window,
|
||||
cairo_t *cr);
|
||||
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
GdkDrawingContext *gdk_window_begin_draw_frame (GdkWindow *window,
|
||||
GdkDrawContext *context,
|
||||
const cairo_region_t *region);
|
||||
GDK_AVAILABLE_IN_3_22
|
||||
void gdk_window_end_draw_frame (GdkWindow *window,
|
||||
@@ -894,6 +900,12 @@ void gdk_window_freeze_updates (GdkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_thaw_updates (GdkWindow *window);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_process_all_updates (void);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_process_updates (GdkWindow *window,
|
||||
gboolean update_children);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_window_constrain_size (GdkGeometry *geometry,
|
||||
GdkWindowHints flags,
|
||||
@@ -939,10 +951,6 @@ gboolean gdk_window_show_window_menu (GdkWindow *window,
|
||||
GDK_AVAILABLE_IN_3_16
|
||||
GdkGLContext * gdk_window_create_gl_context (GdkWindow *window,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_3_90
|
||||
GdkVulkanContext *
|
||||
gdk_window_create_vulkan_context(GdkWindow *window,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ struct _GdkWindowImplClass
|
||||
void (* withdraw) (GdkWindow *window);
|
||||
void (* raise) (GdkWindow *window);
|
||||
void (* lower) (GdkWindow *window);
|
||||
void (* restack_under) (GdkWindow *window,
|
||||
GList *native_siblings);
|
||||
void (* restack_toplevel) (GdkWindow *window,
|
||||
GdkWindow *sibling,
|
||||
gboolean above);
|
||||
@@ -84,6 +86,11 @@ struct _GdkWindowImplClass
|
||||
GdkEventMask (* get_events) (GdkWindow *window);
|
||||
void (* set_events) (GdkWindow *window,
|
||||
GdkEventMask event_mask);
|
||||
|
||||
gboolean (* reparent) (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y);
|
||||
|
||||
void (* set_device_cursor) (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -107,6 +114,8 @@ struct _GdkWindowImplClass
|
||||
gboolean (* begin_paint) (GdkWindow *window);
|
||||
void (* end_paint) (GdkWindow *window);
|
||||
|
||||
cairo_region_t * (* get_shape) (GdkWindow *window);
|
||||
cairo_region_t * (* get_input_shape) (GdkWindow *window);
|
||||
void (* shape_combine_region) (GdkWindow *window,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
@@ -141,6 +150,13 @@ struct _GdkWindowImplClass
|
||||
gboolean foreign_destroy);
|
||||
|
||||
|
||||
/* Called when gdk_window_destroy() is called on a foreign window
|
||||
* or an ancestor of the foreign window. It should generally reparent
|
||||
* the window out of it's current heirarchy, hide it, and then
|
||||
* send a message to the owner requesting that the window be destroyed.
|
||||
*/
|
||||
void (*destroy_foreign) (GdkWindow *window);
|
||||
|
||||
/* optional */
|
||||
gboolean (* beep) (GdkWindow *window);
|
||||
|
||||
@@ -283,6 +299,16 @@ struct _GdkWindowImplClass
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
gboolean (* realize_gl_context) (GdkWindow *window,
|
||||
GdkGLContext *context,
|
||||
GError **error);
|
||||
void (*invalidate_for_new_frame)(GdkWindow *window,
|
||||
cairo_region_t *update_area);
|
||||
|
||||
GdkDrawingContext *(* create_draw_context) (GdkWindow *window,
|
||||
const cairo_region_t *region);
|
||||
void (* destroy_draw_context) (GdkWindow *window,
|
||||
GdkDrawingContext *context);
|
||||
};
|
||||
|
||||
/* Interface Functions */
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include "gdkmir.h"
|
||||
@@ -37,9 +36,6 @@ typedef struct GdkMirDisplay
|
||||
/* Connection to Mir server */
|
||||
MirConnection *connection;
|
||||
|
||||
const MirDisplayConfig *config;
|
||||
GList *monitors;
|
||||
|
||||
/* Event source */
|
||||
GdkMirEventSource *event_source;
|
||||
|
||||
@@ -104,54 +100,6 @@ static void get_pixel_formats (MirConnection *, MirPixelFormat *sw, MirPixelForm
|
||||
|
||||
G_DEFINE_TYPE (GdkMirDisplay, gdk_mir_display, GDK_TYPE_DISPLAY)
|
||||
|
||||
static void
|
||||
config_changed_cb (MirConnection *connection,
|
||||
void *context)
|
||||
{
|
||||
GdkMirDisplay *display = context;
|
||||
GdkMonitor *monitor;
|
||||
const MirOutput *output;
|
||||
const MirOutputMode *mode;
|
||||
gint i;
|
||||
|
||||
g_list_free_full (display->monitors, g_object_unref);
|
||||
g_clear_pointer (&display->config, mir_display_config_release);
|
||||
|
||||
display->config = mir_connection_create_display_configuration (display->connection);
|
||||
display->monitors = NULL;
|
||||
|
||||
for (i = mir_display_config_get_num_outputs (display->config) - 1; i >= 0; i--)
|
||||
{
|
||||
output = mir_display_config_get_output (display->config, i);
|
||||
|
||||
if (!mir_output_is_enabled (output))
|
||||
continue;
|
||||
|
||||
mode = mir_output_get_current_mode (output);
|
||||
monitor = gdk_monitor_new (GDK_DISPLAY (display));
|
||||
|
||||
gdk_monitor_set_position (monitor,
|
||||
mir_output_get_position_x (output),
|
||||
mir_output_get_position_y (output));
|
||||
|
||||
gdk_monitor_set_size (monitor,
|
||||
mir_output_mode_get_width (mode),
|
||||
mir_output_mode_get_height (mode));
|
||||
|
||||
gdk_monitor_set_physical_size (monitor,
|
||||
mir_output_get_physical_width_mm (output),
|
||||
mir_output_get_physical_height_mm (output));
|
||||
|
||||
gdk_monitor_set_scale_factor (monitor,
|
||||
(gint) mir_output_get_scale_factor (output));
|
||||
|
||||
gdk_monitor_set_refresh_rate (monitor,
|
||||
(gint) mir_output_mode_get_refresh_rate (mode));
|
||||
|
||||
display->monitors = g_list_prepend (display->monitors, monitor);
|
||||
}
|
||||
}
|
||||
|
||||
GdkDisplay *
|
||||
_gdk_mir_display_open (const gchar *display_name)
|
||||
{
|
||||
@@ -185,9 +133,6 @@ _gdk_mir_display_open (const gchar *display_name)
|
||||
display = g_object_new (GDK_TYPE_MIR_DISPLAY, NULL);
|
||||
|
||||
display->connection = connection;
|
||||
config_changed_cb (display->connection, display);
|
||||
mir_connection_set_display_config_change_callback (display->connection, config_changed_cb, display);
|
||||
|
||||
GDK_DISPLAY (display)->device_manager = _gdk_mir_device_manager_new (GDK_DISPLAY (display));
|
||||
display->screen = _gdk_mir_screen_new (GDK_DISPLAY (display));
|
||||
display->sw_pixel_format = sw_pixel_format;
|
||||
@@ -232,9 +177,6 @@ gdk_mir_display_dispose (GObject *object)
|
||||
g_clear_object (&display->keymap);
|
||||
g_clear_pointer (&display->event_source, g_source_unref);
|
||||
|
||||
g_list_free_full (display->monitors, g_object_unref);
|
||||
display->monitors = NULL;
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_display_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -243,8 +185,6 @@ gdk_mir_display_finalize (GObject *object)
|
||||
{
|
||||
GdkMirDisplay *display = GDK_MIR_DISPLAY (object);
|
||||
|
||||
g_clear_pointer (&display->config, mir_display_config_release);
|
||||
|
||||
mir_connection_release (display->connection);
|
||||
|
||||
G_OBJECT_CLASS (gdk_mir_display_parent_class)->finalize (object);
|
||||
@@ -421,6 +361,18 @@ gdk_mir_display_get_app_launch_context (GdkDisplay *display)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_before_process_all_updates\n");
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
//g_printerr ("gdk_mir_display_after_process_all_updates\n");
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_mir_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@@ -691,7 +643,7 @@ gdk_mir_display_make_gl_context_current (GdkDisplay *display,
|
||||
mir_context = GDK_MIR_GL_CONTEXT (context);
|
||||
window = gdk_gl_context_get_window (context);
|
||||
|
||||
if (mir_context->is_attached || gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)))
|
||||
if (mir_context->is_attached)
|
||||
{
|
||||
egl_surface = _gdk_mir_window_get_egl_surface (window,
|
||||
mir_context->egl_config);
|
||||
@@ -743,20 +695,6 @@ gboolean _gdk_mir_display_have_egl_surfaceless_context (GdkDisplay *display)
|
||||
return GDK_MIR_DISPLAY (display)->have_egl_surfaceless_context;
|
||||
}
|
||||
|
||||
static int
|
||||
gdk_mir_display_get_n_monitors (GdkDisplay *display)
|
||||
{
|
||||
return g_list_length (GDK_MIR_DISPLAY (display)->monitors);
|
||||
}
|
||||
|
||||
static GdkMonitor *
|
||||
gdk_mir_display_get_monitor (GdkDisplay *display,
|
||||
int index)
|
||||
{
|
||||
g_return_val_if_fail (0 <= index && index < gdk_display_get_n_monitors (display), NULL);
|
||||
|
||||
return g_list_nth_data (GDK_MIR_DISPLAY (display)->monitors, index);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_display_init (GdkMirDisplay *display)
|
||||
@@ -799,6 +737,8 @@ gdk_mir_display_class_init (GdkMirDisplayClass *klass)
|
||||
display_class->get_cursor_for_name = gdk_mir_display_get_cursor_for_name;
|
||||
display_class->get_cursor_for_surface = gdk_mir_display_get_cursor_for_surface;
|
||||
display_class->get_app_launch_context = gdk_mir_display_get_app_launch_context;
|
||||
display_class->before_process_all_updates = gdk_mir_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = gdk_mir_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_mir_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_mir_display_notify_startup_complete;
|
||||
display_class->create_window_impl = gdk_mir_display_create_window_impl;
|
||||
@@ -813,6 +753,4 @@ gdk_mir_display_class_init (GdkMirDisplayClass *klass)
|
||||
display_class->text_property_to_utf8_list = gdk_mir_display_text_property_to_utf8_list;
|
||||
display_class->utf8_to_string_target = gdk_mir_display_utf8_to_string_target;
|
||||
display_class->make_gl_context_current = gdk_mir_display_make_gl_context_current;
|
||||
display_class->get_n_monitors = gdk_mir_display_get_n_monitors;
|
||||
display_class->get_monitor = gdk_mir_display_get_monitor;
|
||||
}
|
||||
|
||||
@@ -97,66 +97,18 @@ gdk_mir_gl_context_realize (GdkGLContext *context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_mir_gl_context_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
EGLSurface egl_surface;
|
||||
GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
|
||||
int buffer_age = 0;
|
||||
|
||||
if (_gdk_mir_display_have_egl_buffer_age (display))
|
||||
{
|
||||
GdkGLContext *shared;
|
||||
GdkMirGLContext *shared_mir;
|
||||
|
||||
shared = gdk_gl_context_get_shared_context (context);
|
||||
if (shared == NULL)
|
||||
shared = context;
|
||||
shared_mir = GDK_MIR_GL_CONTEXT (shared);
|
||||
|
||||
egl_surface = _gdk_mir_window_get_egl_surface (window, shared_mir->egl_config);
|
||||
gdk_gl_context_make_current (shared);
|
||||
eglQuerySurface (_gdk_mir_display_get_egl_display (display), egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
if (buffer_age >= 2)
|
||||
{
|
||||
if (window->old_updated_area[0])
|
||||
return cairo_region_copy (window->old_updated_area[0]);
|
||||
}
|
||||
else if (buffer_age >= 3)
|
||||
{
|
||||
if (window->old_updated_area[0] &&
|
||||
window->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (window->old_updated_area[0]);
|
||||
cairo_region_union (damage, window->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_mir_gl_context_parent_class)->get_damage (context);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_gl_context_end_frame (GdkDrawContext *context,
|
||||
gdk_mir_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkGLContext *gl_context = GDK_GL_CONTEXT (context);
|
||||
GdkMirGLContext *context_mir = GDK_MIR_GL_CONTEXT (gl_context);
|
||||
GdkWindow *window = gdk_gl_context_get_window (gl_context);
|
||||
GdkWindow *window = gdk_gl_context_get_window (context);
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkMirGLContext *context_mir = GDK_MIR_GL_CONTEXT (context);
|
||||
EGLDisplay egl_display = _gdk_mir_display_get_egl_display (display);
|
||||
EGLSurface egl_surface;
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_mir_gl_context_parent_class)->end_frame (context, painted, damage);
|
||||
if (gdk_gl_context_get_shared_context (gl_context))
|
||||
return;
|
||||
|
||||
gdk_gl_context_make_current (gl_context);
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
egl_surface = _gdk_mir_window_get_egl_surface (window,
|
||||
context_mir->egl_config);
|
||||
@@ -212,13 +164,11 @@ gdk_mir_gl_context_dispose (GObject *gobject)
|
||||
static void
|
||||
gdk_mir_gl_context_class_init (GdkMirGLContextClass *klass)
|
||||
{
|
||||
GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GdkGLContextClass *gl_context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
|
||||
gl_context_class->realize = gdk_mir_gl_context_realize;
|
||||
gl_context_class->get_damage = gdk_mir_gl_context_get_damage;
|
||||
draw_context_class->end_frame = gdk_mir_gl_context_end_frame;
|
||||
context_class->realize = gdk_mir_gl_context_realize;
|
||||
context_class->end_frame = gdk_mir_gl_context_end_frame;
|
||||
gobject_class->dispose = gdk_mir_gl_context_dispose;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "gdkmir-private.h"
|
||||
|
||||
#define VISUAL_TYPE GDK_VISUAL_TRUE_COLOR
|
||||
#define VISUAL_DEPTH 32
|
||||
|
||||
typedef struct GdkMirScreen GdkMirScreen;
|
||||
typedef struct GdkMirScreenClass GdkMirScreenClass;
|
||||
@@ -90,6 +91,29 @@ get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
for (i = 0; i < config->num_outputs; i++)
|
||||
{
|
||||
MirDisplayOutput *o = &config->outputs[i];
|
||||
|
||||
if (!o->used)
|
||||
continue;
|
||||
|
||||
*width += o->physical_width_mm;
|
||||
*height += o->physical_height_mm;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_display_config (GdkMirScreen *screen)
|
||||
{
|
||||
@@ -172,6 +196,42 @@ get_output (GdkScreen *screen, gint monitor_num)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_width (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_width\n");
|
||||
gint width, height;
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_height (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_height\n");
|
||||
gint width, height;
|
||||
get_screen_size (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return height;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_width_mm (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_width_mm\n");
|
||||
gint width, height;
|
||||
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return width;
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_mir_screen_get_height_mm (GdkScreen *screen)
|
||||
{
|
||||
//g_printerr ("gdk_mir_screen_get_height_mm\n");
|
||||
gint width, height;
|
||||
get_screen_size_mm (GDK_MIR_SCREEN (screen)->display_config, &width, &height);
|
||||
return height;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_mir_screen_get_root_window (GdkScreen *screen)
|
||||
{
|
||||
@@ -187,6 +247,7 @@ gdk_mir_screen_get_root_window (GdkScreen *screen)
|
||||
s->root_window = _gdk_display_create_window (s->display);
|
||||
s->root_window->impl_window = s->root_window;
|
||||
s->root_window->window_type = GDK_WINDOW_ROOT;
|
||||
s->root_window->depth = VISUAL_DEPTH;
|
||||
s->root_window->x = 0;
|
||||
s->root_window->y = 0;
|
||||
s->root_window->abs_x = 0;
|
||||
@@ -606,6 +667,10 @@ gdk_mir_screen_class_init (GdkMirScreenClass *klass)
|
||||
object_class->finalize = gdk_mir_screen_finalize;
|
||||
|
||||
screen_class->get_display = gdk_mir_screen_get_display;
|
||||
screen_class->get_width = gdk_mir_screen_get_width;
|
||||
screen_class->get_height = gdk_mir_screen_get_height;
|
||||
screen_class->get_width_mm = gdk_mir_screen_get_width_mm;
|
||||
screen_class->get_height_mm = gdk_mir_screen_get_height_mm;
|
||||
screen_class->get_root_window = gdk_mir_screen_get_root_window;
|
||||
screen_class->get_n_monitors = gdk_mir_screen_get_n_monitors;
|
||||
screen_class->get_primary_monitor = gdk_mir_screen_get_primary_monitor;
|
||||
|
||||
@@ -576,6 +576,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
|
||||
MirGraphicsRegion region;
|
||||
cairo_format_t pixel_format = CAIRO_FORMAT_ARGB32;
|
||||
cairo_surface_t *cairo_surface;
|
||||
cairo_t *c;
|
||||
|
||||
if (impl->cairo_surface)
|
||||
{
|
||||
@@ -731,6 +732,14 @@ gdk_mir_window_impl_lower (GdkWindow *window)
|
||||
/* We don't support client window stacking */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_restack_under (GdkWindow *window,
|
||||
GList *native_siblings)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_restack_under window=%p\n", window);
|
||||
/* We don't support client window stacking */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_restack_toplevel (GdkWindow *window,
|
||||
GdkWindow *sibling,
|
||||
@@ -870,6 +879,16 @@ gdk_mir_window_impl_set_events (GdkWindow *window,
|
||||
/* We send all events and let GDK decide */
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_mir_window_impl_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_reparent window=%p new-parent=%p\n", window, new_parent);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -958,10 +977,25 @@ gdk_mir_window_impl_end_paint (GdkWindow *window)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
|
||||
if (impl->visible)
|
||||
//g_printerr ("gdk_mir_window_impl_end_paint window=%p\n", window);
|
||||
if (impl->visible && !window->current_paint.use_gl)
|
||||
send_buffer (window);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_mir_window_impl_get_shape (GdkWindow *window)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_get_shape window=%p\n", window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_mir_window_impl_get_input_shape (GdkWindow *window)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_get_input_shape window=%p\n", window);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_shape_combine_region (GdkWindow *window,
|
||||
const cairo_region_t *shape_region,
|
||||
@@ -992,6 +1026,12 @@ gdk_mir_window_impl_destroy (GdkWindow *window,
|
||||
ensure_no_surface (window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
//g_printerr ("gdk_mir_window_impl_destroy_foreign window=%p\n", window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_focus (GdkWindow *window,
|
||||
guint32 timestamp)
|
||||
@@ -1545,6 +1585,7 @@ gdk_mir_window_impl_create_gl_context (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
context = g_object_new (GDK_TYPE_MIR_GL_CONTEXT,
|
||||
"display", display,
|
||||
"window", window,
|
||||
"shared-context", share,
|
||||
NULL);
|
||||
@@ -1555,6 +1596,67 @@ gdk_mir_window_impl_create_gl_context (GdkWindow *window,
|
||||
return GDK_GL_CONTEXT (context);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
cairo_rectangle_int_t window_rect;
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkMirGLContext *context_mir;
|
||||
int buffer_age;
|
||||
gboolean invalidate_all;
|
||||
EGLSurface egl_surface;
|
||||
|
||||
/* Minimal update is ok if we're not drawing with gl */
|
||||
if (window->gl_paint_context == NULL)
|
||||
return;
|
||||
|
||||
context_mir = GDK_MIR_GL_CONTEXT (window->gl_paint_context);
|
||||
buffer_age = 0;
|
||||
|
||||
egl_surface = _gdk_mir_window_get_egl_surface (window, context_mir->egl_config);
|
||||
|
||||
if (_gdk_mir_display_have_egl_buffer_age (display))
|
||||
{
|
||||
gdk_gl_context_make_current (window->gl_paint_context);
|
||||
eglQuerySurface (_gdk_mir_display_get_egl_display (display), egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||
}
|
||||
|
||||
invalidate_all = FALSE;
|
||||
if (buffer_age == 0 || buffer_age >= 4)
|
||||
invalidate_all = TRUE;
|
||||
else
|
||||
{
|
||||
if (buffer_age >= 2)
|
||||
{
|
||||
if (window->old_updated_area[0])
|
||||
cairo_region_union (update_area, window->old_updated_area[0]);
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
if (buffer_age >= 3)
|
||||
{
|
||||
if (window->old_updated_area[1])
|
||||
cairo_region_union (update_area, window->old_updated_area[1]);
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidate_all)
|
||||
{
|
||||
window_rect.x = 0;
|
||||
window_rect.y = 0;
|
||||
window_rect.width = gdk_window_get_width (window);
|
||||
window_rect.height = gdk_window_get_height (window);
|
||||
|
||||
/* If nothing else is known, repaint everything so that the back
|
||||
buffer is fully up-to-date for the swapbuffer */
|
||||
cairo_region_union_rectangle (update_area, &window_rect);
|
||||
}
|
||||
}
|
||||
|
||||
EGLSurface
|
||||
_gdk_mir_window_get_egl_surface (GdkWindow *window,
|
||||
EGLConfig config)
|
||||
@@ -1657,20 +1759,26 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass)
|
||||
impl_class->withdraw = gdk_mir_window_impl_withdraw;
|
||||
impl_class->raise = gdk_mir_window_impl_raise;
|
||||
impl_class->lower = gdk_mir_window_impl_lower;
|
||||
impl_class->restack_under = gdk_mir_window_impl_restack_under;
|
||||
impl_class->restack_toplevel = gdk_mir_window_impl_restack_toplevel;
|
||||
impl_class->move_resize = gdk_mir_window_impl_move_resize;
|
||||
impl_class->move_to_rect = gdk_mir_window_impl_move_to_rect;
|
||||
impl_class->set_background = gdk_mir_window_impl_set_background;
|
||||
impl_class->get_events = gdk_mir_window_impl_get_events;
|
||||
impl_class->set_events = gdk_mir_window_impl_set_events;
|
||||
impl_class->reparent = gdk_mir_window_impl_reparent;
|
||||
impl_class->set_device_cursor = gdk_mir_window_impl_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_mir_window_impl_get_geometry;
|
||||
impl_class->get_root_coords = gdk_mir_window_impl_get_root_coords;
|
||||
impl_class->get_device_state = gdk_mir_window_impl_get_device_state;
|
||||
impl_class->begin_paint = gdk_mir_window_impl_begin_paint;
|
||||
impl_class->end_paint = gdk_mir_window_impl_end_paint;
|
||||
impl_class->get_shape = gdk_mir_window_impl_get_shape;
|
||||
impl_class->get_input_shape = gdk_mir_window_impl_get_input_shape;
|
||||
impl_class->shape_combine_region = gdk_mir_window_impl_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_mir_window_impl_input_shape_combine_region;
|
||||
impl_class->destroy = gdk_mir_window_impl_destroy;
|
||||
impl_class->destroy_foreign = gdk_mir_window_impl_destroy_foreign;
|
||||
impl_class->focus = gdk_mir_window_impl_focus;
|
||||
impl_class->set_type_hint = gdk_mir_window_impl_set_type_hint;
|
||||
impl_class->get_type_hint = gdk_mir_window_impl_get_type_hint;
|
||||
@@ -1724,4 +1832,5 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass)
|
||||
impl_class->set_opaque_region = gdk_mir_window_impl_set_opaque_region;
|
||||
impl_class->set_shadow_width = gdk_mir_window_impl_set_shadow_width;
|
||||
impl_class->create_gl_context = gdk_mir_window_impl_create_gl_context;
|
||||
impl_class->invalidate_for_new_frame = gdk_mir_window_impl_invalidate_for_new_frame;
|
||||
}
|
||||
|
||||
@@ -244,6 +244,8 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
|
||||
display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = _gdk_quartz_display_supports_cursor_color;
|
||||
|
||||
display_class->before_process_all_updates = _gdk_quartz_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = _gdk_quartz_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_quartz_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_quartz_display_notify_startup_complete;
|
||||
display_class->event_data_copy = _gdk_quartz_display_event_data_copy;
|
||||
|
||||
@@ -399,6 +399,44 @@ _gdk_quartz_window_process_updates_recurse (GdkWindow *window,
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_quartz_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
in_process_all_updates = TRUE;
|
||||
|
||||
NSDisableScreenUpdates ();
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
GSList *old_update_nswindows = update_nswindows;
|
||||
GSList *tmp_list = update_nswindows;
|
||||
|
||||
update_nswindows = NULL;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
NSWindow *nswindow = tmp_list->data;
|
||||
|
||||
[[nswindow contentView] displayIfNeeded];
|
||||
|
||||
_gdk_quartz_window_flush (NULL);
|
||||
|
||||
[nswindow enableFlushWindow];
|
||||
[nswindow flushWindow];
|
||||
[nswindow release];
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_slist_free (old_update_nswindows);
|
||||
|
||||
in_process_all_updates = FALSE;
|
||||
|
||||
NSEnableScreenUpdates ();
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
get_default_title (void)
|
||||
{
|
||||
@@ -946,6 +984,12 @@ gdk_quartz_window_destroy (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_window_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
/* Foreign windows aren't supported in OSX. */
|
||||
}
|
||||
|
||||
/* FIXME: This might be possible to simplify with client-side windows. Also
|
||||
* note that already_mapped is not used yet, see the x11 backend.
|
||||
*/
|
||||
@@ -1284,6 +1328,54 @@ gdk_window_quartz_move_resize (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: This might need fixing (reparenting didn't work before client-side
|
||||
* windows either).
|
||||
*/
|
||||
static gboolean
|
||||
gdk_window_quartz_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkWindow *old_parent;
|
||||
GdkWindowImplQuartz *impl, *old_parent_impl, *new_parent_impl;
|
||||
NSView *view, *new_parent_view;
|
||||
|
||||
if (new_parent == _gdk_root)
|
||||
{
|
||||
/* Could be added, just needs implementing. */
|
||||
g_warning ("Reparenting to root window is not supported yet in the Mac OS X backend");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
|
||||
view = impl->view;
|
||||
|
||||
new_parent_impl = GDK_WINDOW_IMPL_QUARTZ (new_parent->impl);
|
||||
new_parent_view = new_parent_impl->view;
|
||||
|
||||
old_parent = window->parent;
|
||||
old_parent_impl = GDK_WINDOW_IMPL_QUARTZ (old_parent->impl);
|
||||
|
||||
[view retain];
|
||||
|
||||
[view removeFromSuperview];
|
||||
[new_parent_view addSubview:view];
|
||||
|
||||
[view release];
|
||||
|
||||
window->parent = new_parent;
|
||||
|
||||
if (old_parent)
|
||||
{
|
||||
old_parent_impl->sorted_children = g_list_remove (old_parent_impl->sorted_children, window);
|
||||
}
|
||||
|
||||
new_parent_impl->sorted_children = g_list_prepend (new_parent_impl->sorted_children, window);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Get the toplevel ordering from NSApp and update our own list. We do
|
||||
* this on demand since the NSApp’s list is not up to date directly
|
||||
* after we get windowDidBecomeMain.
|
||||
@@ -2698,6 +2790,20 @@ gdk_quartz_window_set_shadow_width (GdkWindow *window,
|
||||
_gdk_quartz_window_update_has_shadow (impl);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_quartz_window_get_shape (GdkWindow *window)
|
||||
{
|
||||
/* FIXME: implement */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_quartz_window_get_input_shape (GdkWindow *window)
|
||||
{
|
||||
/* FIXME: implement */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Protocol to build cleanly for OSX < 10.7 */
|
||||
@protocol ScaleFactor
|
||||
- (CGFloat) backingScaleFactor;
|
||||
@@ -2740,6 +2846,7 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->lower = gdk_window_quartz_lower;
|
||||
impl_class->restack_toplevel = gdk_window_quartz_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_quartz_move_resize;
|
||||
impl_class->reparent = gdk_window_quartz_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_quartz_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_quartz_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_quartz_get_root_coords;
|
||||
@@ -2747,6 +2854,9 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->shape_combine_region = gdk_window_quartz_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
|
||||
impl_class->destroy = gdk_quartz_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
|
||||
impl_class->get_shape = gdk_quartz_window_get_shape;
|
||||
impl_class->get_input_shape = gdk_quartz_window_get_input_shape;
|
||||
impl_class->begin_paint = gdk_window_impl_quartz_begin_paint;
|
||||
impl_class->get_scale_factor = gdk_quartz_window_get_scale_factor;
|
||||
|
||||
|
||||
@@ -772,6 +772,17 @@ gdk_wayland_display_supports_input_shapes (GdkDisplay *display)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
/* Post the damage here instead? */
|
||||
}
|
||||
|
||||
static gulong
|
||||
gdk_wayland_display_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
@@ -941,6 +952,8 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
|
||||
display_class->get_cursor_for_surface = _gdk_wayland_display_get_cursor_for_surface;
|
||||
display_class->supports_cursor_alpha = _gdk_wayland_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = _gdk_wayland_display_supports_cursor_color;
|
||||
display_class->before_process_all_updates = gdk_wayland_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = gdk_wayland_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_wayland_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_wayland_display_notify_startup_complete;
|
||||
display_class->create_window_impl = _gdk_wayland_display_create_window_impl;
|
||||
|
||||
@@ -89,10 +89,7 @@ gdk_event_source_check (GSource *base)
|
||||
if (source->pfd.revents & G_IO_IN)
|
||||
{
|
||||
if (wl_display_read_events (display_wayland->wl_display) < 0)
|
||||
{
|
||||
g_message ("Error reading events from display: %s", g_strerror (errno));
|
||||
_exit (1);
|
||||
}
|
||||
g_error ("Error reading events from display: %s", g_strerror (errno));
|
||||
}
|
||||
else
|
||||
wl_display_cancel_read (display_wayland->wl_display);
|
||||
|
||||
@@ -35,7 +35,71 @@
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandGLContext, gdk_wayland_gl_context, GDK_TYPE_GL_CONTEXT)
|
||||
|
||||
static void gdk_wayland_gl_context_dispose (GObject *gobject);
|
||||
static void gdk_x11_gl_context_dispose (GObject *gobject);
|
||||
|
||||
void
|
||||
gdk_wayland_window_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
cairo_rectangle_int_t window_rect;
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
GdkWaylandGLContext *context_wayland;
|
||||
int buffer_age;
|
||||
gboolean invalidate_all;
|
||||
EGLSurface egl_surface;
|
||||
|
||||
/* Minimal update is ok if we're not drawing with gl */
|
||||
if (window->gl_paint_context == NULL)
|
||||
return;
|
||||
|
||||
context_wayland = GDK_WAYLAND_GL_CONTEXT (window->gl_paint_context);
|
||||
buffer_age = 0;
|
||||
|
||||
egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window,
|
||||
context_wayland->egl_config);
|
||||
|
||||
if (display_wayland->have_egl_buffer_age)
|
||||
{
|
||||
gdk_gl_context_make_current (window->gl_paint_context);
|
||||
eglQuerySurface (display_wayland->egl_display, egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||
}
|
||||
|
||||
invalidate_all = FALSE;
|
||||
if (buffer_age == 0 || buffer_age >= 4)
|
||||
invalidate_all = TRUE;
|
||||
else
|
||||
{
|
||||
if (buffer_age >= 2)
|
||||
{
|
||||
if (window->old_updated_area[0])
|
||||
cairo_region_union (update_area, window->old_updated_area[0]);
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
if (buffer_age >= 3)
|
||||
{
|
||||
if (window->old_updated_area[1])
|
||||
cairo_region_union (update_area, window->old_updated_area[1]);
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidate_all)
|
||||
{
|
||||
window_rect.x = 0;
|
||||
window_rect.y = 0;
|
||||
window_rect.width = gdk_window_get_width (window);
|
||||
window_rect.height = gdk_window_get_height (window);
|
||||
|
||||
/* If nothing else is known, repaint everything so that the back
|
||||
* buffer is fully up-to-date for the swapbuffer
|
||||
*/
|
||||
cairo_region_union_rectangle (update_area, &window_rect);
|
||||
}
|
||||
}
|
||||
|
||||
#define N_EGL_ATTRS 16
|
||||
|
||||
@@ -155,67 +219,17 @@ gdk_wayland_gl_context_realize (GdkGLContext *context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_wayland_gl_context_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
EGLSurface egl_surface;
|
||||
GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
|
||||
int buffer_age = 0;
|
||||
|
||||
if (display_wayland->have_egl_buffer_age)
|
||||
{
|
||||
GdkGLContext *shared;
|
||||
GdkWaylandGLContext *shared_wayland;
|
||||
|
||||
shared = gdk_gl_context_get_shared_context (context);
|
||||
if (shared == NULL)
|
||||
shared = context;
|
||||
shared_wayland = GDK_WAYLAND_GL_CONTEXT (shared);
|
||||
|
||||
egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window,
|
||||
shared_wayland->egl_config);
|
||||
gdk_gl_context_make_current (shared);
|
||||
eglQuerySurface (display_wayland->egl_display, egl_surface,
|
||||
EGL_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
if (buffer_age >= 2)
|
||||
{
|
||||
if (window->old_updated_area[0])
|
||||
return cairo_region_copy (window->old_updated_area[0]);
|
||||
}
|
||||
else if (buffer_age >= 3)
|
||||
{
|
||||
if (window->old_updated_area[0] &&
|
||||
window->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (window->old_updated_area[0]);
|
||||
cairo_region_union (damage, window->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->get_damage (context);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_wayland_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkWindow *window = gdk_gl_context_get_window (context);
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
|
||||
GdkWaylandGLContext *context_wayland = GDK_WAYLAND_GL_CONTEXT (context);
|
||||
EGLSurface egl_surface;
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->end_frame (draw_context, painted, damage);
|
||||
if (gdk_gl_context_get_shared_context (context))
|
||||
return;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window,
|
||||
@@ -241,23 +255,18 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
}
|
||||
else
|
||||
eglSwapBuffers (display_wayland->egl_display, egl_surface);
|
||||
|
||||
gdk_wayland_window_sync (window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_gl_context_class_init (GdkWaylandGLContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gdk_wayland_gl_context_dispose;
|
||||
|
||||
draw_context_class->end_frame = gdk_wayland_gl_context_end_frame;
|
||||
gobject_class->dispose = gdk_x11_gl_context_dispose;
|
||||
|
||||
context_class->realize = gdk_wayland_gl_context_realize;
|
||||
context_class->get_damage = gdk_wayland_gl_context_get_damage;
|
||||
context_class->end_frame = gdk_wayland_gl_context_end_frame;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -446,6 +455,7 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
context = g_object_new (GDK_TYPE_WAYLAND_GL_CONTEXT,
|
||||
"display", display,
|
||||
"window", window,
|
||||
"shared-context", share,
|
||||
NULL);
|
||||
@@ -457,7 +467,7 @@ gdk_wayland_window_create_gl_context (GdkWindow *window,
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_gl_context_dispose (GObject *gobject)
|
||||
gdk_x11_gl_context_dispose (GObject *gobject)
|
||||
{
|
||||
GdkWaylandGLContext *context_wayland = GDK_WAYLAND_GL_CONTEXT (gobject);
|
||||
|
||||
@@ -501,7 +511,7 @@ gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
|
||||
context_wayland = GDK_WAYLAND_GL_CONTEXT (context);
|
||||
window = gdk_gl_context_get_window (context);
|
||||
|
||||
if (context_wayland->is_attached || gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)))
|
||||
if (context_wayland->is_attached)
|
||||
egl_surface = gdk_wayland_window_get_egl_surface (window->impl_window, context_wayland->egl_config);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -51,6 +51,8 @@ GdkGLContext * gdk_wayland_window_create_gl_context (GdkWindow
|
||||
gboolean attach,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
void gdk_wayland_window_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area);
|
||||
gboolean gdk_wayland_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
|
||||
|
||||
@@ -97,7 +97,6 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkCursor *cursor,
|
||||
void _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
|
||||
guint scale);
|
||||
|
||||
void gdk_wayland_window_sync (GdkWindow *window);
|
||||
GdkDragProtocol _gdk_wayland_window_get_drag_protocol (GdkWindow *window,
|
||||
GdkWindow **target);
|
||||
|
||||
|
||||
@@ -888,6 +888,7 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
|
||||
|
||||
if (impl->staging_cairo_surface &&
|
||||
_gdk_wayland_is_shm_surface (impl->staging_cairo_surface) &&
|
||||
!window->current_paint.use_gl &&
|
||||
!cairo_region_is_empty (window->current_paint.region))
|
||||
{
|
||||
gdk_wayland_window_attach_image (window);
|
||||
@@ -920,12 +921,6 @@ gdk_window_impl_wayland_end_paint (GdkWindow *window)
|
||||
impl->pending_commit = TRUE;
|
||||
}
|
||||
|
||||
gdk_wayland_window_sync (window);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_wayland_window_sync (GdkWindow *window)
|
||||
{
|
||||
gdk_wayland_window_sync_margin (window);
|
||||
gdk_wayland_window_sync_opaque_region (window);
|
||||
gdk_wayland_window_sync_input_region (window);
|
||||
@@ -1193,31 +1188,6 @@ gdk_wayland_window_sync_input_region (GdkWindow *window)
|
||||
impl->input_region_dirty = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_set_input_region_if_empty (GdkWindow *window)
|
||||
{
|
||||
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
|
||||
GdkWaylandDisplay *display;
|
||||
struct wl_region *empty;
|
||||
|
||||
if (!impl->input_region_dirty)
|
||||
return;
|
||||
|
||||
if (impl->input_region == NULL)
|
||||
return;
|
||||
|
||||
if (!cairo_region_is_empty (impl->input_region))
|
||||
return;
|
||||
|
||||
display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
|
||||
empty = wl_compositor_create_region (display->compositor);
|
||||
|
||||
wl_surface_set_input_region (impl->display_server.wl_surface, empty);
|
||||
wl_region_destroy (empty);
|
||||
|
||||
impl->input_region_dirty = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
surface_enter (void *data,
|
||||
struct wl_surface *wl_surface,
|
||||
@@ -1247,8 +1217,7 @@ surface_leave (void *data,
|
||||
|
||||
impl->display_server.outputs = g_slist_remove (impl->display_server.outputs, output);
|
||||
|
||||
if (impl->display_server.outputs)
|
||||
window_update_scale (window);
|
||||
window_update_scale (window);
|
||||
}
|
||||
|
||||
static const struct wl_surface_listener surface_listener = {
|
||||
@@ -1267,9 +1236,6 @@ on_parent_surface_committed (GdkWindowImplWayland *parent_impl,
|
||||
impl->parent_surface_committed_handler = 0;
|
||||
|
||||
wl_subsurface_set_desync (impl->display_server.wl_subsurface);
|
||||
|
||||
/* Special case if the input region is empty, it won't change on resize */
|
||||
gdk_wayland_set_input_region_if_empty (window);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1295,9 +1261,7 @@ gdk_wayland_window_create_subsurface (GdkWindow *window)
|
||||
impl->display_server.wl_subsurface =
|
||||
wl_subcompositor_get_subsurface (display_wayland->subcompositor,
|
||||
impl->display_server.wl_surface, parent_impl->display_server.wl_surface);
|
||||
wl_subsurface_set_position (impl->display_server.wl_subsurface,
|
||||
window->x + window->abs_x,
|
||||
window->y + window->abs_y);
|
||||
wl_subsurface_set_position (impl->display_server.wl_subsurface, window->x, window->y);
|
||||
|
||||
/* In order to synchronize the initial position with the initial frame
|
||||
* content, wait with making the subsurface desynchronized until after
|
||||
@@ -2566,6 +2530,12 @@ gdk_window_wayland_lower (GdkWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_restack_under (GdkWindow *window,
|
||||
GList *native_siblings)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_restack_toplevel (GdkWindow *window,
|
||||
GdkWindow *sibling,
|
||||
@@ -2620,9 +2590,7 @@ gdk_window_wayland_move_resize (GdkWindow *window,
|
||||
|
||||
if (impl->display_server.wl_subsurface)
|
||||
{
|
||||
wl_subsurface_set_position (impl->display_server.wl_subsurface,
|
||||
window->x + window->abs_x,
|
||||
window->y + window->abs_y);
|
||||
wl_subsurface_set_position (impl->display_server.wl_subsurface, x, y);
|
||||
gdk_window_request_transient_parent_commit (window);
|
||||
}
|
||||
}
|
||||
@@ -2656,6 +2624,15 @@ gdk_window_wayland_move_to_rect (GdkWindow *window,
|
||||
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_wayland_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
@@ -2797,6 +2774,23 @@ gdk_wayland_window_destroy (GdkWindow *window,
|
||||
drop_cairo_surfaces (window);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_wayland_window_get_shape (GdkWindow *window)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_wayland_window_get_input_shape (GdkWindow *window)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_window_focus (GdkWindow *window,
|
||||
guint32 timestamp)
|
||||
@@ -3585,9 +3579,11 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->get_events = gdk_window_wayland_get_events;
|
||||
impl_class->raise = gdk_window_wayland_raise;
|
||||
impl_class->lower = gdk_window_wayland_lower;
|
||||
impl_class->restack_under = gdk_window_wayland_restack_under;
|
||||
impl_class->restack_toplevel = gdk_window_wayland_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_wayland_move_resize;
|
||||
impl_class->move_to_rect = gdk_window_wayland_move_to_rect;
|
||||
impl_class->reparent = gdk_window_wayland_reparent;
|
||||
impl_class->set_device_cursor = gdk_window_wayland_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_wayland_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_wayland_get_root_coords;
|
||||
@@ -3595,6 +3591,9 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->shape_combine_region = gdk_window_wayland_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_window_wayland_input_shape_combine_region;
|
||||
impl_class->destroy = gdk_wayland_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_window_wayland_destroy_foreign;
|
||||
impl_class->get_shape = gdk_wayland_window_get_shape;
|
||||
impl_class->get_input_shape = gdk_wayland_window_get_input_shape;
|
||||
impl_class->begin_paint = gdk_window_impl_wayland_begin_paint;
|
||||
impl_class->end_paint = gdk_window_impl_wayland_end_paint;
|
||||
impl_class->beep = gdk_window_impl_wayland_beep;
|
||||
@@ -3650,6 +3649,7 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->set_shadow_width = gdk_wayland_window_set_shadow_width;
|
||||
impl_class->show_window_menu = gdk_wayland_window_show_window_menu;
|
||||
impl_class->create_gl_context = gdk_wayland_window_create_gl_context;
|
||||
impl_class->invalidate_for_new_frame = gdk_wayland_window_invalidate_for_new_frame;
|
||||
|
||||
signals[COMMITTED] = g_signal_new ("committed",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
|
||||
@@ -66,8 +66,6 @@ static t_WTOverlap p_WTOverlap;
|
||||
static t_WTPacket p_WTPacket;
|
||||
static t_WTQueueSizeSet p_WTQueueSizeSet;
|
||||
|
||||
static gboolean default_display_opened = FALSE;
|
||||
|
||||
G_DEFINE_TYPE (GdkDeviceManagerWin32, gdk_device_manager_win32, GDK_TYPE_DEVICE_MANAGER)
|
||||
|
||||
static GdkDevice *
|
||||
@@ -615,12 +613,17 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
num_axes++;
|
||||
}
|
||||
|
||||
if (device->pktdata & PK_ORIENTATION)
|
||||
/* The wintab driver for the Wacom ArtPad II reports
|
||||
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
|
||||
* actually sense tilt. Catch this by noticing that the
|
||||
* orientation axis's azimuth resolution is zero.
|
||||
*/
|
||||
if ((device->pktdata & PK_ORIENTATION) && axis_or[0].axResolution == 0)
|
||||
{
|
||||
device->orientation_axes[0] = axis_or[0];
|
||||
device->orientation_axes[1] = axis_or[1];
|
||||
|
||||
/* Wintab gives us azimuth and altitude, which
|
||||
/* Wintab gives us aximuth and altitude, which
|
||||
* we convert to x and y tilt in the -1000..1000 range
|
||||
*/
|
||||
_gdk_device_add_axis (GDK_DEVICE (device),
|
||||
@@ -665,42 +668,11 @@ wintab_init_check (GdkDeviceManagerWin32 *device_manager)
|
||||
}
|
||||
}
|
||||
|
||||
/* Only initialize Wintab after the default display is set for
|
||||
* the first time. WTOpenA() executes code beyond our control,
|
||||
* and it can cause messages to be sent to the application even
|
||||
* before a window is opened. GDK has to be in a fit state to
|
||||
* handle them when they come.
|
||||
*
|
||||
* https://bugzilla.gnome.org/show_bug.cgi?id=774379
|
||||
*/
|
||||
static void
|
||||
wintab_default_display_notify_cb (GdkDisplayManager *display_manager)
|
||||
{
|
||||
GdkDeviceManagerWin32 *device_manager = NULL;
|
||||
GdkDisplay *display = gdk_display_get_default();
|
||||
|
||||
if (default_display_opened)
|
||||
return;
|
||||
|
||||
g_assert (display != NULL);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
device_manager = GDK_DEVICE_MANAGER_WIN32 (gdk_display_get_device_manager (display));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
g_assert (display_manager != NULL);
|
||||
|
||||
default_display_opened = TRUE;
|
||||
GDK_NOTE (INPUT, g_print ("wintab init: doing delayed initialization\n"));
|
||||
wintab_init_check (device_manager);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_device_manager_win32_constructed (GObject *object)
|
||||
{
|
||||
GdkDeviceManagerWin32 *device_manager;
|
||||
GdkSeat *seat;
|
||||
GdkDisplayManager *display_manager = NULL;
|
||||
GdkDisplay *default_display = NULL;
|
||||
|
||||
device_manager = GDK_DEVICE_MANAGER_WIN32 (object);
|
||||
device_manager->core_pointer =
|
||||
@@ -743,18 +715,7 @@ gdk_device_manager_win32_constructed (GObject *object)
|
||||
gdk_seat_default_add_slave (GDK_SEAT_DEFAULT (seat), device_manager->system_keyboard);
|
||||
g_object_unref (seat);
|
||||
|
||||
/* Only call Wintab init stuff after the default display
|
||||
* is globally known and accessible through the display manager
|
||||
* singleton. Approach lifted from gtkmodules.c.
|
||||
*/
|
||||
display_manager = gdk_display_manager_get();
|
||||
g_assert (display_manager != NULL);
|
||||
default_display = gdk_display_manager_get_default_display (display_manager);
|
||||
g_assert (default_display == NULL);
|
||||
|
||||
g_signal_connect (display_manager, "notify::default-display",
|
||||
G_CALLBACK (wintab_default_display_notify_cb),
|
||||
NULL);
|
||||
wintab_init_check (device_manager);
|
||||
}
|
||||
|
||||
static GList *
|
||||
@@ -844,34 +805,11 @@ decode_tilt (gint *axis_data,
|
||||
{
|
||||
double az, el;
|
||||
|
||||
g_return_if_fail (axis_data != NULL);
|
||||
|
||||
/* The wintab driver for the Wacom ArtPad II reports
|
||||
* PK_ORIENTATION in CSR_PKTDATA, but the tablet doesn't
|
||||
* actually sense tilt. Catch this by noticing that the
|
||||
* orientation axis's azimuth resolution is zero.
|
||||
*
|
||||
* The same is true of the Huion H610PRO, but in this case
|
||||
* it's the altitude resolution that's zero. GdkEvents with
|
||||
* sensible tilts will need both, so only add the GDK tilt axes
|
||||
* if both wintab axes are going to be well-behaved in use.
|
||||
*/
|
||||
if ((axes == NULL) ||
|
||||
(axes[0].axResolution == 0) ||
|
||||
(axes[1].axResolution == 0))
|
||||
{
|
||||
axis_data[0] = 0;
|
||||
axis_data[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tested with a Wacom Intuos 5 touch M (PTH-650) + Wacom drivers 6.3.18-5.
|
||||
* Wintab's reference angle leads gdk's by 90 degrees.
|
||||
/* As I don't have a tilt-sensing tablet,
|
||||
* I cannot test this code.
|
||||
*/
|
||||
az = TWOPI * packet->pkOrientation.orAzimuth /
|
||||
(axes[0].axResolution / 65536.);
|
||||
az -= G_PI / 2;
|
||||
el = TWOPI * packet->pkOrientation.orAltitude /
|
||||
(axes[1].axResolution / 65536.);
|
||||
|
||||
@@ -914,9 +852,10 @@ gdk_device_manager_find_wintab_device (GdkDeviceManagerWin32 *device_manager,
|
||||
GdkDeviceWintab *device;
|
||||
GList *tmp_list;
|
||||
|
||||
for (tmp_list = device_manager->wintab_devices; tmp_list != NULL; tmp_list = tmp_list->next)
|
||||
for (tmp_list = device_manager->wintab_devices; tmp_list; tmp_list = tmp_list->next)
|
||||
{
|
||||
device = tmp_list->data;
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
if (device->hctx == hctx &&
|
||||
device->cursor == cursor)
|
||||
|
||||
@@ -1090,6 +1090,17 @@ gdk_win32_display_check_composited (GdkWin32Display *display)
|
||||
gdk_display_set_composited (GDK_DISPLAY (display), composited);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_before_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
static void
|
||||
gdk_win32_display_after_process_all_updates (GdkDisplay *display)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_notify_startup_complete (GdkDisplay *display,
|
||||
const gchar *startup_id)
|
||||
@@ -1262,6 +1273,8 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
|
||||
display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = _gdk_win32_display_supports_cursor_color;
|
||||
|
||||
display_class->before_process_all_updates = gdk_win32_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = gdk_win32_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_win32_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
|
||||
display_class->create_window_impl = _gdk_win32_display_create_window_impl;
|
||||
|
||||
@@ -3266,7 +3266,8 @@ gdk_event_translate (MSG *msg,
|
||||
!(windowpos->flags & SWP_NOCLIENTSIZE) ||
|
||||
(windowpos->flags & SWP_SHOWWINDOW))
|
||||
{
|
||||
if (!IsIconic (msg->hwnd) &&
|
||||
if (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
|
||||
!IsIconic (msg->hwnd) &&
|
||||
!GDK_WINDOW_DESTROYED (window))
|
||||
_gdk_win32_emit_configure_event (window);
|
||||
}
|
||||
|
||||
@@ -81,6 +81,23 @@ _gdk_win32_gl_context_dispose (GObject *gobject)
|
||||
G_OBJECT_CLASS (gdk_win32_gl_context_parent_class)->dispose (gobject);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_class_init (GdkWin32GLContextClass *klass)
|
||||
{
|
||||
GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->end_frame = _gdk_win32_gl_context_end_frame;
|
||||
context_class->realize = _gdk_win32_gl_context_realize;
|
||||
|
||||
gobject_class->dispose = _gdk_win32_gl_context_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_init (GdkWin32GLContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_gl_blit_region (GdkWindow *window, cairo_region_t *region)
|
||||
{
|
||||
@@ -100,22 +117,16 @@ gdk_gl_blit_region (GdkWindow *window, cairo_region_t *region)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
void
|
||||
_gdk_win32_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (context);
|
||||
GdkWindow *window = gdk_gl_context_get_window (context);
|
||||
GdkWin32Display *display = (GDK_WIN32_DISPLAY (gdk_gl_context_get_display (context)));
|
||||
|
||||
gboolean can_wait = display->hasWglOMLSyncControl;
|
||||
cairo_rectangle_int_t whole_window;
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->end_frame (draw_context, painted, damage);
|
||||
if (gdk_gl_context_get_shared_context (context))
|
||||
return;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
if (context_win32->do_frame_sync)
|
||||
@@ -138,12 +149,7 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
}
|
||||
}
|
||||
|
||||
whole_window = (GdkRectangle) { 0, 0, gdk_window_get_width (window), gdk_window_get_height (window) };
|
||||
if (cairo_region_contains_rectangle (painted, &whole_window) == CAIRO_REGION_OVERLAP_IN)
|
||||
{
|
||||
SwapBuffers (context_win32->gl_hdc);
|
||||
}
|
||||
else if (gdk_gl_context_has_framebuffer_blit (context))
|
||||
if (context_win32->do_blit_swap)
|
||||
{
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_BACK);
|
||||
@@ -155,33 +161,44 @@ gdk_win32_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
glFrameTerminatorGREMEDY ();
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Need to swap whole buffer even thouigh not everything was redrawn. Expect artifacts.");
|
||||
SwapBuffers (context_win32->gl_hdc);
|
||||
}
|
||||
SwapBuffers (context_win32->gl_hdc);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_region_t *update_area)
|
||||
void
|
||||
_gdk_win32_window_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkWindow *window;
|
||||
cairo_rectangle_int_t window_rect;
|
||||
gboolean invalidate_all = FALSE;
|
||||
GdkWin32GLContext *context_win32;
|
||||
cairo_rectangle_int_t whole_window = { 0, 0, gdk_window_get_width (window), gdk_window_get_height (window) };
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_parent_class)->begin_frame (draw_context, update_area);
|
||||
if (gdk_gl_context_get_shared_context (context))
|
||||
/* Minimal update is ok if we're not drawing with gl */
|
||||
if (window->gl_paint_context == NULL)
|
||||
return;
|
||||
|
||||
if (gdk_gl_context_has_framebuffer_blit (context))
|
||||
return;
|
||||
context_win32 = GDK_WIN32_GL_CONTEXT (window->gl_paint_context);
|
||||
context_win32->do_blit_swap = FALSE;
|
||||
|
||||
/* If nothing else is known, repaint everything so that the back
|
||||
buffer is fully up-to-date for the swapbuffer */
|
||||
window = gdk_gl_context_get_window (context);
|
||||
cairo_region_union_rectangle (update_area, &(GdkRectangle) {
|
||||
0, 0,
|
||||
gdk_window_get_width (window),
|
||||
gdk_window_get_height (window) });
|
||||
if (gdk_gl_context_has_framebuffer_blit (window->gl_paint_context) &&
|
||||
cairo_region_contains_rectangle (update_area, &whole_window) != CAIRO_REGION_OVERLAP_IN)
|
||||
{
|
||||
context_win32->do_blit_swap = TRUE;
|
||||
}
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
|
||||
if (invalidate_all)
|
||||
{
|
||||
window_rect.x = 0;
|
||||
window_rect.y = 0;
|
||||
window_rect.width = gdk_window_get_width (window);
|
||||
window_rect.height = gdk_window_get_height (window);
|
||||
|
||||
/* If nothing else is known, repaint everything so that the back
|
||||
buffer is fully up-to-date for the swapbuffer */
|
||||
cairo_region_union_rectangle (update_area, &window_rect);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
@@ -613,9 +630,9 @@ _set_pixformat_for_hdc (HDC hdc,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_gl_context_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
gboolean
|
||||
_gdk_win32_gl_context_realize (GdkGLContext *context,
|
||||
GError **error)
|
||||
{
|
||||
GdkGLContext *share = gdk_gl_context_get_shared_context (context);
|
||||
GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (context);
|
||||
@@ -713,26 +730,6 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_class_init (GdkWin32GLContextClass *klass)
|
||||
{
|
||||
GdkGLContextClass *gl_context_class = GDK_GL_CONTEXT_CLASS(klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS(klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gl_context_class->realize = gdk_win32_gl_context_realize;
|
||||
|
||||
draw_context_class->begin_frame = gdk_win32_gl_context_begin_frame;
|
||||
draw_context_class->end_frame = gdk_win32_gl_context_end_frame;
|
||||
|
||||
gobject_class->dispose = _gdk_win32_gl_context_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_gl_context_init (GdkWin32GLContext *self)
|
||||
{
|
||||
}
|
||||
|
||||
GdkGLContext *
|
||||
_gdk_win32_window_create_gl_context (GdkWindow *window,
|
||||
gboolean attached,
|
||||
@@ -762,6 +759,7 @@ _gdk_win32_window_create_gl_context (GdkWindow *window,
|
||||
display_win32->gl_hwnd = hwnd;
|
||||
|
||||
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT,
|
||||
"display", display,
|
||||
"window", window,
|
||||
"shared-context", share,
|
||||
NULL);
|
||||
|
||||
@@ -44,6 +44,7 @@ struct _GdkWin32GLContext
|
||||
/* other items */
|
||||
guint is_attached : 1;
|
||||
guint do_frame_sync : 1;
|
||||
guint do_blit_swap : 1;
|
||||
};
|
||||
|
||||
struct _GdkWin32GLContextClass
|
||||
@@ -57,10 +58,23 @@ _gdk_win32_window_create_gl_context (GdkWindow *window,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
|
||||
void
|
||||
_gdk_win32_window_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area);
|
||||
|
||||
void
|
||||
_gdk_win32_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage);
|
||||
|
||||
gboolean
|
||||
_gdk_win32_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
|
||||
gboolean
|
||||
_gdk_win32_gl_context_realize (GdkGLContext *context,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_WIN32_GL_CONTEXT__ */
|
||||
|
||||
@@ -50,9 +50,9 @@ static gboolean dummy;
|
||||
|
||||
const GOptionEntry _gdk_windowing_args[] = {
|
||||
{ "sync", 0, 0, G_OPTION_ARG_NONE, &gdk_synchronize,
|
||||
/* Description of --sync in --help output */ N_("Don’t batch GDI requests"), NULL },
|
||||
/* Description of --sync in --help output */ N_("Don't batch GDI requests"), NULL },
|
||||
{ "no-wintab", 0, 0, G_OPTION_ARG_NONE, &_gdk_input_ignore_wintab,
|
||||
/* Description of --no-wintab in --help output */ N_("Don’t use the Wintab API for tablet support"), NULL },
|
||||
/* Description of --no-wintab in --help output */ N_("Don't use the Wintab API for tablet support"), NULL },
|
||||
{ "ignore-wintab", 0, 0, G_OPTION_ARG_NONE, &_gdk_input_ignore_wintab,
|
||||
/* Description of --ignore-wintab in --help output */ N_("Same as --no-wintab"), NULL },
|
||||
{ "use-wintab", 0, 0, G_OPTION_ARG_NONE, &dummy,
|
||||
|
||||
@@ -133,7 +133,8 @@ static HDC _gdk_win32_impl_acquire_dc (GdkWindowImplWin32 *impl);
|
||||
static void _gdk_win32_impl_release_dc (GdkWindowImplWin32 *impl);
|
||||
|
||||
#define WINDOW_IS_TOPLEVEL(window) \
|
||||
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
|
||||
GdkScreen *
|
||||
GDK_WINDOW_SCREEN (GObject *win)
|
||||
@@ -325,19 +326,12 @@ gdk_win32_window_begin_paint (GdkWindow *window)
|
||||
if (impl->layered)
|
||||
return FALSE;
|
||||
|
||||
/* FIXME: Possibly remove the following lines when we transition to GL
|
||||
* drawing fully. This will probably mean that we won't
|
||||
* be able to use layered windows, as layered windows seem
|
||||
* to support only up to OpenGL 1.1, which is not enough for our
|
||||
* needs here.
|
||||
*/
|
||||
|
||||
/* Non-GL windows are moved *after* repaint.
|
||||
* We don't supply our own surface, return TRUE to make GDK create
|
||||
* one by itself.
|
||||
*//*
|
||||
*/
|
||||
if (!window->current_paint.use_gl)
|
||||
return TRUE;*/
|
||||
return TRUE;
|
||||
|
||||
/* GL windows are moved *before* repaint (otherwise
|
||||
* repainting doesn't work), but if there's no move queued up,
|
||||
@@ -361,13 +355,6 @@ gdk_win32_window_begin_paint (GdkWindow *window)
|
||||
static void
|
||||
gdk_win32_window_end_paint (GdkWindow *window)
|
||||
{
|
||||
/* FIXME: Possibly make gdk_win32_window_end_paint() a
|
||||
* no-op stub, like what is done in Wayland, as
|
||||
* the items here rely on layered window usage,
|
||||
* when we transition to full GL drawing, as
|
||||
* layered windows do not support enough GL
|
||||
* for our needs here
|
||||
*/
|
||||
GdkWindowImplWin32 *impl;
|
||||
RECT window_rect;
|
||||
HDC hdc;
|
||||
@@ -383,8 +370,8 @@ gdk_win32_window_end_paint (GdkWindow *window)
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
/* GL windows are moved *before* repaint */
|
||||
/*if (window->current_paint.use_gl)
|
||||
return;*/
|
||||
if (window->current_paint.use_gl)
|
||||
return;
|
||||
|
||||
/* No move/resize is queued up, and we don't need to update
|
||||
* the contents of a layered window, so return immediately.
|
||||
@@ -621,6 +608,22 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
|
||||
klass = klassTOPLEVEL;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
if (0 == klassCHILD)
|
||||
{
|
||||
wcl.lpszClassName = L"gdkWindowChild";
|
||||
|
||||
/* XXX: Find out whether GL Widgets are done for GDK_WINDOW_CHILD
|
||||
* MSDN says CS_PARENTDC should not be used for GL Context
|
||||
* creation
|
||||
*/
|
||||
wcl.style |= CS_PARENTDC; /* MSDN: ... enhances system performance. */
|
||||
ONCE_PER_CLASS ();
|
||||
klassCHILD = RegisterClassExW (&wcl);
|
||||
}
|
||||
klass = klassCHILD;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TEMP:
|
||||
if ((wtype_hint == GDK_WINDOW_TYPE_HINT_MENU) ||
|
||||
(wtype_hint == GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU) ||
|
||||
@@ -652,7 +655,6 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
@@ -706,9 +708,13 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
g_return_if_fail (display == _gdk_display);
|
||||
|
||||
GDK_NOTE (MISC,
|
||||
g_print ("_gdk_window_impl_new: %s %s\n", (window->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
|
||||
(window->window_type == GDK_WINDOW_TEMP ? "TEMP" : "???")),
|
||||
(attributes->wclass == GDK_INPUT_OUTPUT ? "" : "input-only")));
|
||||
g_print ("_gdk_window_impl_new: %s %s\n",
|
||||
(window->window_type == GDK_WINDOW_TOPLEVEL ? "TOPLEVEL" :
|
||||
(window->window_type == GDK_WINDOW_CHILD ? "CHILD" :
|
||||
(window->window_type == GDK_WINDOW_TEMP ? "TEMP" :
|
||||
"???"))),
|
||||
(attributes->wclass == GDK_INPUT_OUTPUT ? "" : "input-only"))
|
||||
);
|
||||
|
||||
hparent = GDK_WINDOW_HWND (real_parent);
|
||||
|
||||
@@ -764,6 +770,10 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
dwStyle = WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TEMP:
|
||||
/* A temp window is not necessarily a top level window */
|
||||
dwStyle = (gdk_screen_get_root_window (screen) == real_parent ? WS_POPUP : WS_CHILDWINDOW);
|
||||
@@ -773,38 +783,48 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
offset_y = _gdk_offset_y;
|
||||
break;
|
||||
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
rect.left = window->x * impl->window_scale;
|
||||
rect.top = window->y * impl->window_scale;
|
||||
rect.right = rect.left + window->width * impl->window_scale;
|
||||
rect.bottom = rect.top + window->height * impl->window_scale;
|
||||
|
||||
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
real_x = (window->x - offset_x) * impl->window_scale;
|
||||
real_y = (window->y - offset_y) * impl->window_scale;
|
||||
|
||||
if (window->window_type == GDK_WINDOW_TOPLEVEL)
|
||||
if (window->window_type != GDK_WINDOW_CHILD)
|
||||
{
|
||||
/* We initially place it at default so that we can get the
|
||||
default window positioning if we want */
|
||||
x = y = CW_USEDEFAULT;
|
||||
rect.left = window->x * impl->window_scale;
|
||||
rect.top = window->y * impl->window_scale;
|
||||
rect.right = rect.left + window->width * impl->window_scale;
|
||||
rect.bottom = rect.top + window->height * impl->window_scale;
|
||||
|
||||
AdjustWindowRectEx (&rect, dwStyle, FALSE, dwExStyle);
|
||||
|
||||
real_x = (window->x - offset_x) * impl->window_scale;
|
||||
real_y = (window->y - offset_y) * impl->window_scale;
|
||||
|
||||
if (window->window_type == GDK_WINDOW_TOPLEVEL)
|
||||
{
|
||||
/* We initially place it at default so that we can get the
|
||||
default window positioning if we want */
|
||||
x = y = CW_USEDEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TEMP, FOREIGN: Put these where requested */
|
||||
x = real_x;
|
||||
y = real_y;
|
||||
}
|
||||
|
||||
window_width = rect.right - rect.left;
|
||||
window_height = rect.bottom - rect.top;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* TEMP, FOREIGN: Put these where requested */
|
||||
x = real_x;
|
||||
y = real_y;
|
||||
{
|
||||
/* adjust position relative to real_parent */
|
||||
window_width = impl->unscaled_width;
|
||||
window_height = impl->unscaled_height;
|
||||
/* use given position for initial placement, native coordinates */
|
||||
x = (window->x + window->parent->abs_x - offset_x) * impl->window_scale;
|
||||
y = (window->y + window->parent->abs_y - offset_y) * impl->window_scale;
|
||||
}
|
||||
|
||||
window_width = rect.right - rect.left;
|
||||
window_height = rect.bottom - rect.top;
|
||||
|
||||
title = get_default_title ();
|
||||
if (!title || !*title)
|
||||
title = "";
|
||||
@@ -851,17 +871,20 @@ _gdk_win32_display_create_window_impl (GdkDisplay *display,
|
||||
|
||||
}
|
||||
|
||||
GetWindowRect (GDK_WINDOW_HWND (window), &rect);
|
||||
impl->initial_x = rect.left;
|
||||
impl->initial_y = rect.top;
|
||||
|
||||
/* Now we know the initial position, move to actually specified position */
|
||||
if (real_x != x || real_y != y)
|
||||
if (window->window_type != GDK_WINDOW_CHILD)
|
||||
{
|
||||
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
||||
SWP_NOZORDER_SPECIFIED,
|
||||
real_x, real_y, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
||||
GetWindowRect (GDK_WINDOW_HWND (window), &rect);
|
||||
impl->initial_x = rect.left;
|
||||
impl->initial_y = rect.top;
|
||||
|
||||
/* Now we know the initial position, move to actually specified position */
|
||||
if (real_x != x || real_y != y)
|
||||
{
|
||||
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window),
|
||||
SWP_NOZORDER_SPECIFIED,
|
||||
real_x, real_y, 0, 0,
|
||||
SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER));
|
||||
}
|
||||
}
|
||||
|
||||
g_object_ref (window);
|
||||
@@ -914,10 +937,13 @@ gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||
impl->wrapper = window;
|
||||
parent = GetParent (anid);
|
||||
|
||||
/* Always treat foreigns as toplevels */
|
||||
window->parent = gdk_get_default_root_window ();
|
||||
window->parent = gdk_win32_handle_table_lookup (parent);
|
||||
if (!window->parent || GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_FOREIGN)
|
||||
window->parent = gdk_get_default_root_window ();
|
||||
|
||||
window->parent->children = g_list_concat (&window->children_list_node, window->parent->children);
|
||||
window->parent->impl_window->native_children =
|
||||
g_list_prepend (window->parent->impl_window->native_children, window);
|
||||
|
||||
GetClientRect ((HWND) anid, &rect);
|
||||
point.x = rect.left;
|
||||
@@ -1000,6 +1026,18 @@ gdk_win32_window_destroy (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_destroy_foreign (GdkWindow *window)
|
||||
{
|
||||
/* It's somebody else's window, but in our hierarchy, so reparent it
|
||||
* to the desktop, and then try to destroy it.
|
||||
*/
|
||||
gdk_window_hide (window);
|
||||
gdk_window_reparent (window, NULL, 0, 0);
|
||||
|
||||
PostMessage (GDK_WINDOW_HWND (window), WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
/* This function is called when the window really gone.
|
||||
*/
|
||||
static void
|
||||
@@ -1589,6 +1627,95 @@ gdk_win32_window_move_resize (GdkWindow *window,
|
||||
_gdk_win32_emit_configure_event (window);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_window_reparent (GdkWindow *window,
|
||||
GdkWindow *new_parent,
|
||||
gint x,
|
||||
gint y)
|
||||
{
|
||||
GdkScreen *screen;
|
||||
GdkWindowImplWin32 *impl;
|
||||
gboolean new_parent_is_root;
|
||||
gboolean was_toplevel;
|
||||
LONG style;
|
||||
|
||||
screen = gdk_window_get_screen (window);
|
||||
|
||||
if (!new_parent)
|
||||
{
|
||||
new_parent = gdk_screen_get_root_window (screen);
|
||||
new_parent_is_root = TRUE;
|
||||
}
|
||||
else
|
||||
new_parent_is_root = (gdk_screen_get_root_window (screen) == new_parent);
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_win32_window_reparent: %p: %p\n",
|
||||
GDK_WINDOW_HWND (window),
|
||||
GDK_WINDOW_HWND (new_parent)));
|
||||
|
||||
style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
|
||||
|
||||
was_toplevel = GetAncestor (GDK_WINDOW_HWND (window), GA_PARENT) == GetDesktopWindow ();
|
||||
if (was_toplevel && !new_parent_is_root)
|
||||
{
|
||||
/* Reparenting from top-level (child of desktop). Clear out
|
||||
* decorations.
|
||||
*/
|
||||
style &= ~(WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
|
||||
style |= WS_CHILD;
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
}
|
||||
else if (new_parent_is_root)
|
||||
{
|
||||
/* Reparenting to top-level. Add decorations. */
|
||||
style &= ~(WS_CHILD);
|
||||
style |= WS_OVERLAPPEDWINDOW;
|
||||
SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
|
||||
}
|
||||
|
||||
API_CALL (SetParent, (GDK_WINDOW_HWND (window),
|
||||
GDK_WINDOW_HWND (new_parent)));
|
||||
|
||||
/* From here on, we treat parents of type GDK_WINDOW_FOREIGN like
|
||||
* the root window
|
||||
*/
|
||||
if (GDK_WINDOW_TYPE (new_parent) == GDK_WINDOW_FOREIGN)
|
||||
new_parent = gdk_screen_get_root_window (screen);
|
||||
|
||||
window->parent = new_parent;
|
||||
|
||||
/* Switch the window type as appropriate */
|
||||
|
||||
switch (GDK_WINDOW_TYPE (new_parent))
|
||||
{
|
||||
case GDK_WINDOW_ROOT:
|
||||
if (impl->toplevel_window_type != -1)
|
||||
GDK_WINDOW_TYPE (window) = impl->toplevel_window_type;
|
||||
else if (GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD)
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_TOPLEVEL;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
case GDK_WINDOW_CHILD:
|
||||
case GDK_WINDOW_TEMP:
|
||||
if (WINDOW_IS_TOPLEVEL (window))
|
||||
{
|
||||
/* Save the original window type so we can restore it if the
|
||||
* window is reparented back to be a toplevel.
|
||||
*/
|
||||
impl->toplevel_window_type = GDK_WINDOW_TYPE (window);
|
||||
GDK_WINDOW_TYPE (window) = GDK_WINDOW_CHILD;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move window into desired position while keeping the same client area */
|
||||
gdk_win32_window_move_resize (window, TRUE, x, y, window->width, window->height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_raise (GdkWindow *window)
|
||||
{
|
||||
@@ -1640,6 +1767,7 @@ gdk_win32_window_set_urgency_hint (GdkWindow *window,
|
||||
PFN_FlashWindowEx flashWindowEx = NULL;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
@@ -1890,6 +2018,12 @@ gdk_win32_window_set_transient_for (GdkWindow *window,
|
||||
return;
|
||||
}
|
||||
|
||||
if (window->window_type == GDK_WINDOW_CHILD)
|
||||
{
|
||||
GDK_NOTE (MISC, g_print ("... a child window!\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent == NULL)
|
||||
{
|
||||
GdkWindowImplWin32 *trans_impl = GDK_WINDOW_IMPL_WIN32 (window_impl->transient_owner->impl);
|
||||
@@ -2153,6 +2287,13 @@ gdk_win32_window_get_root_coords (GdkWindow *window,
|
||||
(ty + _gdk_offset_y) / impl->window_scale));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_restack_under (GdkWindow *window,
|
||||
GList *native_siblings)
|
||||
{
|
||||
// ### TODO
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_restack_toplevel (GdkWindow *window,
|
||||
GdkWindow *sibling,
|
||||
@@ -2422,6 +2563,7 @@ static GdkWindow *
|
||||
gdk_win32_window_get_group (GdkWindow *window)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
||||
g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return NULL;
|
||||
@@ -2436,6 +2578,7 @@ gdk_win32_window_set_group (GdkWindow *window,
|
||||
GdkWindow *leader)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD);
|
||||
g_return_if_fail (leader == NULL || GDK_IS_WINDOW (leader));
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) || GDK_WINDOW_DESTROYED (leader))
|
||||
@@ -4833,6 +4976,7 @@ gdk_win32_window_begin_resize_drag (GdkWindow *window,
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD ||
|
||||
IsIconic (GDK_WINDOW_HWND (window)))
|
||||
return;
|
||||
|
||||
@@ -4869,6 +5013,7 @@ gdk_win32_window_begin_move_drag (GdkWindow *window,
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) ||
|
||||
GDK_WINDOW_TYPE (window) == GDK_WINDOW_CHILD ||
|
||||
IsIconic (GDK_WINDOW_HWND (window)))
|
||||
return;
|
||||
|
||||
@@ -5436,6 +5581,35 @@ gdk_win32_window_set_opacity (GdkWindow *window,
|
||||
}
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_win32_window_get_shape (GdkWindow *window)
|
||||
{
|
||||
HRGN hrgn = CreateRectRgn (0, 0, 0, 0);
|
||||
int type = GetWindowRgn (GDK_WINDOW_HWND (window), hrgn);
|
||||
GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
if (type == SIMPLEREGION || type == COMPLEXREGION)
|
||||
{
|
||||
cairo_region_t *region = _gdk_win32_hrgn_to_region (hrgn, impl->window_scale);
|
||||
|
||||
DeleteObject (hrgn);
|
||||
return region;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_input_shape_combine_region (GdkWindow *window,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
/* Partial input shape support is implemented by handling the
|
||||
* WM_NCHITTEST message.
|
||||
*/
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_win32_window_is_win32 (GdkWindow *window)
|
||||
{
|
||||
@@ -5851,17 +6025,6 @@ _gdk_win32_window_get_unscaled_size (GdkWindow *window,
|
||||
*unscaled_height = impl->unscaled_height;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_input_shape_combine_region (GdkWindow *window,
|
||||
const cairo_region_t *shape_region,
|
||||
gint offset_x,
|
||||
gint offset_y)
|
||||
{
|
||||
/* Partial input shape support is implemented by handling the
|
||||
* NC_NCHITTEST message
|
||||
*/
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
{
|
||||
@@ -5881,8 +6044,10 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
impl_class->get_events = gdk_win32_window_get_events;
|
||||
impl_class->raise = gdk_win32_window_raise;
|
||||
impl_class->lower = gdk_win32_window_lower;
|
||||
impl_class->restack_under = gdk_win32_window_restack_under;
|
||||
impl_class->restack_toplevel = gdk_win32_window_restack_toplevel;
|
||||
impl_class->move_resize = gdk_win32_window_move_resize;
|
||||
impl_class->reparent = gdk_win32_window_reparent;
|
||||
impl_class->set_device_cursor = gdk_win32_window_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_win32_window_get_geometry;
|
||||
impl_class->get_device_state = gdk_window_win32_get_device_state;
|
||||
@@ -5891,6 +6056,9 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
impl_class->shape_combine_region = gdk_win32_window_shape_combine_region;
|
||||
impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
|
||||
impl_class->destroy = gdk_win32_window_destroy;
|
||||
impl_class->destroy_foreign = gdk_win32_window_destroy_foreign;
|
||||
impl_class->get_shape = gdk_win32_window_get_shape;
|
||||
//FIXME?: impl_class->get_input_shape = gdk_win32_window_get_input_shape;
|
||||
impl_class->begin_paint = gdk_win32_window_begin_paint;
|
||||
impl_class->end_paint = gdk_win32_window_end_paint;
|
||||
|
||||
@@ -5946,6 +6114,7 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
impl_class->change_property = _gdk_win32_window_change_property;
|
||||
impl_class->delete_property = _gdk_win32_window_delete_property;
|
||||
impl_class->create_gl_context = _gdk_win32_window_create_gl_context;
|
||||
impl_class->invalidate_for_new_frame = _gdk_win32_window_invalidate_for_new_frame;
|
||||
impl_class->get_scale_factor = _gdk_win32_window_get_scale_factor;
|
||||
impl_class->get_unscaled_size = _gdk_win32_window_get_unscaled_size;
|
||||
}
|
||||
@@ -5953,6 +6122,10 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
|
||||
HGDIOBJ
|
||||
gdk_win32_window_get_handle (GdkWindow *window)
|
||||
{
|
||||
/* Try to ensure the window has a native window */
|
||||
if (!_gdk_window_has_impl (window))
|
||||
gdk_window_ensure_native (window);
|
||||
|
||||
if (!GDK_WINDOW_IS_WIN32 (window))
|
||||
{
|
||||
g_warning (G_STRLOC " window is not a native Win32 window");
|
||||
|
||||
@@ -52,8 +52,6 @@ libgdk_x11_la_SOURCES = \
|
||||
gdkselection-x11.c \
|
||||
gdktestutils-x11.c \
|
||||
gdkvisual-x11.c \
|
||||
gdkvulkancontext-x11.c \
|
||||
gdkvulkancontext-x11.h \
|
||||
gdkwindow-x11.c \
|
||||
gdkwindow-x11.h \
|
||||
gdkxftdefaults.c \
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define VK_USE_PLATFORM_XLIB_KHR
|
||||
|
||||
#include "gdkasync.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkeventsource.h"
|
||||
@@ -40,7 +38,6 @@
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkscreen-x11.h"
|
||||
#include "gdkglcontext-x11.h"
|
||||
#include "gdkvulkancontext-x11.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -2954,10 +2951,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
object_class->finalize = gdk_x11_display_finalize;
|
||||
|
||||
display_class->window_type = GDK_TYPE_X11_WINDOW;
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
display_class->vk_context_type = GDK_TYPE_X11_VULKAN_CONTEXT;
|
||||
display_class->vk_extension_name = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
|
||||
#endif
|
||||
|
||||
display_class->get_name = gdk_x11_display_get_name;
|
||||
display_class->get_default_screen = gdk_x11_display_get_default_screen;
|
||||
@@ -2983,6 +2976,8 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
|
||||
display_class->supports_cursor_alpha = _gdk_x11_display_supports_cursor_alpha;
|
||||
display_class->supports_cursor_color = _gdk_x11_display_supports_cursor_color;
|
||||
|
||||
display_class->before_process_all_updates = _gdk_x11_display_before_process_all_updates;
|
||||
display_class->after_process_all_updates = _gdk_x11_display_after_process_all_updates;
|
||||
display_class->get_next_serial = gdk_x11_display_get_next_serial;
|
||||
display_class->notify_startup_complete = gdk_x11_display_notify_startup_complete;
|
||||
display_class->create_window_impl = _gdk_x11_display_create_window_impl;
|
||||
|
||||
@@ -35,6 +35,50 @@ struct _GdkWindowQueueItem
|
||||
cairo_region_t *antiexpose_area;
|
||||
};
|
||||
|
||||
void
|
||||
_gdk_x11_window_move_resize_child (GdkWindow *window,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GdkWindowImplX11 *impl;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||
|
||||
if (width * impl->window_scale > 65535 ||
|
||||
height * impl->window_scale > 65535)
|
||||
{
|
||||
g_warning ("Native children wider or taller than 65535 pixels are not supported");
|
||||
|
||||
if (width * impl->window_scale > 65535)
|
||||
width = 65535 / impl->window_scale;
|
||||
if (height * impl->window_scale > 65535)
|
||||
height = 65535 / impl->window_scale;
|
||||
}
|
||||
|
||||
window->x = x;
|
||||
window->y = y;
|
||||
impl->unscaled_width = width * impl->window_scale;
|
||||
impl->unscaled_height = height * impl->window_scale;
|
||||
window->width = width;
|
||||
window->height = height;
|
||||
|
||||
/* We don't really care about origin overflow, because on overflow
|
||||
* the window won't be visible anyway and thus it will be shaped
|
||||
* to nothing
|
||||
*/
|
||||
XMoveResizeWindow (GDK_WINDOW_XDISPLAY (window),
|
||||
GDK_WINDOW_XID (window),
|
||||
(window->x + window->parent->abs_x) * impl->window_scale,
|
||||
(window->y + window->parent->abs_y) * impl->window_scale,
|
||||
width * impl->window_scale,
|
||||
height * impl->window_scale);
|
||||
}
|
||||
|
||||
static Bool
|
||||
expose_serial_predicate (Display *xdisplay,
|
||||
XEvent *xev,
|
||||
|
||||
@@ -119,30 +119,118 @@ maybe_wait_for_vblank (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_x11_window_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area)
|
||||
{
|
||||
cairo_rectangle_int_t window_rect;
|
||||
GdkDisplay *display = gdk_window_get_display (window);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
Display *dpy = gdk_x11_display_get_xdisplay (display);
|
||||
GdkX11GLContext *context_x11;
|
||||
unsigned int buffer_age;
|
||||
gboolean invalidate_all;
|
||||
|
||||
/* Minimal update is ok if we're not drawing with gl */
|
||||
if (window->gl_paint_context == NULL)
|
||||
return;
|
||||
|
||||
context_x11 = GDK_X11_GL_CONTEXT (window->gl_paint_context);
|
||||
|
||||
buffer_age = 0;
|
||||
|
||||
context_x11->do_blit_swap = FALSE;
|
||||
|
||||
if (display_x11->has_glx_buffer_age)
|
||||
{
|
||||
gdk_gl_context_make_current (window->gl_paint_context);
|
||||
glXQueryDrawable(dpy, context_x11->drawable,
|
||||
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
||||
}
|
||||
|
||||
|
||||
invalidate_all = FALSE;
|
||||
if (buffer_age == 0 || buffer_age >= 4)
|
||||
{
|
||||
cairo_rectangle_int_t whole_window = { 0, 0, gdk_window_get_width (window), gdk_window_get_height (window) };
|
||||
|
||||
if (gdk_gl_context_has_framebuffer_blit (window->gl_paint_context) &&
|
||||
cairo_region_contains_rectangle (update_area, &whole_window) != CAIRO_REGION_OVERLAP_IN)
|
||||
{
|
||||
context_x11->do_blit_swap = TRUE;
|
||||
}
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer_age >= 2)
|
||||
{
|
||||
if (window->old_updated_area[0])
|
||||
cairo_region_union (update_area, window->old_updated_area[0]);
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
if (buffer_age >= 3)
|
||||
{
|
||||
if (window->old_updated_area[1])
|
||||
cairo_region_union (update_area, window->old_updated_area[1]);
|
||||
else
|
||||
invalidate_all = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidate_all)
|
||||
{
|
||||
window_rect.x = 0;
|
||||
window_rect.y = 0;
|
||||
window_rect.width = gdk_window_get_width (window);
|
||||
window_rect.height = gdk_window_get_height (window);
|
||||
|
||||
/* If nothing else is known, repaint everything so that the back
|
||||
buffer is fully up-to-date for the swapbuffer */
|
||||
cairo_region_union_rectangle (update_area, &window_rect);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
gdk_gl_blit_region (GdkWindow *window, cairo_region_t *region)
|
||||
{
|
||||
int n_rects, i;
|
||||
int scale = gdk_window_get_scale_factor (window);
|
||||
int wh = gdk_window_get_height (window);
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (region, i, &rect);
|
||||
glScissor (rect.x * scale, (wh - rect.y - rect.height) * scale, rect.width * scale, rect.height * scale);
|
||||
glBlitFramebuffer (rect.x * scale, (wh - rect.y - rect.height) * scale, (rect.x + rect.width) * scale, (wh - rect.y) * scale,
|
||||
rect.x * scale, (wh - rect.y - rect.height) * scale, (rect.x + rect.width) * scale, (wh - rect.y) * scale,
|
||||
GL_COLOR_BUFFER_BIT, GL_NEAREST);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_gl_context_end_frame (GdkGLContext *context,
|
||||
cairo_region_t *painted,
|
||||
cairo_region_t *damage)
|
||||
{
|
||||
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
|
||||
GdkX11GLContext *context_x11 = GDK_X11_GL_CONTEXT (context);
|
||||
GdkWindow *window = gdk_gl_context_get_window (context);
|
||||
GdkDisplay *display = gdk_gl_context_get_display (context);
|
||||
Display *dpy = gdk_x11_display_get_xdisplay (display);
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
//GdkRectangle whole_window;
|
||||
DrawableInfo *info;
|
||||
GLXDrawable drawable;
|
||||
|
||||
GDK_DRAW_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->end_frame (draw_context, painted, damage);
|
||||
if (gdk_gl_context_get_shared_context (context))
|
||||
return;
|
||||
|
||||
gdk_gl_context_make_current (context);
|
||||
|
||||
info = get_glx_drawable_info (window);
|
||||
|
||||
drawable = context_x11->attached_drawable;
|
||||
drawable = context_x11->drawable;
|
||||
|
||||
GDK_NOTE (OPENGL,
|
||||
g_message ("Flushing GLX buffers for drawable %lu (window: %lu), frame sync: %s",
|
||||
@@ -183,55 +271,24 @@ gdk_x11_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
}
|
||||
}
|
||||
|
||||
glXSwapBuffers (dpy, drawable);
|
||||
if (context_x11->do_blit_swap)
|
||||
{
|
||||
glDrawBuffer(GL_FRONT);
|
||||
glReadBuffer(GL_BACK);
|
||||
gdk_gl_blit_region (window, painted);
|
||||
glDrawBuffer(GL_BACK);
|
||||
glFlush();
|
||||
|
||||
if (gdk_gl_context_has_frame_terminator (context))
|
||||
glFrameTerminatorGREMEDY ();
|
||||
}
|
||||
else
|
||||
glXSwapBuffers (dpy, drawable);
|
||||
|
||||
if (context_x11->do_frame_sync && info != NULL && display_x11->has_glx_video_sync)
|
||||
glXGetVideoSyncSGI (&info->last_frame_counter);
|
||||
}
|
||||
|
||||
static cairo_region_t *
|
||||
gdk_x11_gl_context_get_damage (GdkGLContext *context)
|
||||
{
|
||||
GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
Display *dpy = gdk_x11_display_get_xdisplay (display);
|
||||
GdkWindow *window = gdk_draw_context_get_window (GDK_DRAW_CONTEXT (context));
|
||||
unsigned int buffer_age = 0;
|
||||
|
||||
if (display_x11->has_glx_buffer_age)
|
||||
{
|
||||
GdkGLContext *shared;
|
||||
GdkX11GLContext *shared_x11;
|
||||
|
||||
shared = gdk_gl_context_get_shared_context (context);
|
||||
if (shared == NULL)
|
||||
shared = context;
|
||||
shared_x11 = GDK_X11_GL_CONTEXT (shared);
|
||||
|
||||
gdk_gl_context_make_current (shared);
|
||||
glXQueryDrawable(dpy, shared_x11->attached_drawable,
|
||||
GLX_BACK_BUFFER_AGE_EXT, &buffer_age);
|
||||
|
||||
if (buffer_age >= 2)
|
||||
{
|
||||
if (window->old_updated_area[0])
|
||||
return cairo_region_copy (window->old_updated_area[0]);
|
||||
}
|
||||
else if (buffer_age >= 3)
|
||||
{
|
||||
if (window->old_updated_area[0] &&
|
||||
window->old_updated_area[1])
|
||||
{
|
||||
cairo_region_t *damage = cairo_region_copy (window->old_updated_area[0]);
|
||||
cairo_region_union (damage, window->old_updated_area[1]);
|
||||
return damage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_parent_class)->get_damage (context);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
Display *display;
|
||||
GLXDrawable drawable;
|
||||
@@ -406,7 +463,7 @@ gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
|
||||
gdk_window_get_unscaled_size (window, NULL, &unscaled_window_height);
|
||||
|
||||
sx = sy = 1;
|
||||
cairo_surface_get_device_scale (surface, &sx, &sy);
|
||||
cairo_surface_get_device_scale (window->current_paint.surface, &sx, &sy);
|
||||
cairo_surface_get_device_offset (surface, &device_x_offset, &device_y_offset);
|
||||
|
||||
/* Ensure all the X stuff are synced before we read it back via texture-from-pixmap */
|
||||
@@ -563,6 +620,7 @@ gdk_x11_gl_context_realize (GdkGLContext *context,
|
||||
GdkX11Display *display_x11;
|
||||
GdkDisplay *display;
|
||||
GdkX11GLContext *context_x11;
|
||||
GLXWindow drawable;
|
||||
XVisualInfo *xvisinfo;
|
||||
Display *dpy;
|
||||
DrawableInfo *info;
|
||||
@@ -725,10 +783,13 @@ gdk_x11_gl_context_realize (GdkGLContext *context,
|
||||
|
||||
XFree (xvisinfo);
|
||||
|
||||
context_x11->attached_drawable = info->glx_drawable ? info->glx_drawable : gdk_x11_window_get_xid (window->impl_window);
|
||||
context_x11->unattached_drawable = info->dummy_glx ? info->dummy_glx : info->dummy_xwin;
|
||||
if (context_x11->is_attached)
|
||||
drawable = info->glx_drawable ? info->glx_drawable : gdk_x11_window_get_xid (window->impl_window);
|
||||
else
|
||||
drawable = info->dummy_glx ? info->dummy_glx : info->dummy_xwin;
|
||||
|
||||
context_x11->is_direct = glXIsDirect (dpy, context_x11->glx_context);
|
||||
context_x11->drawable = drawable;
|
||||
|
||||
GDK_NOTE (OPENGL,
|
||||
g_message ("Realized GLX context[%p], %s",
|
||||
@@ -764,15 +825,12 @@ static void
|
||||
gdk_x11_gl_context_class_init (GdkX11GLContextClass *klass)
|
||||
{
|
||||
GdkGLContextClass *context_class = GDK_GL_CONTEXT_CLASS (klass);
|
||||
GdkDrawContextClass *draw_context_class = GDK_DRAW_CONTEXT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
context_class->realize = gdk_x11_gl_context_realize;
|
||||
context_class->get_damage = gdk_x11_gl_context_get_damage;
|
||||
context_class->end_frame = gdk_x11_gl_context_end_frame;
|
||||
context_class->texture_from_surface = gdk_x11_gl_context_texture_from_surface;
|
||||
|
||||
draw_context_class->end_frame = gdk_x11_gl_context_end_frame;
|
||||
|
||||
gobject_class->dispose = gdk_x11_gl_context_dispose;
|
||||
}
|
||||
|
||||
@@ -1218,6 +1276,7 @@ gdk_x11_window_create_gl_context (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
context = g_object_new (GDK_TYPE_X11_GL_CONTEXT,
|
||||
"display", display,
|
||||
"window", window,
|
||||
"shared-context", share,
|
||||
NULL);
|
||||
@@ -1235,7 +1294,6 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkX11GLContext *context_x11;
|
||||
Display *dpy = gdk_x11_display_get_xdisplay (display);
|
||||
gboolean do_frame_sync = FALSE;
|
||||
GLXWindow drawable;
|
||||
|
||||
if (context == NULL)
|
||||
{
|
||||
@@ -1251,16 +1309,11 @@ gdk_x11_display_make_gl_context_current (GdkDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (context_x11->is_attached || gdk_draw_context_is_drawing (GDK_DRAW_CONTEXT (context)))
|
||||
drawable = context_x11->attached_drawable;
|
||||
else
|
||||
drawable = context_x11->unattached_drawable;
|
||||
|
||||
GDK_NOTE (OPENGL,
|
||||
g_message ("Making GLX context %p current to drawable %lu",
|
||||
context, (unsigned long) drawable));
|
||||
g_message ("Making GLX context current to drawable %lu",
|
||||
(unsigned long) context_x11->drawable));
|
||||
|
||||
if (!glXMakeContextCurrent (dpy, drawable, drawable,
|
||||
if (!glXMakeContextCurrent (dpy, context_x11->drawable, context_x11->drawable,
|
||||
context_x11->glx_context))
|
||||
{
|
||||
GDK_NOTE (OPENGL,
|
||||
|
||||
@@ -42,12 +42,13 @@ struct _GdkX11GLContext
|
||||
|
||||
GLXContext glx_context;
|
||||
GLXFBConfig glx_config;
|
||||
GLXDrawable attached_drawable;
|
||||
GLXDrawable unattached_drawable;
|
||||
GLXDrawable drawable;
|
||||
|
||||
guint is_attached : 1;
|
||||
guint is_direct : 1;
|
||||
guint do_frame_sync : 1;
|
||||
|
||||
guint do_blit_swap : 1;
|
||||
};
|
||||
|
||||
struct _GdkX11GLContextClass
|
||||
@@ -60,6 +61,8 @@ GdkGLContext * gdk_x11_window_create_gl_context (GdkWindow
|
||||
gboolean attached,
|
||||
GdkGLContext *share,
|
||||
GError **error);
|
||||
void gdk_x11_window_invalidate_for_new_frame (GdkWindow *window,
|
||||
cairo_region_t *update_area);
|
||||
gboolean gdk_x11_display_make_gl_context_current (GdkDisplay *display,
|
||||
GdkGLContext *context);
|
||||
|
||||
|
||||
@@ -239,7 +239,7 @@ gdk_x_io_error (Display *display)
|
||||
*/
|
||||
if (errno == EPIPE)
|
||||
{
|
||||
g_message ("The application '%s' lost its connection to the display %s;\n"
|
||||
g_warning ("The application '%s' lost its connection to the display %s;\n"
|
||||
"most likely the X server was shut down or you killed/destroyed\n"
|
||||
"the application.\n",
|
||||
g_get_prgname (),
|
||||
@@ -247,7 +247,7 @@ gdk_x_io_error (Display *display)
|
||||
}
|
||||
else
|
||||
{
|
||||
g_message ("%s: Fatal IO error %d (%s) on X server %s.\n",
|
||||
g_warning ("%s: Fatal IO error %d (%s) on X server %s.\n",
|
||||
g_get_prgname (),
|
||||
errno, g_strerror (errno),
|
||||
display ? DisplayString (display) : gdk_get_display_arg_name ());
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user