Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » SetRect doesn't work correctly on GTK
SetRect doesn't work correctly on GTK [message #52302] Mon, 02 September 2019 12:15 Go to next message
Oblivion is currently offline  Oblivion
Messages: 595
Registered: August 2007
Location: Turkey
Contributor
Hello,

SetRect doesn't seem to work correctly on GTK backend. (It works fine on X11).
Top-left position is always incorrect on below example (Tested on: Linux 5.2.9, GCC 9.1.0, Gnome 3.32.2)



#include <CtrlLib/CtrlLib.h>

using namespace Upp;

struct App : TopWindow {
	
	App() {
		SetRect(0, 0, 640, 480);
		Sizeable().Zoomable().CenterScreen();
	}

	bool Key(dword key, int count) override
	{
		Rect r = GetRect();

		if(key == K_UP)
			r.OffsetVert(-10);
		else
		if(key == K_DOWN)
			r.OffsetVert(10);
		else
		if(key == K_LEFT)
			r.OffsetHorz(-10);
		else
		if(key == K_RIGHT)
			r.OffsetHorz(10);
		else
		if(key == K_SPACE)
			r.right += 10;	// See especially this. Even this one moves the window downwards on GTK.

		SetRect(r);
		return true;
	}
};

GUI_APP_MAIN
{
	App().Run();
}


Best regards,
Oblivion


[Updated on: Mon, 02 September 2019 12:16]

Report message to a moderator

Re: SetRect doesn't work correctly on GTK [message #52315 is a reply to message #52302] Thu, 05 September 2019 09:50 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12096
Registered: November 2005
Ultimate Member
First of all, even when fixed, there is no guarantee that X11 manager will move the window where you expect.

But that aside, it seems to be fixed. The issue is interesting:

gdk_window_move_resize

has x, y, width, height parameters. However, while width/height are the client area size, x, y is position of topleft corner of window caption. Not really documented anywhere AFAIK....

Mirek
Re: SetRect doesn't work correctly on GTK [message #52317 is a reply to message #52315] Thu, 05 September 2019 10:38 Go to previous message
Oblivion is currently offline  Oblivion
Messages: 595
Registered: August 2007
Location: Turkey
Contributor
Hello Mirek,

Thank you very much!

The problem seems to be fixed now.

By the way, there are DLOGs left in the code (Ctrl::SetWndRect and Ctrl::SetRect).

Best regards,
Oblivion


Previous Topic: Taking snapshot of GLCtrl no longer works
Next Topic: GLDrawDemo NOGTK doesn't work
Goto Forum:
  


Current Time: Tue Nov 12 06:51:05 CET 2019

Total time taken to generate the page: 0.02083 seconds