So here's where things go bad. If you run VirtualBox and you run a Windows 10 system, you have to turn this off. I believe I had this on due to an early version of VirtualBox not handling ctrl+left click, but they seem to have fixed this in the latest version... ironically my workaround that fixed my issue now breaks it!
Thursday, December 3, 2015
VirtualBox on OS X with Windows 10 guest and the ctrl key
Karabiner allows you to disable ctrl+left click on OS X. That will, by default, do the same thing that right-click does with a mouse. You choose the following option to disable it:
Labels:
karabiner,
os x,
virtualbox
Monday, November 30, 2015
Bypassing the compatibility checker when upgrading from Windows 8.1 to Windows 10 in VirtualBox
I use OS X as my primary operating system, but still need to use Windows so I've installed Windows 8.1 as a VirtualBox Virtual Machine. Recently I decided that I wanted to upgrade to Windows 10, but when I do Windows complains it doesn't like the VirtualBox Graphics Adapter for Windows 8:
I got quite busy, but recently I decided to find out how to resolve this. A (very) cursory Google search wasn't terribly helpful, so I decided to see what registry keys Windows looks for when it checks for compatibility. For this task I used Process Monitor - the process is called GWXUX.exe so I restricted the capture to only the registry and added the filter: Process Name is GWXUX.exe
A quick scroll through the output showed that there is a registry DWORD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade\AllowOSUpgrade
This is set to 0x0, but if you change it to 0x1, then you can upgrade in Windows Update itself (note, if you click on the upgrade to Windows 10 icon in the system notification tray it will still run the compatibility check).
Hopefully someone will find this useful. I can only imagine VMware installs might be getting the same issue, so this key will force an upgrade. I should note that if you set this key on anything other than VirtualBox and do an OS upgrade you do so at your own risk :-)
Labels:
troubleshooting,
upgrade,
virtualbox,
windows
Monday, March 2, 2015
OSI membership
I've just joined the OSI as a member - in AUD it is about $50, but it's well worth it!
The reason I became a member was because I thought it was high time that I did this. I contribute to LibreOffice, and I truly believe that open source and open culture is very important to society at large. I believe that open source gives maximum freedom to those in society who are not necessarily empowered due to economic or social circumstances. It levels the playing field, and what I most love is that it really gives transparency to those who use software so that they can verify and improve upon the work of those who have gone before them, without restricting the ability of others to use the work to improve the conditions and lives of others in society.
I encourage others to also join the OSI, as it is really is a force of good in the world.
The reason I became a member was because I thought it was high time that I did this. I contribute to LibreOffice, and I truly believe that open source and open culture is very important to society at large. I believe that open source gives maximum freedom to those in society who are not necessarily empowered due to economic or social circumstances. It levels the playing field, and what I most love is that it really gives transparency to those who use software so that they can verify and improve upon the work of those who have gone before them, without restricting the ability of others to use the work to improve the conditions and lives of others in society.
I encourage others to also join the OSI, as it is really is a force of good in the world.
Labels:
libreoffice,
open source,
osi
Friday, October 17, 2014
Refactoring LibreOffice: VCL FontCharMap
I have been looking at the VCL in LibreOffice, which is its cross-platform widget and window library. Whilst reading the SalGraphics class (more on this in a future post) I noticed a class called ImplFontCharMap . Curious, I looked more into it. Why the "Impl"-prefix? What about FontCharMap?
As it turns out, ImplFontCharMap is a Pimpl for FontCharMap. Now normally a Pimpl has very little code and is not directly accessible by any class other than the class that uses it. A Pimpl allows for better builds in C++, and a number of other reasons. In this case ImplFontCharMap was doing a LOT.
A font character map in VCL allows a font to be mapped to Unicode codepoints. The VCL font charmap allows you to find a character in the font based on the Unicode codepoint, find the next and previous character supported by the font (these are not necessarily contiguous) and the first and last characters supported. There is also a default charmap, which maps the BMP plane, including surrogates.
ImplFontCharMap had an internal reference counting mechanism to optimise sharing of charmaps. However, this was better changed to boost's intrusive_ptr, because frankly that implementation is far more well engineered and tested, not to mention I'm not a fan of maintaining code that isn't really specifically addressing VCL needs. (incidentally, the best rundown I found of intrusive_ptr can be found at this man's blog) The commit can be found here. You can see that I've been able to immediately remove AddReference() and DeReference().
You will notice, however, that there are a few classes who rely on ImplFontCharMap (now ImplFontCharMapPtr, a typedef to an intrusive_ptr) directly. In particular, SalGraphics was relying on returning the Pimpl! Frankly, that's madness in my view. As I've said, Pimpls are really intended to be tightly coupled to a particular class and should never be used directly. The class that needs the Pimpl should be used! You can see other side effects, because the Pimpl is really duplicating code that should be in FontCharMap. This is clearly a bit if a code maintenance nightmare.
Given that a Pimpl is one of the very few concepts in C++ that relies on tightly coupling two classes, I made FontCharMap a friend class of ImplFontCharMap and moved most public functions from ImplFontCharMap to FontCharMap. I kept the destructor and the functions getDefaultCharMap() and isCharMap() but you'll notice I made them private, hence the lowercase first letter of the function names. I do NOT want VCL based code to access the Pimpl! I thought this was a necessary compromise because the logic really was more entwined with the data itself. There is a function FontCharMap::GetDefaultCharMap() although it's not normally necessary as the default charmap is shared via intrusive_ptr and the default FontCharMap constructor just returns a reference to the default charmap. I have provided it because you can get a default font charmap that excludes symbols.
I realised at this point, after a chat with Kendy on IRC, that I had dealt with managing the Pimpl for FontCharMap, but now I was returning raw FontCharMap pointers. This was defeating my refactor, so I made the typedef FontCharMapPtr, which is an intrusive_ptr to a FontCharMap instance. I then refactored the code to use this instead of the raw pointer.
The second commit that implemented this can be found here.
Finally, I have to have a big shout-out to Caolán McNamara from RedHat who found a rather embarassing bug I introduced and fixed it. The issue was that I didn't initialize the ref counter variables, except where I did where I set it to 1... which was rather silly of me, though I was reliably informed by Michael Meeks that he has done the same thing in the past.
Anyway, this is how I refactored a relatively small class. It actually took a lot of effort to do. In the end, I created a unit test to ensure that FontCharMap was still working correctly.
As it turns out, ImplFontCharMap is a Pimpl for FontCharMap. Now normally a Pimpl has very little code and is not directly accessible by any class other than the class that uses it. A Pimpl allows for better builds in C++, and a number of other reasons. In this case ImplFontCharMap was doing a LOT.
A font character map in VCL allows a font to be mapped to Unicode codepoints. The VCL font charmap allows you to find a character in the font based on the Unicode codepoint, find the next and previous character supported by the font (these are not necessarily contiguous) and the first and last characters supported. There is also a default charmap, which maps the BMP plane, including surrogates.
ImplFontCharMap had an internal reference counting mechanism to optimise sharing of charmaps. However, this was better changed to boost's intrusive_ptr, because frankly that implementation is far more well engineered and tested, not to mention I'm not a fan of maintaining code that isn't really specifically addressing VCL needs. (incidentally, the best rundown I found of intrusive_ptr can be found at this man's blog) The commit can be found here. You can see that I've been able to immediately remove AddReference() and DeReference().
You will notice, however, that there are a few classes who rely on ImplFontCharMap (now ImplFontCharMapPtr, a typedef to an intrusive_ptr) directly. In particular, SalGraphics was relying on returning the Pimpl! Frankly, that's madness in my view. As I've said, Pimpls are really intended to be tightly coupled to a particular class and should never be used directly. The class that needs the Pimpl should be used! You can see other side effects, because the Pimpl is really duplicating code that should be in FontCharMap. This is clearly a bit if a code maintenance nightmare.
Given that a Pimpl is one of the very few concepts in C++ that relies on tightly coupling two classes, I made FontCharMap a friend class of ImplFontCharMap and moved most public functions from ImplFontCharMap to FontCharMap. I kept the destructor and the functions getDefaultCharMap() and isCharMap() but you'll notice I made them private, hence the lowercase first letter of the function names. I do NOT want VCL based code to access the Pimpl! I thought this was a necessary compromise because the logic really was more entwined with the data itself. There is a function FontCharMap::GetDefaultCharMap() although it's not normally necessary as the default charmap is shared via intrusive_ptr and the default FontCharMap constructor just returns a reference to the default charmap. I have provided it because you can get a default font charmap that excludes symbols.
I realised at this point, after a chat with Kendy on IRC, that I had dealt with managing the Pimpl for FontCharMap, but now I was returning raw FontCharMap pointers. This was defeating my refactor, so I made the typedef FontCharMapPtr, which is an intrusive_ptr to a FontCharMap instance. I then refactored the code to use this instead of the raw pointer.
The second commit that implemented this can be found here.
Finally, I have to have a big shout-out to Caolán McNamara from RedHat who found a rather embarassing bug I introduced and fixed it. The issue was that I didn't initialize the ref counter variables, except where I did where I set it to 1... which was rather silly of me, though I was reliably informed by Michael Meeks that he has done the same thing in the past.
Anyway, this is how I refactored a relatively small class. It actually took a lot of effort to do. In the end, I created a unit test to ensure that FontCharMap was still working correctly.
Labels:
c++,
fonts,
libreoffice,
refactoring,
vcl
Sunday, March 23, 2014
How to build only vcl modules from scratch in LibreOffice
After reviewing the component diagram on the LibreOffice wiki, the following will make the VCL module in LibreOffice:
make sal salhelper store cppuhelper cppu xmlreader registry unoidl dtrans \
binaryurp dtrans animations jvmfwk jvmaccess javaunohelper stoc i18nlangtag \
ucbhelper comphelper basegfx tools unotools i18nutil i18npool sot svl vcl
Update: this doesn't always work. Turns out that there is some sort of circular dependency between i18npool and another module, which make sorts out itself.
I'm now trying:
make CppunitTest_i18npool_test_breakiterator ucb configmgr vcl
Labels:
libreoffice,
vcl
Subscribe to:
Posts (Atom)



