Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Test"
on:
workflow_dispatch:
pull_request:
types: [opened,edited,synchronize,reopened]
push:
branches:
- 'master'
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
if: github.repository_owner == 'artturin'
steps:
- uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
- run: nix build --extra-experimental-features nix-command -L --show-trace
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
./result*
.direnv
compile_commands.json

0
ChangeLog
Makefile
Expand Down
4 changes: 2 additions & 2 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ New features included:
Fixed:
- Wallpaper support for XFCE
- Minor fixes

Viewnior 1.2
------------

Expand All @@ -95,7 +95,7 @@ New features included:
- Remember window state (maximized) between startups
- Add "Last Used Mode" zoom option
- --slideshow argument to start in Slideshow mode
- Gnome 3.0 ready
- Gnome 3.0 ready

Fixed:
- Remove deprecated gtk+/glib symbols
Expand Down
1 change: 0 additions & 1 deletion data/vnr-crop-dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
Expand Down
1 change: 0 additions & 1 deletion data/vnr-preferences-dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<property name="resizable">False</property>
<property name="icon_name">viewnior</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
Expand Down
61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 48 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};

outputs =
inputs:
inputs.utils.lib.eachDefaultSystem (
system:
let
name = "viewnior";
pkgs = import inputs.nixpkgs {
localSystem = system;
overlays = [
(_: prev: {
viewnior = (prev.viewnior.override { stdenv = prev.clangStdenv; }).overrideAttrs {
src = prev.nix-gitignore.gitignoreSource [ ] ./.;
};
})
];
};
in
{
packages = {
default = inputs.self.packages."${system}".${name};
"${name}" = pkgs.${name};
viewnior-with-compile-commands = pkgs.viewnior-with-compile-commands;
};

devShells.default =
with pkgs;
mkShell.override { stdenv = pkgs.viewnior.stdenv; } {
inputsFrom = [ inputs.self.packages."${system}".${name} ];
nativeBuildInputs = [ clang-tools ];
env = {
CLANGD_FLAGS = "--query-driver=${pkgs.lib.getExe pkgs.viewnior.stdenv.cc}";
};
shellHook = ''
meson setup builddir >/dev/null
ln -fs "$PWD/builddir/compile_commands.json" .
'';
};

formatter = pkgs.nixfmt-tree;
}
);
}
4 changes: 2 additions & 2 deletions man/viewnior.1
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ viewnior \- simple, fast and elegant image viewer
[\fIOPTIONS\fR]
[\fIFILES\fR|\fIFOLDERS\fR]...
.SH DESCRIPTION
Viewnior is an image viewer program. Created to be simple,
fast and elegant. It's minimalistic interface provides more
Viewnior is an image viewer program. Created to be simple,
fast and elegant. It's minimalistic interface provides more
screenspace for your images.
.SH OPTIONS
.TP
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ i18n = import('i18n')
glib_ver = '>= 2.32'

viewnior_deps = [
dependency('gtk+-2.0', version: '>= 2.20'),
dependency('gtk+-3.0'),
dependency('glib-2.0', version: glib_ver),
dependency('gio-2.0', version: glib_ver),
dependency('shared-mime-info', version: '>= 0.20'),
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ main (int argc, char *argv[])
vnr_window_set_list(VNR_WINDOW(window), file_list, TRUE);
}
}

VNR_WINDOW(window)->prefs->start_slideshow = slideshow;
VNR_WINDOW(window)->prefs->start_fullscreen = fullscreen;
if ( VNR_WINDOW(window)->prefs->start_maximized ) {
Expand Down
25 changes: 16 additions & 9 deletions src/uni-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ uni_pixbuf_draw_cache_intersect_draw (UniPixbufDrawCache * cache,
* uni_pixbuf_draw_cache_draw:
* @cache: a #UniPixbufDrawCache
* @opts: the #UniPixbufDrawOpts to use in this draw
* @window: a #GdkWindow to draw on
* @cr: a #cairo_t to draw with
*
* Redraws the area specified in the pixbuf draw options in an
* efficient way by using caching.
**/
void
uni_pixbuf_draw_cache_draw (UniPixbufDrawCache * cache,
UniPixbufDrawOpts * opts, GdkWindow * window)
UniPixbufDrawOpts * opts, cairo_t *cr)
{
GdkRectangle this = opts->zoom_rect;
UniPixbufDrawMethod method =
Expand Down Expand Up @@ -306,13 +306,20 @@ uni_pixbuf_draw_cache_draw (UniPixbufDrawCache * cache,
(double) -this.x, (double) -this.y,
opts->zoom, opts->interp, this.x, this.y);
}
gdk_draw_pixbuf (window,
NULL,
cache->last_pixbuf,
deltax, deltay,
opts->widget_x, opts->widget_y,
this.width, this.height,
GDK_RGB_DITHER_MAX, opts->widget_x, opts->widget_y);
cairo_save(cr);
GdkRectangle rect;
rect.x = opts->widget_x;
rect.y = opts->widget_y;
rect.width = this.width;
rect.height = this.height;
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
GdkPixbuf *subpixbuf = gdk_pixbuf_new_subpixbuf(cache->last_pixbuf, deltax, deltay, this.width, this.height);
gdk_cairo_set_source_pixbuf(cr, subpixbuf, rect.x, rect.y);
cairo_rectangle(cr, opts->widget_x, opts->widget_y, this.width, this.height);
cairo_clip(cr);
cairo_paint(cr);
cairo_restore(cr);
g_object_unref(subpixbuf);
if (method != UNI_PIXBUF_DRAW_METHOD_CONTAINS)
cache->old = *opts;
}
2 changes: 1 addition & 1 deletion src/uni-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void uni_pixbuf_draw_cache_free (UniPixbufDrawCache * cache);
void uni_pixbuf_draw_cache_invalidate (UniPixbufDrawCache * cache);
void uni_pixbuf_draw_cache_draw (UniPixbufDrawCache * cache,
UniPixbufDrawOpts * opts,
GdkWindow * window);
cairo_t *cr);

UniPixbufDrawMethod uni_pixbuf_draw_cache_get_method (UniPixbufDrawOpts * old,
UniPixbufDrawOpts *
Expand Down
16 changes: 8 additions & 8 deletions src/uni-dragger.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ uni_dragger_motion_notify (UniDragger * tool, GdkEventMotion * ev)
if (abs (dx) < 1 && abs (dy) < 1)
return FALSE;

vadj = UNI_IMAGE_VIEW(tool->view)->vadj;
hadj = UNI_IMAGE_VIEW(tool->view)->hadj;
if ( pow(dx, 2) + pow(dy, 2) > 7 && UNI_IMAGE_VIEW(tool->view)->pixbuf != NULL &&
gtk_adjustment_get_upper(vadj) <= gtk_adjustment_get_page_size(vadj) &&
gtk_adjustment_get_upper(hadj) <= gtk_adjustment_get_page_size(hadj) )
vadj = uni_image_view_get_vadjustment(UNI_IMAGE_VIEW(tool->view));
hadj = uni_image_view_get_hadjustment(UNI_IMAGE_VIEW(tool->view));
if ( pow(dx, 2) + pow(dy, 2) > 7 && UNI_IMAGE_VIEW(tool->view)->pixbuf != NULL &&
gtk_adjustment_get_upper(vadj) <= gtk_adjustment_get_page_size(vadj) &&
gtk_adjustment_get_upper(hadj) <= gtk_adjustment_get_page_size(hadj) )
{
uni_dragger_button_release (tool, (GdkEventButton*)ev);
gtk_drag_begin (GTK_WIDGET(tool->view),
Expand Down Expand Up @@ -139,9 +139,9 @@ uni_dragger_pixbuf_changed (UniDragger * tool,

void
uni_dragger_paint_image (UniDragger * tool,
UniPixbufDrawOpts * opts, GdkWindow * window)
UniPixbufDrawOpts * opts, cairo_t *cr)
{
uni_pixbuf_draw_cache_draw (tool->cache, opts, window);
uni_pixbuf_draw_cache_draw (tool->cache, opts, cr);
}

/*************************************************************/
Expand Down Expand Up @@ -195,7 +195,7 @@ uni_dragger_init (UniDragger * tool)
{
tool->view = NULL;
tool->cache = uni_pixbuf_draw_cache_new ();

tool->pressed = FALSE;
tool->dragging = FALSE;
tool->drag_base_x = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/uni-dragger.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct _UniDragger {
GObject parent;
GtkWidget *view;
UniPixbufDrawCache *cache;

gboolean pressed;
gboolean dragging;

Expand All @@ -52,8 +52,8 @@ struct _UniDragger {
/* Current position of the mouse. */
int drag_ofs_x;
int drag_ofs_y;


/* Cursor to use when grabbing. */
GdkCursor *grab_cursor;
};
Expand Down Expand Up @@ -86,7 +86,7 @@ void uni_dragger_pixbuf_changed (UniDragger * tool,

void uni_dragger_paint_image (UniDragger * tool,
UniPixbufDrawOpts * opts,
GdkWindow * window);
cairo_t *cr);

G_END_DECLS
#endif /* __UNI_TOOL_DRAGGER_H__ */
Loading