[Closed] How do you detect a Minimize event?

Linux specific forum
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

[Closed] How do you detect a Minimize event?

Post 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 :)
Last edited by Env on Sun Dec 11, 2011 9:45 pm, edited 1 time in total.
Thanks!
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: How do you detect a Minimize event?

Post 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  
Windows 11, Manjaro, Raspberry Pi OS
Image
remi_meier
Enthusiast
Enthusiast
Posts: 468
Joined: Sat Dec 20, 2003 6:19 pm
Location: Switzerland

Re: How do you detect a Minimize event?

Post 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
Athlon64 3700+, 1024MB Ram, Radeon X1600
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

Re: How do you detect a Minimize event?

Post 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
Thanks!
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

Re: How do you detect a Minimize event?

Post 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.
Thanks!
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: How do you detect a Minimize event?

Post 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
Windows 11, Manjaro, Raspberry Pi OS
Image
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

Re: How do you detect a Minimize event?

Post 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 :)
Thanks!
Env
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 27, 2010 3:20 pm
Location: Wales, United Kingdom

Re: How do you detect a Minimize event?

Post 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 :)
Thanks!
Post Reply