Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ae0d0fcb61 | |||
| 8a704d75dc | |||
| 6b25a375fa | |||
| 21c53a1969 | |||
| ae2dd1d907 | |||
| f10c234361 | |||
| 3a650bff66 | |||
| e9f622b81f | |||
| a85ad2ce67 | |||
| 2af7e45860 | |||
| cf79ad4433 | |||
| f254ab700c |
+9
-1
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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).
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+4
-3
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
+61
-135
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkgridviewprivate.h"
|
||||
#include "gtkgridview.h"
|
||||
|
||||
#include "gtkbitset.h"
|
||||
#include "gtklistbaseprivate.h"
|
||||
@@ -384,37 +384,6 @@ gtk_grid_view_get_allocation (GtkListBase *base,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Returns the column that the given item will fall in.
|
||||
*/
|
||||
unsigned int
|
||||
gtk_grid_view_get_column_for_position (GtkListItemManager *items,
|
||||
unsigned int n_columns,
|
||||
unsigned int position)
|
||||
{
|
||||
return position % n_columns;
|
||||
}
|
||||
|
||||
/* Determine whether a tile is contained in a single row,
|
||||
* or spans multiple rows.
|
||||
*/
|
||||
gboolean
|
||||
gtk_grid_view_is_multirow_tile (GtkListItemManager *items,
|
||||
unsigned int n_columns,
|
||||
GtkListTile *tile)
|
||||
{
|
||||
unsigned int position;
|
||||
unsigned int col;
|
||||
|
||||
if (tile->n_items <= 1)
|
||||
return FALSE;
|
||||
|
||||
position = gtk_list_tile_get_position (items, tile);
|
||||
|
||||
col = position % n_columns;
|
||||
|
||||
return col + tile->n_items > n_columns;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
int x,
|
||||
@@ -425,7 +394,6 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
GtkGridView *self = GTK_GRID_VIEW (base);
|
||||
GtkListTile *tile;
|
||||
guint pos;
|
||||
guint col;
|
||||
|
||||
tile = gtk_list_item_manager_get_nearest_tile (self->item_manager, x, y);
|
||||
if (tile == NULL)
|
||||
@@ -443,43 +411,44 @@ gtk_grid_view_get_position_from_allocation (GtkListBase *base,
|
||||
}
|
||||
|
||||
pos = gtk_list_tile_get_position (self->item_manager, tile);
|
||||
col = gtk_grid_view_get_column_for_position (self->item_manager, self->n_columns, pos);
|
||||
|
||||
if (tile->n_items > 1)
|
||||
{
|
||||
int xspacing, yspacing;
|
||||
unsigned int row_height;
|
||||
unsigned int row_index;
|
||||
|
||||
gtk_list_base_get_border_spacing (base, &xspacing, &yspacing);
|
||||
|
||||
/* offset in x direction */
|
||||
pos += column_index (self, xspacing, MAX (tile->area.width - 1, x - tile->area.x));
|
||||
if (area)
|
||||
{
|
||||
guint col = MIN (column_index (self, xspacing, x), self->n_columns - 1);
|
||||
area->x = column_start (self, xspacing, col);
|
||||
area->width = column_end (self, xspacing, col) - area->x;
|
||||
}
|
||||
|
||||
/* offset in y direction */
|
||||
if (tile->n_items > self->n_columns)
|
||||
{
|
||||
guint rows_in_tile = tile->n_items / self->n_columns;
|
||||
|
||||
row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
||||
row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
||||
guint row_height = (tile->area.height + yspacing) / rows_in_tile - yspacing;
|
||||
guint row_index = MIN (tile->area.height - 1, y - tile->area.y) / (row_height + yspacing);
|
||||
pos += self->n_columns * row_index;
|
||||
|
||||
if (area)
|
||||
{
|
||||
area->y = tile->area.y + row_index * (row_height + yspacing);
|
||||
area->height = row_height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
row_height = tile->area.height;
|
||||
row_index = 0;
|
||||
if (area)
|
||||
{
|
||||
area->y = tile->area.y;
|
||||
area->height = tile->area.height;
|
||||
}
|
||||
}
|
||||
|
||||
col = gtk_grid_view_get_column_for_position (self->item_manager, self->n_columns, pos);
|
||||
|
||||
if (area)
|
||||
{
|
||||
area->x = column_start (self, xspacing, col);
|
||||
area->y = tile->area.y + row_index * (row_height + yspacing);
|
||||
area->width = column_end (self, xspacing, col) - area->x;
|
||||
area->height = row_height;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -767,48 +736,6 @@ gtk_grid_view_measure (GtkWidget *widget,
|
||||
gtk_grid_view_measure_across (widget, for_size, minimum, natural);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_grid_view_split_tiles_by_columns (GtkListItemManager *items,
|
||||
guint n_columns)
|
||||
{
|
||||
GtkListTile *tile;
|
||||
|
||||
for (tile = gtk_list_item_manager_get_first (items);
|
||||
tile != NULL;
|
||||
tile = gtk_rb_tree_node_get_next (tile))
|
||||
{
|
||||
if (tile->n_items > 1)
|
||||
{
|
||||
guint pos, col;
|
||||
guint remaining;
|
||||
|
||||
pos = gtk_list_tile_get_position (items, tile);
|
||||
col = gtk_grid_view_get_column_for_position (items, n_columns, pos);
|
||||
|
||||
if (col > 0)
|
||||
{
|
||||
/* Determine if the first row needs to be split off */
|
||||
remaining = n_columns - col;
|
||||
if (remaining > 0 && tile->n_items > remaining)
|
||||
gtk_list_tile_split (items, tile, remaining);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
pos += tile->n_items - 1;
|
||||
col = gtk_grid_view_get_column_for_position (items, n_columns, pos);
|
||||
|
||||
if (col < n_columns - 1)
|
||||
{
|
||||
/* Determine if the last row needs to be split off */
|
||||
remaining = n_columns - (col - 1);
|
||||
if (remaining > 0 && col + 1 < tile->n_items)
|
||||
tile = gtk_list_tile_split (items, tile, tile->n_items - (col + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
@@ -848,21 +775,22 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
self->column_width = ((orientation == GTK_ORIENTATION_VERTICAL ? width : height) + xspacing) / self->n_columns - xspacing;
|
||||
self->column_width = MAX (self->column_width, col_min);
|
||||
|
||||
/* step 2: split tiles as required */
|
||||
gtk_grid_view_split_tiles_by_columns (self->item_manager, self->n_columns);
|
||||
|
||||
/* step 3: determine height of known rows */
|
||||
/* step 2: determine height of known rows */
|
||||
heights = g_array_new (FALSE, FALSE, sizeof (int));
|
||||
|
||||
tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||
while (tile != NULL)
|
||||
{
|
||||
if (gtk_grid_view_is_multirow_tile (self->item_manager, self->n_columns, tile))
|
||||
/* if it's a multirow tile, handle it here */
|
||||
if (tile->n_items > 1 && tile->n_items >= self->n_columns)
|
||||
{
|
||||
if (tile->n_items % self->n_columns)
|
||||
gtk_list_tile_split (self->item_manager, tile, tile->n_items / self->n_columns * self->n_columns);
|
||||
tile = gtk_rb_tree_node_get_next (tile);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Not a multirow tile */
|
||||
i = 0;
|
||||
row_height = 0;
|
||||
|
||||
for (i = 0, start = tile;
|
||||
@@ -884,53 +812,32 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
g_array_append_val (heights, size);
|
||||
row_height = MAX (row_height, size);
|
||||
}
|
||||
if (tile->n_items > self->n_columns - i)
|
||||
gtk_list_tile_split (self->item_manager, tile, self->n_columns - i);
|
||||
i += tile->n_items;
|
||||
}
|
||||
|
||||
if (row_height > 0)
|
||||
{
|
||||
for (i = 0;
|
||||
start != tile;
|
||||
start = gtk_rb_tree_node_get_next (start))
|
||||
{
|
||||
unsigned int n_columns;
|
||||
unsigned int tile_height;
|
||||
|
||||
if (gtk_list_tile_is_footer (start))
|
||||
{
|
||||
n_columns = self->n_columns - i;
|
||||
if (n_columns != 0 && n_columns != self->n_columns)
|
||||
tile_height = row_height;
|
||||
else
|
||||
tile_height = 0;
|
||||
}
|
||||
else if (gtk_list_tile_is_header (start))
|
||||
{
|
||||
n_columns = self->n_columns;
|
||||
tile_height = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
n_columns = start->n_items;
|
||||
tile_height = row_height;
|
||||
}
|
||||
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
start,
|
||||
column_end (self, xspacing, i + n_columns - 1)
|
||||
column_end (self, xspacing, i + start->n_items - 1)
|
||||
- column_start (self, xspacing, i),
|
||||
tile_height);
|
||||
|
||||
i = (i + start->n_items) % self->n_columns;
|
||||
row_height);
|
||||
i += start->n_items;
|
||||
}
|
||||
g_assert (i <= self->n_columns);
|
||||
}
|
||||
}
|
||||
|
||||
/* step 4: determine height of rows with only unknown items */
|
||||
/* step 3: determine height of rows with only unknown items */
|
||||
unknown_row_height = gtk_grid_view_get_unknown_row_size (self, heights);
|
||||
g_array_free (heights, TRUE);
|
||||
|
||||
/* step 5: determine height for remaining rows and set each row's position */
|
||||
/* step 4: determine height for remaining rows and set each row's position */
|
||||
y = 0;
|
||||
i = 0;
|
||||
for (tile = gtk_list_item_manager_get_first (self->item_manager);
|
||||
@@ -941,8 +848,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
tile,
|
||||
column_start (self, xspacing, i),
|
||||
y);
|
||||
|
||||
if (gtk_grid_view_is_multirow_tile (self->item_manager, self->n_columns, tile))
|
||||
if (tile->n_items >= self->n_columns && tile->widget == NULL)
|
||||
{
|
||||
g_assert (i == 0);
|
||||
g_assert (tile->n_items % self->n_columns == 0);
|
||||
@@ -955,10 +861,15 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
tile,
|
||||
column_end (self, xspacing, i + tile->n_items - 1) - tile->area.x,
|
||||
unknown_row_height);
|
||||
if (tile->area.height == 0)
|
||||
{
|
||||
/* this case is for the last row - it may not be a full row so it won't
|
||||
* be a multirow tile but it may have no widgets either */
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
tile,
|
||||
column_end (self, xspacing, i + tile->n_items - 1) - tile->area.x,
|
||||
unknown_row_height);
|
||||
}
|
||||
i += tile->n_items;
|
||||
}
|
||||
|
||||
@@ -969,8 +880,23 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
/* Add a filler tile for empty space in the bottom right */
|
||||
if (i > 0)
|
||||
{
|
||||
GtkListTile *footer = gtk_list_item_manager_get_last (self->item_manager);
|
||||
g_assert (gtk_list_tile_is_footer (footer));
|
||||
tile = gtk_rb_tree_node_get_previous (footer);
|
||||
gtk_list_tile_set_area_position (self->item_manager,
|
||||
footer,
|
||||
column_start (self, xspacing, i),
|
||||
y);
|
||||
gtk_list_tile_set_area_size (self->item_manager,
|
||||
footer,
|
||||
column_end (self, xspacing, self->n_columns - 1) - footer->area.x,
|
||||
tile->area.height);
|
||||
}
|
||||
|
||||
/* step 6: allocate the rest */
|
||||
/* step 4: allocate the rest */
|
||||
gtk_list_base_allocate (GTK_LIST_BASE (self));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2023 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gtk/gtktypes.h"
|
||||
#include "gtk/gtkenums.h"
|
||||
#include "gtk/gtkgridview.h"
|
||||
#include "gtk/gtklistitemmanagerprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
unsigned int gtk_grid_view_get_column_for_position (GtkListItemManager *items,
|
||||
unsigned int n_columns,
|
||||
unsigned int position);
|
||||
|
||||
gboolean gtk_grid_view_is_multirow_tile (GtkListItemManager *items,
|
||||
unsigned int n_columns,
|
||||
GtkListTile *tile);
|
||||
|
||||
void gtk_grid_view_split_tiles_by_columns (GtkListItemManager *items,
|
||||
guint n_columns);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+5
-2
@@ -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
|
||||
*/
|
||||
|
||||
@@ -25,3 +25,7 @@ f {
|
||||
g {
|
||||
font-family: Macaroni al dente, Tomato sauce;
|
||||
}
|
||||
|
||||
h {
|
||||
font-family: 楷体;
|
||||
}
|
||||
|
||||
@@ -25,3 +25,7 @@ f {
|
||||
g {
|
||||
font-family: "Macaroni al dente", "Tomato sauce";
|
||||
}
|
||||
|
||||
h {
|
||||
font-family: "楷体";
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtk/gtklistitemmanagerprivate.h"
|
||||
#include "gtk/gtklistbaseprivate.h"
|
||||
#include "gtk/gtkgridviewprivate.h"
|
||||
|
||||
static GListModel *
|
||||
create_source_model (guint min_size, guint max_size)
|
||||
@@ -374,78 +373,8 @@ print_changes_cb (GListModel *model,
|
||||
g_test_message ("%u/%u: removing %u and adding %u items", position, g_list_model_get_n_items (model), removed, added);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_footer (GtkListTile *tile)
|
||||
{
|
||||
if (tile == NULL)
|
||||
return FALSE;
|
||||
|
||||
return tile->type == GTK_LIST_TILE_FOOTER ||
|
||||
tile->type == GTK_LIST_TILE_UNMATCHED_FOOTER;
|
||||
}
|
||||
|
||||
static void
|
||||
check_tile_invariants_for_columns (GtkListItemManager *items,
|
||||
unsigned int n_columns)
|
||||
{
|
||||
GtkListTile *tile;
|
||||
|
||||
for (tile = gtk_list_item_manager_get_first (items);
|
||||
tile != NULL;
|
||||
tile = gtk_rb_tree_node_get_next (tile))
|
||||
{
|
||||
g_assert (tile->type != GTK_LIST_TILE_REMOVED);
|
||||
if (tile->n_items > 1)
|
||||
{
|
||||
unsigned int pos, col, col2;
|
||||
gboolean before_footer;
|
||||
|
||||
pos = gtk_list_tile_get_position (items, tile);
|
||||
col = gtk_grid_view_get_column_for_position (items, n_columns, pos);
|
||||
col2 = gtk_grid_view_get_column_for_position (items, n_columns, pos + tile->n_items - 1);
|
||||
before_footer = is_footer (gtk_rb_tree_node_get_next (tile));
|
||||
|
||||
if (gtk_grid_view_is_multirow_tile (items, n_columns, tile))
|
||||
{
|
||||
g_assert_true (col == 0);
|
||||
g_assert_true (col2 == n_columns - 1 || before_footer);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_assert_true (col2 == col + tile->n_items - 1);
|
||||
g_assert_true (col2 <= n_columns);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_grid_view (GtkListItemManager *items)
|
||||
{
|
||||
for (unsigned int n_columns = 1; n_columns < 10; n_columns++)
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_test_message ("GC");
|
||||
|
||||
gtk_list_item_manager_gc_tiles (items);
|
||||
|
||||
if (g_test_verbose ())
|
||||
print_list_item_manager_tiles (items);
|
||||
|
||||
if (g_test_verbose ())
|
||||
g_test_message ("grid split %u columns", n_columns);
|
||||
|
||||
gtk_grid_view_split_tiles_by_columns (items, n_columns);
|
||||
|
||||
if (g_test_verbose ())
|
||||
print_list_item_manager_tiles (items);
|
||||
|
||||
check_tile_invariants_for_columns (items, n_columns);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_exhaustive (gboolean grid)
|
||||
test_exhaustive (void)
|
||||
{
|
||||
GtkListItemTracker *trackers[N_TRACKERS];
|
||||
GListStore *store;
|
||||
@@ -483,14 +412,9 @@ test_exhaustive (gboolean grid)
|
||||
switch (g_test_rand_int_range (0, 6))
|
||||
{
|
||||
case 0:
|
||||
if (grid)
|
||||
check_grid_view (items);
|
||||
else
|
||||
{
|
||||
if (g_test_verbose ())
|
||||
g_test_message ("GC and checking");
|
||||
check_list_item_manager (items, trackers, N_TRACKERS);
|
||||
}
|
||||
if (g_test_verbose ())
|
||||
g_test_message ("GC and checking");
|
||||
check_list_item_manager (items, trackers, N_TRACKERS);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -560,10 +484,7 @@ test_exhaustive (gboolean grid)
|
||||
}
|
||||
}
|
||||
|
||||
if (grid)
|
||||
check_grid_view (items);
|
||||
else
|
||||
check_list_item_manager (items, trackers, N_TRACKERS);
|
||||
check_list_item_manager (items, trackers, N_TRACKERS);
|
||||
|
||||
for (i = 0; i < N_TRACKERS; i++)
|
||||
gtk_list_item_tracker_free (items, trackers[i]);
|
||||
@@ -571,18 +492,6 @@ test_exhaustive (gboolean grid)
|
||||
gtk_window_destroy (GTK_WINDOW (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
test_exhaustive_list (void)
|
||||
{
|
||||
test_exhaustive (FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
test_exhaustive_grid (void)
|
||||
{
|
||||
test_exhaustive (TRUE);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@@ -590,8 +499,7 @@ main (int argc, char *argv[])
|
||||
|
||||
g_test_add_func ("/listitemmanager/create", test_create);
|
||||
g_test_add_func ("/listitemmanager/create_with_items", test_create_with_items);
|
||||
g_test_add_func ("/listitemmanager/exhaustive", test_exhaustive_list);
|
||||
g_test_add_func ("/gridview/split", test_exhaustive_grid);
|
||||
g_test_add_func ("/listitemmanager/exhaustive", test_exhaustive);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user