Compare commits

..

No commits in common. "ada67f044a36f9b5368c8905bbb9aa6f1dacd0b6" and "3da1d32df764ee45b29dc407353fd0e7a561912c" have entirely different histories.

3 changed files with 16 additions and 38 deletions

View File

@ -548,15 +548,6 @@ on_key_press(G_GNUC_UNUSED GtkWidget *widget, GdkEventKey *event,
G_GNUC_UNUSED gpointer data)
{
switch (event->state & gtk_accelerator_get_default_mod_mask()) {
case GDK_MOD1_MASK | GDK_SHIFT_MASK:
if (event->keyval == GDK_KEY_D) {
GtkSettings *settings = gtk_settings_get_default();
const char *property = "gtk-application-prefer-dark-theme";
gboolean set = FALSE;
g_object_get(settings, property, &set, NULL);
g_object_set(settings, property, !set, NULL);
}
break;
case GDK_CONTROL_MASK:
switch (event->keyval) {
case GDK_KEY_o:
@ -846,16 +837,12 @@ toolbar_connect(int index, GCallback callback)
g_signal_connect_swapped(g.toolbar[index], "clicked", callback, NULL);
}
// TODO(p): The text and icons should be faded, unless the mouse cursor is
// on the toolbar. However, GtkEventBox is of no use, because either buttons
// steal our {enter,leave}-notify-events, or we steal all their input.
// Not even connecting to these signals on children works, insensitive buttons
// will not trigger anything.
// TODO(p): The toolbar should not be visible in fullscreen, or should show up
// only when the cursor reaches the top of the screen. Translucency sounds
// like a good mechanism here. Presumably, GtkOverlay could be used for this,
// but it faces the same problem as above--the input model sucks.
// TODO(p): Simply hide it in fullscreen and add a replacement context menu.
// TODO(p): The toolbar should not be visible in fullscreen,
// or show up only when the cursor reaches the bottom of the screen.
// Presumably, GtkOverlay could be used for this. Proximity-based?
// Might want to make the toolbar normally translucent.
// TODO(p): The text and icons should be faded, unless the mouse cursor
// is on the toolbar.
static GtkWidget *
make_view_toolbar(void)
{
@ -1015,7 +1002,7 @@ main(int argc, char *argv[])
G_CALLBACK(on_button_press_view), NULL);
gtk_container_add(GTK_CONTAINER(view_scroller), g.view);
// TODO(p): Base most colours on the theme, and make this configurable.
// Maybe our custom widgets should derive colours from the theme instead.
g_object_set(gtk_settings_get_default(),
"gtk-application-prefer-dark-theme", TRUE, NULL);

View File

@ -254,12 +254,8 @@ draw_row(FivBrowser *self, cairo_t *cr, const Row *row)
border.top + extents.height + border.bottom);
}
// Performance optimization--specifically targeting the checkerboard.
if (cairo_image_surface_get_format(item->entry->thumbnail) !=
CAIRO_FORMAT_RGB24) {
gtk_render_background(style, cr, border.left, border.top,
extents.width, extents.height);
}
gtk_render_background(
style, cr, border.left, border.top, extents.width, extents.height);
gtk_render_frame(style, cr, 0, 0,
border.left + extents.width + border.right,
@ -310,9 +306,8 @@ rescale_thumbnail(cairo_surface_t *thumbnail, double row_height)
int projected_width = round(scale_x * width);
int projected_height = round(scale_y * height);
cairo_format_t cairo_format = cairo_image_surface_get_format(thumbnail);
cairo_surface_t *scaled = cairo_image_surface_create(
cairo_format, projected_width, projected_height);
CAIRO_FORMAT_ARGB32, projected_width, projected_height);
// pixman can take gamma into account when scaling, unlike Cairo.
struct pixman_f_transform xform_floating;
@ -320,8 +315,7 @@ rescale_thumbnail(cairo_surface_t *thumbnail, double row_height)
// PIXMAN_a8r8g8b8_sRGB can be used for gamma-correct results,
// but it's an incredibly slow transformation
pixman_format_code_t format =
cairo_format == CAIRO_FORMAT_RGB24 ? PIXMAN_x8r8g8b8 : PIXMAN_a8r8g8b8;
pixman_format_code_t format = PIXMAN_a8r8g8b8;
pixman_image_t *src = pixman_image_create_bits(format, width, height,
(uint32_t *) cairo_image_surface_get_data(thumbnail),

View File

@ -2366,15 +2366,9 @@ read_spng_thumbnail(
}
struct spng_ihdr ihdr = {};
struct spng_trns trns = {};
spng_get_ihdr(ctx, &ihdr);
bool may_be_translucent = !spng_get_trns(ctx, &trns) ||
ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA ||
ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA;
cairo_surface_t *surface = cairo_image_surface_create(
may_be_translucent ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24,
ihdr.width, ihdr.height);
CAIRO_FORMAT_ARGB32, ihdr.width, ihdr.height);
cairo_status_t surface_status = cairo_surface_status(surface);
if (surface_status != CAIRO_STATUS_SUCCESS) {
@ -2402,7 +2396,10 @@ read_spng_thumbnail(
}
// pixman can be mildly abused to do this operation, but it won't be faster.
if (may_be_translucent) {
struct spng_trns trns = {};
if (ihdr.color_type == SPNG_COLOR_TYPE_GRAYSCALE_ALPHA ||
ihdr.color_type == SPNG_COLOR_TYPE_TRUECOLOR_ALPHA ||
!spng_get_trns(ctx, &trns)) {
for (size_t i = size / sizeof *data; i--; ) {
const uint8_t *unit = (const uint8_t *) &data[i];
uint32_t a = unit[3],