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