Re: How to add a callback that can be called whenever the event loop calls an event handler?
Ok, take your advice. Thanks! 2014-07-24 1:43 GMT+08:00 Jasper St. Pierre : > So every single time somebody presses a key or clicks a button or even > moves your window, or even when a redraw is queued on the window, you want > to check the internal state of the window and possibly "do something"? That > sounds like a ridiculously bad design to me, personally. > > Just call the function whenever state might change. > > > On Wed, Jul 23, 2014 at 11:52 AM, Gang Chen > wrote: > >> The function checks the state of the application and does something >> accordingly. Because any code in an event handler may potentially change >> the state of the application, a quick method is adding the function as the >> "after" handler for every event. >> >> >> 2014-07-23 22:26 GMT+08:00 Jasper St. Pierre : >> >> Why, though? Why do you need this? >>> >>> >>> On Tue, Jul 22, 2014 at 9:40 PM, Gang Chen >>> wrote: >>> Yes, I need an "after" handler for every event. We can think it is called at the bottom of all event handlers. The function should be called not only after my own event handlers but also the widgets' event handlers. 2014-07-22 22:17 GMT+08:00 Paul Davis : > > > On Tue, Jul 22, 2014 at 8:55 AM, Jasper St. Pierre < > jstpie...@mecheye.net> wrote: > >> Call the function at the bottom of all your event handlers? >> >> I'd need more detail about your specific case in order to help you >> further. >> > > I think he wants the equivalent of an "after" handler for "event". If > he wanted a "before" handler for "event", I believe that already works (it > does in GTK+2, anyway) > > > >>> >>> >>> -- >>> Jasper >>> >> >> > > > -- > Jasper > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to add a callback that can be called whenever the event loop calls an event handler?
So every single time somebody presses a key or clicks a button or even moves your window, or even when a redraw is queued on the window, you want to check the internal state of the window and possibly "do something"? That sounds like a ridiculously bad design to me, personally. Just call the function whenever state might change. On Wed, Jul 23, 2014 at 11:52 AM, Gang Chen wrote: > The function checks the state of the application and does something > accordingly. Because any code in an event handler may potentially change > the state of the application, a quick method is adding the function as the > "after" handler for every event. > > > 2014-07-23 22:26 GMT+08:00 Jasper St. Pierre : > > Why, though? Why do you need this? >> >> >> On Tue, Jul 22, 2014 at 9:40 PM, Gang Chen >> wrote: >> >>> Yes, I need an "after" handler for every event. We can think it is >>> called at the bottom of all event handlers. The function should be called >>> not only after my own event handlers but also the widgets' event handlers. >>> >>> >>> 2014-07-22 22:17 GMT+08:00 Paul Davis : >>> >>> On Tue, Jul 22, 2014 at 8:55 AM, Jasper St. Pierre < jstpie...@mecheye.net> wrote: > Call the function at the bottom of all your event handlers? > > I'd need more detail about your specific case in order to help you > further. > I think he wants the equivalent of an "after" handler for "event". If he wanted a "before" handler for "event", I believe that already works (it does in GTK+2, anyway) >>> >> >> >> -- >> Jasper >> > > -- Jasper ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to add a callback that can be called whenever the event loop calls an event handler?
The function checks the state of the application and does something accordingly. Because any code in an event handler may potentially change the state of the application, a quick method is adding the function as the "after" handler for every event. 2014-07-23 22:26 GMT+08:00 Jasper St. Pierre : > Why, though? Why do you need this? > > > On Tue, Jul 22, 2014 at 9:40 PM, Gang Chen wrote: > >> Yes, I need an "after" handler for every event. We can think it is called >> at the bottom of all event handlers. The function should be called not only >> after my own event handlers but also the widgets' event handlers. >> >> >> 2014-07-22 22:17 GMT+08:00 Paul Davis : >> >> >>> >>> >>> On Tue, Jul 22, 2014 at 8:55 AM, Jasper St. Pierre < >>> jstpie...@mecheye.net> wrote: >>> Call the function at the bottom of all your event handlers? I'd need more detail about your specific case in order to help you further. >>> >>> I think he wants the equivalent of an "after" handler for "event". If he >>> wanted a "before" handler for "event", I believe that already works (it >>> does in GTK+2, anyway) >>> >>> >>> >> > > > -- > Jasper > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to add a callback that can be called whenever the event loop calls an event handler?
Why, though? Why do you need this? On Tue, Jul 22, 2014 at 9:40 PM, Gang Chen wrote: > Yes, I need an "after" handler for every event. We can think it is called > at the bottom of all event handlers. The function should be called not only > after my own event handlers but also the widgets' event handlers. > > > 2014-07-22 22:17 GMT+08:00 Paul Davis : > > >> >> >> On Tue, Jul 22, 2014 at 8:55 AM, Jasper St. Pierre > > wrote: >> >>> Call the function at the bottom of all your event handlers? >>> >>> I'd need more detail about your specific case in order to help you >>> further. >>> >> >> I think he wants the equivalent of an "after" handler for "event". If he >> wanted a "before" handler for "event", I believe that already works (it >> does in GTK+2, anyway) >> >> >> > -- Jasper ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to add a callback that can be called whenever the event loop calls an event handler?
Yes, I need an "after" handler for every event. We can think it is called at the bottom of all event handlers. The function should be called not only after my own event handlers but also the widgets' event handlers. 2014-07-22 22:17 GMT+08:00 Paul Davis : > > > > On Tue, Jul 22, 2014 at 8:55 AM, Jasper St. Pierre > wrote: > >> Call the function at the bottom of all your event handlers? >> >> I'd need more detail about your specific case in order to help you >> further. >> > > I think he wants the equivalent of an "after" handler for "event". If he > wanted a "before" handler for "event", I believe that already works (it > does in GTK+2, anyway) > > > ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to add a callback that can be called whenever the event loop calls an event handler?
On Tue, Jul 22, 2014 at 8:55 AM, Jasper St. Pierre wrote: > Call the function at the bottom of all your event handlers? > > I'd need more detail about your specific case in order to help you further. > I think he wants the equivalent of an "after" handler for "event". If he wanted a "before" handler for "event", I believe that already works (it does in GTK+2, anyway) ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: How to add a callback that can be called whenever the event loop calls an event handler?
Call the function at the bottom of all your event handlers? I'd need more detail about your specific case in order to help you further. On Tue, Jul 22, 2014 at 6:06 AM, Gang Chen wrote: > Hi, > > The callback does something common to every event handler. The callback > should be called after any event handler is called. How to accomplish this? > > Thanks, > Gang > > ___ > gtk-list mailing list > gtk-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-list > > -- Jasper ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list