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 |
Oblivion
Messages: 1092 Registered: August 2007
|
Senior 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
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[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 |
|
mirek
Messages: 13975 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
|
|
|
|
Goto Forum:
Current Time: Tue Apr 23 23:35:39 CEST 2024
Total time taken to generate the page: 0.02346 seconds
|