Skip to content

Commit

Permalink
Merge pull request #88 from anaselli/createImageAndBackground
Browse files Browse the repository at this point in the history
Create image from icon theme and adding a background to layout
  • Loading branch information
shundhammer authored Oct 19, 2022
2 parents 6869c86 + 8f88e12 commit 85acdf2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SET( VERSION_MAJOR "2" )
SET( VERSION_MINOR "52" )
SET( VERSION_PATCH "2" )
SET( VERSION_PATCH "3" )
SET( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SHA1}" )

12 changes: 11 additions & 1 deletion package/libyui-gtk.changes
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
-------------------------------------------------------------------
Mon Oct 17 19:06:36 CEST 2022 - [email protected]

- 2.52.3
- YGImage when creating an image looks if the given image is not a pathname
and try to get it from theme (issue #87)
- YGLayout fixing to show background picture (issue #86)

-------------------------------------------------------------------
Sun Sep 25 19:07:11 CEST 2022 - [email protected]

- Changed displayWidth/displayHeight implementation For GTK3
suggestion is to get the GdkWindow out of the GtkWindow widget
with gtk_widget_get_window(), and then use
gdk_display_get_monitor_at_window()
This fixes dnfdragora bug https://github.com/manatools/dnfdragora/issues/207
when it runs on Gnome desktop.
- 2.51.2
- 2.52.2

-------------------------------------------------------------------
Sun Jul 11 15:27:20 CET 2021 - [email protected]

- Fixed CMAKE_INSTALL_LIBDIR for pkgconfig

-------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions package/libyui-gtk.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@


Name: libyui-gtk
Version: 2.52.2
Version: 2.52.3
Release: 0
Source: %{name}-%{version}.tar.bz2

%define so_version 15
%define so_version 16
%define bin_name %{name}%{so_version}

BuildRequires: boost-devel
Expand Down
19 changes: 18 additions & 1 deletion src/YGImage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "YImage.h"
#include "ygtkimage.h"
#include <string.h>
#include <boost/filesystem.hpp>

static inline bool endsWith (const std::string &str1, const char *str2)
{
Expand Down Expand Up @@ -48,7 +49,23 @@ class YGImage : public YImage, public YGWidget
ygtk_image_set_from_pixbuf (image, pixbuf);
}
else
ygtk_image_set_from_file (image, filename.c_str(), animated);
{
if (animated)
ygtk_image_set_from_file (image, filename.c_str(), animated);
else {
if (boost::filesystem::path(filename).has_extension()) {
ygtk_image_set_from_file (image, filename.c_str(), animated);
}
else {
if (gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default(), filename.c_str(), GTK_ICON_SIZE_DIALOG, GTK_ICON_LOOKUP_USE_BUILTIN)) {
GdkPixbuf *pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(), filename.c_str(), GTK_ICON_SIZE_DIALOG, GTK_ICON_LOOKUP_USE_BUILTIN,NULL);
ygtk_image_set_from_pixbuf (image, pixbuf);
}
else // last chance to find an image
ygtk_image_set_from_file (image, filename.c_str(), animated);
}
}
}
}

virtual void setAutoScale (bool scale)
Expand Down
15 changes: 5 additions & 10 deletions src/YGLayout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,11 @@ class YGAlignment : public YAlignment, public YGWidget

static gboolean draw_event_cb (GtkWidget *widget, cairo_t *cr, YGAlignment *pThis, int width, int height)
{
gdk_cairo_set_source_pixbuf (cr, pThis->m_background_pixbuf, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);

cairo_rectangle (cr, 0, 0, width, height);
cairo_fill (cr);

gtk_container_propagate_draw (GTK_CONTAINER (widget),
gtk_bin_get_child(GTK_BIN (widget)), cr);

return TRUE;
gdk_cairo_set_source_pixbuf (cr, pThis->m_background_pixbuf, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_rectangle (cr, 0, 0, width, height);
cairo_paint(cr);
return FALSE;
}
};

Expand Down

0 comments on commit 85acdf2

Please sign in to comment.