Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to gtk3 #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 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
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -53,4 +53,4 @@ subdir('data')
subdir('man')
subdir('src')

meson.add_install_script('meson_post_install.py')
meson.add_install_script('meson_post_install.py')
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
8 changes: 4 additions & 4 deletions src/uni-dragger.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ 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;
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) )
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
2 changes: 1 addition & 1 deletion src/uni-dragger.h
Original file line number Diff line number Diff line change
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