You are not logged in.

#1 2008-10-26 08:47:48

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Xlib application repositions contents on resize very slowly/choppily

First up, I'm using Xlib for the experience, because I want to learn how X works and because I'm not ready to face the toolkits out there yet. I'll know when I'm ready; we all learn at different speeds.

So I'm writing this app and when I resize my window the code that figures out where to move a subwindow I have a button in is extremely slow.

Put another way, I have (among others) two windows, one is the app window and the other has a button in it; the button mousedown/move/up code works just fine, but the code that moves the button around when I resize the app window is really slow.

When the app window is resized I run the following (this is simplified, a bit more goes on but this is all that counts):

XGetGeometry(display, window, (Window *)&i, &i, &i, &windowwidth, &windowheight, (uint*)&i, (uint*)&i);

XMoveWindow(display, buttonwindow, 10, windowheight - 10);

I've tried running it on the CreateNotify event and now the Expose event. In a VNC display the code works perfectly: resizes are fast (with a bit of flickering, but that's to be expected, this app doesn't double-buffer since I'm not ready for that yet) while on my "main" screen the window will resize quickly but repositioning of the button only occurs every few hundred milliseconds.

I tried putting the code in my Expose event because I have code there that just breaks if event.xexpose.count > 0 (thus ignoring all but the last expose event) but that didn't really help.

I also tried moving the code back to the CreateNotify event, setting the buttonwindow background to white and commenting out everything in the Expose event to see if my expose calls were eating too much application time; there was a small, minutely appreciable speedup but not a lot. So I don't miss the tiny speedup lost because I uncommented the Expose event's contents (and set the buttonwindow background correctly) again.

Conversely, the GTK window created by "zenity --info --text 'hi'" will resize very fast, with its OK button being re-laid out properly at what appears to be every resize event.

Help for this isn't too important for my application, as window resizing in my situation is more of a feature than a requirement, but having it work quickly would be nice. It's also possible that I simply have a slow display and this is completely normal.

By the way, Motif applications are equally as slow here. hmm Are Motif apps (Arch has nedit as an example) slow for you on resize?

-dav7


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

#2 2008-10-26 09:07:15

robertp
Member
From: Warszawa, Poland
Registered: 2007-09-11
Posts: 123

Re: Xlib application repositions contents on resize very slowly/choppily

Maybe you miss calls to XFlush.

Offline

#3 2008-10-26 09:43:57

dav7
Member
From: Australia
Registered: 2008-02-08
Posts: 674

Re: Xlib application repositions contents on resize very slowly/choppily

I tried inserting some XFlush calls right after my XMoveWindow but unfortunately no luck. sad

Thanks, though!

-dav7


Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.

Offline

Board footer

Powered by FluxBB