Page 1 of 1

[Closed] How do you detect a Minimize event?

Posted: Fri Dec 09, 2011 12:14 pm
by Env
Hey,

My GDK programming is a little rusty, and I need help with detecting a window minimize event inside a callback...

So far I have;

Code: Select all

Case #GDK_WINDOW_STATE
  *wsEvt = *event
  If *wsEvt\new_window_state & #GDK_WINDOW_STATE_MAXIMIZED
    \EventType = #AEH_EventType_Maximise
    Debug "Maximise"
  ElseIf *wsEvt\new_window_state & #GDK_WINDOW_STATE_ICONIFIED
    \EventType = #AEH_EventType_Minimise
    Debug "Minimise"
  Else
    \EventType = #AEH_EventType_Restore
  EndIf
where *wsEvent is defined as '*GdkEventWindowState' cast from a 'GdkEvent' data structure.

Maximise works fine, and Restore is just a fall-back, but can't seem to get Minimise working at all.. and it's starting to annoy me a little lol


Please help, thanks :)

Re: How do you detect a Minimize event?

Posted: Fri Dec 09, 2011 8:53 pm
by idle
Can't you use pb's events instead of a callback?

Code: Select all

Select event 
 case #PB_Event_MaximizeWindow
   Debug "maximize"
 case #PB_Event_MinimizeWindow
   Debug "minimize"
EndSelect  

Re: How do you detect a Minimize event?

Posted: Fri Dec 09, 2011 8:56 pm
by remi_meier
Well, without running code I wont help you any more than
pointing you to this nice website:
http://www.codeproject.com/KB/cross-pla ... yIcon.aspx
Obviously you are not checking the events the same way
they do in window_state_event. Maybe that is the reason.

cheers
remi

Re: How do you detect a Minimize event?

Posted: Sat Dec 10, 2011 12:17 am
by Env
@idle - Unfortunately not as the project specification requires use of Callbacks for Windows and Linux. Thanks for the thought though :)

@remi - Thanks for the link, I'll go brew another coffee and see what I can make of it :).


Thanks again :D

Re: How do you detect a Minimize event?

Posted: Sun Dec 11, 2011 4:30 pm
by Env
After a lot of reading up, and prototyping code, for some bizarre reason, no events are being fired when the window is minimised... Must be down to the window manager running on the Linux machine...


Again thanks guys, appreciate the input.

Re: How do you detect a Minimize event?

Posted: Sun Dec 11, 2011 7:56 pm
by idle
It does mentions something about that it in the help, whats your setup?
Try the classwindowstest example in the snapshot of the OPB framework and see if that
sends reports the events for window1

Re: How do you detect a Minimize event?

Posted: Sun Dec 11, 2011 8:10 pm
by Env
Hi Idle,

I've PM'd you the source code of the project I'm working on for you to examine...

Will look into the OPB framework shortly, and report any findings...

Thanks :)

Re: How do you detect a Minimize event?

Posted: Sun Dec 11, 2011 9:45 pm
by Env
Ok, it has been determined that not all linux flavours will report a Minimise event.

Linux Mint 12 (My current setup) does not...
Ubuntu however has been reported to do so...


Pain in the backside, yep.. but nothing that I can really do about it....

Thanks all :)