Compare commits

...

12 Commits

Author SHA1 Message Date
Matthias Clasen
ae0d0fcb61 Add a comment
This is something that wasn't clear to me, and it
is important to know to understand how we are handling
(un)premultiplication here.
2023-05-29 15:17:50 -04:00
Matthias Clasen
8a704d75dc gsk: Use matching memory format
memory_format_gl_format returns the new memory
format if it made a change, we should not drop
that on the floor.
2023-05-29 15:01:01 -04:00
Matthias Clasen
6b25a375fa gl: Prevent bad downloads
When the format we want doesn't match the format
of the GL texture, we need to download as RGBA
and convert.
2023-05-29 13:48:35 -04:00
Luca Bacci
21c53a1969 Merge branch 'win32-monitors' into 'main'
GdkWin32Monitor fixes

See merge request GNOME/gtk!6015
2023-05-29 09:50:30 +00:00
Matthias Clasen
ae2dd1d907 Merge branch 'matthiasc/for-main' into 'main'
css: Add a test for non-ASCII font family

See merge request GNOME/gtk!6028
2023-05-28 17:58:38 +00:00
Matthias Clasen
f10c234361 css: Add a test for non-ASCII font family
This came up in #5852, so make sure that it works.
2023-05-28 07:57:40 -04:00
Matthias Clasen
3a650bff66 Merge branch 'matthiasc/for-main' into 'main'
Annotate more enum additions

See merge request GNOME/gtk!6027
2023-05-28 11:41:48 +00:00
Matthias Clasen
e9f622b81f listitemmanager: Small docs clarifications
If we write docs for private functions,
lets make them relevant.
2023-05-28 07:19:02 -04:00
Matthias Clasen
a85ad2ce67 Annotate more enum additions
We have the technology now, lets use it.
2023-05-28 07:19:02 -04:00
Daniel Boles
2af7e45860 MenuButton: Always mention child@always-show-arrow
get_always_show_arrow() did not mention at all that the custom child is
relevant. set_always_show_arrow() only did in the blurb, not for the arg
2023-05-28 11:35:44 +01:00
Jason Francis
cf79ad4433 win32: implement fullscreen_on_monitor
Track the HMONITOR so it can be used by the toplevel layout.
2023-05-24 18:48:37 -04:00
Jason Francis
f254ab700c win32: Invalidate inactive monitors
Without this, there are still GdkMonitors present for displays that are
present but disconnected (such as when a laptop disables the internal
display to connect to an external monitor).
2023-05-24 17:34:34 -04:00
12 changed files with 85 additions and 32 deletions

View File

@@ -171,13 +171,21 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
Download *download = download_;
GLenum gl_internal_format, gl_format, gl_type;
int major, minor;
unsigned int internal_texture_format, dummy;
expected_stride = texture->width * gdk_memory_format_bytes_per_pixel (download->format);
gdk_gl_context_get_version (context, &major, &minor);
gdk_memory_format_gl_format (gdk_texture_get_format (texture),
FALSE,
major, minor,
&internal_texture_format,
&dummy, &dummy);
if (download->stride == expected_stride &&
!gdk_gl_context_get_use_es (context) &&
gdk_memory_format_gl_format (download->format, TRUE, major, minor, &gl_internal_format, &gl_format, &gl_type))
gdk_memory_format_gl_format (download->format, FALSE, major, minor, &gl_internal_format, &gl_format, &gl_type) &&
gl_internal_format == internal_texture_format)
{
glGetTexImage (GL_TEXTURE_2D,
0,

View File

@@ -600,6 +600,11 @@ gdk_memory_convert (guchar *dest_data,
for (y = 0; y < height; y++)
{
src_desc->to_float (tmp, src_data, width);
/* Note: Converting from a premultiplied format to an opaque format is defined
* to yield the same result as compositing over black, which works out to
* using the premultiplied values, and just dropping alpha.
*/
if (src_desc->alpha == GDK_MEMORY_ALPHA_PREMULTIPLIED && dest_desc->alpha == GDK_MEMORY_ALPHA_STRAIGHT)
unpremultiply (tmp, width);
else if (src_desc->alpha == GDK_MEMORY_ALPHA_STRAIGHT && dest_desc->alpha != GDK_MEMORY_ALPHA_STRAIGHT)

View File

@@ -292,6 +292,7 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
if (!w32_ex_monitor->remove)
continue;
w32_ex_monitor->hmonitor = NULL;
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
gdk_monitor_invalidate (ex_monitor);
}

View File

@@ -443,9 +443,6 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
char *path, *path_lower;
DISPLAYCONFIG_RATIONAL *refresh;
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
continue;
tdn.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
tdn.header.size = sizeof (tdn);
tdn.header.adapterId = dispconf_paths[path_index].targetInfo.adapterId;
@@ -481,6 +478,12 @@ populate_monitor_devices_from_display_config (GPtrArray *monitors)
if (w32mon == NULL)
continue;
if ((dispconf_paths[path_index].flags & DISPLAYCONFIG_PATH_ACTIVE) == 0)
{
w32mon->remove = TRUE;
continue;
}
mon = GDK_MONITOR (w32mon);
if (!tdn.flags.friendlyNameForced)
@@ -598,6 +601,8 @@ enum_monitor (HMONITOR hmonitor,
if (w32mon == NULL)
continue;
w32mon->hmonitor = hmonitor;
}
else
{

View File

@@ -35,6 +35,9 @@ struct _GdkWin32Monitor
/* Device instance path (used to match GdkWin32Monitor to monitor device) */
char *instance_path;
/* MOnitor handle (used to fullscreen windows on monitors) */
HMONITOR hmonitor;
/* TRUE if monitor is made up by us
* (this happens when system has logical monitors, but no physical ones).
*/

View File

@@ -50,6 +50,7 @@
#include "gdkdisplay-win32.h"
#include "gdkdevice-win32.h"
#include "gdkcairocontext-win32.h"
#include "gdkmonitor-win32.h"
#include <cairo-win32.h>
#include <dwmapi.h>
@@ -625,7 +626,8 @@ get_outer_rect (GdkSurface *window,
}
static void
gdk_win32_surface_fullscreen (GdkSurface *window);
gdk_win32_surface_fullscreen (GdkSurface *window,
GdkMonitor *monitor);
static void
show_window_internal (GdkSurface *window,
@@ -789,11 +791,7 @@ show_window_internal (GdkSurface *window,
}
if (window->state & GDK_TOPLEVEL_STATE_FULLSCREEN)
{
gdk_win32_surface_fullscreen (window);
}
else if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
if (window->state & GDK_TOPLEVEL_STATE_MAXIMIZED)
{
GtkShowWindow (window, SW_MAXIMIZE);
}
@@ -4008,11 +4006,12 @@ gdk_win32_surface_unmaximize (GdkSurface *surface)
}
static void
gdk_win32_surface_fullscreen (GdkSurface *window)
gdk_win32_surface_fullscreen (GdkSurface *window,
GdkMonitor *monitor)
{
int x, y, width, height;
FullscreenInfo *fi;
HMONITOR monitor;
HMONITOR hmonitor = NULL;
MONITORINFO mi;
g_return_if_fail (GDK_IS_SURFACE (window));
@@ -4025,9 +4024,14 @@ gdk_win32_surface_fullscreen (GdkSurface *window)
{
GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
monitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
if (monitor && GDK_IS_WIN32_MONITOR (monitor))
hmonitor = GDK_WIN32_MONITOR (monitor)->hmonitor;
if (!hmonitor)
hmonitor = MonitorFromWindow (GDK_SURFACE_HWND (window), MONITOR_DEFAULTTONEAREST);
mi.cbSize = sizeof (mi);
if (monitor && GetMonitorInfo (monitor, &mi))
if (hmonitor && GetMonitorInfo (hmonitor, &mi))
{
x = mi.rcMonitor.left;
y = mi.rcMonitor.top;
@@ -4869,9 +4873,16 @@ gdk_win32_toplevel_present (GdkToplevel *toplevel,
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
{
if (fullscreen)
gdk_win32_surface_fullscreen (surface);
{
GdkMonitor *monitor;
monitor = gdk_toplevel_layout_get_fullscreen_monitor (layout);
gdk_win32_surface_fullscreen (surface, monitor);
}
else
gdk_win32_surface_unfullscreen (surface);
{
gdk_win32_surface_unfullscreen (surface);
}
}
gdk_win32_surface_show (surface, FALSE);

View File

@@ -1447,6 +1447,7 @@ gsk_gl_command_queue_create_framebuffer (GskGLCommandQueue *self)
return fbo_id;
}
static GdkMemoryFormat
memory_format_gl_format (GdkMemoryFormat data_format,
gboolean use_es,
@@ -1611,13 +1612,13 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
use_es = gdk_gl_context_get_use_es (self->context);
gdk_gl_context_get_version (self->context, &major, &minor);
data_format = gdk_texture_get_format (chunks[0].texture);
memory_format_gl_format (data_format,
use_es,
major,
minor,
&gl_internalformat,
&gl_format,
&gl_type);
data_format = memory_format_gl_format (data_format,
use_es,
major,
minor,
&gl_internalformat,
&gl_format,
&gl_type);
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);

View File

@@ -1422,7 +1422,7 @@ typedef enum {
GTK_ACCESSIBLE_ROLE_TREE_ITEM,
GTK_ACCESSIBLE_ROLE_WIDGET,
GTK_ACCESSIBLE_ROLE_WINDOW,
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON
GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON GDK_AVAILABLE_ENUMERATOR_IN_4_10
} GtkAccessibleRole;
/**
@@ -1449,7 +1449,8 @@ typedef enum {
* @GTK_ACCESSIBLE_STATE_SELECTED: A “selected” state; set when a widget
* is selected. Value type: boolean or undefined
* @GTK_ACCESSIBLE_STATE_VISITED: Indicates that a widget with the
* GTK_ACCESSIBLE_ROLE_LINK has been visited. Value type: boolean. Since: 4.12
* GTK_ACCESSIBLE_ROLE_LINK has been visited. Value type: boolean.
* Since: 4.12
*
* The possible accessible states of a [iface@Accessible].
*/
@@ -1462,7 +1463,7 @@ typedef enum {
GTK_ACCESSIBLE_STATE_INVALID,
GTK_ACCESSIBLE_STATE_PRESSED,
GTK_ACCESSIBLE_STATE_SELECTED,
GTK_ACCESSIBLE_STATE_VISITED
GTK_ACCESSIBLE_STATE_VISITED GDK_AVAILABLE_ENUMERATOR_IN_4_12
} GtkAccessibleState;
/**

View File

@@ -1004,6 +1004,8 @@ gtk_list_item_manager_merge_list_items (GtkListItemManager *self,
* It is not valid for either tile to have 0 items after
* the split.
*
* This function does not update the tiles' areas.
*
* Returns: The new tile
**/
GtkListTile *
@@ -1037,10 +1039,6 @@ gtk_list_tile_split (GtkListItemManager *self,
*
* Note that this only looks forward, but never backward.
*
* A special case here are filler tiles. They only get
* collected, when they are explicitly passed in, but never
* otherwise.
*
* Returns: The next tile or NULL if everything was gc'ed
**/
static GtkListTile *
@@ -1093,6 +1091,15 @@ gtk_list_tile_gc (GtkListItemManager *self,
return tile;
}
/*
* gtk_list_item_manager_gc_tiles:
* @self: the listitemmanager
*
* Removes all tiles of type GTK_LIST_TILE_REMOVED
* and merges item tiles as much as possible.
*
* This function does not update the tiles' areas.
*/
void
gtk_list_item_manager_gc_tiles (GtkListItemManager *self)
{

View File

@@ -1094,6 +1094,7 @@ gtk_menu_button_get_icon_name (GtkMenuButton *menu_button)
* gtk_menu_button_set_always_show_arrow: (attributes org.gtk.Method.set_property=always-show-arrow)
* @menu_button: a `GtkMenuButton`
* @always_show_arrow: whether to show a dropdown arrow even when using an icon
* or a custom child
*
* Sets whether to show a dropdown arrow even when using an icon or a custom
* child.
@@ -1122,9 +1123,11 @@ gtk_menu_button_set_always_show_arrow (GtkMenuButton *menu_button,
* gtk_menu_button_get_always_show_arrow: (attributes org.gtk.Method.get_property=always-show-arrow)
* @menu_button: a `GtkMenuButton`
*
* Gets whether to show a dropdown arrow even when using an icon.
* Gets whether to show a dropdown arrow even when using an icon or a custom
* child.
*
* Returns: whether to show a dropdown arrow even when using an icon
* Returns: whether to show a dropdown arrow even when using an icon or a custom
* child.
*
* Since: 4.4
*/

View File

@@ -25,3 +25,7 @@ f {
g {
font-family: Macaroni al dente, Tomato sauce;
}
h {
font-family: ;
}

View File

@@ -25,3 +25,7 @@ f {
g {
font-family: "Macaroni al dente", "Tomato sauce";
}
h {
font-family: "楷体";
}