Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: Great! Could someone send me the WIki password? Then I'll add a line under Miscellaneous. sent privately p
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: > Great! Could someone send me the WIki password? Then I'll add a line under > "Miscellaneous". sent privately p
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: Another version of the patch is attached, this time hopefully readable by everyone... no its octet-stream now. next guess is .txt :) cant be this code: +// GUI_DONTSWAPCB_VISIBLE reveals checkbox for switching Ctrl and Meta on Mac: +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +#define GUI_DONTSWAPCB_VISIBLE true +#endif +#endif +#ifndef GUI_DONTSWAPCB_VISIBLE + dontswapCB-setVisible(false); +#endif written as: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + dontswapCB-setVisible(false); +#endif ? pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 19, 2010, at 12:02 AM, Pavel Sanda wrote: Jens Nöckel wrote: Another version of the patch is attached, this time hopefully readable by everyone... no its octet-stream now. next guess is .txt :) Or using a different mailer, sigh. cant be this code: +// GUI_DONTSWAPCB_VISIBLE reveals checkbox for switching Ctrl and Meta on Mac: +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +#define GUI_DONTSWAPCB_VISIBLE true +#endif +#endif +#ifndef GUI_DONTSWAPCB_VISIBLE + dontswapCB-setVisible(false); +#endif written as: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + dontswapCB-setVisible(false); +#endif No, this would be the wrong way around. If you really want even fewer #ifdef, one could say this: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + dontswapCB-setVisible(false); +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + dontswapCB-setVisible(true); +#endif But then the actual code on Mac would execute two calls to setVisible instead of one, which just seems slightly more inelegant. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + dontswapCB-setVisible(false); +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + dontswapCB-setVisible(true); +#endif But then the actual code on Mac would execute two calls to setVisible instead of one, which just seems slightly more inelegant. i see. what you feel better with bool swapcb=false; #ifdef Q_WS_MACX #if QT_VERSION 0x040600 swapcb=true; #endif dontswapCB-setVisible(swapcb); pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 19, 2010, at 8:25 AM, Pavel Sanda wrote: Jens Nöckel wrote: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + dontswapCB-setVisible(false); +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + dontswapCB-setVisible(true); +#endif But then the actual code on Mac would execute two calls to setVisible instead of one, which just seems slightly more inelegant. i see. what you feel better with bool swapcb=false; #ifdef Q_WS_MACX #if QT_VERSION 0x040600 swapcb=true; #endif dontswapCB-setVisible(swapcb); pavel That's perfect - please feel free to modify my patch this way. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: That's perfect - please feel free to modify my patch this way. its in. perhaps you want to add oneliner into misc section of newinlyx20 wiki... pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 19, 2010, at 3:03 PM, Pavel Sanda wrote: Jens Nöckel wrote: That's perfect - please feel free to modify my patch this way. its in. perhaps you want to add oneliner into misc section of newinlyx20 wiki... pavel Great! Could someone send me the WIki password? Then I'll add a line under Miscellaneous. Thanks, Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: > Another version of the patch is attached, this time hopefully readable by > everyone... no its octet-stream now. next guess is .txt :) cant be this code: +// GUI_DONTSWAPCB_VISIBLE reveals checkbox for switching Ctrl and Meta on Mac: +#ifdef Q_WS_MACX +#if QT_VERSION > 0x040600 + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +#define GUI_DONTSWAPCB_VISIBLE true +#endif +#endif +#ifndef GUI_DONTSWAPCB_VISIBLE + dontswapCB->setVisible(false); +#endif written as: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); +#ifdef Q_WS_MACX +#if QT_VERSION > 0x040600 + dontswapCB->setVisible(false); +#endif ? pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 19, 2010, at 12:02 AM, Pavel Sanda wrote: > Jens Nöckel wrote: >> Another version of the patch is attached, this time hopefully readable by >> everyone... > > no its octet-stream now. next guess is .txt :) > Or using a different mailer, sigh. > cant be this code: > > +// GUI_DONTSWAPCB_VISIBLE reveals checkbox for switching Ctrl and Meta on > Mac: > > +#ifdef Q_WS_MACX > +#if QT_VERSION > 0x040600 > + connect(dontswapCB, SIGNAL(toggled(bool)), > + this, SIGNAL(changed())); > +#define GUI_DONTSWAPCB_VISIBLE true > +#endif > +#endif > +#ifndef GUI_DONTSWAPCB_VISIBLE > + dontswapCB->setVisible(false); > +#endif > > > written as: > > + connect(dontswapCB, SIGNAL(toggled(bool)), > + this, SIGNAL(changed())); > +#ifdef Q_WS_MACX > +#if QT_VERSION > 0x040600 > + dontswapCB->setVisible(false); > +#endif > No, this would be the wrong way around. If you really want even fewer #ifdef, one could say this: + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); + dontswapCB->setVisible(false); +#ifdef Q_WS_MACX +#if QT_VERSION > 0x040600 + dontswapCB->setVisible(true); +#endif But then the actual code on Mac would execute two calls to setVisible instead of one, which just seems slightly more inelegant. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: > + connect(dontswapCB, SIGNAL(toggled(bool)), > + this, SIGNAL(changed())); > + dontswapCB->setVisible(false); > +#ifdef Q_WS_MACX > +#if QT_VERSION > 0x040600 > + dontswapCB->setVisible(true); > +#endif > > But then the actual code on Mac would execute two calls to setVisible instead > of one, which just seems slightly more inelegant. i see. what you feel better with bool swapcb=false; #ifdef Q_WS_MACX #if QT_VERSION > 0x040600 swapcb=true; #endif dontswapCB->setVisible(swapcb); pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 19, 2010, at 8:25 AM, Pavel Sanda wrote: > Jens Nöckel wrote: >> + connect(dontswapCB, SIGNAL(toggled(bool)), >> + this, SIGNAL(changed())); >> + dontswapCB->setVisible(false); >> +#ifdef Q_WS_MACX >> +#if QT_VERSION > 0x040600 >> + dontswapCB->setVisible(true); >> +#endif >> >> But then the actual code on Mac would execute two calls to setVisible >> instead of one, which just seems slightly more inelegant. > > i see. what you feel better with > > bool swapcb=false; > > #ifdef Q_WS_MACX > #if QT_VERSION > 0x040600 > swapcb=true; > #endif > > dontswapCB->setVisible(swapcb); > > pavel That's perfect - please feel free to modify my patch this way. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: > That's perfect - please feel free to modify my patch this way. its in. perhaps you want to add oneliner into misc section of newinlyx20 wiki... pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 19, 2010, at 3:03 PM, Pavel Sanda wrote: > Jens Nöckel wrote: >> That's perfect - please feel free to modify my patch this way. > > its in. perhaps you want to add oneliner into misc section of newinlyx20 > wiki... > pavel Great! Could someone send me the WIki password? Then I'll add a line under "Miscellaneous". Thanks, Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 17, 2010, at 3:48 PM, Pavel Sanda wrote: Stephan Witt wrote: So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. I'd have no problem with that. +1 OK, here is the new patch for the current LyX 2.0 in svn trunk: modifierKey-2.diff Description: Binary data The check box is added in Preferences Editing Keyboard/Mouse, but only if we're on MacOSX with Qt 4.6.0. The default setting is to leave everything as it is now. When the check box is set, the Mac control key will act as LyX Ctrl and the Mac Command key will act as LyX Meta (which is the reverse of the current default mapping, and is preferred by emacs users). No matter what the setting is, the MacOSX-specific commands for Quit, Hide and Preferences will be unchanged (i.e., they continue to use the Mac Command key). Thanks, Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 18, 2010, at 10:14 AM, Jens Nöckel wrote: On Sep 17, 2010, at 3:48 PM, Pavel Sanda wrote: Stephan Witt wrote: So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. I'd have no problem with that. +1 OK, here is the new patch for the current LyX 2.0 in svn trunk: modifierKey-2.diff The check box is added in Preferences Editing Keyboard/Mouse, but only if we're on MacOSX with Qt 4.6.0. The default setting is to leave everything as it is now. When the check box is set, the Mac control key will act as LyX Ctrl and the Mac Command key will act as LyX Meta (which is the reverse of the current default mapping, and is preferred by emacs users). No matter what the setting is, the MacOSX-specific commands for Quit, Hide and Preferences will be unchanged (i.e., they continue to use the Mac Command key). Another comment I forgot to add (but had mentioned earlier): the change takes effect only after restarting LyX (because the keynoard shortcuts in the menu bar have to be rebuilt). Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
OK, here is the new patch for the current LyX 2.0 in svn trunk: please note that its difficult to directly comment on your pacthes, because the attachment is signed as octet-stream type. one need for examples application/text (maybe only naming the attachment .patch would help, depends on your mailer...) some comments: this, SIGNAL(changed())); connect(scrollzoomValueCO, SIGNAL(activated(int)), this, SIGNAL(changed())); + +// GUI_DONTSWAPCB_VISIBLE reveals checkbox for switching Ctrl and Meta on Mac: +#ifdef Q_WS_MACX +#if QT_VERSION 0x040600 + connect(dontswapCB, SIGNAL(toggled(bool)), + this, SIGNAL(changed())); i would be happy if we can get rid of any additional #ifdefs. it needs to be tested but i guess except this part: + dontswapCB-setVisible(false); all other parts of code could be normally written and no GUI_DONTSWAPCB_VISIBLE needed. + stringDo not swap Meta and Control keys/string add something like on MacOSX... void LyXRC::setDefaults() { + mac_dontswap_ctrl_meta = false; concerning the default value - this is the current value lyx uses or are we changing defaults? also put this assignment more down between other rc settings concerning keyboard. other parts looks fine. (dow we have already GPL statement from you?) pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
Another version of the patch is attached, this time hopefully readable by everyone...There was one additional line in GuiApplication.cpp that I took out - it was commented out anyway and corresponded to the initial test I described inhttp://wiki.lyx.org/Mac/LyXmodifierKeys#sMac.LyXmodifierKeys_5(which is no longer the way I do things). It was put in by Stephan in rev. 34812. modifierKey-3.patch Description: Binary data Below are some more responses:On Sep 18, 2010, at 12:48 PM, Pavel Sanda wrote:i would be happy if we can get rid of any additional #ifdefs. it needs to be testedbut i guess except this part:+ dontswapCB-setVisible(false);all other parts of code could be normally written and no GUI_DONTSWAPCB_VISIBLE needed.I took those two #ifdef out.+ stringDo not swap Meta and Control keys/stringadd something like "on MacOSX"...Since this text only shows up on Mac anyway, I just modified the text slightly and added your suggestion in a tooltip instead. void LyXRC::setDefaults() {+ mac_dontswap_ctrl_meta = false;concerning the default value - this is the current value lyx uses or are we changing defaults?also put this assignment more down between other rc settings concerning keyboard.Yes, the default _is_ to swap Apple and Ctrl keys. That's what makes this so annoying to emacs users. And by _not_ swapping these modifier keys we are changing the default. The check box unchecked when the default setting is desired. Basically I'm following the nomenclature as dictated by Qt's convoluted Mac behavior (their Attribute "MacDontSwapCtrlAndMeta" is false by default)... other parts looks fine. (dow we have already GPL statement from you?)Probably not - I'll send it in the next message.Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 17, 2010, at 3:48 PM, Pavel Sanda wrote: > Stephan Witt wrote: >>> So if I put Pavel's suggestion in, would my checkbox patch be acceptable? >>> As I said, I'd be OK without GUI, but I don't really think it will hurt >>> anyone to have it in there, with the default being not to change the key >>> mapping. >> >> I'd have no problem with that. > > +1 OK, here is the new patch for the current LyX 2.0 in svn trunk: modifierKey-2.diff Description: Binary data The check box is added in Preferences > Editing > Keyboard/Mouse, but only if we're on MacOSX with Qt > 4.6.0. The default setting is to leave everything as it is now. When the check box is set, the Mac control key will act as LyX Ctrl and the Mac Command key will act as LyX Meta (which is the reverse of the current default mapping, and is preferred by emacs users). No matter what the setting is, the MacOSX-specific commands for "Quit", "Hide" and "Preferences" will be unchanged (i.e., they continue to use the Mac Command key). Thanks, Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 18, 2010, at 10:14 AM, Jens Nöckel wrote: > > On Sep 17, 2010, at 3:48 PM, Pavel Sanda wrote: > >> Stephan Witt wrote: So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. >>> >>> I'd have no problem with that. >> >> +1 > > OK, here is the new patch for the current LyX 2.0 in svn trunk: > > > The check box is added in Preferences > Editing > Keyboard/Mouse, but only if > we're on MacOSX with Qt > 4.6.0. The default setting is to leave everything > as it is now. When the check box is set, the Mac control key will act as LyX > Ctrl and the Mac Command key will act as LyX Meta (which is the reverse of > the current default mapping, and is preferred by emacs users). No matter what > the setting is, the MacOSX-specific commands for "Quit", "Hide" and > "Preferences" will be unchanged (i.e., they continue to use the Mac Command > key). Another comment I forgot to add (but had mentioned earlier): the change takes effect only after restarting LyX (because the keynoard shortcuts in the menu bar have to be rebuilt). Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
> OK, here is the new patch for the current LyX 2.0 in svn trunk: please note that its difficult to directly comment on your pacthes, because the attachment is signed as octet-stream type. one need for examples application/text (maybe only naming the attachment .patch would help, depends on your mailer...) some comments: > this, SIGNAL(changed())); > connect(scrollzoomValueCO, SIGNAL(activated(int)), > this, SIGNAL(changed())); > + > +// GUI_DONTSWAPCB_VISIBLE reveals checkbox for switching Ctrl and Meta on > Mac: > +#ifdef Q_WS_MACX > +#if QT_VERSION > 0x040600 > + connect(dontswapCB, SIGNAL(toggled(bool)), > + this, SIGNAL(changed())); i would be happy if we can get rid of any additional #ifdefs. it needs to be tested but i guess except this part: > + dontswapCB->setVisible(false); all other parts of code could be normally written and no GUI_DONTSWAPCB_VISIBLE needed. > + Do not swap Meta and Control keys add something like "on MacOSX"... > void LyXRC::setDefaults() > { > + mac_dontswap_ctrl_meta = false; concerning the default value - this is the current value lyx uses or are we changing defaults? also put this assignment more down between other rc settings concerning keyboard. other parts looks fine. (dow we have already GPL statement from you?) pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
Another version of the patch is attached, this time hopefully readable by everyone... There was one additional line in GuiApplication.cpp that I took out - it was commented out anyway and corresponded to the initial test I described in http://wiki.lyx.org/Mac/LyXmodifierKeys#sMac.LyXmodifierKeys_5 (which is no longer the way I do things). It was put in by Stephan in rev. 34812. modifierKey-3.patch Description: Binary data Below are some more responses:On Sep 18, 2010, at 12:48 PM, Pavel Sanda wrote:i would be happy if we can get rid of any additional #ifdefs. it needs to be testedbut i guess except this part:+ dontswapCB->setVisible(false);all other parts of code could be normally written and no GUI_DONTSWAPCB_VISIBLE needed.I took those two #ifdef out.+ Do not swap Meta and Control keysadd something like "on MacOSX"...Since this text only shows up on Mac anyway, I just modified the text slightly and added your suggestion in a tooltip instead. void LyXRC::setDefaults() {+ mac_dontswap_ctrl_meta = false;concerning the default value - this is the current value lyx uses or are we changing defaults?also put this assignment more down between other rc settings concerning keyboard.Yes, the default _is_ to swap Apple and Ctrl keys. That's what makes this so annoying to emacs users. And by _not_ swapping these modifier keys we are changing the default. The check box unchecked when the default setting is desired. Basically I'm following the nomenclature as dictated by Qt's convoluted Mac behavior (their Attribute "MacDontSwapCtrlAndMeta" is false by default)... other parts looks fine. (dow we have already GPL statement from you?)Probably not - I'll send it in the next message.Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 07:57 schrieb Jens Nöckel: On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: Am 17.09.2010 um 06:31 schrieb Jens Nöckel: On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt 4.6. JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens Hi again, it's been a while, but now I have a patch for lyx-devel/trunk that implements the customizable switching of Control and Modifier keys on Mac OS X for LyX 2.0 with Qt 4.6. Hi Jens, I'm not the nestor here but I'd like to welcome you. Although I still have (at least) one open problem, maybe someone here wants to try it out (I tested it and it works with the svn checkout): modifierKey.diff.zip As a brief explanation: By setting a preference, you decide whether Ctrl and Meta are swapped next time LyX starts up (as is currently hard-coded in LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? My main question is still the following: There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. An alternative would be to patch PrefInput.ui at the configure stage when MacOSX is detected. This is not that nice. You have to move to something like PrefInput.ui.in for SVN check-in and remove the real PrefInput.ui from VCS. Next you have to care for at least 3 build systems - autotools, cmake and scons. I would strongly vote against that move. But there I would need advice from someone who knows the LyX build system. Two formal points: * You sent a patch of 4k size as zip file - so you make it impossible to view it inline. I
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 16, 2010, at 11:24 PM, Stephan Witt wrote: Am 17.09.2010 um 07:57 schrieb Jens Nöckel: On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: Am 17.09.2010 um 06:31 schrieb Jens Nöckel: On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt 4.6. JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens Hi again, it's been a while, but now I have a patch for lyx-devel/trunk that implements the customizable switching of Control and Modifier keys on Mac OS X for LyX 2.0 with Qt 4.6. Hi Jens, I'm not the nestor here but I'd like to welcome you. Although I still have (at least) one open problem, maybe someone here wants to try it out (I tested it and it works with the svn checkout): modifierKey.diff.zip As a brief explanation: By setting a preference, you decide whether Ctrl and Meta are swapped next time LyX starts up (as is currently hard-coded in LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? My main question is still the following: There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. An alternative would be to patch PrefInput.ui at the configure stage when MacOSX is detected. This is not that nice. You have to move to something like PrefInput.ui.in for SVN check-in and remove the real PrefInput.ui from VCS. Next you have to care for at least 3 build systems - autotools, cmake and scons. I would strongly vote against that move. But there I would need advice from someone who knows the LyX build system. Two formal points: * You sent a patch of 4k size as zip file
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 08:49 schrieb Jens Nöckel: On Sep 16, 2010, at 11:24 PM, Stephan Witt wrote: Am 17.09.2010 um 07:57 schrieb Jens Nöckel: On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: Am 17.09.2010 um 06:31 schrieb Jens Nöckel: On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: Hi again, it's been a while, but now I have a patch for lyx-devel/trunk that implements the customizable switching of Control and Modifier keys on Mac OS X for LyX 2.0 with Qt 4.6. Although I still have (at least) one open problem, maybe someone here wants to try it out (I tested it and it works with the svn checkout): modifierKey.diff.zip As a brief explanation: By setting a preference, you decide whether Ctrl and Meta are swapped next time LyX starts up (as is currently hard-coded in LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? My main question is still the following: There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. A better option would be to create it hidden and make it visible only when it is sensible. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. Hi Stephan, it would be OK with me to just have a preference without UI, but I wanted to explore the UI because Pavel already gave me a nice starting point for how to do it (earlier in this thread). I can understand you very good. (I cannot see Pavels E-Mails in this thread - but that's not the point, non-relevant). For completeness, here's the missing passage: http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg160178.html Thanks. Anyway, about the philosophical reasons for why this is an issue in need of fixing, see the LyX Wiki (the discussion goes back many years, so I can't repeat it all here): http://wiki.lyx.org/Mac/LyXmodifierKeys I took a quick look. And had the idea to make the default for the new RC variable dynamic. It can depend on the keyboard binding. When mac.bind is used make it false, for emacs.bind make it true. In principle that sounds interesting because mac.bind would be really weird with the switched modifiers. But what if a user has a custom bind file (e.g., I have a custom xemacs.bind)? The naming of bind files is arbitrary and therefore shouldn't be the basis for a dynamic adjustment of the RC variable. But what about extending that idea a little: if the bind file name is not emacs.bind or xemacs.bind, it would most likely be including one or the other, so we could search the file for \bind_file (x)emacs.bind ... The more I think about it, the more it seems like a hack though. There should be an explicit declaration of whether the switch is desired, LyX probably shouldn't try to guess what the user wants. You're right. My proposal was not thought to the end. But I can imagine to make it three-state: No, Yes, Auto. When Yes then swap, when No then don't swap, when Auto then check the bindings for some emacs like usage. But it remains guessing... When reading the wiki I got the impression the common emacs user wants to swap the modifiers. Regarding a global Qt option: can that work if the libs are included as a private framework? I don't know if global Qt options exist and how they work if any. But, I'd guess the storage of that would be some plist file in your home dir. In that sense with global I meant global for the user - not the machine. In the standalone LyX, there is no system-wide Qt that is being used, so any Qt setting would have to be done at the application level, right? I have to check Qt4 at first to answer that. In general that's a question for packaging of LyX. I think LyX should work with Qt4
Re: Solving the Meta/Control key swap problem on Mac OS X
Stephan Witt st.w...@gmx.net writes: You're right. My proposal was not thought to the end. But I can imagine to make it three-state: No, Yes, Auto. When Yes then swap, when No then don't swap, when Auto then check the bindings for some emacs like usage. But it remains guessing... The reasonable solution would be to allow something like \swap_ctrl_and_option_by_default_on_mac true (with a shorter name :) in bind files. JMarc
Re: Solving the Meta/Control key swap problem on Mac OS X
Stephan Witt wrote: ... its little bit hard to follow the thread when people dont kill the unused top lines There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. if you mean hide for other archs on solution would be to have normal rc variable and in gui code put something like #ifndef MACOSX chanegBindingCB.setVisible(false); #endif pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 17, 2010, at 3:53 AM, Pavel Sanda wrote: Stephan Witt wrote: ... its little bit hard to follow the thread when people dont kill the unused top lines There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. if you mean hide for other archs on solution would be to have normal rc variable and in gui code put something like #ifndef MACOSX chanegBindingCB.setVisible(false); #endif That's exactly what I was looking for! And regarding Stefan's observation that the prescription on the Wiki for a plist item for this Qt attribute doesn't work: yes, without patching Qt I can currently only see application-specific mechanisms for setting this dontSwap attribute. So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 21:57 schrieb Jens Nöckel: On Sep 17, 2010, at 3:53 AM, Pavel Sanda wrote: Stephan Witt wrote: ... its little bit hard to follow the thread when people dont kill the unused top lines I don't know, but I would look for a function to hide the UI element conditionally. if you mean hide for other archs on solution would be to have normal rc variable and in gui code put something like #ifndef MACOSX chanegBindingCB.setVisible(false); #endif That's exactly what I was looking for! Fine. And regarding Stephan's observation that the prescription on the Wiki for a plist item for this Qt attribute doesn't work: yes, without patching Qt I can currently only see application-specific mechanisms for setting this dontSwap attribute. I tried a joke but failed, obviously. :-) So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. I'd have no problem with that. Stephan
Re: Solving the Meta/Control key swap problem on Mac OS X
Stephan Witt wrote: So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. I'd have no problem with that. +1 pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 07:57 schrieb Jens Nöckel: > > On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: > >> Am 17.09.2010 um 06:31 schrieb Jens Nöckel: >> >>> >>> On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: >>> On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: > Le 05/06/2010 18:45, Jens Nöckel a écrit : >> So my question to the LyX dev team would be: could you add a preference >> item that lets the user set some flag, so that the call >> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); >> can be made dependent on that flag? Maybe the simplest place to put this >> in would be not in the Preferences, but in the Mac-only part of the LyX >> menu. But on the other hand, that wouldn't look very consistent - so the >> Preferences, under "Keyboard/Mouse" would perhaps be the most logical >> location where to add such a flag. Any ideas on that would be great - >> I'm sure it should be possible to add a little extra button somewhere. > > This should be done in a way that does not break with qt < 4.6. > > JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION > 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens >>> >>> Hi again, >>> it's been a while, but now I have a patch for lyx-devel/trunk that >>> implements the customizable switching of Control and Modifier keys on Mac >>> OS X for LyX 2.0 with Qt 4.6. >> >> Hi Jens, >> >> I'm not the nestor here but I'd like to welcome you. >> >>> Although I still have (at least) one open problem, maybe someone here wants >>> to try it out (I tested it and it works with the svn checkout): >>> >>> >>> >>> As a brief explanation: By setting a preference, you decide whether Ctrl >>> and Meta are swapped next time LyX starts up (as is currently hard-coded in >>> LyX/Mac), or not (as many emacs users prefer). >> >> (Sorry, I should have raised my hand earlier.) >> >> I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it >> and decided I don't like it. >> I don't know any application where you can swap Ctrl and Meta. Neither on >> MacOSX nor on Windows or Linux. >> The option to do so with Qt4 makes me think that this shouldn't be done at >> application level. >> It should be a global Qt preference. That's my personal opinion. But of >> course it's a matter of taste... >> Is there any other application using that feature (except emacs I guess)? >> >>> My main question is still the following: >>> There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines >>> the role of Control and Apple keys, but this new UI element will appear for >>> all versions of Qt and all platforms, even though it has an effect only >>> with Qt >= 4.6 (in the other files, my changes are only applied when the >>> right OS and version is detected). In order to make this checkbox disappear >>> when it's not needed, what is the best approach? Is there a Qt or LyX >>> directive for conditional UI elements that I could use in PrefInput.ui >>> (similar to compiler directives as in my previous post)? My guess is that >>> the answer is no. >> >> I don't know, but I would look for a function to hide the UI element >> conditionally. >> >> Perhaps it is enough to have that preference without UI at first, document >> it and ask users later about the >> acceptance and how urgent the UI is needed. >> >>> An alternative would be to patch PrefInput.ui at the configure stage when >>> MacOSX is detected. >> >> This is not that nice. You have to move to something like
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 16, 2010, at 11:24 PM, Stephan Witt wrote: > Am 17.09.2010 um 07:57 schrieb Jens Nöckel: > >> >> On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: >> >>> Am 17.09.2010 um 06:31 schrieb Jens Nöckel: >>> On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: > > On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: > >> Le 05/06/2010 18:45, Jens Nöckel a écrit : >>> So my question to the LyX dev team would be: could you add a preference >>> item that lets the user set some flag, so that the call >>> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); >>> can be made dependent on that flag? Maybe the simplest place to put >>> this in would be not in the Preferences, but in the Mac-only part of >>> the LyX menu. But on the other hand, that wouldn't look very consistent >>> - so the Preferences, under "Keyboard/Mouse" would perhaps be the most >>> logical location where to add such a flag. Any ideas on that would be >>> great - I'm sure it should be possible to add a little extra button >>> somewhere. >> >> This should be done in a way that does not break with qt < 4.6. >> >> JMarc > > I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and > successfully connected it to a checkbox in the Keyboard Preferences. The > default value is false (meaning the current standard behavior - this > follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the > line > > > setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); > > in GuiApplication::execBatchCommands() > > right after > > #ifdef Q_WS_MACX > > Everything is working great. I can set the preference and it gets applied > when the application is re-launched (maybe one could apply it > immediately, but I wasn't sure how I can then make sure that the menu > shortcuts are updated to display the correct modifier keys). If anyone > sees something wrong with this approach, please let me know. > > To avoid problems with earlier Qt versions, I will (but haven't yet) > enclose all my code in: > > #if QT_VERSION > 0x040600 > ... > #endif > > and if it isn't already there, I'll also put in > #ifdef Q_WS_MACX > ... > #endif > > All my testing was done with the official lyx-1.6.1 source release, so my > next hurdle will be to get an SVN version to build. I haven't tried that > for several years, so I may have some questions tomorrow... if all else > fails, I could perhaps just send the diffs to the official release. > > Jens > > Hi again, it's been a while, but now I have a patch for lyx-devel/trunk that implements the customizable switching of Control and Modifier keys on Mac OS X for LyX 2.0 with Qt 4.6. >>> >>> Hi Jens, >>> >>> I'm not the nestor here but I'd like to welcome you. >>> Although I still have (at least) one open problem, maybe someone here wants to try it out (I tested it and it works with the svn checkout): As a brief explanation: By setting a preference, you decide whether Ctrl and Meta are swapped next time LyX starts up (as is currently hard-coded in LyX/Mac), or not (as many emacs users prefer). >>> >>> (Sorry, I should have raised my hand earlier.) >>> >>> I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it >>> and decided I don't like it. >>> I don't know any application where you can swap Ctrl and Meta. Neither on >>> MacOSX nor on Windows or Linux. >>> The option to do so with Qt4 makes me think that this shouldn't be done at >>> application level. >>> It should be a global Qt preference. That's my personal opinion. But of >>> course it's a matter of taste... >>> Is there any other application using that feature (except emacs I guess)? >>> My main question is still the following: There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt >= 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. >>> >>> I don't know, but I would look for a function to hide the UI element >>> conditionally. >>> >>> Perhaps it is enough to have that preference without UI at first, document >>> it and ask users later about the >>> acceptance and how urgent the UI is needed. >>>
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 08:49 schrieb Jens Nöckel: > > On Sep 16, 2010, at 11:24 PM, Stephan Witt wrote: > >> Am 17.09.2010 um 07:57 schrieb Jens Nöckel: >> >>> >>> On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: >>> Am 17.09.2010 um 06:31 schrieb Jens Nöckel: > > On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: > > Hi again, > it's been a while, but now I have a patch for lyx-devel/trunk that > implements the customizable switching of Control and Modifier keys on Mac > OS X for LyX 2.0 with Qt 4.6. > Although I still have (at least) one open problem, maybe someone here > wants to try it out (I tested it and it works with the svn checkout): > > > > As a brief explanation: By setting a preference, you decide whether Ctrl > and Meta are swapped next time LyX starts up (as is currently hard-coded > in LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? > My main question is still the following: > There is now a new checkbox in frontend/qt/ui/PrefInput.ui which > determines the role of Control and Apple keys, but this new UI element > will appear for all versions of Qt and all platforms, even though it has > an effect only with Qt >= 4.6 (in the other files, my changes are only > applied when the right OS and version is detected). In order to make this > checkbox disappear when it's not needed, what is the best approach? Is > there a Qt or LyX directive for conditional UI elements that I could use > in PrefInput.ui (similar to compiler directives as in my previous post)? > My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. A better option would be to create it hidden and make it visible only when it is sensible. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. >>> >>> Hi Stephan, >>> it would be OK with me to just have a preference without UI, but I wanted >>> to explore the UI because Pavel already gave me a nice starting point for >>> how to do it (earlier in this thread). >> >> I can understand you very good. >> >> (I cannot see Pavels E-Mails in this thread - but that's not the point, >> non-relevant). >> > For completeness, here's the missing passage: > http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg160178.html Thanks. > >>> Anyway, about the philosophical reasons for why this is an issue in need of >>> fixing, see the LyX Wiki (the discussion goes back many years, so I can't >>> repeat it all here): http://wiki.lyx.org/Mac/LyXmodifierKeys >> >> I took a quick look. And had the idea to make the default for the new RC >> variable dynamic. It can depend on the keyboard binding. >> When mac.bind is used make it false, for emacs.bind make it true. >> > > In principle that sounds interesting because mac.bind would be really weird > with the switched modifiers. But what if a user has a custom bind file (e.g., > I have a custom xemacs.bind)? The naming of bind files is arbitrary and > therefore shouldn't be the basis for a dynamic adjustment of the RC variable. > But what about extending that idea a little: if the bind file name is not > emacs.bind or xemacs.bind, it would most likely be including one or the > other, so we could search the file for "\bind_file (x)emacs.bind" ... > > The more I think about it, the more it seems like a hack though. There should > be an explicit declaration of whether the switch is desired, LyX probably > shouldn't try to guess what the user wants. You're right. My proposal was not thought to the end. But I can imagine to make it three-state: No, Yes, Auto. When "Yes" then swap, when "No" then don't swap, when "Auto" then check the bindings for some emacs like usage. But it remains guessing... When reading the wiki I got the impression the "common" emacs user wants to swap the modifiers. > >>> Regarding a global Qt option: can that work if the libs are included as a >>> private framework? >> >> I don't know if global Qt options exist and how they work if any. But, I'd >> guess the storage of that would be some plist file in your home dir. >> In that sense with global I meant global for the user - not the machine.
Re: Solving the Meta/Control key swap problem on Mac OS X
Stephan Wittwrites: > You're right. My proposal was not thought to the end. But I can > imagine to make it three-state: No, Yes, Auto. When "Yes" then swap, > when "No" then don't swap, when "Auto" then check the bindings for > some emacs like usage. But it remains guessing... The reasonable solution would be to allow something like \swap_ctrl_and_option_by_default_on_mac true (with a shorter name :) in bind files. JMarc
Re: Solving the Meta/Control key swap problem on Mac OS X
Stephan Witt wrote: ... its little bit hard to follow the thread when people dont kill the unused top lines > > There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines > > the role of Control and Apple keys, but this new UI element will appear for > > all versions of Qt and all platforms, even though it has an effect only > > with Qt >= 4.6 (in the other files, my changes are only applied when the > > right OS and version is detected). In order to make this checkbox disappear > > when it's not needed, what is the best approach? Is there a Qt or LyX > > directive for conditional UI elements that I could use in PrefInput.ui > > (similar to compiler directives as in my previous post)? My guess is that > > the answer is no. > > I don't know, but I would look for a function to hide the UI element > conditionally. if you mean hide for other archs on solution would be to have normal rc variable and in gui code put something like #ifndef MACOSX chanegBindingCB.setVisible(false); #endif pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 17, 2010, at 3:53 AM, Pavel Sanda wrote: > Stephan Witt wrote: > > ... its little bit hard to follow the thread when people dont kill the unused > top lines > >>> There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines >>> the role of Control and Apple keys, but this new UI element will appear for >>> all versions of Qt and all platforms, even though it has an effect only >>> with Qt >= 4.6 (in the other files, my changes are only applied when the >>> right OS and version is detected). In order to make this checkbox disappear >>> when it's not needed, what is the best approach? Is there a Qt or LyX >>> directive for conditional UI elements that I could use in PrefInput.ui >>> (similar to compiler directives as in my previous post)? My guess is that >>> the answer is no. >> >> I don't know, but I would look for a function to hide the UI element >> conditionally. > > if you mean hide for other archs on solution would be to have normal rc > variable and in gui code put something like > #ifndef MACOSX > chanegBindingCB.setVisible(false); > #endif That's exactly what I was looking for! And regarding Stefan's observation that the prescription on the Wiki for a plist item for this Qt attribute doesn't work: yes, without patching Qt I can currently only see application-specific mechanisms for setting this "dontSwap" attribute. So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As I said, I'd be OK without GUI, but I don't really think it will hurt anyone to have it in there, with the default being not to change the key mapping. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 21:57 schrieb Jens Nöckel: > > On Sep 17, 2010, at 3:53 AM, Pavel Sanda wrote: > >> Stephan Witt wrote: >> >> ... its little bit hard to follow the thread when people dont kill the >> unused top lines >>> >>> I don't know, but I would look for a function to hide the UI element >>> conditionally. >> >> if you mean hide for other archs on solution would be to have normal rc >> variable and in gui code put something like >> #ifndef MACOSX >> chanegBindingCB.setVisible(false); >> #endif > > That's exactly what I was looking for! Fine. > And regarding Stephan's observation that the prescription on the Wiki for a > plist item for this Qt attribute doesn't work: yes, without patching Qt I can > currently only see application-specific mechanisms for setting this > "dontSwap" attribute. I tried a joke but failed, obviously. :-) > So if I put Pavel's suggestion in, would my checkbox patch be acceptable? As > I said, I'd be OK without GUI, but I don't really think it will hurt anyone > to have it in there, with the default being not to change the key mapping. I'd have no problem with that. Stephan
Re: Solving the Meta/Control key swap problem on Mac OS X
Stephan Witt wrote: > > So if I put Pavel's suggestion in, would my checkbox patch be acceptable? > > As I said, I'd be OK without GUI, but I don't really think it will hurt > > anyone to have it in there, with the default being not to change the key > > mapping. > > I'd have no problem with that. +1 pavel
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 06:31 schrieb Jens Nöckel: On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt 4.6. JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens Hi again, it's been a while, but now I have a patch for lyx-devel/trunk that implements the customizable switching of Control and Modifier keys on Mac OS X for LyX 2.0 with Qt 4.6. Hi Jens, I'm not the nestor here but I'd like to welcome you. Although I still have (at least) one open problem, maybe someone here wants to try it out (I tested it and it works with the svn checkout): modifierKey.diff.zip As a brief explanation: By setting a preference, you decide whether Ctrl and Meta are swapped next time LyX starts up (as is currently hard-coded in LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? My main question is still the following: There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. An alternative would be to patch PrefInput.ui at the configure stage when MacOSX is detected. This is not that nice. You have to move to something like PrefInput.ui.in for SVN check-in and remove the real PrefInput.ui from VCS. Next you have to care for at least 3 build systems - autotools, cmake and scons. I would strongly vote against that move. But there I would need advice from someone who knows the LyX build system. Two formal points: * You sent a patch of 4k size as zip file - so you make it impossible to view it inline. I had the patch to save and unpack to read it. :( * The indentation of your code is by blanks. The convention is to use tabs. Stephan
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: Am 17.09.2010 um 06:31 schrieb Jens Nöckel: On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt 4.6. JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens Hi again, it's been a while, but now I have a patch for lyx-devel/trunk that implements the customizable switching of Control and Modifier keys on Mac OS X for LyX 2.0 with Qt 4.6. Hi Jens, I'm not the nestor here but I'd like to welcome you. Although I still have (at least) one open problem, maybe someone here wants to try it out (I tested it and it works with the svn checkout): modifierKey.diff.zip As a brief explanation: By setting a preference, you decide whether Ctrl and Meta are swapped next time LyX starts up (as is currently hard-coded in LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? My main question is still the following: There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines the role of Control and Apple keys, but this new UI element will appear for all versions of Qt and all platforms, even though it has an effect only with Qt = 4.6 (in the other files, my changes are only applied when the right OS and version is detected). In order to make this checkbox disappear when it's not needed, what is the best approach? Is there a Qt or LyX directive for conditional UI elements that I could use in PrefInput.ui (similar to compiler directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. An alternative would be to patch PrefInput.ui at the configure stage when MacOSX is detected. This is not that nice. You have to move to something like PrefInput.ui.in for SVN check-in and remove the real PrefInput.ui from VCS. Next you have to care for at least 3 build systems - autotools, cmake and scons. I would strongly vote against that move. But there I would need advice from someone who knows the LyX build system. Two formal points: * You sent a patch of 4k size as zip file - so you make it impossible to view it inline. I had the patch to save and unpack to read it. :(
Re: Solving the Meta/Control key swap problem on Mac OS X
Am 17.09.2010 um 06:31 schrieb Jens Nöckel: > > On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: > >> >> On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: >> >>> Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under "Keyboard/Mouse" would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. >>> >>> This should be done in a way that does not break with qt < 4.6. >>> >>> JMarc >> >> I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and >> successfully connected it to a checkbox in the Keyboard Preferences. The >> default value is false (meaning the current standard behavior - this follows >> the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line >> >> >> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); >> >> in GuiApplication::execBatchCommands() >> >> right after >> >> #ifdef Q_WS_MACX >> >> Everything is working great. I can set the preference and it gets applied >> when the application is re-launched (maybe one could apply it immediately, >> but I wasn't sure how I can then make sure that the menu shortcuts are >> updated to display the correct modifier keys). If anyone sees something >> wrong with this approach, please let me know. >> >> To avoid problems with earlier Qt versions, I will (but haven't yet) enclose >> all my code in: >> >> #if QT_VERSION > 0x040600 >> ... >> #endif >> >> and if it isn't already there, I'll also put in >> #ifdef Q_WS_MACX >> ... >> #endif >> >> All my testing was done with the official lyx-1.6.1 source release, so my >> next hurdle will be to get an SVN version to build. I haven't tried that for >> several years, so I may have some questions tomorrow... if all else fails, >> I could perhaps just send the diffs to the official release. >> >> Jens >> >> > > Hi again, > it's been a while, but now I have a patch for lyx-devel/trunk that implements > the customizable switching of Control and Modifier keys on Mac OS X for LyX > 2.0 with Qt 4.6. Hi Jens, I'm not the nestor here but I'd like to welcome you. > Although I still have (at least) one open problem, maybe someone here wants > to try it out (I tested it and it works with the svn checkout): > > > > As a brief explanation: By setting a preference, you decide whether Ctrl and > Meta are swapped next time LyX starts up (as is currently hard-coded in > LyX/Mac), or not (as many emacs users prefer). (Sorry, I should have raised my hand earlier.) I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and decided I don't like it. I don't know any application where you can swap Ctrl and Meta. Neither on MacOSX nor on Windows or Linux. The option to do so with Qt4 makes me think that this shouldn't be done at application level. It should be a global Qt preference. That's my personal opinion. But of course it's a matter of taste... Is there any other application using that feature (except emacs I guess)? > My main question is still the following: > There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines > the role of Control and Apple keys, but this new UI element will appear for > all versions of Qt and all platforms, even though it has an effect only with > Qt >= 4.6 (in the other files, my changes are only applied when the right OS > and version is detected). In order to make this checkbox disappear when it's > not needed, what is the best approach? Is there a Qt or LyX directive for > conditional UI elements that I could use in PrefInput.ui (similar to compiler > directives as in my previous post)? My guess is that the answer is no. I don't know, but I would look for a function to hide the UI element conditionally. Perhaps it is enough to have that preference without UI at first, document it and ask users later about the acceptance and how urgent the UI is needed. > An alternative would be to patch PrefInput.ui at the configure stage when > MacOSX is detected. This is not that nice. You have to move to something like PrefInput.ui.in for SVN check-in and remove the real PrefInput.ui from VCS. Next you have to care for at least 3 build systems - autotools, cmake and scons. I would strongly vote against that move. > But there I would need advice from someone who knows the LyX build system. Two formal points: * You sent a patch of 4k size as zip file - so you make it impossible to view it
Re: Solving the Meta/Control key swap problem on Mac OS X
On Sep 16, 2010, at 10:30 PM, Stephan Witt wrote: > Am 17.09.2010 um 06:31 schrieb Jens Nöckel: > >> >> On Jun 5, 2010, at 7:40 PM, Jens Nöckel wrote: >> >>> >>> On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: >>> Le 05/06/2010 18:45, Jens Nöckel a écrit : > So my question to the LyX dev team would be: could you add a preference > item that lets the user set some flag, so that the call > setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); > can be made dependent on that flag? Maybe the simplest place to put this > in would be not in the Preferences, but in the Mac-only part of the LyX > menu. But on the other hand, that wouldn't look very consistent - so the > Preferences, under "Keyboard/Mouse" would perhaps be the most logical > location where to add such a flag. Any ideas on that would be great - I'm > sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt < 4.6. JMarc >>> >>> I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and >>> successfully connected it to a checkbox in the Keyboard Preferences. The >>> default value is false (meaning the current standard behavior - this >>> follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the >>> line >>> >>> >>> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); >>> >>> in GuiApplication::execBatchCommands() >>> >>> right after >>> >>> #ifdef Q_WS_MACX >>> >>> Everything is working great. I can set the preference and it gets applied >>> when the application is re-launched (maybe one could apply it immediately, >>> but I wasn't sure how I can then make sure that the menu shortcuts are >>> updated to display the correct modifier keys). If anyone sees something >>> wrong with this approach, please let me know. >>> >>> To avoid problems with earlier Qt versions, I will (but haven't yet) >>> enclose all my code in: >>> >>> #if QT_VERSION > 0x040600 >>> ... >>> #endif >>> >>> and if it isn't already there, I'll also put in >>> #ifdef Q_WS_MACX >>> ... >>> #endif >>> >>> All my testing was done with the official lyx-1.6.1 source release, so my >>> next hurdle will be to get an SVN version to build. I haven't tried that >>> for several years, so I may have some questions tomorrow... if all else >>> fails, I could perhaps just send the diffs to the official release. >>> >>> Jens >>> >>> >> >> Hi again, >> it's been a while, but now I have a patch for lyx-devel/trunk that >> implements the customizable switching of Control and Modifier keys on Mac OS >> X for LyX 2.0 with Qt 4.6. > > Hi Jens, > > I'm not the nestor here but I'd like to welcome you. > >> Although I still have (at least) one open problem, maybe someone here wants >> to try it out (I tested it and it works with the svn checkout): >> >> >> >> As a brief explanation: By setting a preference, you decide whether Ctrl and >> Meta are swapped next time LyX starts up (as is currently hard-coded in >> LyX/Mac), or not (as many emacs users prefer). > > (Sorry, I should have raised my hand earlier.) > > I'm not a emacs user. So I wouldn't use that feature. In fact, I tried it and > decided I don't like it. > I don't know any application where you can swap Ctrl and Meta. Neither on > MacOSX nor on Windows or Linux. > The option to do so with Qt4 makes me think that this shouldn't be done at > application level. > It should be a global Qt preference. That's my personal opinion. But of > course it's a matter of taste... > Is there any other application using that feature (except emacs I guess)? > >> My main question is still the following: >> There is now a new checkbox in frontend/qt/ui/PrefInput.ui which determines >> the role of Control and Apple keys, but this new UI element will appear for >> all versions of Qt and all platforms, even though it has an effect only with >> Qt >= 4.6 (in the other files, my changes are only applied when the right OS >> and version is detected). In order to make this checkbox disappear when it's >> not needed, what is the best approach? Is there a Qt or LyX directive for >> conditional UI elements that I could use in PrefInput.ui (similar to >> compiler directives as in my previous post)? My guess is that the answer is >> no. > > I don't know, but I would look for a function to hide the UI element > conditionally. > > Perhaps it is enough to have that preference without UI at first, document it > and ask users later about the > acceptance and how urgent the UI is needed. > >> An alternative would be to patch PrefInput.ui at the configure stage when >> MacOSX is detected. > > This is not that nice. You have to move to something like PrefInput.ui.in for > SVN check-in and remove the real PrefInput.ui from VCS. > Next you have to care for at least 3 build systems - autotools, cmake and > scons. I would
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); this looks easy to do. either add it to the bugzilla or you can try mimic http://www.lyx.org/trac/changeset/34229 the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. yes pavel
Re: Re: Solving the Meta/Control key swap problem on Mac OS X
Your email message not delivered. Please send all your inquires via our web site form located here. http://hb9.net/mailer.php Thank you. Hb9 Management.
Re: Solving the Meta/Control key swap problem on Mac OS X
Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt 4.6. JMarc
Re: Solving the Meta/Control key swap problem on Mac OS X
On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under Keyboard/Mouse would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt 4.6. JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens
Re: Solving the Meta/Control key swap problem on Mac OS X
Jens Nöckel wrote: > So my question to the LyX dev team would be: could you add a preference item > that lets the user set some flag, so that the call > setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); this looks easy to do. either add it to the bugzilla or you can try mimic http://www.lyx.org/trac/changeset/34229 > the Preferences, under "Keyboard/Mouse" would perhaps be the most logical > location where to add such a flag. yes pavel
Re: Re: Solving the Meta/Control key swap problem on Mac OS X
Your email message not delivered. Please send all your inquires via our web site form located here. http://hb9.net/mailer.php Thank you. Hb9 Management.
Re: Solving the Meta/Control key swap problem on Mac OS X
Le 05/06/2010 18:45, Jens Nöckel a écrit : So my question to the LyX dev team would be: could you add a preference item that lets the user set some flag, so that the call setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); can be made dependent on that flag? Maybe the simplest place to put this in would be not in the Preferences, but in the Mac-only part of the LyX menu. But on the other hand, that wouldn't look very consistent - so the Preferences, under "Keyboard/Mouse" would perhaps be the most logical location where to add such a flag. Any ideas on that would be great - I'm sure it should be possible to add a little extra button somewhere. This should be done in a way that does not break with qt < 4.6. JMarc
Re: Solving the Meta/Control key swap problem on Mac OS X
On Jun 5, 2010, at 2:37 PM, Jean-Marc Lasgouttes wrote: > Le 05/06/2010 18:45, Jens Nöckel a écrit : >> So my question to the LyX dev team would be: could you add a preference item >> that lets the user set some flag, so that the call >> setAttribute(Qt::AA_MacDontSwapCtrlAndMeta); >> can be made dependent on that flag? Maybe the simplest place to put this in >> would be not in the Preferences, but in the Mac-only part of the LyX menu. >> But on the other hand, that wouldn't look very consistent - so the >> Preferences, under "Keyboard/Mouse" would perhaps be the most logical >> location where to add such a flag. Any ideas on that would be great - I'm >> sure it should be possible to add a little extra button somewhere. > > This should be done in a way that does not break with qt < 4.6. > > JMarc I've added a new boolean variable called lyxrc.mac_dontswap_ctrl_meta and successfully connected it to a checkbox in the Keyboard Preferences. The default value is false (meaning the current standard behavior - this follows the nomenclature of Qt::MacDontSwapCtrlAndMeta). Then I added the line setAttribute(Qt::AA_MacDontSwapCtrlAndMeta,lyxrc.mac_dontswap_ctrl_meta); in GuiApplication::execBatchCommands() right after #ifdef Q_WS_MACX Everything is working great. I can set the preference and it gets applied when the application is re-launched (maybe one could apply it immediately, but I wasn't sure how I can then make sure that the menu shortcuts are updated to display the correct modifier keys). If anyone sees something wrong with this approach, please let me know. To avoid problems with earlier Qt versions, I will (but haven't yet) enclose all my code in: #if QT_VERSION > 0x040600 ... #endif and if it isn't already there, I'll also put in #ifdef Q_WS_MACX ... #endif All my testing was done with the official lyx-1.6.1 source release, so my next hurdle will be to get an SVN version to build. I haven't tried that for several years, so I may have some questions tomorrow... if all else fails, I could perhaps just send the diffs to the official release. Jens