Move events different from Windows

Linux specific forum
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Move events different from Windows

Post 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
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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 ?
quidquid Latine dictum sit altum videtur
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

Shouldn't native PB commands hide the underlying API?
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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.
oh... and have a nice day.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post 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.
quidquid Latine dictum sit altum videtur
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

beautiful... so you have a Windows-Problem.

..and what should the PB team do with it?
oh... and have a nice day.
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post 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?
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post 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. ;)
oh... and have a nice day.
Post Reply