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

[HiDPI] Toolbar Icons are small #111

Open
h0tc0d3 opened this issue Aug 7, 2022 · 10 comments
Open

[HiDPI] Toolbar Icons are small #111

h0tc0d3 opened this issue Aug 7, 2022 · 10 comments

Comments

@h0tc0d3
Copy link

h0tc0d3 commented Aug 7, 2022

gtk2 has issues with HiDPI and toolbar icons are small.
It would be nice to add an icons size in the interface settings. Or switch gtk2 to gtk3.
I tried to change the size of the icons, but it didn't work for me. It would be nice if someone solved this problem or helped me with it. Thank you!

diff --git a/libs/gtkutil/image.cpp b/libs/gtkutil/image.cpp
index e4122c846643..15aa79174224 100644
--- a/libs/gtkutil/image.cpp
+++ b/libs/gtkutil/image.cpp
@@ -61,7 +61,7 @@ GtkImage* image_new_from_file_with_mask( const char* filename ){
 }
 
 GtkImage* image_new_missing(){
-	return GTK_IMAGE( gtk_image_new_from_stock( GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_SMALL_TOOLBAR ) );
+	return GTK_IMAGE( gtk_image_new_from_stock( GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_DIALOG ) );
 }
 
 GtkImage* new_image( const char* filename ){
diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp
index ff4a872c6ea6..27aa4c7dacfe 100644
--- a/radiant/entityinspector.cpp
+++ b/radiant/entityinspector.cpp
@@ -1731,7 +1731,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 					gtk_table_set_col_spacings( table, 0 );
 					{
 						GtkWidget* button = gtk_button_new();
-						gtk_button_set_image( GTK_BUTTON( button ), gtk_image_new_from_stock( GTK_STOCK_APPLY, GTK_ICON_SIZE_MENU ) );
+						gtk_button_set_image( GTK_BUTTON( button ), gtk_image_new_from_stock( GTK_STOCK_APPLY, GTK_ICON_SIZE_DIALOG ) );
 						gtk_widget_set_can_focus( button, FALSE );
 						gtk_widget_set_tooltip_text( button, "Select by key" );
 						gtk_widget_show( button );
@@ -1742,7 +1742,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 					}
 					{
 						GtkWidget* button = gtk_button_new();
-						gtk_button_set_image( GTK_BUTTON( button ), gtk_image_new_from_stock( GTK_STOCK_APPLY, GTK_ICON_SIZE_MENU ) );
+						gtk_button_set_image( GTK_BUTTON( button ), gtk_image_new_from_stock( GTK_STOCK_APPLY, GTK_ICON_SIZE_DIALOG ) );
 						gtk_widget_set_can_focus( button, FALSE );
 						gtk_widget_set_tooltip_text( button, "Select by value" );
 						gtk_widget_show( button );
@@ -1753,7 +1753,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 					}
 					{
 						GtkWidget* button = gtk_button_new();
-						gtk_button_set_image( GTK_BUTTON( button ), gtk_image_new_from_stock( GTK_STOCK_APPLY, GTK_ICON_SIZE_MENU ) );
+						gtk_button_set_image( GTK_BUTTON( button ), gtk_image_new_from_stock( GTK_STOCK_APPLY, GTK_ICON_SIZE_DIALOG ) );
 						gtk_widget_set_can_focus( button, FALSE );
 						gtk_widget_set_tooltip_text( button, "Select by key + value" );
 						gtk_widget_show( button );
@@ -1809,7 +1809,7 @@ GtkWidget* EntityInspector_constructWindow( GtkWindow* toplevel ){
 					}
 					{
 						GtkWidget* button = gtk_toggle_button_new();
-						GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_SMALL_TOOLBAR );
+						GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_ZOOM_IN, GTK_ICON_SIZE_DIALOG );
 						gtk_button_set_image( GTK_BUTTON( button ), image );
 						gtk_button_set_relief( GTK_BUTTON( button ), GTK_RELIEF_NONE );
 						gtk_widget_set_can_focus( button, FALSE );
diff --git a/radiant/gtktheme.cpp b/radiant/gtktheme.cpp
index 5f176bad839e..25b72adb2bed 100644
--- a/radiant/gtktheme.cpp
+++ b/radiant/gtktheme.cpp
@@ -334,7 +334,7 @@ GtkWidget* create_rc_window() {
 	gtk_widget_show( hbox6 );
 	gtk_container_add( GTK_CONTAINER( alignment2 ), hbox6 );
 
-	image1 = gtk_image_new_from_stock( "gtk-revert-to-saved", GTK_ICON_SIZE_BUTTON );
+	image1 = gtk_image_new_from_stock( "gtk-revert-to-saved", GTK_ICON_SIZE_DIALOG );
 	gtk_widget_set_name( image1, "image1" );
 	gtk_widget_show( image1 );
 	gtk_box_pack_start( GTK_BOX( hbox6 ), image1, FALSE, FALSE, 0 );
diff --git a/radiant/mainframe.cpp b/radiant/mainframe.cpp
index f974e9e4eaf1..42e42efc4389 100644
--- a/radiant/mainframe.cpp
+++ b/radiant/mainframe.cpp
@@ -2623,6 +2623,7 @@ void Manipulators_constructToolbar( GtkToolbar* toolbar ){
 
 GtkToolbar* create_main_toolbar( MainFrame::EViewStyle style ){
 	GtkToolbar* toolbar = toolbar_new();
+	gtk_toolbar_set_icon_size(toolbar, GTK_ICON_SIZE_DIALOG);
 
 	File_constructToolbar( toolbar );
 	toolbar_append_space( toolbar );
@@ -3109,14 +3110,17 @@ void MainFrame::Create(){
 
 			if( g_Layout_enableMainToolbar.m_value ){
 				GtkToolbar* main_toolbar = create_main_toolbar( CurrentStyle() );
+				gtk_toolbar_set_icon_size(main_toolbar, GTK_ICON_SIZE_DIALOG);
 				gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( main_toolbar ), TRUE, TRUE, 0 );
 			}
 			if ( g_Layout_enableFilterToolbar.m_value ){
 				GtkToolbar* filter_toolbar = create_filter_toolbar();
+				gtk_toolbar_set_icon_size(filter_toolbar, GTK_ICON_SIZE_DIALOG);
 				gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( filter_toolbar ), TRUE, TRUE, 0 );
 			}
 			if ( g_Layout_enablePluginToolbar.m_value ){
 				GtkToolbar* plugin_toolbar = create_plugin_toolbar();
+				gtk_toolbar_set_icon_size(plugin_toolbar, GTK_ICON_SIZE_DIALOG);
 				gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( plugin_toolbar ), TRUE, TRUE, 0 );
 			}
 		}
@@ -3125,6 +3129,7 @@ void MainFrame::Create(){
 	else{
 		if( g_Layout_enableMainToolbar.m_value ){
 			GtkToolbar* main_toolbar = create_main_toolbar( CurrentStyle() );
+			gtk_toolbar_set_icon_size(main_toolbar, GTK_ICON_SIZE_DIALOG);
 			gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( main_toolbar ), FALSE, FALSE, 0 );
 		}
 		if ( g_Layout_enablePluginToolbar.m_value || g_Layout_enableFilterToolbar.m_value ){
@@ -3133,6 +3138,7 @@ void MainFrame::Create(){
 			gtk_widget_show( hbox );
 			if ( g_Layout_enablePluginToolbar.m_value ){
 				GtkToolbar* plugin_toolbar = create_plugin_toolbar();
+				gtk_toolbar_set_icon_size(plugin_toolbar, GTK_ICON_SIZE_DIALOG);
 				if ( g_Layout_enableFilterToolbar.m_value ){
 					gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( plugin_toolbar ), FALSE, FALSE, 0 );
 				}
@@ -3142,6 +3148,7 @@ void MainFrame::Create(){
 			}
 			if ( g_Layout_enableFilterToolbar.m_value ){
 				GtkToolbar* filter_toolbar = create_filter_toolbar();
+				gtk_toolbar_set_icon_size(filter_toolbar, GTK_ICON_SIZE_DIALOG);
 				gtk_box_pack_start( GTK_BOX( hbox ), GTK_WIDGET( filter_toolbar ), TRUE, TRUE, 0 );
 			}
 		}
diff --git a/radiant/texwindow.cpp b/radiant/texwindow.cpp
index 335db2a91cbf..2e0b84b8848f 100644
--- a/radiant/texwindow.cpp
+++ b/radiant/texwindow.cpp
@@ -1940,7 +1940,7 @@ void TextureBrowser_constructTagNotebook(){
 }
 
 void TextureBrowser_constructSearchButton(){
-	GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_SMALL_TOOLBAR );
+	GtkWidget* image = gtk_image_new_from_stock( GTK_STOCK_FIND, GTK_ICON_SIZE_DIALOG );
 	g_TextureBrowser.m_search_button = gtk_button_new();
 	g_signal_connect( G_OBJECT( g_TextureBrowser.m_search_button ), "clicked", G_CALLBACK( TextureBrowser_searchTags ), NULL );
 	gtk_widget_set_tooltip_text( g_TextureBrowser.m_search_button, "Search with selected tags" );
@@ -2059,19 +2059,20 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
 
 		toolbar = toolbar_new();
 		gtk_box_pack_start( GTK_BOX( vbox ), GTK_WIDGET( toolbar ), FALSE, FALSE, 0 );
+		gtk_toolbar_set_icon_size(toolbar, GTK_ICON_SIZE_DIALOG);
 
 		//view menu button
 		GtkToolButton* button = toolbar_append_button( toolbar, "View", "texbro_view.png", PointerCaller<GtkMenu, Popup_View_Menu>( menu_view ) );
-//		gtk_widget_set_size_request( GTK_WIDGET( button ), 24, 24 ); // 24 is minimal here for non scissored icon with any gtk theme
+		gtk_widget_set_size_request( GTK_WIDGET( button ), 48, 48 ); // 24 is minimal here for non scissored icon with any gtk theme
 
 		//show detached menu over floating tex bro
 		gtk_menu_attach_to_widget( menu_view, GTK_WIDGET( button ), NULL );
 
 		button = toolbar_append_button( toolbar, "Find / Replace...", "texbro_gtk-find-and-replace.png", "FindReplaceTextures" );
-//		gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
+		gtk_widget_set_size_request( GTK_WIDGET( button ), 48, 48 );
 
 		button = toolbar_append_button( toolbar, "Flush & Reload Shaders", "texbro_refresh.png", "RefreshShaders" );
-//		gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
+		gtk_widget_set_size_request( GTK_WIDGET( button ), 48, 48 );
 	}
 	{	// filter entry
 		GtkWidget* entry = g_TextureBrowser.m_filter_entry = gtk_entry_new();
@@ -2152,7 +2153,7 @@ GtkWidget* TextureBrowser_constructWindow( GtkWindow* toplevel ){
 			TextureBrowser_constructTagsMenu( menu_tags );
 
 			GtkToolButton* button = toolbar_append_button( toolbar, "Tags", "texbro_tags.png", PointerCaller<GtkMenu, Popup_View_Menu>( menu_tags ) );
-//			gtk_widget_set_size_request( GTK_WIDGET( button ), 22, 22 );
+			gtk_widget_set_size_request( GTK_WIDGET( button ), 48, 48 );
 
 			//show detached menu over floating tex bro and main wnd...
 			gtk_menu_attach_to_widget( menu_tags, GTK_WIDGET( button ), NULL );
diff --git a/tools/quake3/common/vfs.cpp b/tools/quake3/common/vfs.cpp
index d1e7f948bed6..163c6032e87e 100644
--- a/tools/quake3/common/vfs.cpp
+++ b/tools/quake3/common/vfs.cpp
@@ -125,7 +125,7 @@ static void vfsInitPakFile( const char *filename ){
 						filename_inzip,
 						*(unz_s*)uf,
 						pak,
-						file_info.uncompressed_size
+						static_cast<guint32>(file_info.uncompressed_size)
 					} );
 				}
 			} while( unzGoToNextFile( uf ) == UNZ_OK );
@Garux
Copy link
Owner

Garux commented Aug 8, 2022

I recall being able to fatten buttons via Gtk theme.
Also upscaling button images does the trick
image
There is buildable Gtk3 branch, but it is not an option, because its GLArea doesn't support compatibility profile, while rendering code is mostly ogl 1.1
I'm trying Qt now, it's HiDPI aware, idk though which steps are required to have it functioning.

@Garux
Copy link
Owner

Garux commented Nov 2, 2022

Qt has arrived 9d3d204, something is following DPI, something is not (windows)
image

@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 2, 2022

@Garux that's great news, I'll go check on my linux.

@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 2, 2022

It looks very good. But there is a bug, I see my desktop wallpaper. And the workspaces didn't scale correctly.
netradiant-custom-hidpi

@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 2, 2022

Another error: "QBasicTimer::start: QBasicTimer can only be used with threads started with QThread"

@Garux
Copy link
Owner

Garux commented Nov 2, 2022

Viewports bug is either wayland or scaling. Scaling + no wayland in ubuntu:
image
Your screenshot looks as if pplication is scaled as a whole.
Must be QOpenGLWidget issue, can't google it though.

Timer issue source is unkown either, as radiant itself is only using single thread. Does it happen after any specific actions?

@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 2, 2022

Yes, it's a wayland. At the moment I can not reproduce the error. core dump was without debug information.

QT_QPA_PLATFORM=wayland
QT_SCALE_FACTOR=1

in sway config

output * scale 2

@Garux
Copy link
Owner

Garux commented Nov 8, 2022

Viewports scaling problem is likely fixed here 15ca706
As for wayland, there are many unsolvable issues seemingly, as no pointer warp, no widget grab, no glClear.

@h0tc0d3
Copy link
Author

h0tc0d3 commented Nov 8, 2022

@Garux Thanks.

@Garux
Copy link
Owner

Garux commented Nov 21, 2022

Solution of wayland issues is to use xwayland by running as QT_QPA_PLATFORM=xcb ./radiant.x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants