Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar Lakkimsetti2016-03-02 18:25:47 -0500
committerSravan Kumar Lakkimsetti2016-04-21 07:08:43 -0400
commit9cb1add9fdf8082b3285309f092be2e2e9679b09 (patch)
tree48dcda576e4d4014adb386f879c51d8748549b68 /features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c
parent9fa023ca5c273cb706c1976b89805d6faed48b9a (diff)
downloadrt.equinox.framework-9cb1add9fdf8082b3285309f092be2e2e9679b09.tar.gz
rt.equinox.framework-9cb1add9fdf8082b3285309f092be2e2e9679b09.tar.xz
rt.equinox.framework-9cb1add9fdf8082b3285309f092be2e2e9679b09.zip
Bug 488910 - [HiDpi][GTK] splash screen should show the correct size
based on the scaling selected -Completed the necessary testing for the launcher. This solves the splash cropping problem Change-Id: I1a234c7842589a6acbedf83196b86ea66ee2387a Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
Diffstat (limited to 'features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c')
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtk.c31
1 files changed, 28 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();

Back to the top