Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c31
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.h3
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c3
3 files changed, 34 insertions, 3 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
index 1c60b3d00..2b25cc61e 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
@@ -226,11 +226,26 @@ int reuseWorkbench(_TCHAR** filePath, int timeout) {
return result;
}
+/* Get current scaling-factor */
+float scaleFactor ()
+{
+ float scaleFactor = 1;
+ GdkScreen * screen;
+ double resolution;
+ screen = gtk.gdk_screen_get_default();
+ resolution = gtk.gdk_screen_get_resolution (screen);
+ if (resolution <= 0) resolution = 96; // in unix and windows 100% corresponds to dpi of 96
+ resolution = ((int)(resolution/24 + 0.5)) * 24; //rounding the resolution to 25% multiples, 25% of 96 is 24.
+ scaleFactor = (float)(resolution/96);
+ return scaleFactor;
+}
/* Create and Display the Splash Window */
int showSplash( const char* featureImage )
{
GtkWidget *image;
- GdkPixbuf *pixbuf;
+ GdkPixbuf *pixbuf, *scaledPixbuf;
+ int width, height;
+ float scalingFactor;
if (splashHandle != 0)
return 0; /* already showing splash */
@@ -249,7 +264,17 @@ int showSplash( const char* featureImage )
gtk.g_signal_connect_data((gpointer)shellHandle, "destroy", (GtkSignalFunc)(gtk.gtk_widget_destroyed), &shellHandle, NULL, 0);
pixbuf = gtk.gdk_pixbuf_new_from_file(featureImage, NULL);
- image = gtk.gtk_image_new_from_pixbuf(pixbuf);
+ width = gtk.gdk_pixbuf_get_width(pixbuf);
+ height = gtk.gdk_pixbuf_get_height(pixbuf);
+ scalingFactor = scaleFactor();
+
+ if (scalingFactor > 1) {
+ scaledPixbuf = gtk.gdk_pixbuf_scale_simple(pixbuf, width * scalingFactor, height * scalingFactor, GDK_INTERP_BILINEAR);
+ } else {
+ scaledPixbuf = pixbuf;
+ }
+
+ image = gtk.gtk_image_new_from_pixbuf(scaledPixbuf);
if (pixbuf) {
gtk.g_object_unref(pixbuf);
}
@@ -258,7 +283,7 @@ int showSplash( const char* featureImage )
if (getOfficialName() != NULL)
gtk.gtk_window_set_title((GtkWindow*)(shellHandle), getOfficialName());
gtk.gtk_window_set_position((GtkWindow*)(shellHandle), GTK_WIN_POS_CENTER);
- gtk.gtk_window_resize((GtkWindow*)(shellHandle), gtk.gdk_pixbuf_get_width(pixbuf), gtk.gdk_pixbuf_get_height(pixbuf));
+ gtk.gtk_window_resize((GtkWindow*)(shellHandle), gtk.gdk_pixbuf_get_width(scaledPixbuf), gtk.gdk_pixbuf_get_height(scaledPixbuf));
gtk.gtk_widget_show_all((GtkWidget*)(shellHandle));
splashHandle = (long)shellHandle;
dispatchMessages();
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.h b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.h
index 5a233eea9..6e2cd52bd 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.h
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.h
@@ -48,9 +48,12 @@ struct GTK_PTRS {
GdkDisplay* (*gdk_display_get_default) ();
Display* (*gdk_x11_display_get_xdisplay) (GdkDisplay*);
GdkPixbuf* (*gdk_pixbuf_new_from_file) (const char*, GError **);
+ GdkPixbuf* (*gdk_pixbuf_scale_simple) (const GdkPixbuf*, int, int, GdkInterpType);
int (*gdk_pixbuf_get_width) (const GdkPixbuf*);
int (*gdk_pixbuf_get_height) (const GdkPixbuf*);
void (*gdk_set_program_class) (const char*);
+ GdkScreen * (*gdk_screen_get_default) ();
+ double (*gdk_screen_get_resolution) (GdkScreen *);
Window (*XGetSelectionOwner) (Display*, Atom);
void (*XSetSelectionOwner) (Display*, Atom, Window, Time);
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
index 2b956a92d..66c1a3b62 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
@@ -53,6 +53,8 @@ static FN_TABLE gdkFunctions[] = {
FN_TABLE_ENTRY(gdk_set_program_class, 1),
FN_TABLE_ENTRY(gdk_display_get_default, 1),
FN_TABLE_ENTRY(gdk_x11_display_get_xdisplay, 1),
+ FN_TABLE_ENTRY(gdk_screen_get_default, 1),
+ FN_TABLE_ENTRY(gdk_screen_get_resolution, 1),
{ NULL, NULL }
};
/* functions from libgdk_pixbuf-2.0 */
@@ -60,6 +62,7 @@ static FN_TABLE pixFunctions[] = {
FN_TABLE_ENTRY(gdk_pixbuf_new_from_file, 1),
FN_TABLE_ENTRY(gdk_pixbuf_get_width, 1),
FN_TABLE_ENTRY(gdk_pixbuf_get_height, 1),
+ FN_TABLE_ENTRY(gdk_pixbuf_scale_simple, 1),
{ NULL, NULL }
};
/* functions from libgobject-2.0 */

Back to the top