[Sugar-devel] Is it possible to hack the rotate key?
Hi all. Is it possible to hack the rotate key in XO? I wish to have the following working :: * Press the rotate key. This will rotate the window. * Just after that, have a callback function being called in sugar (this of course being possible only if the rotate key could be hacked). I will be thankful for any pointers. Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Is it possible to hack the rotate key?
Hi Ajay, On 18 Feb 2013, at 11:12, Ajay Garg a...@activitycentral.com wrote: Hi all. Is it possible to hack the rotate key in XO? I wish to have the following working :: * Press the rotate key. This will rotate the window. * Just after that, have a callback function being called in sugar (this of course being possible only if the rotate key could be hacked). I will be thankful for any pointers. This is a little out of my league, but I think you'll need to take a look at olpc-kbdshim [1] so see how things are currently triggered, in particular the olpc-rotate script. If you want to pickup aspect ration changes on the Sugar side, perhaps hook a gtk.gdk.screen_get_default().connect('size-changed', do something interesting) callback intp the sugar toolkit. I've implemented something simple like this in the Moon activity, so that it uses different layouts for landscape and portrait screen orientations [3]. Regards, --Gary [1] http://dev.laptop.org/git/users/pgf/olpc-kbdshim/ [2] http://dev.laptop.org/git/users/pgf/olpc-kbdshim/tree/olpc-rotate [3] http://git.sugarlabs.org/moon/mainline/blobs/master/moon.py Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Is it possible to hack the rotate key?
ajay wrote: Hi all. Is it possible to hack the rotate key in XO? I wish to have the following working :: * Press the rotate key. This will rotate the window. * Just after that, have a callback function being called in sugar (this of course being possible only if the rotate key could be hacked). as gary points out, the rotate key event (KEY_SWITCHVIDEOMODE) is caught by olpc-kbdshim. that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both. if there were consensus that running the command _and_ passing the event was safe and reasonable, maybe we could do that, though it doesn't feel right to me. but i also think gary's on the right track by suggesting you look at other window events to learn of the rotation changes -- after all, rotation doesn't require a button press. it can be caused by manual xrandr invocation, or simply by someone typing olpc-rotate left. paul I will be thankful for any pointers. Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com part 2 text/plain 129 ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel =- paul fox, p...@laptop.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Is it possible to hack the rotate key?
Thanks Gary and Paul. I tested Moon on build 28 on XO-4; and the rotation caused the canvas to be redrawn appropriately. Paul, I have two queries :: a) In Moon's code (as already told by Gary), the size-changed signal is used to call the callback that redraws the canvas. So, in this case, is the size-changed signal a result of the rotate-key-event (KEY_SWITCHVIDEOMODE), or size-changed signal is generated via some another mechanism? b) Is the behaviour of olpc-kbdshim the same for a XO-1.75 and a XO-4 (as far as that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both is concerned)? On Mon, Feb 18, 2013 at 7:18 PM, Paul Fox p...@laptop.org wrote: ajay wrote: Hi all. Is it possible to hack the rotate key in XO? I wish to have the following working :: * Press the rotate key. This will rotate the window. * Just after that, have a callback function being called in sugar (this of course being possible only if the rotate key could be hacked). as gary points out, the rotate key event (KEY_SWITCHVIDEOMODE) is caught by olpc-kbdshim. that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both. if there were consensus that running the command _and_ passing the event was safe and reasonable, maybe we could do that, though it doesn't feel right to me. but i also think gary's on the right track by suggesting you look at other window events to learn of the rotation changes -- after all, rotation doesn't require a button press. it can be caused by manual xrandr invocation, or simply by someone typing olpc-rotate left. paul I will be thankful for any pointers. Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com part 2 text/plain 129 ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel =- paul fox, p...@laptop.org ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel -- Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Is it possible to hack the rotate key?
ajay wrote: Thanks Gary and Paul. I tested Moon on build 28 on XO-4; and the rotation caused the canvas to be redrawn appropriately. okay. was that unexpected? Paul, I have two queries :: a) In Moon's code (as already told by Gary), the size-changed signal is used to call the callback that redraws the canvas. So, in this case, is the size-changed signal a result of the rotate-key-event (KEY_SWITCHVIDEOMODE), or size-changed signal is generated via some another mechanism? i don't know. b) Is the behaviour of olpc-kbdshim the same for a XO-1.75 and a XO-4 (as far as that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both is concerned)? yes. and for XO-1 and XO-1.5 as well. paul On Mon, Feb 18, 2013 at 7:18 PM, Paul Fox p...@laptop.org wrote: ajay wrote: Hi all. Is it possible to hack the rotate key in XO? I wish to have the following working :: * Press the rotate key. This will rotate the window. * Just after that, have a callback function being called in sugar (this of course being possible only if the rotate key could be hacked). as gary points out, the rotate key event (KEY_SWITCHVIDEOMODE) is caught by olpc-kbdshim. that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both. if there were consensus that running the command _and_ passing the event was safe and reasonable, maybe we could do that, though it doesn't feel right to me. but i also think gary's on the right track by suggesting you look at other window events to learn of the rotation changes -- after all, rotation doesn't require a button press. it can be caused by manual xrandr invocation, or simply by someone typing olpc-rotate left. paul I will be thankful for any pointers. Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com part 2 text/plain 129 ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel =- paul fox, p...@laptop.org ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel -- Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com =- paul fox, p...@laptop.org ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Is it possible to hack the rotate key?
On Mon, Feb 18, 2013 at 7:58 PM, Paul Fox p...@laptop.org wrote: ajay wrote: Thanks Gary and Paul. I tested Moon on build 28 on XO-4; and the rotation caused the canvas to be redrawn appropriately. okay. was that unexpected? No.. just wanted to state it explicitly that it worked :) Paul, I have two queries :: a) In Moon's code (as already told by Gary), the size-changed signal is used to call the callback that redraws the canvas. So, in this case, is the size-changed signal a result of the rotate-key-event (KEY_SWITCHVIDEOMODE), or size-changed signal is generated via some another mechanism? i don't know. ok :) b) Is the behaviour of olpc-kbdshim the same for a XO-1.75 and a XO-4 (as far as that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both is concerned)? yes. and for XO-1 and XO-1.5 as well. Great.. thanks !!! paul On Mon, Feb 18, 2013 at 7:18 PM, Paul Fox p...@laptop.org wrote: ajay wrote: Hi all. Is it possible to hack the rotate key in XO? I wish to have the following working :: * Press the rotate key. This will rotate the window. * Just after that, have a callback function being called in sugar (this of course being possible only if the rotate key could be hacked). as gary points out, the rotate key event (KEY_SWITCHVIDEOMODE) is caught by olpc-kbdshim. that code is written to either run a command attached to the event (currently /usr/bin/olpc-rotate), or pass the event through, but not both. if there were consensus that running the command _and_ passing the event was safe and reasonable, maybe we could do that, though it doesn't feel right to me. but i also think gary's on the right track by suggesting you look at other window events to learn of the rotation changes -- after all, rotation doesn't require a button press. it can be caused by manual xrandr invocation, or simply by someone typing olpc-rotate left. paul I will be thankful for any pointers. Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com part 2 text/plain 129 ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel =- paul fox, p...@laptop.org ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel -- Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com =- paul fox, p...@laptop.org ___ Devel mailing list de...@lists.laptop.org http://lists.laptop.org/listinfo/devel -- Regards, Ajay Garg Dextrose Developer Activity Central: http://activitycentral.com ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel