{"action":"created","issue":{"url":"https://api.github.com/repos/fontforge/fontforge/issues/2782","repository_url":"https://api.github.com/repos/fontforge/fontforge","labels_url":"https://api.github.com/repos/fontforge/fontforge/issues/2782/labels{/name}","comments_url":"https://api.github.com/repos/fontforge/fontforge/issues/2782/comments","events_url":"https://api.github.com/repos/fontforge/fontforge/issues/2782/events","html_url":"https://github.com/fontforge/fontforge/pull/2782","id":172599373,"number":2782,"title":"[WIP] Add experimental GDK GUI backend","user":{"login":"jtanx","id":5137410,"avatar_url":"https://avatars.githubusercontent.com/u/5137410?v=3","gravatar_id":"","url":"https://api.github.com/users/jtanx","html_url":"https://github.com/jtanx","followers_url":"https://api.github.com/users/jtanx/followers","following_url":"https://api.github.com/users/jtanx/following{/other_user}","gists_url":"https://api.github.com/users/jtanx/gists{/gist_id}","starred_url":"https://api.github.com/users/jtanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtanx/subscriptions","organizations_url":"https://api.github.com/users/jtanx/orgs","repos_url":"https://api.github.com/users/jtanx/repos","events_url":"https://api.github.com/users/jtanx/events{/privacy}","received_events_url":"https://api.github.com/users/jtanx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-23T02:35:03Z","updated_at":"2016-08-23T07:27:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fontforge/fontforge/pulls/2782","html_url":"https://github.com/fontforge/fontforge/pull/2782","diff_url":"https://github.com/fontforge/fontforge/pull/2782.diff","patch_url":"https://github.com/fontforge/fontforge/pull/2782.patch"},"body":"Note: Not to be merged as of yet.\r\n\r\n-----\r\n\r\nThis adds an experimental GDK (GDK3) backend to GDraw. It is meant to be more or less a drop-in replacement for the X11 backend. This backend is enabled by passing `--enable-gdk` at the configure stage. This will add a dependency on `libgdk-3.0`, which most often is provided by `libgtk-3-dev` or equivalent.\r\n\r\n### Motivation and Context\r\nBy using the GDK backend, it removes the hard dependency on X11. This is beneficial on Windows and OS X as it removes the need to run an X server (VcXsrv or XQuartz). Note that most of the benefits of this backend would be on Windows.\r\n\r\nSide-effects of using GDK:\r\n* Better multi-monitor support - windows should no longer open halfway between monitors  - fixes #2256 and #2381\r\n* Menus open in front of the taskbar - fixes #2462. Also fixes #2461 as a side-effect of not being able to move the window without first dismissing the menu.\r\n* Proper centering of windows on screen (by taking into account the size of window decorations) and not opening windows under the cursor (not really a side-effect since I specifically coded this in)\r\n* Native support for the user's current keyboard, including IME support (IME support on Windows only) - there's no longer a need to mess with VcXsrv config files to get the right keyboard. Fixes #1729, #2065, and probably #2156.\r\n* Fixes #2096 (preview windows when hovering over taskbar in Windows)\r\n* Window titles (on Windows) are displayed properly - fixes #2590\r\n* RGBA cursors can now be used (if someone wants to make them)\r\n* The palette windows can now be docked/undocked within a single session on OS X (due to removal of reparenting code)\r\n* Technically supports running natively on Wayland by virtue of GDK supporting it - but this is untested - and server side decorations would have to be provided, which I don't think happens as of now.\r\n\r\nTechnically the GUI can now also be built on Homebrew using this backend, although I don't have enough experience with the OS X packaging. \r\n\r\n#### Caveats\r\nExpect this backend to crash a bit more than on X11. I have been testing quite a lot, but it's difficult to emulate the behaviour of that backend exactly. There may be differences in behaviour that I may have overlooked which causes odd things to happen.\r\n\r\n### Types of changes\r\nChanges to FontForge outside of adding this backend have been kept as minimal as possible. However, some changes did have to be made:\r\n\r\n* Removal of XOR mode drawing. It's simply not supported by Cairo, which is the only way to draw things when using GDK. Luckily this only affects a few things - the cursor blinking, the ruler position markers and the guidelines in the charview. I've made changes to all three of these to make sure that they still work (either by doing expose calls - or in the case of the cursor, using 'difference' mode). There may be more efficient ways to do this.\r\n* Removal of all code that used the reparenting feature - which was only the palette toolbars. GDK's support of this was flakey - especially on OS X. Even XQuartz couldn't do it right (try undocking then docking the palettes on a current version of FF). Anyway, this was fixed by simply destroying then re-creating the palettes whenever it's docked/undocked, which I don't think is a big deal.\r\n* I implemented the `DrawArc` function in Cairo for the X11 backend.\r\n* Popups no longer show if FF doesn't have focus \r\n\r\n### Known remaining issues\r\n* I still don't understand the start routine for OS X. To be honest, `startui.c` is in particularly bad shape. I remember #1277. What I do know is that it has a separate event loop to Windows and Linux, which seems odd.\r\n* I don't know if resolution is detected correctly on OS X (particularly on HiDPI displays). GDK has a function ([gdk_screen_get_resolution](https://developer.gnome.org/gdk3/stable/GdkScreen.html#gdk-screen-get-resolution)) to get it, but on my test rig (*cough*) it reports 72dpi, even though it should be rendered at 96dpi. Anyway, I added a property called \"ScreenResolution\", so this value can be manually set (no messing around with \"ScreenWidth...\" settings).\r\n* The clipboard should work on all three platforms. Note however, that copy/pasting to/from external applications on OS X is limited to text only.\r\n* Drag and drop to/from external applications is not supported. Although I'm led to believe that this didn't actually work with the current version anyway. \r\n* IME support doesn't exist on OS X/Linux. Unlikely to change because this support lies in the GTK layer. \r\n* The palette windows now lack a black border around them when docked - they relied on the window manager to do this (as reparented toplevel windows), but this no longer happens because they're implemented as child windows now.\r\n"},"comment":{"url":"https://api.github.com/repos/fontforge/fontforge/issues/comments/241649547","html_url":"https://github.com/fontforge/fontforge/pull/2782#issuecomment-241649547","issue_url":"https://api.github.com/repos/fontforge/fontforge/issues/2782","id":241649547,"user":{"login":"jtanx","id":5137410,"avatar_url":"https://avatars.githubusercontent.com/u/5137410?v=3","gravatar_id":"","url":"https://api.github.com/users/jtanx","html_url":"https://github.com/jtanx","followers_url":"https://api.github.com/users/jtanx/followers","following_url":"https://api.github.com/users/jtanx/following{/other_user}","gists_url":"https://api.github.com/users/jtanx/gists{/gist_id}","starred_url":"https://api.github.com/users/jtanx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtanx/subscriptions","organizations_url":"https://api.github.com/users/jtanx/orgs","repos_url":"https://api.github.com/users/jtanx/repos","events_url":"https://api.github.com/users/jtanx/events{/privacy}","received_events_url":"https://api.github.com/users/jtanx/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T07:27:25Z","updated_at":"2016-08-23T07:27:25Z","body":"IMO, the only option of moving away from GDraw would be to move to Qt. Now I've had time to see it, I hate GTK (in particular GTK3). In any case, that would be a major undertaking, far greater than this patch would ever be."}}
{"actor":{"display_login":"jtanx"}}