Page 1 of 1

Move events different from Windows

Posted: Thu Mar 08, 2007 2:08 pm
by Trond
1. In Windows a #PB_Event_MoveWindow occurs when the window is minimized, not in Linux.

2. Sometimes this debugs "minimized" when it is run, but not always:

Code: Select all

#APPNAME = ""
#WndMain = 0

OpenWindow(#WndMain, 0, 0, 640, 480, #APPNAME, #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_SizeGadget | #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(#WndMain))

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_MoveWindow
      If GetWindowState(#WndMain) = #PB_Window_Minimize
        Debug "Minimized"
      EndIf
    Case #PB_Event_CloseWindow
      Break
  EndSelect
ForEver

Posted: Thu Mar 08, 2007 3:46 pm
by freak
Well, on Windows when a window gets minimized it is actually just moved offscreen, hence the move event.
On Linux, the window does not change position when it is minimized, hence no move event.
So the fired events correctly represent what actually happens.
Why should there be a move event on Linux when the window never changes position ?

Posted: Thu Mar 08, 2007 4:23 pm
by Trond
Shouldn't native PB commands hide the underlying API?

Posted: Thu Mar 08, 2007 4:28 pm
by Kaeru Gaman
that would mean to introduce a #PB_Event_MinimizeWindow that will work at least almost similar on the different platforms.

in fact, to react on MoveWindow to examine a minimize is a workaround.
works under winows, doesn't work under linux. normal for a workaround.

Posted: Thu Mar 08, 2007 5:32 pm
by freak
Trond wrote:Shouldn't native PB commands hide the underlying API?
Yes, but some OS behavious simply cannot be completly hidden.

The fact that Windows moves the window and Linux does not is something that we cannot work around.
Now, we could block the move event on Windows, or introduce a move event on Linux,
but then the events do not reflect the reality. This would in my opinion be a real bug then.

You watch for the move event if you want to know when a window gets moved,
so it should fire only when that happens, don't you think ?
The real mistake is in my opinion to watch for a move event when you really want
a minimize event.

Posted: Thu Mar 08, 2007 9:33 pm
by Trond
You watch for the move event if you want to know when a window gets moved,
so it should fire only when that happens, don't you think ?
Yes, but on Windows it fires not only when the window is moved, but when it is minimized. Which means I can't use it to detect when the window is moved, and not to detect when the window is minimized either.

Posted: Thu Mar 08, 2007 9:36 pm
by Kaeru Gaman
beautiful... so you have a Windows-Problem.

..and what should the PB team do with it?

Posted: Mon Mar 12, 2007 12:25 pm
by techjunkie
Trond wrote:
You watch for the move event if you want to know when a window gets moved,
so it should fire only when that happens, don't you think ?
Yes, but on Windows it fires not only when the window is moved, but when it is minimized. Which means I can't use it to detect when the window is moved, and not to detect when the window is minimized either.
You can't? :shock: Can't you check if the coords have changed after the move event?

Posted: Mon Mar 12, 2007 3:34 pm
by Trond
> Can't you check if the coords have changed after the move event?
So I have to store the window position to check if the move event actually moved the window, isn't that a bit overkill? I could do without a move event if I had to check whether the window moved manually.

Posted: Mon Mar 12, 2007 4:36 pm
by Kaeru Gaman
> I could do without a move event if I had to check whether the window moved manually.
then you'd have to check koordinates in every frame.
normally you'll use an event to indicate if you have to check something or not.

> So I have to store the window position to check if the move event actually moved the window
not really, because you know that on a minimize, the WindowState will change.
so, if the state hasn't changed, it's a standard move.

and I can only repeat:
It's a windows-problem, not a PB-Problem, so blame Billy, not Fred. ;)