summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 38e0b14)
raw | patch | inline | side by side (parent: 38e0b14)
author | Eric Wertz <ericdwertz@gmail.com> | |
Mon, 20 Feb 2017 20:29:57 +0000 (15:29 -0500) | ||
committer | Eric Wertz <ericdwertz@gmail.com> | |
Mon, 20 Feb 2017 20:29:57 +0000 (15:29 -0500) |
dock_icon.c | patch | blob | history | |
ericdock.h | patch | blob | history | |
main.c | patch | blob | history | |
pager_item.c | patch | blob | history |
diff --git a/dock_icon.c b/dock_icon.c
index 07076e2955d5a33aeece9a53003a899aaa722531..ab5bf70274bd0d683464d6c334833d709141e3d8 100644 (file)
--- a/dock_icon.c
+++ b/dock_icon.c
#include "ericdock.h"
#include "dock_icon.h"
#include "tooltip_window.h"
-#include "xutils.h"
#include <stdio.h>
#include <ctype.h>
icon->class_group = wnck_window_get_class_group( window );
icon->instance_name = wnck_window_get_class_instance_name( window );
icon->icon_pixbuf = get_icon( window, (int)SCALE_VALUE( 32.0 ) );
+ g_object_ref( icon->icon_pixbuf );
icon->pager_items = NULL;
icon->icon_state = ICON_STATE_NORMAL;
diff --git a/ericdock.h b/ericdock.h
index 2ced79af569a1220a9601c158a28e346b0a0e2ac..6aabd9c6971adc1aca2179730588cd38b8bb522f 100644 (file)
--- a/ericdock.h
+++ b/ericdock.h
#define ERIC_DOCK_TOOLTIP_SHADOW_RADIUS 16.0
#define ERIC_DOCK_TOOLTIP_WIDTH ERIC_DOCK_TOOLTIP_SHADOW_RADIUS + 320.0
#define ERIC_DOCK_TOOLTIP_ITEM_HEIGHT 24.0
-#define UI_SCALE 2.0
+#define UI_SCALE interface_scale
#define SCALE_VALUE(x) (x)*UI_SCALE
#define BAR_HEIGHT 48.0
extern eric_window* dock_window;
extern eric_window* tooltip_window;
extern dock_icon* tooltip_window_icon;
+extern double interface_scale;
index 29ad61c4047f6aaad4fa0c6d4ebf6e30e27af115..78a442af8679f77d10bfda245151b8bbf097a375 100644 (file)
--- a/main.c
+++ b/main.c
#include "dock_icon.h"
#include "tooltip_window.h"
-#include "xutils.h"
int screen_width;
int screen_height;
+double interface_scale;
//Logic to add a window to the pager items.
//If a matching class group already exists it will be added to that, otherwise create
int found_class_group = 0;
dock_icon *icon, *new_dock_icon;
- WnckClassGroup* class = wnck_window_get_class_group( window );
- gchar* instance_name = wnck_window_get_class_instance_name( window );
+ const gchar* instance_name = wnck_window_get_class_instance_name( window );
for( icon_list = dock_icons; icon_list != NULL; icon_list = icon_list->next )
{
icon = (dock_icon*)icon_list->data;
@@ -315,6 +314,9 @@ static void wnck_window_closed( WnckScreen* screen, WnckWindow* window, gpointer
item = (pager_item*)pager_list->data;
if( item->window == window )
{
+ if( GDK_IS_PIXBUF( item->icon_pixbuf ) )
+ g_object_unref( item->icon_pixbuf );
+
icon->pager_items = g_list_remove( icon->pager_items, item );
free( item );
printf( "Removed pager item\n" );
g_signal_connect( screen, "active-window-changed", G_CALLBACK( wnck_active_window_changed ), NULL );
}
+void load_gsettings()
+{
+ GSettings* gsettings = g_settings_new ( "org.gnome.desktop.interface" );
+ interface_scale = (double)g_settings_get_uint( gsettings, "scaling-factor" );
+ if( interface_scale < 1.0 )
+ interface_scale = 1.0;
+}
+
int main( int argc, char* argv[] )
{
gtk_init( &argc, &argv );
+ load_gsettings();
setup_dock_window();
tooltip_window_create( dock_window->window );
diff --git a/pager_item.c b/pager_item.c
index 4c9886fdbe1f125579620b47add45b585b202362..83afcd363ee6347960b27691408973d62e19b3ac 100644 (file)
--- a/pager_item.c
+++ b/pager_item.c
void pager_item_icon_changed( WnckWindow* window, pager_item* item )
{
+ if( GDK_IS_PIXBUF( item->icon_pixbuf ) )
+ g_object_unref( item->icon_pixbuf );
+
item->icon_pixbuf = get_icon( window, (int)SCALE_VALUE( 16.0 ) );
+ g_object_ref( item->icon_pixbuf );
}
void pager_item_state_changed( WnckWindow* window, WnckWindowState changed_mask, WnckWindowState new_state, pager_item* item )
item->window = window;
strcpy( item->name, wnck_window_get_name( item->window ) );
item->icon_pixbuf = get_icon( window, (int)SCALE_VALUE( 16.0 ) );
+ g_object_ref( item->icon_pixbuf );
item->icon_state = ICON_STATE_NORMAL;
g_signal_connect( G_OBJECT( window ), "name-changed", G_CALLBACK( pager_item_name_changed ), (gpointer)item );