Compare commits

...

292 Commits

Author SHA1 Message Date
a175226ce3 Keep the build directory as an artifact 2019-07-22 20:35:18 +02:00
7c53d75718 Fix test step dependency 2019-07-22 20:12:26 +02:00
fa32a03fbf Update CI configuration to enable tests 2019-07-22 19:31:43 +02:00
53a6876830 Remove unused/unnecessary parts 2019-07-22 16:40:34 +02:00
629b15840a Add missing build file 2019-07-22 15:29:26 +02:00
ff3a7b02b6 Enable tests, fixing the existing ones to use the current API
This also involved building a static library for the application for
tests to link to. The main application executable also links to it.
2019-07-22 15:22:17 +02:00
7495ec9bbb Merge branch 'remove-includes' into 'master'
Remove unnecessary X11 includes

See merge request Librem5/squeekboard!91
2019-07-20 22:00:58 +00:00
e25d5a84b2 Remove unnecessary X11 includes 2019-07-20 23:57:38 +02:00
88ade4df1b Merge branch 'add-keyboards-for-purposes' into 'master'
Add keyboards for purposes

See merge request Librem5/squeekboard!89
2019-07-20 21:44:30 +00:00
00c3903672 Respond to the input purpose, showing a numeric keypad if requested 2019-07-20 17:33:55 +02:00
c801b17ba0 Add initial files to test specialized keyboard support 2019-07-20 17:33:50 +02:00
9ec8d62f3f Merge branch 'respond-to-input-source-changes' into 'master'
Respond to input source changes

See merge request Librem5/squeekboard!88
2019-07-20 15:31:40 +00:00
b1edcfcb1b Tidy up a merge 2019-07-20 17:26:00 +02:00
54b0f59935 Always create a new widget for a keyboard and update it if already visible 2019-07-20 17:25:55 +02:00
531b09f296 Merge branch 'adapt-keyboard-for-different-levels' into 'master'
Omit keys without labels on the current level, update key definitions

See merge request Librem5/squeekboard!87
2019-07-20 15:24:09 +00:00
e5b6d66d60 Omit keys without labels on the current level, update key definitions 2019-07-20 17:17:37 +02:00
a045810af6 Merge branch 'add-built-in-keymaps' into 'master'
Add built in keymaps

See merge request Librem5/squeekboard!78
2019-07-20 14:42:51 +00:00
d68a8fef9a Merge branch 'resize-icons' into 'master'
Declare the correct size for icons

See merge request Librem5/squeekboard!86
2019-07-20 14:41:29 +00:00
9162d4291f Declare the correct size for icons 2019-07-20 14:39:47 +00:00
93d7699aa7 Merge branch 'make-layout-more-flexible' into 'master'
Make layout handling more flexible

See merge request Librem5/squeekboard!85
2019-07-20 14:31:26 +00:00
6eb63f6a4c Refactor layout code, rescale and reformat when changing level 2019-07-19 17:35:49 +02:00
f6d4ca0387 Place keys after symbols have been read, skipping blank keys 2019-07-19 17:35:49 +02:00
7b41466a77 Start to refactor keyboard section layout 2019-07-19 17:35:49 +02:00
18c25084db Merge branch 'merge-renderers' into 'master'
Move EekGtkRenderer features into EekRenderer

Closes #61

See merge request Librem5/squeekboard!84
2019-07-19 14:56:54 +00:00
a5875402ef Move EekGtkRenderer features into EekRenderer 2019-07-18 15:42:27 +02:00
f3ed1ba247 Merge branch 'config' into 'master'
Clean up config.h (and some other stuff)

See merge request Librem5/squeekboard!83
2019-07-18 11:11:57 +00:00
633d69baca Drop HAVE_CLUTTER_GTK
We don't use it.
2019-07-17 19:50:53 +02:00
dbc8cc14bc Generate config.h
This allows us to remove a lot of #ifdef's. Either we want to use
a config.h or we don't. Since we'll want it for e.g. optional gsound
support later on let's have it.
2019-07-17 19:50:53 +02:00
c65583b911 Add a gitignore file
Based on the phosh one to ignore (upcoming) translations, editor
backup files and so forth.
2019-07-17 19:39:33 +02:00
3d518b5757 build: Bump meson dep since we use '/' 2019-07-17 19:37:05 +02:00
bfa72d7f61 Merge branch 'less-flicker' into 'master'
Make redisplaying the keyboard faster

Closes #60

See merge request Librem5/squeekboard!82
2019-07-17 16:32:29 +00:00
373713ba54 ServerContextService: Don't destroy widget all the time
This avoids icon theme lookups and lots of other stuff down the road.

Closes: #60
2019-07-17 17:16:35 +02:00
068c325ee2 EekGtkRenderer: Use a hash table for icon theme lookups 2019-07-17 17:14:42 +02:00
3b076e5e64 EekGtkRenderer: Simplify type declaration
It's 2019.
2019-07-17 17:14:42 +02:00
07d6e3a0f2 ServerContextService: Don't use gtk_widget_show_all
This gives children more flexibility without using `no_show_all`.
2019-07-17 17:14:42 +02:00
7690ef9a1a Merge branch 'layer-shell' into 'master'
Hide/show window instead of destroying it

Closes #42

See merge request Librem5/squeekboard!76
2019-07-17 11:34:10 +00:00
9974c385e5 EekboardContextService: Don't comment out property setters
This lets us keep the visible property up to date.
2019-07-17 00:44:09 +02:00
8dafad80b1 ServerContextService: Check for mapped/unmapped
Visible does not tell us if the widget is actually visible on the
screen.
2019-07-17 00:44:00 +02:00
93e9b2dde9 ServerContextService: Hide the widget instead of destroying it
This is quicker and makes sure we don't stack up surfaces.
2019-07-16 18:52:53 +02:00
c3a54595ea layersurface: Refresh layersurface on map
If the surface gets unmapped and mapped again we have another GDK window
so we have to reconfigure the layers surface on map and destroy it on
unmap.

This will be merged back into phosh if it works out.
2019-07-16 18:52:36 +02:00
95ef52fe42 ServerContextService: Remove more unused code
The whole visible/enable logic was disfunctional all the time.
What works is show_keyboard and hide_keyboard.
2019-07-16 18:47:55 +02:00
c638c40a09 ServerContextService: Drop everything depending on self->was_visible
This was never used so everything depending on it was dead code.
2019-07-16 18:47:55 +02:00
83d48d24ce ServerContextService: Really destroy the main window
Otherwise layer surfaces keep piling up
2019-07-16 18:47:55 +02:00
d807e43929 ServerContextService: Drop unneeded code
The layer shell code handles parts of this and others are just
not needed on wayland.
2019-07-16 18:47:55 +02:00
0a112be956 ServerContextService: Show keyboard when everything else is set up
This avoids some flickering.
2019-07-16 18:47:55 +02:00
078efa2a6e LayerShell: Set a proper namespace 2019-07-16 18:47:55 +02:00
5827827008 Update layer surface code from phosh
As of commit 77bba4fcb2d836a58ccf8913d9a514aac6cc49a2. This allows
us to split the widget creation from making it visible.
2019-07-16 18:47:55 +02:00
9c61d8de72 Merge branch 'dbus-prop' into 'master'
EekboardService: Properly toggle keyboard visibility on DBus

Closes #55

See merge request Librem5/squeekboard!80
2019-07-16 13:22:53 +00:00
f72ddc8129 Undo formatting changes 2019-07-16 14:06:49 +02:00
7e9c3b40bb Remove debugging code 2019-07-16 14:00:41 +02:00
a8371af9c0 Fall back to US layout and keymap if needed 2019-07-16 14:00:41 +02:00
4e11d071d9 Add a keymap for the US layout, update the US symbols 2019-07-16 14:00:41 +02:00
a7140705c4 Search for an xkb keymap in the resources 2019-07-16 14:00:41 +02:00
69986132b4 Use keysyms for the Shift modifier 2019-07-16 14:00:41 +02:00
3c97a3a592 Convert symbols file and update test keymap 2019-07-16 14:00:41 +02:00
268dda4da0 Improve symbol mapping 2019-07-16 14:00:41 +02:00
45f58a97b9 Update the test keymap 2019-07-16 14:00:41 +02:00
bdbbaf6099 Use groups to reference keysyms in the keymap 2019-07-16 14:00:41 +02:00
839968dc84 Try using a custom keymap 2019-07-16 14:00:41 +02:00
fbdc5f4a93 Stash for sharing 2019-07-16 14:00:41 +02:00
e5648a82a3 Remove explicit keycodes in XML, auto-generate them instead
This makes it easier to keep the geometry and symbols files in sync.
2019-07-16 14:00:41 +02:00
38133d326b Merge branch 'autogen.sh' into 'master'
Remove more files

See merge request Librem5/squeekboard!81
2019-07-16 11:06:55 +00:00
cc00fcb5c9 Remove more files
autogen.sh is for automake and the TODO refers to eekboard.
2019-07-16 11:00:59 +02:00
53f7a14717 EekboardService: Properly toggle keyboard visibility on DBus
Closes: #55
2019-07-16 10:21:59 +02:00
922495ca06 Merge branch 'remove-unused-files' into 'master'
Remove unused files and functions

See merge request Librem5/squeekboard!79
2019-07-16 07:16:29 +00:00
e5e2e08ff4 Merge branch 'fewer-redraws' into 'master'
keyboard: Schedule widget redraw instead of gdk_window_invalidate_rect

See merge request Librem5/squeekboard!75
2019-07-15 22:57:12 +00:00
c7c410210b Merge branch 'scale' into 'master'
Honor widget scale  factor

See merge request Librem5/squeekboard!56
2019-07-15 22:27:34 +00:00
cb7c214aa0 Merge branch 'fixes' into 'master'
Fixes

See merge request Librem5/squeekboard!74
2019-07-15 22:20:40 +00:00
6f5f49729c Remove unused files and functions 2019-07-15 23:45:17 +02:00
94c9442de1 keyboard: Drop now unused clip_bounds_to_dirty_rectangle() 2019-07-15 17:42:32 +02:00
8c044d0852 keyboard: Schedule widget redraw instead of gdk_window_invalidate_rect
The later would invaliate the drawn area again and again in a ::draw()
handler. This caused infinite redraws when e.g. a key was locked.  To
reproduce break e.g. on `eek_gtk_keyboard_real_draw()` and see how it is
invoked again and again.
2019-07-15 17:42:32 +02:00
1f0cc0a5f3 keyboard: Don't leak on set_keyboard()
Unref and disconnect signals before setting a new keyboard.
2019-07-15 14:12:10 +02:00
5693ce3df7 keyboard: Simplify signal disconnect
We're only keeping the signal ids around for disconnect but that only
happens in dispose so it's o.k.to just disconnect all keyboard signals
we listen to.
2019-07-15 14:12:10 +02:00
bcf04ab11e Merge branch 'exclusive-zone' into 'master'
LayerSurface: Make exclusive zone identical to height

Closes #53

See merge request Librem5/squeekboard!72
2019-07-15 11:55:41 +00:00
086f6bd772 renderer: Only scale by output scale
The original eekboard code scaled icons by a factor. That was simplified
in c529e9ed9c but we can do away with it
completely and fetch the icons at the right size making them not blurry.
2019-07-15 13:23:16 +02:00
d0fa444a0e Honor the outputs scale factor 2019-07-15 13:13:34 +02:00
cd81aeb286 get_icon_surface: Add a scale argument
This will allow us to pass the output scale around
2019-07-15 13:13:34 +02:00
7db33bc92e renderer: Add icons in resource bundle to the icon theme 2019-07-15 13:13:34 +02:00
fb6c501e44 renderer: Use gtk_icon_theme_load_surface
This will allow us to feed in the output scale.
2019-07-15 13:12:26 +02:00
ce7b398f7b LayerSurface: Make exclusive zone identical to height
Othewise we hide content beneath the keyboard.

Closes: #53
2019-07-15 12:49:11 +02:00
4d8d3a8109 Merge branch 'suppress-warnings' into 'master'
Suppress warning message

See merge request Librem5/squeekboard!70
2019-07-13 22:14:54 +00:00
a183cf8b63 Suppress warning message 2019-07-14 00:13:41 +02:00
f834edcf94 Merge branch 'fix-compiler-warnings' into 'master'
Fix use of inappropriate type

See merge request Librem5/squeekboard!69
2019-07-13 19:47:40 +00:00
17802a9408 Fix use of inappropriate type 2019-07-13 18:36:59 +02:00
ac1aad881c Merge branch '49-inconsistent-behaviour-of-shift-key-s-pressed-state' into 'master'
Resolve "Inconsistent behaviour of shift key's pressed state"

Closes #49

See merge request Librem5/squeekboard!66
2019-07-13 16:35:07 +00:00
928110a92d Merge branch 'add-missing-icon' into 'master'
Add keyboard preferences icon

See merge request Librem5/squeekboard!68
2019-07-12 21:09:49 +00:00
f6479fafe2 Add keyboard preferences icon 2019-07-12 23:07:01 +02:00
62b1c2ba84 Revert to latch behavior for letters 2019-07-12 19:54:21 +00:00
c0ac5e540f Merge branch 'add-key-icons' into 'master'
Add key icons

Closes #44

See merge request Librem5/squeekboard!65
2019-07-12 19:17:29 +00:00
fb5ec5557b Make icons smaller 2019-07-12 20:12:09 +02:00
74d94e6792 Merge branch 'remove-unused-xml' into 'master'
Remove unused XML from the US definitions

See merge request Librem5/squeekboard!64
2019-07-12 18:08:55 +00:00
63f4c6b4da Use icons for Shift and Return in the US layout 2019-07-12 20:04:50 +02:00
2774c1c988 Try to load icons from app resources first 2019-07-12 20:04:22 +02:00
469b0c0a9a Add icons to the resource manifest 2019-07-12 20:04:02 +02:00
2ddd217737 Add Enter and Shift icons 2019-07-12 19:16:21 +02:00
c4e8e34ad6 Remove unused XML from the US definitions 2019-07-12 17:15:38 +00:00
4dc18c0af4 Merge branch '27-period-should-not-change-when-caps-lock-is-active' into 'master'
Resolve "Period should not change when caps lock is active"

Closes #27

See merge request Librem5/squeekboard!63
2019-07-12 17:11:10 +00:00
55c6911b87 Remove level with > character from . key 2019-07-12 17:17:11 +02:00
9bf0da5409 Merge branch 'adjust-scaling' into 'master'
Reduce icon size to match platform guidelines

See merge request Librem5/squeekboard!62
2019-07-12 15:15:43 +00:00
7d5b2dd1de Reduce icon size to match platform guidelines 2019-07-12 16:10:31 +02:00
6091632e40 Merge branch 'simplify-geometry-xml' into 'master'
Simplify geometry XML

See merge request Librem5/squeekboard!61
2019-07-12 14:09:57 +00:00
44110fd4d9 Remove bounds for everything except the geometry element 2019-07-12 14:00:20 +00:00
74d76ebfeb Remove unused XML elements 2019-07-12 14:00:20 +00:00
760bc138b0 Test effect of setting attributes to zero 2019-07-12 14:00:20 +00:00
2a4763d4f3 Merge branch 'fix-bottom-margin' into 'master'
Include extra space in the window object

Closes #47

See merge request Librem5/squeekboard!60
2019-07-12 13:42:20 +00:00
4b92f205ef Include extra space in the window object 2019-07-12 10:30:44 +00:00
a5668fa1db Merge branch 'remove-pressed-key-popups' into 'master'
Remove pop-ups for pressed keys

See merge request Librem5/squeekboard!59
2019-07-11 23:42:34 +00:00
de39256377 Remove pop-ups for pressed keys 2019-07-11 23:39:33 +00:00
f53709c83d Merge branch 'fix-bottom-margin' into 'master'
Fix clipping issue at bottom of keyboard

Closes #47

See merge request Librem5/squeekboard!58
2019-07-11 23:07:01 +00:00
8ad0192e55 Fix clipping issue at bottom of keyboard
Closes #47.
2019-07-11 23:04:29 +00:00
791e454cb6 Merge branch 'functioning-views' into 'master'
Basic functioning views

See merge request Librem5/squeekboard!57
2019-07-11 22:58:50 +00:00
c85638be4d Use a dummy, non-emitting key to switch views 2019-07-11 19:38:02 +00:00
a61b1fdf06 Merge branch 'implement-more-view-behavior' into 'master'
Improve view behavior to more closely reflect #38

See merge request Librem5/squeekboard!55
2019-07-11 16:29:26 +00:00
07c25d1d91 Improve view behavior to more closely reflect #38 2019-07-11 16:29:26 +00:00
83dafd87a4 Merge branch 'copyright' into 'master'
Copyright

See merge request Librem5/squeekboard!6
2019-07-11 13:49:00 +00:00
25a8733957 Merge branch 'scale' into 'master'
Simplify icon rendering a bit

See merge request Librem5/squeekboard!52
2019-07-11 13:42:50 +00:00
c529e9ed9c render: Simplify drawing
Instead of doing scale guessing we know that we get a properly
sized image from GTK+ so just scale it down a bit so it gets
some border within the drawing area.
2019-07-11 15:40:18 +02:00
d6a8a85b5e render: Get foreground color only once 2019-07-11 15:40:18 +02:00
3a945535f7 render: Remove trailing white space 2019-07-11 15:40:18 +02:00
0fc4374193 gtk-renderer: Simplify 2019-07-11 15:40:18 +02:00
e350b4ab92 Merge branch 'some-bugfixes' into 'master'
MERGE these: Some bugfixes - the buildsystem is acting up again

See merge request Librem5/squeekboard!53
2019-07-11 13:39:56 +00:00
626527ee09 Merge branch 'feature-xml-resources' into 'master'
FINAL: bundle xml resources, allows running uninstalled from git repo

Closes #29 and #21

See merge request Librem5/squeekboard!49
2019-07-11 13:33:45 +00:00
c4a462c385 Merge branch 'ci' into 'master'
gitlab-ci: No need for our ci repository

See merge request Librem5/squeekboard!54
2019-07-11 13:16:32 +00:00
706a04dbfc gitlab-ci: No need for our ci repository
Just using debian buster makes things more stable.
2019-07-11 14:31:25 +02:00
7fd51af4de debian: Drop virtboard build-dependency 2019-07-11 14:31:25 +02:00
c1af9b2ba4 Add dbus protocol definition
This let's us drop the virtboard build dependency.
2019-07-11 14:31:25 +02:00
5efb4cc58d Bundle keyboard definitions
This allows running uninstalled from a git repo

Closes: #21, #29
2019-07-11 13:40:03 +02:00
4b2977d601 Plug 3 leaks 2019-07-11 13:26:04 +02:00
2f1c1c2fb1 Remove unused variable and remove damage from botched rebase
- remove bounds it is not used.

- remove the g_clear_pointer, it does the same thing as the if-block
  above, the were both there as the result of the merge, and it is
  apparently easily overlooked

- cleanup after myself (FIXMEs)
2019-07-11 13:24:48 +02:00
f47ef09a1f Merge branch 'implement-basic-views' into 'master'
Implement basic keyboard views

See merge request Librem5/squeekboard!51
2019-07-11 10:24:29 +00:00
47041b0fac Implement basic keyboard views
Use existing concepts of levels and modifier latches and locks to
implement the three view design of issue #38.

The use of a lock to switch from letter to numbers and a latch to
handle upper and lower case has side effects, but these can be
addressed in a future commit.
2019-07-10 23:33:45 +00:00
b6111b5e00 Merge branch 'fix-backspace-key' into 'master'
Specify a keyval to make the backspace key work again

Closes #45

See merge request Librem5/squeekboard!50
2019-07-10 23:12:59 +00:00
b8a2b2d7c8 Specify a keyval to make the backspace key work again 2019-07-11 01:09:04 +02:00
0765ea1b86 Merge branch 'update-symbols' into 'master'
Update symbols to more closely resemble #38

See merge request Librem5/squeekboard!48
2019-07-10 22:20:30 +00:00
64223704e0 Update symbols to more closely resemble #38 2019-07-10 23:50:34 +02:00
8c14763ea4 Merge branch 'theme-path' into 'master'
Drop now unused theme_path

See merge request Librem5/squeekboard!46
2019-07-10 17:09:58 +00:00
10cd93022a Merge branch 'update-icons' into 'master'
Use an icon for backspace

See merge request Librem5/squeekboard!47
2019-07-10 16:57:09 +00:00
d006aede6a Merge branch 'top-margin' into 'master'
Add some border at the top

Closes #28

See merge request Librem5/squeekboard!43
2019-07-10 15:46:16 +00:00
b57e1ce660 Drop now unused theme_path 2019-07-10 15:39:16 +02:00
1b59c4dad3 Use an icon for backspace 2019-07-10 14:36:19 +02:00
189c721d7e Merge branch 'use_gresource' into 'master'
Use a gresource to store the css

See merge request Librem5/squeekboard!28
2019-07-10 11:36:53 +00:00
1ff1592f24 Merge branch 'master' into 'use_gresource'
# Conflicts:
#   src/server-context-service.c
2019-07-10 11:35:40 +00:00
7f5f310bf0 Add some border at the top
Closes: #28
2019-07-10 11:31:24 +02:00
f999861228 Merge branch 'remove-more-unused-code-and-data' into 'master'
Remove unused color definitions

See merge request Librem5/squeekboard!42
2019-07-09 21:40:36 +00:00
a571bd7dca Remove unused color definitions 2019-07-09 17:55:40 +02:00
3d0d28fa01 Merge branch 'remove-unused-eekboard-context-service-code' into 'master'
Remove currently unused eekboard code

See merge request Librem5/squeekboard!41
2019-07-09 15:48:59 +00:00
4c54b49ef5 Merge branch 'remove-unused-sources' into 'master'
Remove unlisted files

See merge request Librem5/squeekboard!38
2019-07-09 14:44:00 +00:00
eb940bcf52 Remove currently unused eekboard code 2019-07-09 16:34:16 +02:00
be0e773879 Merge branch 'quick-review-fast-lane-very-speedy' into 'master'
Some cleanups, and some FIXME hints for future work (no functional changes)

See merge request Librem5/squeekboard!39
2019-07-09 14:25:45 +00:00
056e07e80e Merge branch 'prevent-warnings' into 'master'
Prevent compiler warnings by commenting out unused code

See merge request Librem5/squeekboard!37
2019-07-09 13:44:54 +00:00
83b36d07d0 Add note about unused code 2019-07-09 15:28:02 +02:00
89aaf05aff Some minor cleanups 2019-07-09 13:52:23 +02:00
2f87fd46fb Improve codeflow 2019-07-09 13:50:14 +02:00
e04276ee38 Use properly typed and named variables for user_data 2019-07-09 13:46:44 +02:00
05c3061f08 Add some FIXME hints for future work 2019-07-09 13:41:20 +02:00
c33006bcbc use g_clear_pointer with gtk_widget_destroy
brief, clear, idiomatic and grep friendly
2019-07-09 13:33:49 +02:00
4bf4500ae1 Remove unlisted files 2019-07-09 01:07:19 +02:00
e2944ff4a7 Use a macro to declare a type with private data 2019-07-09 00:46:03 +02:00
f79b5dadbb Use a macro to declare a type with private data 2019-07-09 00:41:25 +02:00
4d44129b04 Prevent compiler warnings by commenting out unused code 2019-07-09 00:24:57 +02:00
b3e1d84e6c Merge branch 'mem' into 'master'
Fix visibility-related bugs

See merge request Librem5/squeekboard!25
2019-07-08 21:25:27 +00:00
6702edaa9d Merge branch 'fix-deprecated-warnings' into 'master'
Fix deprecated warnings

See merge request Librem5/squeekboard!34
2019-07-08 21:19:57 +00:00
a3a6e5933a Merge branch 'quick-review-fast-lane-very-speedy' into 'master'
Quick review fast lane very speedy

See merge request Librem5/squeekboard!36
2019-07-08 21:01:40 +00:00
66ec95ebb0 fix-up prototypes (-Wincompatible-pointer-types) 2019-07-08 09:21:26 +02:00
a944bf85b8 remove stray const (-Wdiscarded-qualifiers) 2019-07-08 09:20:17 +02:00
1d1829f664 fix accidentally committed line (-Wincompatible-pointer-types) 2019-07-08 09:18:41 +02:00
094aa872ce Cleanups: fix deprecated g_type_class_add_private()
- use G_DECLARE_ and G_DEFINE_ macros
- move all data into ClassNamePrivate
- use _get_instance_private()

This should not introduce any functional changes or breakage.

Skipped two classes (EekKeyboard and EekboardContextService) for now in
order not to break the build.

These two classes are used in some very funky WIP code that tries to
circumvent encapsulation.

(Funky code is in eekboard/key-emitter.c and eekboard/eekboard-context-service.c)
2019-07-08 08:44:05 +02:00
eaf925e30b Cleanups: fix g_type_init() deprecation warning
None of this seems necessary anymore. This file could be axed, but leave
it for now.
2019-07-08 08:39:43 +02:00
722d3d1ad4 Cleanups: fix deprecations
gtk_widget_get_root_window()
	gdk_screen_get_monitor_at_window()
	gdk_screen_get_monitor_geometry()
2019-07-08 08:39:16 +02:00
b69b3e9409 Merge branch 'fix-uninitialized-var' into 'master'
Fix an uninitialized-variable warning, and fixes gradients (quickie)

See merge request Librem5/squeekboard!35
2019-07-07 17:37:11 +00:00
ae5eaeec93 Fix an uninitialized-variable warning, and fixes gradients 2019-07-07 18:45:56 +02:00
c393eb20be Merge branch 'improve-key-rendering' into 'master'
Improve key rendering and eliminate two deprecation warnings

See merge request Librem5/squeekboard!33
2019-07-07 11:39:12 +00:00
0e8715b4ff Improve key rendering and eliminate two deprecation warnings
- Replace two calls to deprecated gdk_cairo_create()

- Alleviate asymmetry between rendering pressed and released keys
  by consistenly clipping the same area up front to avoid
  artefacts

- make sure pressed and released keys are shown immediately by
  calling gdk_window_invalidate_rect()

- improve consistency between render_(pressed|locked|released)_key

- improve code flow
2019-07-07 11:34:24 +02:00
b09c812579 Merge branch 'drop-icons' into 'master'
Drop icons

See merge request Librem5/squeekboard!29
2019-07-04 18:34:15 +00:00
d6f7c271e2 Merge branch 'kill-automake' into 'master'
Remove automake leftovers

See merge request Librem5/squeekboard!27
2019-07-04 18:26:24 +00:00
f1d97e396b Drop icons
They're not being installed and we want ones matching current
GNOME design anyway.
2019-07-04 16:25:05 +02:00
abf8f4daa8 eek-theme: Remove code for old croko versions
These versions aren't even in Debian's oldstable release.
2019-07-04 16:21:18 +02:00
aba242301d Use a gresource to store the css
This makes build / test faster since one can skip install. It's
also more obvious which file is being used.
2019-07-04 16:16:04 +02:00
7a52080940 Remove automake leftovers 2019-07-04 14:51:00 +02:00
c3ffe6ab8b visibility: Handle visibility change no-ops 2019-07-04 08:48:43 +00:00
851a9185c0 Merge branch 'margins' into 'master'
style: Fix right margin

See merge request Librem5/squeekboard!26
2019-07-04 08:44:52 +00:00
c1e1ddb73f style: Fix right margin
For some reason, adjusting the width of the keyboard layout affects the margin when used at 360 width.
2019-07-04 08:27:37 +00:00
d530c1d6d6 Merge branch 'session' into 'master'
session: Register to the session manager

See merge request Librem5/squeekboard!24
2019-07-04 08:27:00 +00:00
43579b51f0 session: Register to the session manager
Registering as "sm.puri.OSK0", because that's as much as the session knows about the virtual keyboard.
2019-07-04 07:58:34 +00:00
3d1133cdb5 Fix memory corruption due to a wrong assumption 2019-07-04 07:48:46 +00:00
e27af9fd24 Merge branch 'be-explicit-about-meson' into 'master'
Specify the build system when building a package

See merge request Librem5/squeekboard!23
2019-07-03 22:28:20 +00:00
a7c6597246 Specify the build system when building a package 2019-07-04 00:18:42 +02:00
fd6d873c01 Merge branch 'add-debian-source-format' into 'squeekboard'
Add missing packaging file

See merge request Librem5/squeekboard!22
2019-07-03 19:40:43 +00:00
89dee04cdf Add missing packaging file 2019-07-03 21:35:24 +02:00
3b0a073964 Merge branch 'conflict' into 'squeekboard'
build: Apply fixes/suggestions

See merge request Librem5/squeekboard!21
2019-07-03 08:48:40 +00:00
a129863a4d build: Apply fixes/suggestions
Following comments on https://source.puri.sm/Librem5/squeekboard/merge_requests/20
2019-07-02 20:14:12 +00:00
5b700f7dfc Merge branch 'modifiers' into 'squeekboard'
Modifiers

See merge request Librem5/squeekboard!19
2019-07-02 18:44:33 +00:00
d982bcb5e4 Merge branch 'conflict' into 'squeekboard'
Fix virtboard conflict

See merge request Librem5/squeekboard!20
2019-07-02 18:18:19 +00:00
61a5e8d4fd install: Don't distribute dbus definition
Instead, require virtboard to provide it.
2019-07-02 18:13:34 +00:00
cb641bd221 ci: Prevent caching of build directory 2019-07-02 18:11:49 +00:00
2f6e9a1756 Merge branch 'remove-trigger-in-packaging' into 'squeekboard'
Remove unnecessary trigger

See merge request Librem5/squeekboard!18
2019-07-02 13:23:47 +00:00
51b183a0f3 Remove unnecessary trigger 2019-07-02 13:23:47 +00:00
d071bb04af Merge branch 'linking' into 'squeekboard'
build: Link Rust library statically

See merge request Librem5/squeekboard!16
2019-07-02 13:19:14 +00:00
14887f9c99 layout: Change label for Level 3 modifier 2019-07-02 13:09:33 +00:00
654909261e modifiers: Level 3 works 2019-07-02 13:03:35 +00:00
ab2a27345d Merge branch 'modifiers' into 'squeekboard'
modifiers: Seem to be emitted correctly

See merge request Librem5/squeekboard!17
2019-07-02 11:54:34 +00:00
484eb3303c modifiers: Seem to be emitted correctly 2019-07-02 11:52:45 +00:00
319d64e1e5 build: Link Rust library statically 2019-07-02 10:11:32 +00:00
60250ca5e5 Merge branch 'font-size' into 'squeekboard'
hack: Adjust font size

See merge request Librem5/squeekboard!15
2019-07-01 15:41:10 +00:00
d729bb3a89 hack: Adjust font size 2019-07-01 15:27:06 +00:00
4dc55635d7 Merge branch 'new_layout' into 'squeekboard'
New layout

See merge request Librem5/squeekboard!13
2019-07-01 15:04:32 +00:00
4af49ef7b6 layout: Make keys higher 2019-07-01 13:31:53 +00:00
3a42e66504 layout: Position keys closer to the left edge 2019-07-01 12:57:52 +00:00
250b196b81 theme: Use mockup colors 2019-07-01 12:57:52 +00:00
9ba1987cab layout: Moved keys a bit to the left 2019-07-01 12:57:52 +00:00
909b1e2a28 theme: Adjust colors to match the mockup closer 2019-07-01 12:57:52 +00:00
e46af41abf layouts: Fixed spacing 2019-07-01 12:57:52 +00:00
17671a3b08 layout: Use outlines for key bounds 2019-07-01 12:57:52 +00:00
b8eb7752e7 layout: Using bigger keys 2019-07-01 12:57:52 +00:00
5e92f45111 layout: Arrange keys similar to mockup 2019-07-01 12:57:52 +00:00
baf848c791 layout: Ignore keycodes without corresponding keys 2019-07-01 12:57:52 +00:00
737d57c1f4 Merge branch 'install-rslib' into 'squeekboard'
Install rslib

See merge request Librem5/squeekboard!12
2019-07-01 12:57:22 +00:00
9985ad7ee1 Fix lintian package-must-activate-ldconfig-trigger error 2019-07-01 01:46:16 +02:00
025b55e1a2 Install rslib 2019-07-01 00:05:42 +02:00
14fbabe8d7 Merge branch 'popup' into 'squeekboard'
Pop up when input requested

See merge request Librem5/squeekboard!10
2019-06-30 19:04:42 +00:00
b746f7a70e input method: Pop up the keyboard 2019-06-30 19:03:24 +00:00
0d3b003aac input method: Initialize the protocol and pretend to handle a few things 2019-06-30 19:03:24 +00:00
9428927879 Merge branch 'build-dep' into 'squeekboard'
ci: Use build-dep instead of a dependency list

See merge request Librem5/squeekboard!11
2019-06-30 19:03:08 +00:00
511b2f7186 ci: Use build-dep instead of a dependency list 2019-06-30 19:01:36 +00:00
d8c83e3c65 Merge branch 'touch' into 'squeekboard'
Touch support

See merge request Librem5/squeekboard!9
2019-06-30 06:11:16 +00:00
050fd6f3ba Touch support
Single stream of touch events.
2019-06-29 12:56:04 +00:00
72d6a8d4e1 Merge branch 'wayland-gen' into 'squeekboard'
build: Use 'client-code' instead of 'code' for protocols

See merge request Librem5/squeekboard!8
2019-06-29 12:47:27 +00:00
30d35216f6 build: Use 'client-code' instead of 'code' for protocols 2019-06-29 12:46:08 +00:00
bcd0d40912 Merge branch 'fixes' into 'squeekboard'
fix: Remove leftover debug print

See merge request Librem5/squeekboard!7
2019-06-29 12:18:59 +00:00
4b8a6bbbe0 fix: Remove leftover debug print 2019-06-29 12:16:34 +00:00
47026b669b Make copyright more granular 2019-06-29 10:50:30 +00:00
752dc467a8 Merge branch 'desktop-file' into 'squeekboard'
Add a desktop file

See merge request Librem5/squeekboard!5
2019-06-29 10:13:20 +00:00
bde45b262a Merge branch 'debian-files' into 'squeekboard'
Add Debian packaging files

See merge request Librem5/squeekboard!4
2019-06-29 10:10:15 +00:00
fc338f5723 Add Debian packaging files 2019-06-29 10:10:15 +00:00
346ed453ef Start working on a desktop file 2019-06-26 18:17:54 +02:00
664f05edba Remove unnecessary build dependency 2019-06-26 17:45:23 +02:00
edcff44f4b Add another build dependency, add an empty rule to override autoreconf 2019-06-26 17:35:13 +02:00
42ee5d2ddb Update packaging files 2019-06-26 17:35:05 +02:00
54e421d7e6 Add initial Debian packaging 2019-06-26 17:35:00 +02:00
9e5629d1e0 Enable Wayland's virtual-keyboard protocol
This commit includes a little restructuring necessary for keeping wayland objects properly.
It doesn't fix broken modifier functionality yet.
2019-06-25 18:12:15 +00:00
c0fdffac28 Separate keyboards from the dbus handler 2019-06-23 10:59:45 +00:00
e94e64d204 Move dbus setup closer together 2019-06-23 10:42:20 +00:00
e503e35b84 Rename squeak_ to squeek_ for consitency 2019-06-23 10:30:25 +00:00
752592a3d8 Fixed build 2019-06-23 10:29:18 +00:00
2e6d194a6f Remove server-service 2019-06-23 10:26:24 +00:00
63dfb07b51 Simplify the storage of context 2019-06-23 09:54:09 +00:00
02525056d6 Removed X11 header, added some clarifications 2019-06-22 16:20:03 +00:00
8292429648 Context: removing more unused things 2019-06-22 16:04:33 +00:00
765c496068 Removed more unused stuff in context 2019-06-22 15:57:48 +00:00
d6feec8010 Removed d-bus paths from service class 2019-06-22 15:40:20 +00:00
f1fbb37547 Kill connection in context service 2019-06-22 15:31:08 +00:00
5a6386dd24 Fixed rendering deprecation warnings 2019-06-22 13:13:55 +00:00
0809db9e32 Remove some rendering code with no effect and warnings 2019-06-22 12:56:33 +00:00
15a3315854 Fix dragging across the keyboard 2019-06-22 12:34:10 +00:00
82d1f256b2 Remove released and cancelled key events 2019-06-22 12:23:04 +00:00
e7ba2a0eb0 Got rid of signals in the pressed path 2019-06-19 17:00:30 +00:00
eff0449b3a Redrawing key after press is happening directly 2019-06-19 16:51:57 +00:00
3b9e066ec8 Simplify key press handling 2019-06-19 16:05:37 +00:00
260ab42b9e Forward press timestamps 2019-06-19 15:56:19 +00:00
a3d745edd0 Moved key pressing from context to keyboard 2019-06-19 15:27:29 +00:00
40a92fe730 Ignoring section.key-pressed 2019-06-19 14:11:23 +00:00
e30bb23711 build: Add debug/release options 2019-06-18 13:37:10 +00:00
292c1d08d8 fixes: Minor type and include mismatches 2019-06-16 12:55:50 +00:00
be56447614 readme: Update development installation info 2019-06-16 12:13:43 +00:00
70fda8ba64 Fix releasing buttons when dragged 2019-04-06 18:46:33 +00:00
5cc407986b Ignore multi-clicks and non-left-buttons 2019-04-06 18:35:06 +00:00
53af829f46 Send both press and release events 2019-04-06 17:45:06 +00:00
53065a6d95 Fix crash on double click 2019-04-05 18:42:11 +00:00
862cfdb55d Showing and hiding 2019-04-05 18:36:25 +00:00
b065b16bf1 Use layer shell 2019-04-05 15:39:57 +00:00
6ff33b48d1 dbus: Add missing schema 2019-03-27 13:48:53 +00:00
d04020f79c readme: Use language with non-US layout 2019-03-27 13:33:40 +00:00
6b15072764 dbus: Use generated code 2019-03-23 09:36:53 +00:00
f261115ac4 ci: Change job name to meson 2019-03-22 19:06:29 +00:00
116f130c4c readme: Remove settings schema variable 2019-03-22 19:00:03 +00:00
cad1b02482 settings: Switching layouts according to input settings 2019-03-22 17:18:12 +00:00
09fe69f63a cleanup: Remove Context dbus interface remains 2019-03-22 16:35:02 +00:00
8ecd81d51c settings: Fall back to "us" layout when no file found 2019-03-22 16:20:39 +00:00
8f71b010cc settings: Removed custom settings schema 2019-03-22 15:52:35 +00:00
b817c6189d build: Update keysym generator to Python3 2019-03-22 13:09:21 +00:00
a00d41930d readme: Update features 2019-03-22 07:23:17 +00:00
caee942796 build, readme: Update build and run instructions 2019-03-22 07:23:17 +00:00
d3410fdc61 Keyboard shows up on a single ShowKeyboard 2019-03-22 07:23:12 +00:00
8087c3e5d4 build: Use only meson for squeekboard
This breaks autoconf. The only resulting binary is the squeekboard GUI. It still needs the autotools-built eekboard client in order to do anything useful. That one needs to be built using a different branch, making this a WIP.
2019-03-15 20:59:29 +00:00
10bd0ea09e build: Remove eekboard-server 2019-03-14 20:40:27 +00:00
5803222e68 build: Remove libeekboard dependency 2019-03-14 18:03:10 +00:00
a243fce1ae build: Squeekboard build in meson 2019-03-14 17:29:13 +00:00
c8059ebf50 stubbing: Key generation events
Only enabled when Xtest is in use. It's probably always meant to be in use though, as this piece of code also opens the preferences dialog
2019-03-14 11:09:35 +00:00
ce2d270e7c ci: Add config flags relevant for Wayland builds 2019-03-13 18:08:56 +00:00
0c945bdc7e readme: Update build and run instructions 2019-03-13 17:59:59 +00:00
60ec684853 readme: Moved to Markdown 2019-03-13 17:59:54 +00:00
b159625e62 Add gitlab CI 2019-02-14 16:57:39 +00:00
158 changed files with 6783 additions and 14010 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.zanata-cache/
_build
TAGS
tags
vgdump
*.swp
*~
\#*#
.\#*

33
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,33 @@
image: debian:buster
stages:
- build
- test
.tags: &tags
tags:
- librem5
before_script:
- apt-get -y update
- apt-get -y build-dep .
build_meson:
<<: *tags
stage: build
artifacts:
paths:
- _build
script:
- meson . _build/ -Ddepdatadir=/usr/share
- ninja -C _build install
test:
<<: *tags
stage: test
dependencies:
- build_meson
script:
- export LC_ALL=C.UTF-8
- ninja -C _build test

View File

View File

@ -1,39 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = eek eekboard src tests bindings docs po data examples
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection
GITIGNOREFILES = \
INSTALL \
aclocal.m4 \
compile \
config.guess \
config.h.in \
config.sub \
depcomp \
gtk-doc.make \
install-sh \
ltmain.sh \
m4 \
missing \
mkinstalldirs \
$(NULL)
-include $(top_srcdir)/git.mk

0
NEWS
View File

35
README
View File

@ -1,35 +0,0 @@
eekboard - an easy to use virtual keyboard toolkit -*- outline -*-
eekboard is a virtual keyboard software package, including a set of
tools to implement desktop virtual keyboards.
* Building
** Dependencies
REQUIRED: GLib2, GTK, PangoCairo, libxklavier, libcroco
OPTIONAL: libXtst, at-spi2-core, IBus, Clutter, Clutter-Gtk, Python, Vala, gobject-introspection, libcanberra
** Build from git repo
$ git clone git://github.com/ueno/eekboard.git
$ cd eekboard
$ ./autogen.sh --prefix=/usr --enable-gtk-doc
$ make
$ sudo make install
** Build from tarball
$ ./configure --prefix=/usr
$ make
$ sudo make install
* Running
$ eekboard
$ eekboard -f # show/hide automatically based on focus-in/focus-out events
Even though eekboard -f watches a11y events by default, it currently
works better with IBus. To use IBus, do:
$ gsettings set org.fedorahosted.eekboard focus-listener 'ibus'

68
README.md Normal file
View File

@ -0,0 +1,68 @@
*squeekboard* - a Wayland virtual keyboard
========================================
*Squeekboard* is a virtual keyboard supporting Wayland, built primarily for the *Librem 5* phone.
Features
--------
### Present
- GTK3
- Custom xml-defined keyboards
- DBus interface to show and hide
### Temporarily dropped
- A settings interface
### TODO
- Use Wayland virtual keyboard protocol
- Use Wayland text input protocol
- Use Wayland input method protocol
- Pick up DBus interface files from /usr/share
Building
--------
### Dependencies
See `.gitlab-ci.yml`.
### Build from git repo
```
$ git clone https://source.puri.sm/Librem5/eekboard.git
$ cd eekboard
$ mkdir ../build
$ meson ../build/
$ cd ../build
$ ninja install
```
For development, alter the `meson` call:
```
$ meson ../build/ --prefix=../install
```
and don't skip `ninja install` before running. The last step is necessary in order to find the keyboard definition files.
Running
-------
```
$ rootston
$ cd ../build/
$ src/squeekboard
```
### Testing
```
$ busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
$ busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
$ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ua')]"
$ gsettings set org.gnome.desktop.input-sources current 1
```

1
TODO
View File

@ -1 +0,0 @@
See https://github.com/ueno/eekboard/wiki/TODO

View File

@ -1,25 +0,0 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
PKG_NAME="eekboard"
(test -f $srcdir/configure.ac \
&& test -f $srcdir/README ) || {
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
}
which gnome-autogen.sh || {
echo "You need to install gnome-common from the GNOME CVS"
exit 1
}
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
REQUIRED_AUTOMAKE_VERSION=1.10
REQUIRED_AUTOCONF_VERSION=2.60
. gnome-autogen.sh

View File

@ -1,21 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
SUBDIRS = vala
-include $(top_srcdir)/git.mk

View File

@ -1,96 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
NULL =
if ENABLE_VALA
vapidir = $(datadir)/vala/vapi
dist_vapi_DATA = \
eek-$(EEK_API_VERSION).vapi \
eek-$(EEK_API_VERSION).deps \
eek-gtk-$(EEK_API_VERSION).vapi \
eek-gtk-$(EEK_API_VERSION).deps \
eek-xkl-$(EEK_API_VERSION).vapi \
eek-xkl-$(EEK_API_VERSION).deps \
$(NULL)
EXTRA_DIST = \
Eek-$(EEK_API_VERSION).metadata \
EekGtk-$(EEK_API_VERSION).metadata \
EekXkl-$(EEK_API_VERSION).metadata \
$(NULL)
GITIGNOREFILES = \
eek-$(EEK_API_VERSION).vapi \
eek-gtk-$(EEK_API_VERSION).vapi \
eek-xkl-$(EEK_API_VERSION).vapi \
$(NULL)
maintainer-clean-local:
rm -f *.vapi
eek_vapi_deps = \
$(srcdir)/Eek-$(EEK_API_VERSION).metadata \
| \
$(top_builddir)/eek/Eek-$(EEK_API_VERSION).gir \
$(NULL)
eek-$(EEK_API_VERSION).vapi: $(eek_vapi_deps)
$(VAPIGEN_V)$(VAPIGEN) \
--library eek-$(EEK_API_VERSION) \
--pkg gio-2.0 \
--metadatadir=$(srcdir) \
$(top_builddir)/eek/Eek-$(EEK_API_VERSION).gir
eek_gtk_vapi_deps = \
$(srcdir)/EekGtk-$(EEK_API_VERSION).metadata \
| \
$(top_builddir)/eek/EekGtk-$(EEK_API_VERSION).gir \
$(NULL)
eek-gtk-$(EEK_API_VERSION).vapi: $(eek_gtk_vapi_deps)
$(VAPIGEN_V)$(VAPIGEN) --vapidir=$(builddir) \
--library eek-gtk-$(EEK_API_VERSION) \
--pkg eek-$(EEK_API_VERSION) \
--pkg gio-2.0 \
--pkg gtk+-3.0 \
--metadatadir=$(srcdir) \
$(top_builddir)/eek/EekGtk-$(EEK_API_VERSION).gir
eek_xkl_vapi_deps = \
$(srcdir)/EekXkl-$(EEK_API_VERSION).metadata \
| \
$(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir \
$(NULL)
eek-xkl-$(EEK_API_VERSION).vapi: $(eek_xkl_vapi_deps)
$(VAPIGEN_V)$(VAPIGEN) \
--vapidir=$(builddir) \
--library eek-xkl-$(EEK_API_VERSION) \
--pkg eek-$(EEK_API_VERSION) \
--pkg gio-2.0 \
--metadatadir=$(srcdir) \
$(top_builddir)/eek/EekXkl-$(EEK_API_VERSION).gir
# set up the verbosity rules to avoid some build noise
VAPIGEN_V = $(VAPIGEN_V_$(V))
VAPIGEN_V_ = $(VAPIGEN_V_$(AM_DEFAULT_VERBOSITY))
VAPIGEN_V_0 = @echo " VAPIG " $@;
endif
-include $(top_srcdir)/git.mk

View File

@ -1,245 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
AC_PREREQ(2.63)
dnl AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_INIT([eekboard], [1.0.8], [ueno@unixuser.org])
dnl Init automake
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE([enable])
AC_GNU_SOURCE
dnl Support silent build
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
dnl Check for programs
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_CXX
# define PACKAGE_VERSION_* variables
AM_DISABLE_STATIC
AC_ISC_POSIX
AC_HEADER_STDC
LT_INIT
IT_PROG_INTLTOOL([0.35.0])
GTK_API_VERSION=3.0
GTK_REQUIRED=2.91.0
EEK_API_VERSION=0.90
EEK_API_MAJOR_VERSION=0
EEK_API_MINOR_VERSION=90
EEK_API_PC_VERSION=0.90
EEK_LIBRARY_SUFFIX="-$EEK_API_VERSION"
AC_SUBST([GTK_API_VERSION])
AC_SUBST([EEK_API_VERSION])
AC_SUBST([EEK_API_MAJOR_VERSION])
AC_SUBST([EEK_API_MINOR_VERSION])
AC_SUBST([EEK_API_PC_VERSION])
AC_SUBST([EEK_LIBRARY_SUFFIX])
AC_SUBST([EEK_LIBRARY_SUFFIX_U],[AS_TR_SH([$EEK_LIBRARY_SUFFIX])])
AM_PATH_GLIB_2_0
PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= 2.26.0], ,
[AC_MSG_ERROR([GLib2 not found])])
PKG_CHECK_MODULES([GIO2], [gio-2.0], ,
[AC_MSG_ERROR([Gio2 not found])])
GLIB_GSETTINGS
PKG_CHECK_MODULES([PANGOCAIRO], [pangocairo], ,
[AC_MSG_ERROR([PangoCairo not found])])
PKG_CHECK_MODULES([GTK], [
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
gdk-$GTK_API_VERSION >= $GTK_REQUIRED], ,
[AC_MSG_ERROR([GTK not found])])
PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier x11], ,
[AC_MSG_ERROR([Libxklavier not found])])
PKG_CHECK_MODULES([LIBCROCO], [libcroco-0.6], ,
[AC_MSG_ERROR([libcroco not found])])
dnl use XTest to generate key events
AC_MSG_CHECKING([whether you enable XTest])
AC_ARG_ENABLE(xtest,
AS_HELP_STRING([--enable-xtest=no/yes],
[Enable XTest default=yes]),
enable_xtest=$enableval,
enable_xtest=yes)
if test x$enable_xtest = xyes; then
PKG_CHECK_MODULES([XTEST], [xtst], , enable_xtest=no)
if test x$enable_xtest = xyes; then
AC_DEFINE([HAVE_XTEST], [1], [Define if XTest is found])
fi
fi
AM_CONDITIONAL(ENABLE_XTEST, [test x$enable_xtest = xyes])
AC_MSG_RESULT($enable_xtest)
dnl use X to mark the fullscreen window as dock
AC_MSG_CHECKING([whether you enable X dock])
AC_ARG_ENABLE(x-dock,
AS_HELP_STRING([--enable-x-dock=no/yes],
[Enable X dock default=yes]),
enable_x_dock=$enableval,
enable_x_dock=yes)
if test x$enable_x_dock = xyes; then
PKG_CHECK_MODULES([XDOCK], [x11], , enable_x_dock=no)
if test x$enable_x_dock = xyes; then
AC_DEFINE([HAVE_XDOCK], [1], [Define if X dock is found])
fi
fi
AM_CONDITIONAL(ENABLE_XDOCK, [test x$enable_x_dock = xyes])
AC_MSG_RESULT($enable_x_dock)
focus_listeners="ibus"
keystroke_listeners=""
dnl use AT-SPI 2 to capture focus/keystroke events
AC_MSG_CHECKING([whether you enable AT-SPI 2 event handling])
AC_ARG_ENABLE(atspi,
AS_HELP_STRING([--enable-atspi=no/yes],
[Enable AT-SPI 2 event handling default=yes]),
enable_atspi=$enableval,
enable_atspi=yes)
if test x$enable_atspi = xyes; then
PKG_CHECK_MODULES([ATSPI2], [atspi-2], , enable_atspi=no)
if test x$enable_atspi = xyes; then
AC_DEFINE([HAVE_ATSPI], [1], [Define if AT-SPI 2 is found])
focus_listeners="atspi $focus_listeners"
keystroke_listeners="atspi $keystroke_listeners"
fi
fi
AC_MSG_RESULT($enable_atspi)
AM_CONDITIONAL(ENABLE_ATSPI, [test x$enable_atspi = xyes])
if test -n "$focus_listeners"; then
AC_DEFINE(ENABLE_FOCUS_LISTENER, [1], [Define if eekboard can follow focus changes])
fi
GOBJECT_INTROSPECTION_CHECK([0.9.0])
dnl Vala langauge binding
AC_MSG_CHECKING([whether you enable Vala language support])
AC_ARG_ENABLE(vala,
AS_HELP_STRING([--enable-vala=no/yes],
[Enable Vala language binding default=yes]),
enable_vala=$enableval,
enable_vala=yes)
if test x$enable_vala = xyes; then
if test "x$INTROSPECTION_SCANNER" = x; then
enable_vala=no
AC_MSG_WARN([GObject-Introspection must be enabled for Vala bindings])
fi
AM_PROG_VALAC([0.10.0])
have_vala=yes
AC_PATH_PROG(VALAC, valac, valac)
AC_SUBST(VALAC)
AC_SUBST(VALAFLAGS)
AC_PATH_PROG([VAPIGEN], [vapigen], [false])
if test "x$VAPIGEN" = "xfalse"; then
enable_vala=no
AC_MSG_WARN([vapigen not found. Was vala compiled with --enable-vapigen?])
fi
AC_SUBST(VAPIGEN)
fi
AC_MSG_RESULT($enable_vala)
AM_CONDITIONAL(ENABLE_VALA, [test x$enable_vala = xyes])
dnl libcanberra
AC_MSG_CHECKING([whether you enable libcanberra])
AC_ARG_ENABLE(libcanberra,
AS_HELP_STRING([--enable-libcanberra=no/yes],
[Enable libcanberra user interface default=no]),
enable_libcanberra=$enableval,
enable_libcanberra=yes)
if test x$enable_libcanberra = xyes; then
PKG_CHECK_MODULES([LIBCANBERRA], [libcanberra-gtk3], , enable_libcanberra=no)
if test x$enable_libcanberra = xyes; then
AC_DEFINE([HAVE_LIBCANBERRA], [1], [Define if libcanberra is found])
fi
fi
AM_CONDITIONAL(ENABLE_LIBCANBERRA, [test x$enable_libcanberra = xyes])
AC_MSG_RESULT($enable_libcanberra)
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
dnl define GETTEXT_* variables
GETTEXT_PACKAGE=$PACKAGE
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only architecture-independent data directory.])
AM_GLIB_GNU_GETTEXT
AM_GLIB_DEFINE_LOCALEDIR(EEKBOARD_LOCALEDIR)
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
eek/Makefile
eekboard/Makefile
src/Makefile
tests/Makefile
bindings/Makefile
bindings/vala/Makefile
docs/Makefile
docs/reference/Makefile
docs/reference/eek/Makefile
docs/reference/eekboard/Makefile
po/Makefile.in
data/Makefile
data/icons/Makefile
data/icons/16x16/Makefile
data/icons/22x22/Makefile
data/icons/24x24/Makefile
data/icons/32x32/Makefile
data/icons/48x48/Makefile
data/icons/scalable/Makefile
data/themes/Makefile
data/keyboards/Makefile
examples/Makefile
examples/simple-client/Makefile
eek/eek-${EEK_API_VERSION}.pc
eek/eek-gtk-${EEK_API_VERSION}.pc
eek/eek-xkl-${EEK_API_VERSION}.pc
eekboard/eekboard-${EEK_API_VERSION}.pc])
AC_OUTPUT
AC_MSG_RESULT([
Build options:
Version $VERSION
Install prefix $prefix
Build shared libs $enable_shared
Build static libs $enable_static
CFLAGS $CFLAGS
Build Vala binding $enable_vala
Sound support $enable_libcanberra
Build document $enable_gtk_doc
Focus listeners $focus_listeners
Keystroke listeners $keystroke_listeners
])

View File

@ -1,35 +0,0 @@
SUBDIRS = icons themes keyboards
@GSETTINGS_RULES@
@INTLTOOL_XML_NOMERGE_RULE@
gsettings_schemas_in_files = org.fedorahosted.eekboard.gschema.xml.in
gsettings_SCHEMAS = $(gsettings_schemas_in_files:.gschema.xml.in=.gschema.xml)
servicedir = $(datadir)/dbus-1/services
service_in_files = eekboard-server.service.in
service_DATA = $(service_in_files:.service.in=.service)
$(service_DATA): $(service_in_files) Makefile
$(AM_V_GEN) sed -e "s|\@bindir\@|$(bindir)|" $< > $@
desktopdir = $(datadir)/applications
desktop_in_files = eekboard.desktop.in
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
if ENABLE_ATSPI
autostartdir = $(sysconfdir)/xdg/autostart
autostart_in_files = eekboard-autostart.desktop.in
autostart_DATA = $(autostart_in_files:.desktop.in=.desktop)
endif
@INTLTOOL_DESKTOP_RULE@
CLEANFILES = $(service_DATA) $(desktop_DATA) $(gsettings_SCHEMAS)
EXTRA_DIST = $(service_in_files) $(desktop_in_files) $(gsettings_schemas_in_files)
if ENABLE_ATSPI
CLEANFILES += $(autostart_DATA)
EXTRA_DIST += $(autostart_in_files)
endif
-include $(top_srcdir)/git.mk

View File

@ -0,0 +1,20 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<interface name="sm.puri.OSK0">
<method name="SetVisible">
<arg name="visible" type="b" direction="in"/>
<doc:doc><doc:description>
Switch keyboard visibility
</doc:description></doc:doc>
</method>
<method name="GetVisible">
<arg name="visible" type="b" direction="out"/>
<doc:doc><doc:description>
Get keyboard visibility
</doc:description></doc:doc>
</method>
<property name="Visible" type="b" access="read">
</property>
</interface>
</node>

View File

@ -1,17 +0,0 @@
size = 16x16
icondir = $(datadir)/icons/hicolor/$(size)/apps
dist_icon_DATA = eekboard.png
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
-include $(top_srcdir)/git.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 B

View File

@ -1,17 +0,0 @@
size = 22x22
icondir = $(datadir)/icons/hicolor/$(size)/apps
dist_icon_DATA = eekboard.png
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
-include $(top_srcdir)/git.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 892 B

View File

@ -1,17 +0,0 @@
size = 24x24
icondir = $(datadir)/icons/hicolor/$(size)/apps
dist_icon_DATA = eekboard.png
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
-include $(top_srcdir)/git.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 957 B

View File

@ -1,17 +0,0 @@
size = 32x32
icondir = $(datadir)/icons/hicolor/$(size)/apps
dist_icon_DATA = eekboard.png
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
-include $(top_srcdir)/git.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -1,17 +0,0 @@
size = 48x48
icondir = $(datadir)/icons/hicolor/$(size)/apps
dist_icon_DATA = eekboard.png
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
-include $(top_srcdir)/git.mk

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,3 +0,0 @@
SUBDIRS = 16x16 22x22 24x24 32x32 48x48 scalable
-include $(top_srcdir)/git.mk

10
data/icons/key-enter.svg Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"
version="1.1" viewBox="0 0 24 24">
<path d="M 24,1 L 24,10 C 24,15 20,17 17,17 L 7,17 L 10,20 L 10,23
L 7,23 L 0,15 L 7,7 L 10,7 L 10,10 L 7,13 L 17,13
C 19,13 20,12 20,10 L 20,1 Z"
stroke="none" fill="black" />
</svg>

After

Width:  |  Height:  |  Size: 388 B

8
data/icons/key-shift.svg Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"
version="1.1" viewBox="0 0 24 24">
<path d="M 12,2 L 22,14 L 16,14 L 16,22 L 8,22 L 8,14 L 2,14 Z"
stroke="none" fill="black" />
</svg>

After

Width:  |  Height:  |  Size: 279 B

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg4043"
version="1.1"
viewBox="0 0 4.2333331 4.2333093"
height="4.2333093mm"
width="4.2333331mm">
<defs
id="defs4037" />
<metadata
id="metadata4040">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(-86.329776,-68.097636)"
id="layer1">
<g
style="stroke-width:1.00004983;fill:#2e3436;fill-opacity:1"
transform="matrix(0.99990029,0,0,1,-7.1823833,-1.8799927)"
id="g842">
<g
style="stroke-width:1.00004983;fill:#2e3436;fill-opacity:1"
id="g836">
<path
id="path5166"
d="m 95.636719,69.978516 c -1.165869,0 -2.115235,0.949365 -2.115235,2.115234 0,1.165869 0.949366,2.117188 2.115235,2.117188 1.165869,0 2.117187,-0.951319 2.117187,-2.117188 0,-1.165869 -0.951318,-2.115234 -2.117187,-2.115234 z m 0,0.529296 c 0.879886,0 1.58789,0.706052 1.58789,1.585938 0,0.879886 -0.708004,1.587891 -1.58789,1.587891 -0.879886,0 -1.585938,-0.708005 -1.585938,-1.587891 0,-0.879886 0.706052,-1.585937 1.585938,-1.585938 z"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52919304;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
</g>
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26459652;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 95.636719,70.109375 c -0.144398,0 -0.27248,0.07793 -0.373047,0.189453 -0.100567,0.111521 -0.18209,0.261405 -0.25,0.439453 -0.135821,0.356096 -0.214844,0.830395 -0.214844,1.355469 0,0.525074 0.07902,1.001326 0.214844,1.357422 0.06791,0.178048 0.149433,0.327932 0.25,0.439453 0.100567,0.111521 0.228649,0.1875 0.373047,0.1875 0.144397,0 0.27248,-0.07598 0.373047,-0.1875 0.100566,-0.111521 0.182089,-0.261405 0.25,-0.439453 0.135821,-0.356096 0.216797,-0.832348 0.216796,-1.357422 0,-0.525074 -0.08097,-0.999373 -0.216796,-1.355469 -0.06791,-0.178048 -0.149434,-0.327932 -0.25,-0.439453 -0.100567,-0.111521 -0.22865,-0.189453 -0.373047,-0.189453 z m 0,0.265625 c 0.05067,0 0.109272,0.02564 0.177734,0.101562 0.06846,0.07592 0.139293,0.198356 0.199219,0.355469 0.119851,0.314227 0.197266,0.763915 0.197266,1.261719 0,0.497804 -0.07742,0.949446 -0.197266,1.263672 -0.05993,0.157113 -0.130756,0.279549 -0.199219,0.355469 -0.06846,0.07592 -0.12706,0.101562 -0.177734,0.101562 -0.05067,0 -0.107319,-0.02564 -0.175781,-0.101562 -0.06846,-0.07592 -0.139294,-0.198356 -0.199219,-0.355469 C 95.141867,73.043196 95.0625,72.591554 95.0625,72.09375 c 0,-0.497804 0.07937,-0.947492 0.199219,-1.261719 0.05993,-0.157113 0.130756,-0.279549 0.199219,-0.355469 C 95.5294,70.400643 95.586045,70.375 95.636719,70.375 Z"
id="circle5168" />
<path
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26459652;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 93.697266,71.962891 v 0.263671 h 3.96875 v -0.263671 z"
id="path5170" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -1,15 +0,0 @@
icondir = $(datadir)/icons/hicolor/scalable/apps
dist_icon_DATA = eekboard.svg
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook:
@-if test -z "$(DESTDIR)"; then \
echo "Updating Gtk icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
-include $(top_srcdir)/git.mk

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 472 KiB

View File

@ -1,40 +0,0 @@
keyboardsdir = $(pkgdatadir)/keyboards
nobase_dist_keyboards_DATA = \
keyboards.xml \
geometry/compact.xml \
symbols/ar.xml \
symbols/be.xml \
symbols/fa.xml \
symbols/he.xml \
symbols/ja-kana.xml \
symbols/kk.xml \
symbols/ks.xml \
symbols/my.xml \
symbols/ru.xml \
symbols/th.xml \
symbols/ua.xml \
symbols/ug.xml \
symbols/us.xml \
symbols/zh-bopomofo.xml \
$(inscript_symbols) \
$(NULL)
inscript_symbols = \
symbols/as-inscript.xml \
symbols/bn-inscript.xml \
symbols/gu-inscript.xml \
symbols/hi-inscript.xml \
symbols/kn-inscript.xml \
symbols/ks-inscript.xml \
symbols/mai-inscript.xml \
symbols/ml-inscript.xml \
symbols/mr-inscript.xml \
symbols/or-inscript.xml \
symbols/pa-inscript.xml \
symbols/sd-inscript.xml \
symbols/ta-inscript.xml \
symbols/te-inscript.xml \
$(NULL)
-include $(top_srcdir)/git.mk

View File

@ -1,313 +1,120 @@
<?xml version="1.0"?>
<geometry version="0.90">
<bounds x="0.000000" y="0.000000" width="640.0000" height="296.5853"/>
<bounds x="0" y="10.000000" width="426.0000" height="296.5853"/>
<section angle="0">
<bounds x="15.60975" y="15.60975" width="640.0000" height="39.02439"/>
<row orientation="1">
<key keycode="9" name="ESC" oref="outline2">
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="67" name="FK01" oref="outline2">
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="68" name="FK02" oref="outline2">
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="69" name="FK03" oref="outline2">
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="70" name="FK04" oref="outline2">
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="71" name="FK05" oref="outline2">
<bounds x="266.9268" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="72" name="FK06" oref="outline2">
<bounds x="307.5121" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="73" name="FK07" oref="outline2">
<bounds x="348.0975" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="74" name="FK08" oref="outline2">
<bounds x="388.6829" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="75" name="FK09" oref="outline2">
<bounds x="449.5609" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="76" name="FK10" oref="outline2">
<bounds x="490.1463" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="95" name="FK11" oref="outline2">
<bounds x="530.7317" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="96" name="FK12" oref="outline2">
<bounds x="571.3170" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="24" name="AD01" oref="outline2" />
<key keycode="25" name="AD02" oref="outline2" />
<key keycode="26" name="AD03" oref="outline2" />
<key keycode="27" name="AD04" oref="outline2" />
<key keycode="28" name="AD05" oref="outline2" />
<key keycode="29" name="AD06" oref="outline2" />
<key keycode="30" name="AD07" oref="outline2" />
<key keycode="31" name="AD08" oref="outline2" />
<key keycode="32" name="AD09" oref="outline2" />
<key keycode="33" name="AD10" oref="outline2" />
</row>
</section>
<section angle="0">
<bounds x="15.60975" y="78.04878" width="608.7804" height="201.3658"/>
<row orientation="1">
<key keycode="49" name="TLDE" oref="outline2">
<bounds x="3.121951" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="10" name="AE01" oref="outline2">
<bounds x="43.70731" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="11" name="AE02" oref="outline2">
<bounds x="84.29268" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="12" name="AE03" oref="outline2">
<bounds x="124.8780" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="13" name="AE04" oref="outline2">
<bounds x="165.4634" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="14" name="AE05" oref="outline2">
<bounds x="206.0487" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="15" name="AE06" oref="outline2">
<bounds x="245.0731" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="16" name="AE07" oref="outline2">
<bounds x="285.6585" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="17" name="AE08" oref="outline2">
<bounds x="326.2439" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="18" name="AE09" oref="outline2">
<bounds x="366.8292" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="19" name="AE10" oref="outline2">
<bounds x="407.4146" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="20" name="AE11" oref="outline2">
<bounds x="448.0000" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="21" name="AE12" oref="outline2">
<bounds x="488.5853" y="1.560976" width="37.46341" height="37.46341"/>
</key>
<key keycode="22" name="BKSP" oref="outline13">
<bounds x="529.1707" y="1.560976" width="79.60975" height="37.46341"/>
</key>
<key keycode="38" name="AC01" oref="outline2" />
<key keycode="39" name="AC02" oref="outline2" />
<key keycode="40" name="AC03" oref="outline2" />
<key keycode="41" name="AC04" oref="outline2" />
<key keycode="42" name="AC05" oref="outline2" />
<key keycode="43" name="AC06" oref="outline2" />
<key keycode="44" name="AC07" oref="outline2" />
<key keycode="45" name="AC08" oref="outline2" />
<key keycode="46" name="AC09" oref="outline2" />
<key keycode="47" name="AC10" oref="outline2" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="23" name="TAB" oref="outline4">
<bounds x="3.121951" y="42.14634" width="59.31707" height="37.46341"/>
</key>
<key keycode="24" name="AD01" oref="outline2">
<bounds x="65.56097" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="25" name="AD02" oref="outline2">
<bounds x="106.1463" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="26" name="AD03" oref="outline2">
<bounds x="145.1707" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="27" name="AD04" oref="outline2">
<bounds x="185.7560" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="28" name="AD05" oref="outline2">
<bounds x="226.3414" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="29" name="AD06" oref="outline2">
<bounds x="266.9268" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="30" name="AD07" oref="outline2">
<bounds x="307.5121" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="31" name="AD08" oref="outline2">
<bounds x="348.0975" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="32" name="AD09" oref="outline2">
<bounds x="388.6829" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="33" name="AD10" oref="outline2">
<bounds x="429.2682" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="34" name="AD11" oref="outline2">
<bounds x="468.2926" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="35" name="AD12" oref="outline2">
<bounds x="508.8780" y="42.14634" width="37.46341" height="37.46341"/>
</key>
<key keycode="51" name="BKSL" oref="outline5">
<bounds x="549.4634" y="42.14634" width="59.31707" height="37.46341"/>
</key>
<key keycode="50" name="LFSH" oref="altline" />
<key keycode="52" name="AB01" oref="outline2" />
<key keycode="53" name="AB02" oref="outline2" />
<key keycode="54" name="AB03" oref="outline2" />
<key keycode="55" name="AB04" oref="outline2" />
<key keycode="56" name="AB05" oref="outline2" />
<key keycode="57" name="AB06" oref="outline2" />
<key keycode="58" name="AB07" oref="outline2" />
<key keycode="22" name="BKSP" oref="altline" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="66" name="CAPS" oref="outline6">
<bounds x="3.121951" y="82.73170" width="68.68292" height="37.46341"/>
</key>
<key keycode="38" name="AC01" oref="outline2">
<bounds x="76.48780" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="39" name="AC02" oref="outline2">
<bounds x="115.5121" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="40" name="AC03" oref="outline2">
<bounds x="156.0975" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="41" name="AC04" oref="outline2">
<bounds x="196.6829" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="42" name="AC05" oref="outline2">
<bounds x="237.2682" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="43" name="AC06" oref="outline2">
<bounds x="277.8536" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="44" name="AC07" oref="outline2">
<bounds x="318.4390" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="45" name="AC08" oref="outline2">
<bounds x="359.0243" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="46" name="AC09" oref="outline2">
<bounds x="399.6097" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="47" name="AC10" oref="outline2">
<bounds x="438.6341" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="48" name="AC11" oref="outline2">
<bounds x="479.2195" y="82.73170" width="37.46341" height="37.46341"/>
</key>
<key keycode="36" name="RTRN" oref="outline7">
<bounds x="519.8048" y="82.73170" width="88.97561" height="37.46341"/>
</key>
</row>
<row orientation="1">
<key keycode="50" name="LFSH" oref="outline8">
<bounds x="3.121951" y="121.7560" width="88.97561" height="37.46341"/>
</key>
<key keycode="52" name="AB01" oref="outline2">
<bounds x="95.21951" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="53" name="AB02" oref="outline2">
<bounds x="135.8048" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="54" name="AB03" oref="outline2">
<bounds x="176.3902" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="55" name="AB04" oref="outline2">
<bounds x="215.4146" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="56" name="AB05" oref="outline2">
<bounds x="256.0000" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="57" name="AB06" oref="outline2">
<bounds x="296.5853" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="58" name="AB07" oref="outline2">
<bounds x="337.1707" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="59" name="AB08" oref="outline2">
<bounds x="377.7560" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="60" name="AB09" oref="outline2">
<bounds x="418.3414" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="61" name="AB10" oref="outline2">
<bounds x="458.9268" y="121.7560" width="37.46341" height="37.46341"/>
</key>
<key keycode="62" name="RTSH" oref="outline9">
<bounds x="499.5121" y="121.7560" width="109.2682" height="37.46341"/>
</key>
</row>
<row orientation="1">
<key keycode="149" name="I149" oref="outline10">
<bounds x="3.121951" y="162.3414" width="37.46341" height="37.46341"/>
</key>
<key keycode="37" name="LCTL" oref="outline1">
<bounds x="62.43902" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="64" name="LALT" oref="outline1">
<bounds x="113.9512" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="65" name="SPCE" oref="outline3">
<bounds x="165.4634" y="162.3414" width="217.5853" height="37.46341"/>
</key>
<key keycode="113" name="LEFT" oref="outline1">
<bounds x="368.0487" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="111" name="UP" oref="outline1">
<bounds x="419.43894" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="116" name="DOWN" oref="outline1">
<bounds x="470.82918" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="114" name="RGHT" oref="outline1">
<bounds x="522.21942" y="162.3414" width="48.39024" height="37.46341"/>
</key>
<key keycode="150" name="I150" oref="outline10">
<bounds x="573.60966" y="162.3414" width="37.46341" height="37.46341"/>
</key>
<key keycode="0" name="ABC123" oref="altline" />
<key keycode="149" name="I149" oref="altline" />
<key keycode="65" name="SPCE" oref="spaceline" />
<key keycode="59" name="AB08" oref="outline2" />
<key keycode="36" name="RTRN" oref="outline7" />
</row>
</section>
<outline id="outline2" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline1" corner-radius="1.000000">
<outline id="altline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="48.39024" y="0.000000"/>
<point x="48.39024" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="48.39024" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline4" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline5" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline6" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="68.68292" y="0.000000"/>
<point x="68.68292" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="68.68292" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline7" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline8" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline9" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="109.2682" y="0.000000"/>
<point x="109.2682" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="109.2682" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline10" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline13" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="79.60975" y="0.000000"/>
<point x="79.60975" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="79.60975" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline3" corner-radius="1.000000">
<outline id="spaceline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="217.5853" y="0.000000"/>
<point x="217.5853" y="37.46341"/>
<point x="0.000000" y="37.46341"/>
<point x="150.5853" y="0.000000"/>
<point x="150.5853" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
</geometry>

View File

@ -0,0 +1,126 @@
<?xml version="1.0"?>
<geometry version="0.90">
<bounds x="0" y="10.000000" width="426.0000" height="296.5853"/>
<!-- Keycodes correspond to those used in /usr/share/X11/xkb/keycodes/evdev.
For Squeekboard, the values have no connection to evdev. They are only
used as indices into the keymap sent to the compositor. They must have
values in the range from 8 to 255. -->
<section angle="0">
<row orientation="1">
<key keycode="24" name="AD01" oref="outline2" />
<key keycode="25" name="AD02" oref="outline2" />
<key keycode="26" name="AD03" oref="outline2" />
<key keycode="27" name="AD04" oref="outline2" />
<key keycode="28" name="AD05" oref="outline2" />
<key keycode="29" name="AD06" oref="outline2" />
<key keycode="30" name="AD07" oref="outline2" />
<key keycode="31" name="AD08" oref="outline2" />
<key keycode="32" name="AD09" oref="outline2" />
<key keycode="33" name="AD10" oref="outline2" />
<key keycode="34" name="AD11" oref="outline2" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="38" name="AC01" oref="outline2" />
<key keycode="39" name="AC02" oref="outline2" />
<key keycode="40" name="AC03" oref="outline2" />
<key keycode="41" name="AC04" oref="outline2" />
<key keycode="42" name="AC05" oref="outline2" />
<key keycode="43" name="AC06" oref="outline2" />
<key keycode="44" name="AC07" oref="outline2" />
<key keycode="45" name="AC08" oref="outline2" />
<key keycode="46" name="AC09" oref="outline2" />
<key keycode="47" name="AC10" oref="outline2" />
<key keycode="48" name="AC11" oref="outline2" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="50" name="LFSH" oref="altline" />
<key keycode="52" name="AB01" oref="outline2" />
<key keycode="53" name="AB02" oref="outline2" />
<key keycode="54" name="AB03" oref="outline2" />
<key keycode="55" name="AB04" oref="outline2" />
<key keycode="56" name="AB05" oref="outline2" />
<key keycode="57" name="AB06" oref="outline2" />
<key keycode="58" name="AB07" oref="outline2" />
<key keycode="22" name="BKSP" oref="altline" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="0" name="ABC123" oref="altline" />
<key keycode="149" name="I149" oref="altline" />
<key keycode="65" name="SPCE" oref="spaceline" />
<key keycode="59" name="AB08" oref="outline2" />
<key keycode="36" name="RTRN" oref="outline7" />
</row>
</section>
<outline id="outline2" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="32" y="0.000000"/>
<point x="32" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="altline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="48.39024" y="0.000000"/>
<point x="48.39024" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline4" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline5" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline6" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="68.68292" y="0.000000"/>
<point x="68.68292" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline7" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline8" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline9" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="109.2682" y="0.000000"/>
<point x="109.2682" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline10" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline13" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="79.60975" y="0.000000"/>
<point x="79.60975" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="spaceline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="150.5853" y="0.000000"/>
<point x="150.5853" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
</geometry>

View File

@ -0,0 +1,105 @@
<?xml version="1.0"?>
<geometry version="0.90">
<bounds x="0" y="10.000000" width="426.0000" height="296.5853"/>
<section angle="0">
<row orientation="1">
<key keycode="24" name="AD01" oref="outline2" />
<key keycode="25" name="AD02" oref="outline2" />
<key keycode="26" name="AD03" oref="outline2" />
<key keycode="27" name="AD04" oref="outline2" />
<key keycode="28" name="AD05" oref="outline2" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="38" name="AC01" oref="outline2" />
<key keycode="39" name="AC02" oref="outline2" />
<key keycode="40" name="AC03" oref="outline2" />
<key keycode="41" name="AC04" oref="outline2" />
<key keycode="42" name="AC05" oref="outline2" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="52" name="AB01" oref="outline2" />
<key keycode="53" name="AB02" oref="outline2" />
<key keycode="54" name="AB03" oref="outline2" />
<key keycode="55" name="AB04" oref="outline2" />
<key keycode="56" name="AB05" oref="outline2" />
</row>
</section>
<section angle="0">
<row orientation="1">
<key keycode="22" name="BKSP" oref="altline" />
<key keycode="57" name="AB06" oref="outline2" />
<key keycode="65" name="SPCE" oref="spaceline" />
<key keycode="36" name="RTRN" oref="outline7" />
</row>
</section>
<outline id="outline2" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="altline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="48.39024" y="0.000000"/>
<point x="48.39024" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline4" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline5" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="59.31707" y="0.000000"/>
<point x="59.31707" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline6" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="68.68292" y="0.000000"/>
<point x="68.68292" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline7" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline8" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="88.97561" y="0.000000"/>
<point x="88.97561" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline9" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="109.2682" y="0.000000"/>
<point x="109.2682" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline10" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="37.46341" y="0.000000"/>
<point x="37.46341" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="outline13" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="79.60975" y="0.000000"/>
<point x="79.60975" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
<outline id="spaceline" corner-radius="1.000000">
<point x="0.000000" y="0.000000"/>
<point x="120.5853" y="0.000000"/>
<point x="120.5853" y="52.44877"/>
<point x="0.000000" y="52.44877"/>
</outline>
</geometry>

View File

@ -24,6 +24,9 @@
<keyboard id="my" name="my"
geometry="compact" symbols="my"
longname="Myanmar" language="my"/>
<keyboard id="nb" name="nb"
geometry="extended" symbols="nb"
longname="Norwegian" language="nb"/>
<keyboard id="ru" name="ru"
geometry="compact" symbols="us"
longname="Russian" language="ru"/>
@ -85,4 +88,10 @@
<keyboard id="te-inscript" name="te-inscript"
geometry="compact" symbols="te-inscript"
longname="Telugu (Inscript)" language="te"/>
<!-- Common keyboards -->
<keyboard id="numbers" name="numbers"
geometry="numbers-keypad" symbols="special/numbers"
longname="Numeric keypad" language="all"/>
</keyboards>

View File

@ -0,0 +1,308 @@
xkb_keymap {
xkb_keycodes "squeekboard" {
minimum = 8;
maximum = 255;
<ESC> = 9;
<AE01> = 10;
<AE02> = 11;
<AE03> = 12;
<AE04> = 13;
<AE05> = 14;
<AE06> = 15;
<AE07> = 16;
<AE08> = 17;
<AE09> = 18;
<AE10> = 19;
<AE11> = 20;
<AE12> = 21;
<BKSP> = 22;
<TAB> = 23;
<AD01> = 24;
<AD02> = 25;
<AD03> = 26;
<AD04> = 27;
<AD05> = 28;
<AD06> = 29;
<AD07> = 30;
<AD08> = 31;
<AD09> = 32;
<AD10> = 33;
<AD11> = 34;
<AD12> = 35;
<RTRN> = 36;
<LCTL> = 37;
<AC01> = 38;
<AC02> = 39;
<AC03> = 40;
<AC04> = 41;
<AC05> = 42;
<AC06> = 43;
<AC07> = 44;
<AC08> = 45;
<AC09> = 46;
<AC10> = 47;
<AC11> = 48;
<TLDE> = 49;
<LFSH> = 50;
<BKSL> = 51;
<AB01> = 52;
<AB02> = 53;
<AB03> = 54;
<AB04> = 55;
<AB05> = 56;
<AB06> = 57;
<AB07> = 58;
<AB08> = 59;
<AB09> = 60;
<AB10> = 61;
<RTSH> = 62;
<KPMU> = 63;
<LALT> = 64;
<SPCE> = 65;
<CAPS> = 66;
<FK01> = 67;
<FK02> = 68;
<FK03> = 69;
<FK04> = 70;
<FK05> = 71;
<FK06> = 72;
<FK07> = 73;
<FK08> = 74;
<FK09> = 75;
<FK10> = 76;
<NMLK> = 77;
<SCLK> = 78;
<KP7> = 79;
<KP8> = 80;
<KP9> = 81;
<KPSU> = 82;
<KP4> = 83;
<KP5> = 84;
<KP6> = 85;
<KPAD> = 86;
<KP1> = 87;
<KP2> = 88;
<KP3> = 89;
<KP0> = 90;
<KPDL> = 91;
<LVL3> = 92;
<LSGT> = 94;
<FK11> = 95;
<FK12> = 96;
<AB11> = 97;
<KATA> = 98;
<HIRA> = 99;
<HENK> = 100;
<HKTG> = 101;
<MUHE> = 102;
<JPCM> = 103;
<KPEN> = 104;
<RCTL> = 105;
<KPDV> = 106;
<PRSC> = 107;
<RALT> = 108;
<LNFD> = 109;
<HOME> = 110;
<UP> = 111;
<PGUP> = 112;
<LEFT> = 113;
<RGHT> = 114;
<END> = 115;
<DOWN> = 116;
<PGDN> = 117;
<INS> = 118;
<DELE> = 119;
<I120> = 120;
<MUTE> = 121;
<VOL-> = 122;
<VOL+> = 123;
<POWR> = 124;
<KPEQ> = 125;
<I126> = 126;
<PAUS> = 127;
<I128> = 128;
<I129> = 129;
<HNGL> = 130;
<HJCV> = 131;
<AE13> = 132;
<LWIN> = 133;
<RWIN> = 134;
<COMP> = 135;
<STOP> = 136;
<AGAI> = 137;
<PROP> = 138;
<UNDO> = 139;
<FRNT> = 140;
<COPY> = 141;
<OPEN> = 142;
<PAST> = 143;
<FIND> = 144;
<CUT> = 145;
<HELP> = 146;
<I147> = 147;
<I148> = 148;
<I149> = 149;
<I150> = 150;
<I151> = 151;
<I152> = 152;
<I153> = 153;
<I154> = 154;
<I155> = 155;
<I156> = 156;
<I157> = 157;
<I158> = 158;
<I159> = 159;
<I160> = 160;
<I161> = 161;
<I162> = 162;
<I163> = 163;
<I164> = 164;
<I165> = 165;
<I166> = 166;
<I167> = 167;
<I168> = 168;
<I169> = 169;
<I170> = 170;
<I171> = 171;
<I172> = 172;
<I173> = 173;
<I174> = 174;
<I175> = 175;
<I176> = 176;
<I177> = 177;
<I178> = 178;
<I179> = 179;
<I180> = 180;
<I181> = 181;
<I182> = 182;
<I183> = 183;
<I184> = 184;
<I185> = 185;
<I186> = 186;
<I187> = 187;
<I188> = 188;
<I189> = 189;
<I190> = 190;
<FK13> = 191;
<FK14> = 192;
<FK15> = 193;
<FK16> = 194;
<FK17> = 195;
<FK18> = 196;
<FK19> = 197;
<FK20> = 198;
<FK21> = 199;
<FK22> = 200;
<FK23> = 201;
<FK24> = 202;
<MDSW> = 203;
<ALT> = 204;
<META> = 205;
<SUPR> = 206;
<HYPR> = 207;
<I208> = 208;
<I209> = 209;
<I210> = 210;
<I211> = 211;
<I212> = 212;
<I213> = 213;
<I214> = 214;
<I215> = 215;
<I216> = 216;
<I217> = 217;
<I218> = 218;
<I219> = 219;
<I220> = 220;
<I221> = 221;
<I222> = 222;
<I223> = 223;
<I224> = 224;
<I225> = 225;
<I226> = 226;
<I227> = 227;
<I228> = 228;
<I229> = 229;
<I230> = 230;
<I231> = 231;
<I232> = 232;
<I233> = 233;
<I234> = 234;
<I235> = 235;
<I236> = 236;
<I237> = 237;
<I238> = 238;
<I239> = 239;
<I240> = 240;
<I241> = 241;
<I242> = 242;
<I243> = 243;
<I244> = 244;
<I245> = 245;
<I246> = 246;
<I247> = 247;
<I248> = 248;
<I249> = 249;
<I250> = 250;
<I251> = 251;
<I252> = 252;
<I253> = 253;
<I254> = 254;
<I255> = 255;
};
xkb_symbols "squeekboard" {
name[Group1] = "Letters";
name[Group2] = "Numbers/Symbols";
key <AD01> { [ q, Q ], [ 1, asciitilde ] };
key <AD02> { [ w, W ], [ 2, quoteleft ] };
key <AD03> { [ e, E ], [ 3, bar ] };
key <AD04> { [ r, R ], [ 4, U00B7 ] };
key <AD05> { [ t, T ], [ 5, squareroot ] };
key <AD06> { [ y, Y ], [ 6, Greek_pi ] };
key <AD07> { [ u, U ], [ 7, division ] };
key <AD08> { [ i, I ], [ 8, multiply ] };
key <AD09> { [ o, O ], [ 9, paragraph ] };
key <AD10> { [ p, P ], [ 0, U25B3 ] };
key <AD11> { [ aring, Aring ], [ U00B1, U00A7 ] };
key <AC01> { [ a, A ], [ at, copyright ] };
key <AC02> { [ s, S ], [ numbersign, U00AE ] };
key <AC03> { [ d, D ], [ dollar, U00A3 ] };
key <AC04> { [ f, F ], [ percent, EuroSign ] };
key <AC05> { [ g, G ], [ ampersand, U00A5 ] };
key <AC06> { [ h, H ], [ minus, underscore ] };
key <AC07> { [ j, J ], [ plus, equal ] };
key <AC08> { [ k, K ], [ U00FC, asciicircum ] };
key <AC09> { [ l, L ], [ U00F6, degree ] };
key <AC10> { [ oslash, Oslash ], [ parenleft, braceleft ] };
key <AC11> { [ ae, AE ], [ parenright, braceright ] };
key <RTRN> { [ Return, Return ], [ Return, Return ] };
key <LFSH> { [ Shift_L, Shift_L ], [ Shift_L, Shift_L ] };
key <AB01> { [ z, Z ], [ comma, backslash ] };
key <AB02> { [ x, X ], [ quotedbl, slash ] };
key <AB03> { [ c, C ], [ quoteright, less ] };
key <AB04> { [ v, V ], [ colon, greater ] };
key <AB05> { [ b, B ], [ semicolon, equal ] };
key <AB06> { [ n, N ], [ exclam, bracketleft ] };
key <AB07> { [ m, M ], [ question, bracketright ] };
key <AB08> { [ period, period ], [ period, period ] };
key <I149> { [ preferences, preferences ], [ preferences, preferences ] };
key <SPCE> { [ space, space ], [ space, space ] };
key <BKSP> { [ BackSpace, BackSpace ], [ BackSpace, BackSpace ] };
};
xkb_types "squeekboard" {
type "TWO_LEVEL" {
modifiers = Shift;
map[Shift] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Shift";
};
};
xkb_compatibility "squeekboard" {
};
};

View File

@ -0,0 +1,292 @@
xkb_keymap {
xkb_keycodes "squeekboard" {
minimum = 8;
maximum = 255;
<ESC> = 9;
<AE01> = 10;
<AE02> = 11;
<AE03> = 12;
<AE04> = 13;
<AE05> = 14;
<AE06> = 15;
<AE07> = 16;
<AE08> = 17;
<AE09> = 18;
<AE10> = 19;
<AE11> = 20;
<AE12> = 21;
<BKSP> = 22;
<TAB> = 23;
<AD01> = 24;
<AD02> = 25;
<AD03> = 26;
<AD04> = 27;
<AD05> = 28;
<AD06> = 29;
<AD07> = 30;
<AD08> = 31;
<AD09> = 32;
<AD10> = 33;
<AD11> = 34;
<AD12> = 35;
<RTRN> = 36;
<LCTL> = 37;
<AC01> = 38;
<AC02> = 39;
<AC03> = 40;
<AC04> = 41;
<AC05> = 42;
<AC06> = 43;
<AC07> = 44;
<AC08> = 45;
<AC09> = 46;
<AC10> = 47;
<AC11> = 48;
<TLDE> = 49;
<LFSH> = 50;
<BKSL> = 51;
<AB01> = 52;
<AB02> = 53;
<AB03> = 54;
<AB04> = 55;
<AB05> = 56;
<AB06> = 57;
<AB07> = 58;
<AB08> = 59;
<AB09> = 60;
<AB10> = 61;
<RTSH> = 62;
<KPMU> = 63;
<LALT> = 64;
<SPCE> = 65;
<CAPS> = 66;
<FK01> = 67;
<FK02> = 68;
<FK03> = 69;
<FK04> = 70;
<FK05> = 71;
<FK06> = 72;
<FK07> = 73;
<FK08> = 74;
<FK09> = 75;
<FK10> = 76;
<NMLK> = 77;
<SCLK> = 78;
<KP7> = 79;
<KP8> = 80;
<KP9> = 81;
<KPSU> = 82;
<KP4> = 83;
<KP5> = 84;
<KP6> = 85;
<KPAD> = 86;
<KP1> = 87;
<KP2> = 88;
<KP3> = 89;
<KP0> = 90;
<KPDL> = 91;
<LVL3> = 92;
<LSGT> = 94;
<FK11> = 95;
<FK12> = 96;
<AB11> = 97;
<KATA> = 98;
<HIRA> = 99;
<HENK> = 100;
<HKTG> = 101;
<MUHE> = 102;
<JPCM> = 103;
<KPEN> = 104;
<RCTL> = 105;
<KPDV> = 106;
<PRSC> = 107;
<RALT> = 108;
<LNFD> = 109;
<HOME> = 110;
<UP> = 111;
<PGUP> = 112;
<LEFT> = 113;
<RGHT> = 114;
<END> = 115;
<DOWN> = 116;
<PGDN> = 117;
<INS> = 118;
<DELE> = 119;
<I120> = 120;
<MUTE> = 121;
<VOL-> = 122;
<VOL+> = 123;
<POWR> = 124;
<KPEQ> = 125;
<I126> = 126;
<PAUS> = 127;
<I128> = 128;
<I129> = 129;
<HNGL> = 130;
<HJCV> = 131;
<AE13> = 132;
<LWIN> = 133;
<RWIN> = 134;
<COMP> = 135;
<STOP> = 136;
<AGAI> = 137;
<PROP> = 138;
<UNDO> = 139;
<FRNT> = 140;
<COPY> = 141;
<OPEN> = 142;
<PAST> = 143;
<FIND> = 144;
<CUT> = 145;
<HELP> = 146;
<I147> = 147;
<I148> = 148;
<I149> = 149;
<I150> = 150;
<I151> = 151;
<I152> = 152;
<I153> = 153;
<I154> = 154;
<I155> = 155;
<I156> = 156;
<I157> = 157;
<I158> = 158;
<I159> = 159;
<I160> = 160;
<I161> = 161;
<I162> = 162;
<I163> = 163;
<I164> = 164;
<I165> = 165;
<I166> = 166;
<I167> = 167;
<I168> = 168;
<I169> = 169;
<I170> = 170;
<I171> = 171;
<I172> = 172;
<I173> = 173;
<I174> = 174;
<I175> = 175;
<I176> = 176;
<I177> = 177;
<I178> = 178;
<I179> = 179;
<I180> = 180;
<I181> = 181;
<I182> = 182;
<I183> = 183;
<I184> = 184;
<I185> = 185;
<I186> = 186;
<I187> = 187;
<I188> = 188;
<I189> = 189;
<I190> = 190;
<FK13> = 191;
<FK14> = 192;
<FK15> = 193;
<FK16> = 194;
<FK17> = 195;
<FK18> = 196;
<FK19> = 197;
<FK20> = 198;
<FK21> = 199;
<FK22> = 200;
<FK23> = 201;
<FK24> = 202;
<MDSW> = 203;
<ALT> = 204;
<META> = 205;
<SUPR> = 206;
<HYPR> = 207;
<I208> = 208;
<I209> = 209;
<I210> = 210;
<I211> = 211;
<I212> = 212;
<I213> = 213;
<I214> = 214;
<I215> = 215;
<I216> = 216;
<I217> = 217;
<I218> = 218;
<I219> = 219;
<I220> = 220;
<I221> = 221;
<I222> = 222;
<I223> = 223;
<I224> = 224;
<I225> = 225;
<I226> = 226;
<I227> = 227;
<I228> = 228;
<I229> = 229;
<I230> = 230;
<I231> = 231;
<I232> = 232;
<I233> = 233;
<I234> = 234;
<I235> = 235;
<I236> = 236;
<I237> = 237;
<I238> = 238;
<I239> = 239;
<I240> = 240;
<I241> = 241;
<I242> = 242;
<I243> = 243;
<I244> = 244;
<I245> = 245;
<I246> = 246;
<I247> = 247;
<I248> = 248;
<I249> = 249;
<I250> = 250;
<I251> = 251;
<I252> = 252;
<I253> = 253;
<I254> = 254;
<I255> = 255;
};
xkb_symbols "squeekboard" {
name[Group1] = "Letters";
name[Group2] = "Numbers/Symbols";
key <AD01> { [ 1, 1 ], [ 1, 1 ] };
key <AD02> { [ 2, 2 ], [ 2, 2 ] };
key <AD03> { [ 3, 3 ], [ 3, 3 ] };
key <AD04> { [ parenleft, parenleft ], [ parenleft, parenleft ] };
key <AD05> { [ parenright, parenright ], [ parenright, parenright ] };
key <AC01> { [ 4, 4 ], [ 4, 4 ] };
key <AC02> { [ 5, 5 ], [ 5, 5 ] };
key <AC03> { [ 6, 6 ], [ 6, 6 ] };
key <AC04> { [ numbersign, numbersign ], [ numbersign, numbersign ] };
key <AC05> { [ asterisk, asterisk ], [ asterisk, asterisk ] };
key <AB01> { [ 7, 7 ], [ 7, 7 ] };
key <AB02> { [ 8, 8 ], [ 8, 8 ] };
key <AB03> { [ 9, 9 ], [ 9, 9 ] };
key <AB04> { [ plus, plus ], [ plus, plus ] };
key <AB05> { [ minus, minus ], [ minus, minus ] };
key <AB06> { [ 0, 0 ], [ 0, 0 ] };
key <RTRN> { [ Return, Return ], [ Return, Return ] };
key <SPCE> { [ space, space ], [ space, space ] };
key <BKSP> { [ BackSpace, BackSpace ], [ BackSpace, BackSpace ] };
};
xkb_types "squeekboard" {
type "TWO_LEVEL" {
modifiers = Shift;
map[Shift] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Shift";
};
};
xkb_compatibility "squeekboard" {
};
};

View File

@ -0,0 +1,306 @@
xkb_keymap {
xkb_keycodes "squeekboard" {
minimum = 8;
maximum = 255;
<ESC> = 9;
<AE01> = 10;
<AE02> = 11;
<AE03> = 12;
<AE04> = 13;
<AE05> = 14;
<AE06> = 15;
<AE07> = 16;
<AE08> = 17;
<AE09> = 18;
<AE10> = 19;
<AE11> = 20;
<AE12> = 21;
<BKSP> = 22;
<TAB> = 23;
<AD01> = 24;
<AD02> = 25;
<AD03> = 26;
<AD04> = 27;
<AD05> = 28;
<AD06> = 29;
<AD07> = 30;
<AD08> = 31;
<AD09> = 32;
<AD10> = 33;
<AD11> = 34;
<AD12> = 35;
<RTRN> = 36;
<LCTL> = 37;
<AC01> = 38;
<AC02> = 39;
<AC03> = 40;
<AC04> = 41;
<AC05> = 42;
<AC06> = 43;
<AC07> = 44;
<AC08> = 45;
<AC09> = 46;
<AC10> = 47;
<AC11> = 48;
<TLDE> = 49;
<LFSH> = 50;
<BKSL> = 51;
<AB01> = 52;
<AB02> = 53;
<AB03> = 54;
<AB04> = 55;
<AB05> = 56;
<AB06> = 57;
<AB07> = 58;
<AB08> = 59;
<AB09> = 60;
<AB10> = 61;
<RTSH> = 62;
<KPMU> = 63;
<LALT> = 64;
<SPCE> = 65;
<CAPS> = 66;
<FK01> = 67;
<FK02> = 68;
<FK03> = 69;
<FK04> = 70;
<FK05> = 71;
<FK06> = 72;
<FK07> = 73;
<FK08> = 74;
<FK09> = 75;
<FK10> = 76;
<NMLK> = 77;
<SCLK> = 78;
<KP7> = 79;
<KP8> = 80;
<KP9> = 81;
<KPSU> = 82;
<KP4> = 83;
<KP5> = 84;
<KP6> = 85;
<KPAD> = 86;
<KP1> = 87;
<KP2> = 88;
<KP3> = 89;
<KP0> = 90;
<KPDL> = 91;
<LVL3> = 92;
<LSGT> = 94;
<FK11> = 95;
<FK12> = 96;
<AB11> = 97;
<KATA> = 98;
<HIRA> = 99;
<HENK> = 100;
<HKTG> = 101;
<MUHE> = 102;
<JPCM> = 103;
<KPEN> = 104;
<RCTL> = 105;
<KPDV> = 106;
<PRSC> = 107;
<RALT> = 108;
<LNFD> = 109;
<HOME> = 110;
<UP> = 111;
<PGUP> = 112;
<LEFT> = 113;
<RGHT> = 114;
<END> = 115;
<DOWN> = 116;
<PGDN> = 117;
<INS> = 118;
<DELE> = 119;
<I120> = 120;
<MUTE> = 121;
<VOL-> = 122;
<VOL+> = 123;
<POWR> = 124;
<KPEQ> = 125;
<I126> = 126;
<PAUS> = 127;
<I128> = 128;
<I129> = 129;
<HNGL> = 130;
<HJCV> = 131;
<AE13> = 132;
<LWIN> = 133;
<RWIN> = 134;
<COMP> = 135;
<STOP> = 136;
<AGAI> = 137;
<PROP> = 138;
<UNDO> = 139;
<FRNT> = 140;
<COPY> = 141;
<OPEN> = 142;
<PAST> = 143;
<FIND> = 144;
<CUT> = 145;
<HELP> = 146;
<I147> = 147;
<I148> = 148;
<I149> = 149;
<I150> = 150;
<I151> = 151;
<I152> = 152;
<I153> = 153;
<I154> = 154;
<I155> = 155;
<I156> = 156;
<I157> = 157;
<I158> = 158;
<I159> = 159;
<I160> = 160;
<I161> = 161;
<I162> = 162;
<I163> = 163;
<I164> = 164;
<I165> = 165;
<I166> = 166;
<I167> = 167;
<I168> = 168;
<I169> = 169;
<I170> = 170;
<I171> = 171;
<I172> = 172;
<I173> = 173;
<I174> = 174;
<I175> = 175;
<I176> = 176;
<I177> = 177;
<I178> = 178;
<I179> = 179;
<I180> = 180;
<I181> = 181;
<I182> = 182;
<I183> = 183;
<I184> = 184;
<I185> = 185;
<I186> = 186;
<I187> = 187;
<I188> = 188;
<I189> = 189;
<I190> = 190;
<FK13> = 191;
<FK14> = 192;
<FK15> = 193;
<FK16> = 194;
<FK17> = 195;
<FK18> = 196;
<FK19> = 197;
<FK20> = 198;
<FK21> = 199;
<FK22> = 200;
<FK23> = 201;
<FK24> = 202;
<MDSW> = 203;
<ALT> = 204;
<META> = 205;
<SUPR> = 206;
<HYPR> = 207;
<I208> = 208;
<I209> = 209;
<I210> = 210;
<I211> = 211;
<I212> = 212;
<I213> = 213;
<I214> = 214;
<I215> = 215;
<I216> = 216;
<I217> = 217;
<I218> = 218;
<I219> = 219;
<I220> = 220;
<I221> = 221;
<I222> = 222;
<I223> = 223;
<I224> = 224;
<I225> = 225;
<I226> = 226;
<I227> = 227;
<I228> = 228;
<I229> = 229;
<I230> = 230;
<I231> = 231;
<I232> = 232;
<I233> = 233;
<I234> = 234;
<I235> = 235;
<I236> = 236;
<I237> = 237;
<I238> = 238;
<I239> = 239;
<I240> = 240;
<I241> = 241;
<I242> = 242;
<I243> = 243;
<I244> = 244;
<I245> = 245;
<I246> = 246;
<I247> = 247;
<I248> = 248;
<I249> = 249;
<I250> = 250;
<I251> = 251;
<I252> = 252;
<I253> = 253;
<I254> = 254;
<I255> = 255;
};
xkb_symbols "squeekboard" {
name[Group1] = "Letters";
name[Group2] = "Numbers/Symbols";
key <AD01> { [ q, Q ], [ 1, asciitilde ] };
key <AD02> { [ w, W ], [ 2, quoteleft ] };
key <AD03> { [ e, E ], [ 3, bar ] };
key <AD04> { [ r, R ], [ 4, U00B7 ] };
key <AD05> { [ t, T ], [ 5, squareroot ] };
key <AD06> { [ y, Y ], [ 6, Greek_pi ] };
key <AD07> { [ u, U ], [ 7, division ] };
key <AD08> { [ i, I ], [ 8, multiply ] };
key <AD09> { [ o, O ], [ 9, paragraph ] };
key <AD10> { [ p, P ], [ 0, U25B3 ] };
key <AC01> { [ a, A ], [ at, copyright ] };
key <AC02> { [ s, S ], [ numbersign, U00AE ] };
key <AC03> { [ d, D ], [ dollar, U00A3 ] };
key <AC04> { [ f, F ], [ percent, EuroSign ] };
key <AC05> { [ g, G ], [ ampersand, U00A5 ] };
key <AC06> { [ h, H ], [ minus, asciicircum ] };
key <AC07> { [ j, J ], [ underscore, degree ] };
key <AC08> { [ k, K ], [ plus, equal ] };
key <AC09> { [ l, L ], [ parenleft, braceleft ] };
key <AC10> { [ ], [ parenright, braceright ] };
key <RTRN> { [ Return, Return ], [ Return, Return ] };
key <LFSH> { [ Shift_L, Shift_L ], [ Shift_L, Shift_L ] };
key <AB01> { [ z, Z ], [ comma, backslash ] };
key <AB02> { [ x, X ], [ quotedbl, slash ] };
key <AB03> { [ c, C ], [ quoteright, less ] };
key <AB04> { [ v, V ], [ colon, greater ] };
key <AB05> { [ b, B ], [ semicolon, equal ] };
key <AB06> { [ n, N ], [ exclam, bracketleft ] };
key <AB07> { [ m, M ], [ question, bracketright ] };
key <AB08> { [ period, period ], [ period, period ] };
key <I149> { [ preferences, preferences ], [ preferences, preferences ] };
key <SPCE> { [ space, space ], [ space, space ] };
key <BKSP> { [ BackSpace, BackSpace ], [ BackSpace, BackSpace ] };
};
xkb_types "squeekboard" {
type "TWO_LEVEL" {
modifiers = Shift;
map[Shift] = Level2;
level_name[Level1] = "Base";
level_name[Level2] = "Shift";
};
};
xkb_compatibility "squeekboard" {
};
};

View File

@ -0,0 +1,204 @@
<?xml version='1.0' encoding='ASCII' standalone='yes'?>
<symbols version="0.90">
<key name="AD01">
<symbol label="q">q</symbol>
<symbol label="Q">Q</symbol>
<symbol label="1">1</symbol>
<symbol label="~">asciitilde</symbol>
</key>
<key name="AD02">
<symbol label="w">w</symbol>
<symbol label="W">W</symbol>
<symbol label="2">2</symbol>
<symbol label="`">quoteleft</symbol>
</key>
<key name="AD03">
<symbol label="e">e</symbol>
<symbol label="E">E</symbol>
<symbol label="3">3</symbol>
<symbol label="|">bar</symbol>
</key>
<key name="AD04">
<symbol label="r">r</symbol>
<symbol label="R">R</symbol>
<symbol label="4">4</symbol>
<symbol label="&#183;">U00B7</symbol>
</key>
<key name="AD05">
<symbol label="t">t</symbol>
<symbol label="T">T</symbol>
<symbol label="5">5</symbol>
<symbol label="&#8730;">squareroot</symbol>
</key>
<key name="AD06">
<symbol label="y">y</symbol>
<symbol label="Y">Y</symbol>
<symbol label="6">6</symbol>
<symbol label="&#960;">Greek_pi</symbol>
</key>
<key name="AD07">
<symbol label="u">u</symbol>
<symbol label="U">U</symbol>
<symbol label="7">7</symbol>
<symbol label="&#247;">division</symbol>
</key>
<key name="AD08">
<symbol label="i">i</symbol>
<symbol label="I">I</symbol>
<symbol label="8">8</symbol>
<symbol label="&#215;">multiply</symbol>
</key>
<key name="AD09">
<symbol label="o">o</symbol>
<symbol label="O">O</symbol>
<symbol label="9">9</symbol>
<symbol label="&#182;">paragraph</symbol>
</key>
<key name="AD10">
<symbol label="p">p</symbol>
<symbol label="P">P</symbol>
<symbol label="0">0</symbol>
<symbol label="&#9651;">U25B3</symbol>
</key>
<key name="AD11">
<symbol keyval="229" label="&#229;">aring</symbol>
<symbol keyval="197" label="&#197;">Aring</symbol>
<symbol label="&#177;">U00B1</symbol>
<symbol label="&#167;">U00A7</symbol>
</key>
<key name="AC01">
<symbol label="a">a</symbol>
<symbol label="A">A</symbol>
<symbol label="@">at</symbol>
<symbol label="&#169;">copyright</symbol>
</key>
<key name="AC02">
<symbol label="s">s</symbol>
<symbol label="S">S</symbol>
<symbol label="#">numbersign</symbol>
<symbol label="&#174;">U00AE</symbol>
</key>
<key name="AC03">
<symbol label="d">d</symbol>
<symbol label="D">D</symbol>
<symbol label="$">dollar</symbol>
<symbol label="&#163;">U00A3</symbol>
</key>
<key name="AC04">
<symbol label="f">f</symbol>
<symbol label="F">F</symbol>
<symbol label="%">percent</symbol>
<symbol label="&#8364;">EuroSign</symbol>
</key>
<key name="AC05">
<symbol label="g">g</symbol>
<symbol label="G">G</symbol>
<symbol label="&amp;">ampersand</symbol>
<symbol label="&#165;">U00A5</symbol>
</key>
<key name="AC06">
<symbol label="h">h</symbol>
<symbol label="H">H</symbol>
<symbol label="-">minus</symbol>
<symbol label="_">underscore</symbol>
</key>
<key name="AC07">
<symbol label="j">j</symbol>
<symbol label="J">J</symbol>
<symbol label="+">plus</symbol>
<symbol label="=">equal</symbol>
</key>
<key name="AC08">
<symbol label="k">k</symbol>
<symbol label="K">K</symbol>
<symbol label="&#252;">U00FC</symbol>
<symbol label="^">asciicircum</symbol>
</key>
<key name="AC09">
<symbol label="l">l</symbol>
<symbol label="L">L</symbol>
<symbol label="&#246;">U00F6</symbol>
<symbol label="&#176;">degree</symbol>
</key>
<key name="AC10">
<symbol keyval="248" label="&#248;">oslash</symbol>
<symbol keyval="216" label="&#216;">Oslash</symbol>
<symbol label="(">parenleft</symbol>
<symbol label="{">braceleft</symbol>
</key>
<key name="AC11">
<symbol keyval="230" label="&#230;">ae</symbol>
<symbol keyval="198" label="&#198;">AE</symbol>
<symbol label=")">parenright</symbol>
<symbol label="}">braceright</symbol>
</key>
<key name="RTRN">
<symbol keyval="65293" icon="key-enter">Return</symbol>
</key>
<key name="LFSH">
<keysym keyval="65505" icon="key-shift">Shift_L</keysym>
<keysym keyval="65505" icon="key-shift">Shift_L</keysym>
<keysym keyval="65505" label="=/+">Shift_L</keysym>
<keysym keyval="65505" label="123">Shift_L</keysym>
</key>
<key name="AB01">
<symbol label="z">z</symbol>
<symbol label="Z">Z</symbol>
<symbol label=",">comma</symbol>
<symbol label="\">backslash</symbol>
</key>
<key name="AB02">
<symbol label="x">x</symbol>
<symbol label="X">X</symbol>
<symbol label="&quot;">quotedbl</symbol>
<symbol label="/">slash</symbol>
</key>
<key name="AB03">
<symbol label="c">c</symbol>
<symbol label="C">C</symbol>
<symbol label="'">quoteright</symbol>
<symbol label="&lt;">less</symbol>
</key>
<key name="AB04">
<symbol label="v">v</symbol>
<symbol label="V">V</symbol>
<symbol label=":">colon</symbol>
<symbol label="&gt;">greater</symbol>
</key>
<key name="AB05">
<symbol label="b">b</symbol>
<symbol label="B">B</symbol>
<symbol label=";">semicolon</symbol>
<symbol label="=">equal</symbol>
</key>
<key name="AB06">
<symbol label="n">n</symbol>
<symbol label="N">N</symbol>
<symbol label="!">exclam</symbol>
<symbol label="[">bracketleft</symbol>
</key>
<key name="AB07">
<symbol label="m">m</symbol>
<symbol label="M">M</symbol>
<symbol label="?">question</symbol>
<symbol label="]">bracketright</symbol>
</key>
<key name="AB08">
<symbol label=".">period</symbol>
</key>
<key name="ABC123">
<symbol label="123">show-numbers</symbol>
<symbol label="123">show-numbers</symbol>
<symbol label="ABC">show-letters</symbol>
<symbol label="ABC">show-letters</symbol>
</key>
<key name="I149">
<symbol icon="keyboard-mode-symbolic" tooltip="Setup">preferences</symbol>
</key>
<key name="SPCE">
<symbol label=" ">space</symbol>
</key>
<key name="BKSP">
<symbol keyval="65288" icon="edit-clear-symbolic">BackSpace</symbol>
</key>
</symbols>

View File

@ -0,0 +1,60 @@
<?xml version='1.0' encoding='ASCII' standalone='yes'?>
<symbols version="0.90">
<key name="AD01">
<symbol label="1">1</symbol>
</key>
<key name="AD02">
<symbol label="2">2</symbol>
</key>
<key name="AD03">
<symbol label="3">3</symbol>
</key>
<key name="AD04">
<symbol label="(">parenleft</symbol>
</key>
<key name="AD05">
<symbol label=")">parenright</symbol>
</key>
<key name="AC01">
<symbol label="4">4</symbol>
</key>
<key name="AC02">
<symbol label="5">5</symbol>
</key>
<key name="AC03">
<symbol label="6">6</symbol>
</key>
<key name="AC04">
<symbol label="#">numbersign</symbol>
</key>
<key name="AC05">
<symbol label="*">asterisk</symbol>
</key>
<key name="AB01">
<symbol label="7">7</symbol>
</key>
<key name="AB02">
<symbol label="8">8</symbol>
</key>
<key name="AB03">
<symbol label="9">9</symbol>
</key>
<key name="AB04">
<symbol label="+">plus</symbol>
</key>
<key name="AB05">
<symbol label="-">minus</symbol>
</key>
<key name="AB06">
<symbol label="0">0</symbol>
</key>
<key name="RTRN">
<symbol keyval="65293" icon="key-enter">Return</symbol>
</key>
<key name="SPCE">
<symbol label=" ">space</symbol>
</key>
<key name="BKSP">
<symbol keyval="65288" icon="edit-clear-symbolic">BackSpace</symbol>
</key>
</symbols>

View File

@ -1,278 +1,192 @@
<?xml version="1.0"?>
<?xml version='1.0' encoding='ASCII' standalone='yes'?>
<symbols version="0.90">
<key keycode="9" name="ESC">
<keysym keyval="65307">Escape</keysym>
</key>
<key keycode="67" name="FK01">
<keysym keyval="65470">F1</keysym>
</key>
<key keycode="68" name="FK02">
<keysym keyval="65471">F2</keysym>
</key>
<key keycode="69" name="FK03">
<keysym keyval="65472">F3</keysym>
</key>
<key keycode="70" name="FK04">
<keysym keyval="65473">F4</keysym>
</key>
<key keycode="71" name="FK05">
<keysym keyval="65474">F5</keysym>
</key>
<key keycode="72" name="FK06">
<keysym keyval="65475">F6</keysym>
</key>
<key keycode="73" name="FK07">
<keysym keyval="65476">F7</keysym>
</key>
<key keycode="74" name="FK08">
<keysym keyval="65477">F8</keysym>
</key>
<key keycode="75" name="FK09">
<keysym keyval="65478">F9</keysym>
</key>
<key keycode="76" name="FK10">
<keysym keyval="65479">F10</keysym>
</key>
<key keycode="95" name="FK11">
<keysym keyval="65480">F11</keysym>
</key>
<key keycode="96" name="FK12">
<keysym keyval="65481">F12</keysym>
</key>
<key keycode="49" name="TLDE">
<keysym keyval="96">quoteleft</keysym>
<keysym keyval="126">asciitilde</keysym>
</key>
<key keycode="10" name="AE01">
<keysym keyval="49">1</keysym>
<keysym keyval="33">exclam</keysym>
</key>
<key keycode="11" name="AE02">
<keysym keyval="50">2</keysym>
<keysym keyval="64">at</keysym>
</key>
<key keycode="12" name="AE03">
<keysym keyval="51">3</keysym>
<keysym keyval="35">numbersign</keysym>
</key>
<key keycode="13" name="AE04">
<keysym keyval="52">4</keysym>
<keysym keyval="36">dollar</keysym>
</key>
<key keycode="14" name="AE05">
<keysym keyval="53">5</keysym>
<keysym keyval="37">percent</keysym>
<keysym keyval="8364">EuroSign</keysym>
</key>
<key keycode="15" name="AE06">
<keysym keyval="54">6</keysym>
<keysym keyval="94">asciicircum</keysym>
</key>
<key keycode="16" name="AE07">
<keysym keyval="55">7</keysym>
<keysym keyval="38">ampersand</keysym>
</key>
<key keycode="17" name="AE08">
<keysym keyval="56">8</keysym>
<keysym keyval="42">asterisk</keysym>
</key>
<key keycode="18" name="AE09">
<keysym keyval="57">9</keysym>
<keysym keyval="40">parenleft</keysym>
</key>
<key keycode="19" name="AE10">
<keysym keyval="48">0</keysym>
<keysym keyval="41">parenright</keysym>
</key>
<key keycode="20" name="AE11">
<keysym keyval="45">minus</keysym>
<keysym keyval="95">underscore</keysym>
</key>
<key keycode="21" name="AE12">
<keysym keyval="61">equal</keysym>
<keysym keyval="43">plus</keysym>
</key>
<key keycode="22" name="BKSP">
<keysym keyval="65288">BackSpace</keysym>
</key>
<key keycode="23" name="TAB">
<keysym keyval="65289">Tab</keysym>
<keysym keyval="65056">ISO_Left_Tab</keysym>
</key>
<key keycode="24" name="AD01">
<keysym keyval="113">q</keysym>
<keysym keyval="81">Q</keysym>
</key>
<key keycode="25" name="AD02">
<keysym keyval="119">w</keysym>
<keysym keyval="87">W</keysym>
</key>
<key keycode="26" name="AD03">
<keysym keyval="101">e</keysym>
<keysym keyval="69">E</keysym>
</key>
<key keycode="27" name="AD04">
<keysym keyval="114">r</keysym>
<keysym keyval="82">R</keysym>
</key>
<key keycode="28" name="AD05">
<keysym keyval="116">t</keysym>
<keysym keyval="84">T</keysym>
</key>
<key keycode="29" name="AD06">
<keysym keyval="121">y</keysym>
<keysym keyval="89">Y</keysym>
</key>
<key keycode="30" name="AD07">
<keysym keyval="117">u</keysym>
<keysym keyval="85">U</keysym>
</key>
<key keycode="31" name="AD08">
<keysym keyval="105">i</keysym>
<keysym keyval="73">I</keysym>
</key>
<key keycode="32" name="AD09">
<keysym keyval="111">o</keysym>
<keysym keyval="79">O</keysym>
</key>
<key keycode="33" name="AD10">
<keysym keyval="112">p</keysym>
<keysym keyval="80">P</keysym>
</key>
<key keycode="34" name="AD11">
<keysym keyval="91">bracketleft</keysym>
<keysym keyval="123">braceleft</keysym>
</key>
<key keycode="35" name="AD12">
<keysym keyval="93">bracketright</keysym>
<keysym keyval="125">braceright</keysym>
</key>
<key keycode="51" name="BKSL">
<keysym keyval="92">backslash</keysym>
<keysym keyval="124">bar</keysym>
</key>
<key keycode="66" name="CAPS">
<keysym keyval="65027">ISO_Level3_Shift</keysym>
</key>
<key keycode="38" name="AC01">
<keysym keyval="97">a</keysym>
<keysym keyval="65">A</keysym>
</key>
<key keycode="39" name="AC02">
<keysym keyval="115">s</keysym>
<keysym keyval="83">S</keysym>
</key>
<key keycode="40" name="AC03">
<keysym keyval="100">d</keysym>
<keysym keyval="68">D</keysym>
</key>
<key keycode="41" name="AC04">
<keysym keyval="102">f</keysym>
<keysym keyval="70">F</keysym>
</key>
<key keycode="42" name="AC05">
<keysym keyval="103">g</keysym>
<keysym keyval="71">G</keysym>
</key>
<key keycode="43" name="AC06">
<keysym keyval="104">h</keysym>
<keysym keyval="72">H</keysym>
</key>
<key keycode="44" name="AC07">
<keysym keyval="106">j</keysym>
<keysym keyval="74">J</keysym>
</key>
<key keycode="45" name="AC08">
<keysym keyval="107">k</keysym>
<keysym keyval="75">K</keysym>
</key>
<key keycode="46" name="AC09">
<keysym keyval="108">l</keysym>
<keysym keyval="76">L</keysym>
</key>
<key keycode="47" name="AC10">
<keysym keyval="59">semicolon</keysym>
<keysym keyval="58">colon</keysym>
</key>
<key keycode="48" name="AC11">
<keysym keyval="39">quoteright</keysym>
<keysym keyval="34">quotedbl</keysym>
</key>
<key keycode="36" name="RTRN">
<keysym keyval="65293">Return</keysym>
</key>
<key keycode="50" name="LFSH">
<keysym keyval="65505">Shift_L</keysym>
</key>
<key keycode="52" name="AB01">
<keysym keyval="122">z</keysym>
<keysym keyval="90">Z</keysym>
</key>
<key keycode="53" name="AB02">
<keysym keyval="120">x</keysym>
<keysym keyval="88">X</keysym>
</key>
<key keycode="54" name="AB03">
<keysym keyval="99">c</keysym>
<keysym keyval="67">C</keysym>
</key>
<key keycode="55" name="AB04">
<keysym keyval="118">v</keysym>
<keysym keyval="86">V</keysym>
</key>
<key keycode="56" name="AB05">
<keysym keyval="98">b</keysym>
<keysym keyval="66">B</keysym>
</key>
<key keycode="57" name="AB06">
<keysym keyval="110">n</keysym>
<keysym keyval="78">N</keysym>
</key>
<key keycode="58" name="AB07">
<keysym keyval="109">m</keysym>
<keysym keyval="77">M</keysym>
</key>
<key keycode="59" name="AB08">
<keysym keyval="44">comma</keysym>
<keysym keyval="60">less</keysym>
</key>
<key keycode="60" name="AB09">
<keysym keyval="46">period</keysym>
<keysym keyval="62">greater</keysym>
</key>
<key keycode="61" name="AB10">
<keysym keyval="47">slash</keysym>
<keysym keyval="63">question</keysym>
</key>
<key keycode="62" name="RTSH">
<keysym keyval="65506">Shift_R</keysym>
</key>
<key keycode="149" name="I149">
<symbol label="⌨" icon="input-keyboard-symbolic" tooltip="Change keyboard">cycle-keyboard</symbol>
</key>
<key keycode="150" name="I150">
<symbol label="☺" icon="preferences-system-symbolic" tooltip="Setup">preferences</symbol>
</key>
<key keycode="37" name="LCTL">
<keysym keyval="65507">Control_L</keysym>
</key>
<key keycode="64" name="LALT">
<keysym keyval="65513">Alt_L</keysym>
<keysym keyval="65511">Meta_L</keysym>
</key>
<key keycode="65" name="SPCE">
<keysym keyval="32">space</keysym>
</key>
<key keycode="113" name="LEFT">
<keysym keyval="65361">Left</keysym>
</key>
<key keycode="111" name="UP">
<keysym keyval="65362">Up</keysym>
</key>
<key keycode="116" name="DOWN">
<keysym keyval="65364">Down</keysym>
</key>
<key keycode="114" name="RGHT">
<keysym keyval="65363">Right</keysym>
<key name="AD01">
<symbol label="q">q</symbol>
<symbol label="Q">Q</symbol>
<symbol label="1">1</symbol>
<symbol label="~">asciitilde</symbol>
</key>
<key name="AD02">
<symbol label="w">w</symbol>
<symbol label="W">W</symbol>
<symbol label="2">2</symbol>
<symbol label="`">quoteleft</symbol>
</key>
<key name="AD03">
<symbol label="e">e</symbol>
<symbol label="E">E</symbol>
<symbol label="3">3</symbol>
<symbol label="|">bar</symbol>
</key>
<key name="AD04">
<symbol label="r">r</symbol>
<symbol label="R">R</symbol>
<symbol label="4">4</symbol>
<symbol label="&#183;">U00B7</symbol>
</key>
<key name="AD05">
<symbol label="t">t</symbol>
<symbol label="T">T</symbol>
<symbol label="5">5</symbol>
<symbol label="&#8730;">squareroot</symbol>
</key>
<key name="AD06">
<symbol label="y">y</symbol>
<symbol label="Y">Y</symbol>
<symbol label="6">6</symbol>
<symbol label="&#960;">Greek_pi</symbol>
</key>
<key name="AD07">
<symbol label="u">u</symbol>
<symbol label="U">U</symbol>
<symbol label="7">7</symbol>
<symbol label="&#247;">division</symbol>
</key>
<key name="AD08">
<symbol label="i">i</symbol>
<symbol label="I">I</symbol>
<symbol label="8">8</symbol>
<symbol label="&#215;">multiply</symbol>
</key>
<key name="AD09">
<symbol label="o">o</symbol>
<symbol label="O">O</symbol>
<symbol label="9">9</symbol>
<symbol label="&#182;">paragraph</symbol>
</key>
<key name="AD10">
<symbol label="p">p</symbol>
<symbol label="P">P</symbol>
<symbol label="0">0</symbol>
<symbol label="&#9651;">U25B3</symbol>
</key>
<key name="AC01">
<symbol label="a">a</symbol>
<symbol label="A">A</symbol>
<symbol label="@">at</symbol>
<symbol label="&#169;">copyright</symbol>
</key>
<key name="AC02">
<symbol label="s">s</symbol>
<symbol label="S">S</symbol>
<symbol label="#">numbersign</symbol>
<symbol label="&#174;">U00AE</symbol>
</key>
<key name="AC03">
<symbol label="d">d</symbol>
<symbol label="D">D</symbol>
<symbol label="$">dollar</symbol>
<symbol label="&#163;">U00A3</symbol>
</key>
<key name="AC04">
<symbol label="f">f</symbol>
<symbol label="F">F</symbol>
<symbol label="%">percent</symbol>
<symbol label="&#8364;">EuroSign</symbol>
</key>
<key name="AC05">
<symbol label="g">g</symbol>
<symbol label="G">G</symbol>
<symbol label="&amp;">ampersand</symbol>
<symbol label="&#165;">U00A5</symbol>
</key>
<key name="AC06">
<symbol label="h">h</symbol>
<symbol label="H">H</symbol>
<symbol label="-">minus</symbol>
<symbol label="^">asciicircum</symbol>
</key>
<key name="AC07">
<symbol label="j">j</symbol>
<symbol label="J">J</symbol>
<symbol label="_">underscore</symbol>
<symbol label="&#176;">degree</symbol>
</key>
<key name="AC08">
<symbol label="k">k</symbol>
<symbol label="K">K</symbol>
<symbol label="+">plus</symbol>
<symbol label="=">equal</symbol>
</key>
<key name="AC09">
<symbol label="l">l</symbol>
<symbol label="L">L</symbol>
<symbol label="(">parenleft</symbol>
<symbol label="{">braceleft</symbol>
</key>
<key name="AC10">
<symbol label=""></symbol>
<symbol label=""></symbol>
<symbol label=")">parenright</symbol>
<symbol label="}">braceright</symbol>
</key>
<key name="RTRN">
<symbol keyval="65293" icon="key-enter">Return</symbol>
</key>
<key name="LFSH">
<keysym keyval="65505" icon="key-shift">Shift_L</keysym>
<keysym keyval="65505" icon="key-shift">Shift_L</keysym>
<keysym keyval="65505" label="=/+">Shift_L</keysym>
<keysym keyval="65505" label="123">Shift_L</keysym>
</key>
<key name="AB01">
<symbol label="z">z</symbol>
<symbol label="Z">Z</symbol>
<symbol label=",">comma</symbol>
<symbol label="\">backslash</symbol>
</key>
<key name="AB02">
<symbol label="x">x</symbol>
<symbol label="X">X</symbol>
<symbol label="&quot;">quotedbl</symbol>
<symbol label="/">slash</symbol>
</key>
<key name="AB03">
<symbol label="c">c</symbol>
<symbol label="C">C</symbol>
<symbol label="'">quoteright</symbol>
<symbol label="&lt;">less</symbol>
</key>
<key name="AB04">
<symbol label="v">v</symbol>
<symbol label="V">V</symbol>
<symbol label=":">colon</symbol>
<symbol label="&gt;">greater</symbol>
</key>
<key name="AB05">
<symbol label="b">b</symbol>
<symbol label="B">B</symbol>
<symbol label=";">semicolon</symbol>
<symbol label="=">equal</symbol>
</key>
<key name="AB06">
<symbol label="n">n</symbol>
<symbol label="N">N</symbol>
<symbol label="!">exclam</symbol>
<symbol label="[">bracketleft</symbol>
</key>
<key name="AB07">
<symbol label="m">m</symbol>
<symbol label="M">M</symbol>
<symbol label="?">question</symbol>
<symbol label="]">bracketright</symbol>
</key>
<key name="AB08">
<symbol label=".">period</symbol>
</key>
<key name="ABC123">
<symbol label="123">show-numbers</symbol>
<symbol label="123">show-numbers</symbol>
<symbol label="ABC">show-letters</symbol>
<symbol label="ABC">show-letters</symbol>
</key>
<key name="I149">
<symbol label="&#9786;" icon="keyboard-mode-symbolic" tooltip="Setup">preferences</symbol>
</key>
<key name="SPCE">
<symbol label=" ">space</symbol>
</key>
<key name="BKSP">
<symbol keyval="65288" icon="edit-clear-symbolic">BackSpace</symbol>
</key>
</symbols>

19
data/meson.build Normal file
View File

@ -0,0 +1,19 @@
gnome = import('gnome')
squeekboard_resources = gnome.compile_resources(
'squeekboard-resources',
'squeekboard.gresources.xml',
c_name: 'squeekboard',
)
desktop_file = 'sm.puri.Squeekboard.desktop'
i18n.merge_file('desktop',
input: desktop_file + '.in',
output: desktop_file,
po_dir: '../po',
install: true,
install_dir: join_paths(datadir, 'applications'),
type: 'desktop'
)

View File

@ -1,60 +0,0 @@
<?xml version="1.0"?>
<schemalist>
<schema id="org.fedorahosted.eekboard" path="/org/fedorahosted/eekboard/">
<key name="keyboards" type="as">
<default>['us']</default>
<summary>Keyboard types</summary>
<description>keyboard types.</description>
</key>
<key name="focus-listener" type="s">
<default>'atspi'</default>
<summary>Use the given focus listener</summary>
<description>The name of the focus listener (either 'atspi' or 'ibus') used to detect focus events.</description>
</key>
<key name="auto-hide" type="b">
<default>true</default>
<summary>Hide keyboard automatically when focus is out</summary>
<description>If true, hide keyboard automatically when focus is out.</description>
</key>
<key name="auto-hide-delay" type="u">
<default>500</default>
<summary>Delay before hiding keyboard</summary>
<description>Delay before hiding keyboard in milliseconds. This is useful when focus listener is enabled.</description>
</key>
<key type="b" name="repeat">
<default>true</default>
<summary>Key repeat</summary>
<description>Generate key-press/release event repeatedly while a key is held down</description>
</key>
<key type="u" name="repeat-interval">
<default>100</default>
<summary>Key repeat interval</summary>
<description>Delay between repeats in milliseconds.</description>
</key>
<key type="u" name="repeat-delay">
<default>1000</default>
<summary>Initial key repeat delay</summary>
<description>Initial key repeat delay in milliseconds.</description>
</key>
<key name="start-fullscreen" type="b">
<default>false</default>
<summary>Switch to fullscreen mode when startup</summary>
<description>If true, switch to fullscreen mode when startup.</description>
</key>
<key name="size-constraint-landscape" type="(dd)">
<default>(1.0, 0.3)</default>
<summary>Constraint of the maximum window size on landscape screen</summary>
<description>Constraint of maximum window size on landscape screen</description>
</key>
<key name="size-constraint-portrait" type="(dd)">
<default>(1.0, 0.5)</default>
<summary>Constraint of the maximum window size on portrait screen</summary>
<description>Constraint of maximum window size on portrait screen</description>
</key>
<key name="theme" type="s">
<default>'default'</default>
<summary>Theme</summary>
<description>Base name of the theme to apply.</description>
</key>
</schema>
</schemalist>

View File

@ -0,0 +1,9 @@
[Desktop Entry]
Name=Squeekboard
GenericName=Squeekboard Virtual Keyboard
Comment=Virtual Keyboard
Exec=squeekboard
Icon=squeekboard
Terminal=false
Type=Application
Categories=GTK;Utility;

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/sm/puri/squeekboard">
<file compressed="true">style.css</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/geometry/compact.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/geometry/extended.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/geometry/numbers-keypad.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/keyboards.xml</file>
<file compressed="true">keyboards/keymaps/nb.xkb</file>
<file compressed="true">keyboards/keymaps/us.xkb</file>
<file compressed="true">keyboards/keymaps/numbers.xkb</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ar.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/as-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/be.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/bn-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/fa.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/gu-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/he.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/hi-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ja-kana.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/kk.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/kn-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ks-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ks.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/mai-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ml-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/mr-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/my.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/nb.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/or-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/pa-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ru.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/sd-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ta-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/te-inscript.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/th.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ua.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/ug.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/us.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/zh-bopomofo.xml</file>
<file compressed="true" preprocess="xml-stripblanks">keyboards/symbols/special/numbers.xml</file>
<file>icons/key-enter.svg</file>
<file>icons/key-shift.svg</file>
<file>icons/keyboard-mode-symbolic.svg</file>
</gresource>
</gresources>

18
data/style.css Normal file
View File

@ -0,0 +1,18 @@
.keyboard {
background-color: rgba(0, 0, 0, 255);
color: #ffffff;
font-family: cantarell, sans-serif;
}
.key {
color: #deddda;
background: #464448;
border-width: 0.5px;
border-color: #5e5c64;
border-radius: 2px;
}
.key:active {
background: #1c71d8;
border-color: #3584e4;
}

View File

@ -1,4 +0,0 @@
themedir = $(pkgdatadir)/themes
dist_theme_DATA = default.css
-include $(top_srcdir)/git.mk

View File

@ -1,22 +0,0 @@
.keyboard {
background-color: rgba(0, 0, 0, 255);
color: #ffffff;
font-family: cantarell, sans-serif;
}
.key {
color: #ffffff;
background-gradient-direction: vertical;
background-gradient-start: rgba(0, 0, 0, 255);
background-gradient-end: rgba(64, 64, 64, 255);
border-width: 2px;
border-color: rgba(128, 128, 128, 255);
border-radius: 3px;
}
.key:active {
background-gradient-direction: vertical;
background-gradient-start: rgba(0, 0, 255, 255);
background-gradient-end: rgba(64, 64, 255, 255);
border-color: rgba(160, 160, 255, 255);
}

11
debian/changelog vendored Normal file
View File

@ -0,0 +1,11 @@
squeekboard (1.0.10) unstable; urgency=medium
* Use a shared DBus definition
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 02 Jul 2019 20:12:02 +0000
squeekboard (1.0.9) unstable; urgency=medium
* Initial release.
-- David Boddie <david.boddie@puri.sm> Tue, 25 Jun 2019 19:33:00 +0200

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
10

24
debian/control vendored Normal file
View File

@ -0,0 +1,24 @@
Source: squeekboard
Section: x11
Priority: optional
Maintainer: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Build-Depends:
debhelper (>= 10),
meson (>=0.43.0),
pkg-config,
libglib2.0-dev,
libgtk-3-dev,
libcroco3-dev,
libwayland-dev (>= 1.16),
rustc,
wayland-protocols (>= 1.14)
Standards-Version: 4.1.3
Homepage: https://source.puri.sm/Librem5/squeekboard
Package: squeekboard
Architecture: linux-any
Depends:
${shlibs:Depends}
${misc:Depends}
Description: On-screen keyboard for Wayland
Virtual keyboard supporting Wayland, built primarily for the Librem 5 phone.

73
debian/copyright vendored Normal file
View File

@ -0,0 +1,73 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: evscript
Source: https://source.puri.sm/david.boddie/evscript
Files: *
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
2010-2011 Red Hat, Inc.
2019 Purism SPC
License: GPL-3+
Files: eek/layersurface.c
src/wayland.c
src/key-emitter.c
meson.build
src/meson.build
po/meson.build
Copyright: 2018-2019 Purism SPC
License: GPL-3+
Files: eekboard/keymap.c
Copyright: 2000 Red Hat, Inc.
2019 Purism, SPC
License: LGPL-2+
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
Files: protocols/wlr-layer-shell-unstable-v1.xml
Copytight: Copyright © 2017 Drew DeVault
License: X11
Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee, provided
that the above copyright notice appear in all copies and fthat both that
copyright notice and this permission notice appear in supporting
documentation, and that the name of the copyright holders not be used in
advertising or publicity pertaining to distribution of the software
without specific, written prior permission. The copyright holders make
no representations about the suitability of this software for any
purpose. It is provided "as is" without express or implied warranty.
.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
License: GPL-3+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

8
debian/rules vendored Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@ --builddirectory=_build --buildsystem=meson
override_dh_autoreconf:

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (native)

View File

@ -1,21 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
SUBDIRS = reference
-include $(top_srcdir)/git.mk

View File

@ -1,21 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
SUBDIRS = eek eekboard
-include $(top_srcdir)/git.mk

View File

@ -1,133 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=eek
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
#DOC_MODULE_VERSION=2
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../eek
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=--rebuild-types --deprecated-guards="EEK_DISABLE_DEPRECATED"
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-mkhtml
MKHTML_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/eek/*.h
CFILE_GLOB=$(top_srcdir)/eek/*.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES = \
config.h \
eek-renderer.h \
eek-gtk-renderer.h \
eek-theme.h \
eek-theme-node.h \
eek-enumtypes.h
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=eek-overview.xml
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=eek-overview.xml
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
GTKDOC_LIBS = $(top_builddir)/eek/libeek.la \
$(top_builddir)/eek/libeek-gtk.la \
$(top_builddir)/eek/libeek-xkl.la \
$(GIO2_LIBS) \
$(GTK_LIBS) \
$(LIBXKLAVIER_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
EXTRA_DIST +=
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
#DISTCLEANFILES +=
# Comment this out if you want your docs-status tested during 'make check'
if ENABLE_GTK_DOC
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
#TESTS = $(GTKDOC_CHECK)
endif
-include $(top_srcdir)/gtk-doc.mk
-include $(top_srcdir)/git.mk

View File

@ -1,122 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
## Process this file with automake to produce Makefile.in
# We require automake 1.6 at least.
AUTOMAKE_OPTIONS = 1.6
# This is a blank Makefile.am for using gtk-doc.
# Copy this to your project's API docs directory and modify the variables to
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
# of using the various options.
# The name of the module, e.g. 'glib'.
DOC_MODULE=eekboard
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
#DOC_MODULE_VERSION=2
# The top-level SGML file. You can change this if you want to.
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
# The directory containing the source code. Relative to $(srcdir).
# gtk-doc will search all .c & .h files beneath here for inline comments
# documenting the functions and macros.
# e.g. DOC_SOURCE_DIR=../../../gtk
DOC_SOURCE_DIR=../../../eekboard
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
SCANGOBJ_OPTIONS=
# Extra options to supply to gtkdoc-scan.
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
SCAN_OPTIONS=
# Extra options to supply to gtkdoc-mkdb.
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
MKDB_OPTIONS=--sgml-mode --output-format=xml
# Extra options to supply to gtkdoc-mktmpl
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
MKTMPL_OPTIONS=
# Extra options to supply to gtkdoc-mkhtml
MKHTML_OPTIONS=
# Extra options to supply to gtkdoc-fixref. Not normally needed.
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
FIXXREF_OPTIONS=
# Used for dependencies. The docs will be rebuilt if any of these change.
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
HFILE_GLOB=$(top_srcdir)/eekboard/*.h
CFILE_GLOB=$(top_srcdir)/eekboard/*.c
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
EXTRA_HFILES=
# Header files to ignore when scanning. Use base file name, no paths
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES=config.h eekboard.h
# Images to copy into HTML directory.
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
HTML_IMAGES=
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
# content_files=eekboard-overview.xml
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
# expand_content_files=eekboard-overview.xml
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
# signals and properties.
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
GTKDOC_CFLAGS = $(GIO2_CFLAGS)
GTKDOC_LIBS = $(top_builddir)/eekboard/libeekboard.la $(GIO2_LIBS)
# This includes the standard gtk-doc make rules, copied by gtkdocize.
include $(top_srcdir)/gtk-doc.make
# Other files to distribute
# e.g. EXTRA_DIST += version.xml.in
# EXTRA_DIST +=
# Files not to distribute
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
#DISTCLEANFILES +=
# Comment this out if you want your docs-status tested during 'make check'
if ENABLE_GTK_DOC
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
#TESTS = $(GTKDOC_CHECK)
endif
-include $(top_srcdir)/gtk-doc.mk
-include $(top_srcdir)/git.mk

View File

@ -1,298 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
NULL =
lib_LTLIBRARIES = \
libeek.la \
libeek-gtk.la \
libeek-xkl.la \
$(NULL)
libeek_public_headers = \
$(srcdir)/eek-layout.h \
$(srcdir)/eek-element.h \
$(srcdir)/eek-container.h \
$(srcdir)/eek-keyboard.h \
$(srcdir)/eek-section.h \
$(srcdir)/eek-key.h \
$(srcdir)/eek-symbol.h \
$(srcdir)/eek-keysym.h \
$(srcdir)/eek-text.h \
$(srcdir)/eek-symbol-matrix.h \
$(srcdir)/eek-types.h \
$(srcdir)/eek-xml.h \
$(srcdir)/eek-xml-layout.h \
$(srcdir)/eek-serializable.h \
$(srcdir)/eek-theme.h \
$(srcdir)/eek.h \
$(NULL)
libeek_private_headers = \
$(srcdir)/eek-renderer.h \
$(libeek_keysym_headers) \
$(builddir)/eek-marshalers.h \
$(srcdir)/eek-theme-context.h \
$(srcdir)/eek-theme-private.h \
$(srcdir)/eek-theme-node.h \
$(NULL)
libeek_sources = \
$(srcdir)/eek.c \
$(srcdir)/eek-layout.c \
$(srcdir)/eek-element.c \
$(srcdir)/eek-container.c \
$(srcdir)/eek-keyboard.c \
$(srcdir)/eek-section.c \
$(srcdir)/eek-key.c \
$(srcdir)/eek-symbol-matrix.c \
$(srcdir)/eek-symbol.c \
$(srcdir)/eek-keysym.c \
$(srcdir)/eek-text.c \
$(srcdir)/eek-types.c \
$(srcdir)/eek-serializable.c \
$(srcdir)/eek-xml.c \
$(srcdir)/eek-xml-layout.c \
$(srcdir)/eek-renderer.c \
$(srcdir)/eek-keyboard-drawing.c \
$(srcdir)/eek-theme.c \
$(srcdir)/eek-theme-context.c \
$(srcdir)/eek-theme-node.c \
$(NULL)
libeek_keysym_headers = \
$(builddir)/eek-special-keysym-entries.h \
$(builddir)/eek-unicode-keysym-entries.h \
$(builddir)/eek-xkeysym-keysym-entries.h \
$(NULL)
libeek_enumtypes_sources = \
$(builddir)/eek-enumtypes.c \
$(builddir)/eek-enumtypes.h \
$(NULL)
libeek_marshalers_sources = \
$(builddir)/eek-marshalers.c \
$(builddir)/eek-marshalers.h \
$(NULL)
BUILT_SOURCES = \
$(libeek_keysym_headers) \
$(libeek_enumtypes_sources) \
$(libeek_marshalers_sources) \
$(NULL)
libeek_la_SOURCES = \
$(libeek_sources) \
$(builddir)/eek-enumtypes.c \
$(builddir)/eek-marshalers.c \
$(NULL)
libeek_la_CFLAGS = \
-DEEK_COMPILATION=1 \
-DKEYBOARDSDIR=\"$(pkgdatadir)/keyboards\" \
$(GIO2_CFLAGS) \
$(PANGOCAIRO_CFLAGS) \
$(LIBCROCO_CFLAGS) \
$(NULL)
libeek_la_LIBADD = \
$(GIO2_LIBS) \
$(PANGOCAIRO_LIBS) \
$(LIBCROCO_LIBS) \
-lm \
$(NULL)
libeek_gtk_public_headers = \
$(srcdir)/eek-gtk-keyboard.h \
$(srcdir)/eek-gtk.h \
$(NULL)
libeek_gtk_private_headers = \
$(srcdir)/eek-gtk-renderer.h \
$(NULL)
libeek_gtk_sources = \
$(srcdir)/eek-gtk-keyboard.c \
$(srcdir)/eek-gtk-renderer.c \
$(NULL)
libeek_gtk_la_SOURCES = $(libeek_gtk_sources)
libeek_gtk_la_CFLAGS = -DEEK_COMPILATION=1 $(GTK_CFLAGS) $(LIBCANBERRA_CFLAGS)
libeek_gtk_la_LIBADD = libeek.la $(GTK_LIBS) $(LIBCANBERRA_LIBS)
libeek_xkl_public_headers = \
$(srcdir)/eek-xkl-layout.h \
$(srcdir)/eek-xkl.h \
$(srcdir)/eek-xkb-layout.h \
$(srcdir)/eek-xkb.h \
$(NULL)
libeek_xkl_sources = \
$(srcdir)/eek-xkb-layout.c \
$(srcdir)/eek-xkl-layout.c \
$(NULL)
libeek_xkl_la_SOURCES = $(libeek_xkl_sources)
libeek_xkl_la_CFLAGS = -DEEK_COMPILATION=1 $(LIBXKLAVIER_CFLAGS)
libeek_xkl_la_LIBADD = libeek.la $(LIBXKLAVIER_LIBS)
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
eek_HEADERS = \
$(libeek_public_headers) \
$(builddir)/eek-enumtypes.h \
$(libeek_gtk_public_headers) \
$(libeek_xkl_public_headers) \
$(NULL)
noinst_HEADERS = \
$(libeek_private_headers) \
$(libeek_gtk_private_headers) \
$(libeek_xkl_private_headers) \
$(NULL)
eek-special-keysym-entries.h: special-keysym-entries.txt
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-keysym-entries.py \
special_keysym_entries \
< $< > $@
eek-unicode-keysym-entries.h: unicode-keysym-entries.txt
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-keysym-entries.py \
unicode_keysym_entries \
< $< > $@
eek-xkeysym-keysym-entries.h: xkeysym-keysym-entries.txt
$(AM_V_GEN) $(PYTHON) $(srcdir)/gen-keysym-entries.py \
xkeysym_keysym_entries \
< $< > $@
eek-enumtypes.h: $(libeek_public_headers) eek-enumtypes.h.template
$(AM_V_GEN) $(GLIB_MKENUMS) \
--template $(srcdir)/eek-enumtypes.h.template \
$(libeek_public_headers) > eek-enumtypes.h.tmp && \
mv eek-enumtypes.h.tmp eek-enumtypes.h
eek-enumtypes.c: $(libeek_public_headers) eek-enumtypes.c.template
$(AM_V_GEN) $(GLIB_MKENUMS) \
--template $(srcdir)/eek-enumtypes.c.template \
$(libeek_public_headers) > eek-enumtypes.c.tmp && \
mv eek-enumtypes.c.tmp eek-enumtypes.c
# gen marshal
eek-marshalers.h: eek-marshalers.list
$(AM_V_GEN) $(GLIB_GENMARSHAL) \
--prefix=_eek_marshal $(srcdir)/eek-marshalers.list \
--header --internal > $@.tmp && \
mv $@.tmp $@
eek-marshalers.c: eek-marshalers.list eek-marshalers.h
$(AM_V_GEN) (echo "#include \"eek-marshalers.h\""; \
$(GLIB_GENMARSHAL) --prefix=_eek_marshal \
$(srcdir)/eek-marshalers.list --body --internal) > $@.tmp && \
mv $@.tmp $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = \
eek-$(EEK_API_VERSION).pc \
eek-gtk-$(EEK_API_VERSION).pc \
eek-xkl-$(EEK_API_VERSION).pc \
$(NULL)
CLEANFILES =
DISTCLEANFILES = \
$(BUILT_SOURCES) \
$(pkgconfig_DATA) \
$(NULL)
EXTRA_DIST = \
gen-keysym-entries.py \
special-keysym-entries.txt \
unicode-keysym-entries.txt \
xkeysym-keysym-entries.txt \
eek-enumtypes.h.template \
eek-enumtypes.c.template \
eek-marshalers.list \
$(NULL)
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = --add-include-path=$(builddir)
INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
if HAVE_INTROSPECTION
Eek@EEK_LIBRARY_SUFFIX@.gir: libeek.la
Eek@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
--identifier-prefix=Eek \
--symbol-prefix=eek \
--pkg=glib-2.0 \
--pkg-export=eek-$(EEK_API_VERSION) \
$(NULL)
Eek@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GLib-2.0 GObject-2.0 Gio-2.0
Eek@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_la_CFLAGS)
Eek@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek.la
Eek@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
$(libeek_sources) \
$(libeek_public_headers) \
$(builddir)/eek-enumtypes.h \
$(NULL)
EekGtk@EEK_LIBRARY_SUFFIX@.gir: libeek-gtk.la Eek@EEK_LIBRARY_SUFFIX@.gir
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
--identifier-prefix=Eek \
--symbol-prefix=eek \
--pkg-export=eek-gtk-$(EEK_API_VERSION) \
$(NULL)
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = \
GObject-2.0 \
Gtk-@GTK_API_VERSION@ \
Eek@EEK_LIBRARY_SUFFIX@ \
$(NULL)
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_gtk_la_CFLAGS)
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek-gtk.la
EekGtk@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
$(libeek_gtk_sources) \
$(libeek_gtk_public_headers) \
$(NULL)
EekXkl@EEK_LIBRARY_SUFFIX@.gir: libeek-xkl.la Eek@EEK_LIBRARY_SUFFIX@.gir
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_SCANNERFLAGS = \
--identifier-prefix=Eek \
--symbol-prefix=eek \
$(NULL)
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_INCLUDES = GObject-2.0 Eek@EEK_LIBRARY_SUFFIX@
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_CFLAGS = $(libeek_xkl_la_CFLAGS)
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_LIBS = libeek-xkl.la
EekXkl@EEK_LIBRARY_SUFFIX_U@_gir_FILES = \
$(libeek_xkl_sources) \
$(libeek_xkl_public_headers) \
$(NULL)
INTROSPECTION_GIRS += \
Eek@EEK_LIBRARY_SUFFIX@.gir \
EekGtk@EEK_LIBRARY_SUFFIX@.gir \
EekXkl@EEK_LIBRARY_SUFFIX@.gir \
$(NULL)
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif
-include $(top_srcdir)/git.mk

View File

@ -26,9 +26,7 @@
* shall be used to implement #EekKeyboard and #EekSection.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-container.h"
@ -40,23 +38,19 @@ enum {
static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_ABSTRACT_TYPE (EekContainer, eek_container, EEK_TYPE_ELEMENT);
#define EEK_CONTAINER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CONTAINER, EekContainerPrivate))
struct _EekContainerPrivate
typedef struct _EekContainerPrivate
{
GList *head;
GList *last;
};
} EekContainerPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (EekContainer, eek_container, EEK_TYPE_ELEMENT)
static void
eek_container_real_add_child (EekContainer *self,
EekElement *child)
{
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
EekContainerPrivate *priv = eek_container_get_instance_private (self);
g_return_if_fail (EEK_IS_ELEMENT(child));
g_object_ref (child);
@ -75,7 +69,7 @@ static void
eek_container_real_remove_child (EekContainer *self,
EekElement *child)
{
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
EekContainerPrivate *priv = eek_container_get_instance_private (self);
GList *head;
g_return_if_fail (EEK_IS_ELEMENT(child));
@ -94,7 +88,7 @@ eek_container_real_foreach_child (EekContainer *self,
EekCallback callback,
gpointer user_data)
{
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
EekContainerPrivate *priv = eek_container_get_instance_private (self);
GList *head;
for (head = priv->head; head; head = g_list_next (head))
@ -106,7 +100,7 @@ eek_container_real_find (EekContainer *self,
EekCompareFunc func,
gpointer user_data)
{
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
EekContainerPrivate *priv = eek_container_get_instance_private (self);
GList *head;
head = g_list_find_custom (priv->head, user_data, (GCompareFunc)func);
@ -118,7 +112,8 @@ eek_container_real_find (EekContainer *self,
static void
eek_container_dispose (GObject *object)
{
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(object);
EekContainer *self = EEK_CONTAINER (object);
EekContainerPrivate *priv = eek_container_get_instance_private (self);
GList *head;
for (head = priv->head; head; head = priv->head) {
@ -134,9 +129,6 @@ eek_container_class_init (EekContainerClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (gobject_class,
sizeof (EekContainerPrivate));
klass->add_child = eek_container_real_add_child;
klass->remove_child = eek_container_real_remove_child;
klass->foreach_child = eek_container_real_foreach_child;
@ -189,7 +181,7 @@ eek_container_class_init (EekContainerClass *klass)
static void
eek_container_init (EekContainer *self)
{
self->priv = EEK_CONTAINER_GET_PRIVATE(self);
/* void */
}
/**

View File

@ -30,14 +30,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_CONTAINER (eek_container_get_type())
#define EEK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CONTAINER, EekContainer))
#define EEK_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CONTAINER, EekContainerClass))
#define EEK_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CONTAINER))
#define EEK_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CONTAINER))
#define EEK_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CONTAINER, EekContainerClass))
typedef struct _EekContainerClass EekContainerClass;
typedef struct _EekContainerPrivate EekContainerPrivate;
G_DECLARE_DERIVABLE_TYPE (EekContainer, eek_container, EEK, CONTAINER, EekElement)
/**
* EekCallback:
@ -50,14 +43,6 @@ typedef struct _EekContainerPrivate EekContainerPrivate;
typedef void (*EekCallback) (EekElement *element, gpointer user_data);
typedef gint (*EekCompareFunc) (EekElement *element, gpointer user_data);
struct _EekContainer
{
/*< private >*/
EekElement parent;
EekContainerPrivate *priv;
};
/**
* EekContainerClass:
* @foreach_child: virtual function for iterating over the container's children

View File

@ -26,9 +26,7 @@
* shall be used to implement #EekKeyboard, #EekSection, or #EekKey.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <string.h>
@ -52,20 +50,16 @@ enum {
static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_ABSTRACT_TYPE (EekElement, eek_element, G_TYPE_OBJECT);
#define EEK_ELEMENT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_ELEMENT, EekElementPrivate))
struct _EekElementPrivate
typedef struct _EekElementPrivate
{
gchar *name;
EekBounds bounds;
EekElement *parent;
gint group;
gint level;
};
} EekElementPrivate;
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (EekElement, eek_element, G_TYPE_OBJECT)
static void
eek_element_real_symbol_index_changed (EekElement *self,
@ -78,7 +72,8 @@ eek_element_real_symbol_index_changed (EekElement *self,
static void
eek_element_finalize (GObject *object)
{
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(object);
EekElement *self = EEK_ELEMENT (object);
EekElementPrivate *priv = eek_element_get_instance_private (self);
g_free (priv->name);
G_OBJECT_CLASS (eek_element_parent_class)->finalize (object);
@ -146,9 +141,6 @@ eek_element_class_init (EekElementClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekElementPrivate));
/* signals */
klass->symbol_index_changed = eek_element_real_symbol_index_changed;
@ -238,9 +230,8 @@ eek_element_class_init (EekElementClass *klass)
static void
eek_element_init (EekElement *self)
{
EekElementPrivate *priv;
EekElementPrivate *priv = eek_element_get_instance_private (self);
priv = self->priv = EEK_ELEMENT_GET_PRIVATE(self);
priv->group = -1;
priv->level = -1;
}
@ -259,10 +250,12 @@ eek_element_set_parent (EekElement *element,
g_return_if_fail (EEK_IS_ELEMENT(element));
g_return_if_fail (parent == NULL || EEK_IS_ELEMENT(parent));
if (element->priv->parent == parent)
EekElementPrivate *priv = eek_element_get_instance_private (element);
if (priv->parent == parent)
return;
if (element->priv->parent != NULL) {
if (priv->parent != NULL) {
/* release self-reference acquired when setting parent */
g_object_unref (element);
}
@ -271,7 +264,7 @@ eek_element_set_parent (EekElement *element,
g_object_ref (element);
}
element->priv->parent = parent;
priv->parent = parent;
}
/**
@ -285,7 +278,10 @@ EekElement *
eek_element_get_parent (EekElement *element)
{
g_return_val_if_fail (EEK_IS_ELEMENT(element), NULL);
return element->priv->parent;
EekElementPrivate *priv = eek_element_get_instance_private (element);
return priv->parent;
}
/**
@ -300,8 +296,11 @@ eek_element_set_name (EekElement *element,
const gchar *name)
{
g_return_if_fail (EEK_IS_ELEMENT(element));
g_free (element->priv->name);
element->priv->name = g_strdup (name);
EekElementPrivate *priv = eek_element_get_instance_private (element);
g_free (priv->name);
priv->name = g_strdup (name);
}
/**
@ -315,7 +314,10 @@ const gchar *
eek_element_get_name (EekElement *element)
{
g_return_val_if_fail (EEK_IS_ELEMENT(element), NULL);
return element->priv->name;
EekElementPrivate *priv = eek_element_get_instance_private (element);
return priv->name;
}
/**
@ -332,7 +334,10 @@ eek_element_set_bounds (EekElement *element,
EekBounds *bounds)
{
g_return_if_fail (EEK_IS_ELEMENT(element));
memcpy (&element->priv->bounds, bounds, sizeof(EekBounds));
EekElementPrivate *priv = eek_element_get_instance_private (element);
memcpy (&priv->bounds, bounds, sizeof(EekBounds));
}
/**
@ -350,7 +355,10 @@ eek_element_get_bounds (EekElement *element,
{
g_return_if_fail (EEK_IS_ELEMENT(element));
g_return_if_fail (bounds != NULL);
memcpy (bounds, &element->priv->bounds, sizeof(EekBounds));
EekElementPrivate *priv = eek_element_get_instance_private (element);
memcpy (bounds, &priv->bounds, sizeof(EekBounds));
}
/**
@ -486,11 +494,14 @@ eek_element_set_group (EekElement *element,
gint group)
{
g_return_if_fail (EEK_IS_ELEMENT(element));
if (element->priv->group != group) {
element->priv->group = group;
EekElementPrivate *priv = eek_element_get_instance_private (element);
if (priv->group != group) {
priv->group = group;
g_object_notify (G_OBJECT(element), "group");
g_signal_emit (element, signals[SYMBOL_INDEX_CHANGED], 0,
group, element->priv->level);
group, priv->level);
}
}
@ -509,11 +520,14 @@ eek_element_set_level (EekElement *element,
gint level)
{
g_return_if_fail (EEK_IS_ELEMENT(element));
if (element->priv->level != level) {
element->priv->level = level;
EekElementPrivate *priv = eek_element_get_instance_private (element);
if (priv->level != level) {
priv->level = level;
g_object_notify (G_OBJECT(element), "level");
g_signal_emit (element, signals[SYMBOL_INDEX_CHANGED], 0,
element->priv->group, level);
priv->group, level);
}
}
@ -530,7 +544,10 @@ gint
eek_element_get_group (EekElement *element)
{
g_return_val_if_fail (EEK_IS_ELEMENT(element), -1);
return element->priv->group;
EekElementPrivate *priv = eek_element_get_instance_private (element);
return priv->group;
}
/**
@ -546,5 +563,8 @@ gint
eek_element_get_level (EekElement *element)
{
g_return_val_if_fail (EEK_IS_ELEMENT(element), -1);
return element->priv->level;
EekElementPrivate *priv = eek_element_get_instance_private (element);
return priv->level;
}

View File

@ -30,22 +30,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_ELEMENT (eek_element_get_type())
#define EEK_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_ELEMENT, EekElement))
#define EEK_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_ELEMENT, EekElementClass))
#define EEK_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_ELEMENT))
#define EEK_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_ELEMENT))
#define EEK_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_ELEMENT, EekElementClass))
typedef struct _EekElementClass EekElementClass;
typedef struct _EekElementPrivate EekElementPrivate;
struct _EekElement
{
/*< private >*/
GObject parent;
EekElementPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE (EekElement, eek_element, EEK, ELEMENT, GObject)
struct _EekElementClass
{

View File

@ -1,17 +1,17 @@
/*
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
@ -23,18 +23,17 @@
* @short_description: a #GtkWidget displaying #EekKeyboard
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#ifdef HAVE_LIBCANBERRA
#include <canberra-gtk.h>
#endif
#include <math.h>
#include <string.h>
#include "eek-gtk-keyboard.h"
#include "eek-gtk-renderer.h"
#include "eek-renderer.h"
#include "eek-keyboard.h"
#include "eek-section.h"
#include "eek-key.h"
@ -46,46 +45,33 @@ enum {
PROP_LAST
};
G_DEFINE_TYPE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA);
#define EEK_GTK_KEYBOARD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboardPrivate))
/* since 2.91.5 GDK_DRAWABLE was removed and gdk_cairo_create takes
GdkWindow as the argument */
#ifndef GDK_DRAWABLE
#define GDK_DRAWABLE(x) (x)
#endif
struct _EekGtkKeyboardPrivate
typedef struct _EekGtkKeyboardPrivate
{
EekRenderer *renderer;
EekKeyboard *keyboard;
gulong key_pressed_handler;
gulong key_released_handler;
gulong key_locked_handler;
gulong key_unlocked_handler;
gulong key_cancelled_handler;
gulong symbol_index_changed_handler;
EekTheme *theme;
};
static EekColor * color_from_gdk_color (GdkColor *gdk_color);
static void on_key_pressed (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data);
static void on_key_released (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data);
GdkEventSequence *sequence; // unowned reference
} EekGtkKeyboardPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA)
static void on_key_pressed (EekKey *key,
EekGtkKeyboard *self);
static void on_key_released (EekKey *key,
EekGtkKeyboard *self);
static void on_key_locked (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data);
static void on_key_unlocked (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data);
static void on_key_cancelled (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data);
static void on_symbol_index_changed (EekKeyboard *keyboard,
gint group,
gint level,
@ -100,7 +86,6 @@ static void render_released_key (GtkWidget *widget,
static void
eek_gtk_keyboard_real_realize (GtkWidget *self)
{
gtk_widget_set_double_buffered (self, FALSE);
gtk_widget_set_events (self,
GDK_EXPOSURE_MASK |
GDK_KEY_PRESS_MASK |
@ -116,51 +101,28 @@ static gboolean
eek_gtk_keyboard_real_draw (GtkWidget *self,
cairo_t *cr)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self));
GtkAllocation allocation;
EekColor background;
GList *list, *head;
gtk_widget_get_allocation (self, &allocation);
if (!priv->renderer) {
GtkStyle *style;
GtkStateType state;
PangoContext *pcontext;
EekColor *color;
pcontext = gtk_widget_get_pango_context (self);
priv->renderer = eek_gtk_renderer_new (priv->keyboard, pcontext, self);
priv->renderer = eek_renderer_new (priv->keyboard, pcontext);
if (priv->theme)
eek_renderer_set_theme (priv->renderer, priv->theme);
eek_renderer_set_allocation_size (priv->renderer,
allocation.width,
allocation.height);
style = gtk_widget_get_style (self);
state = gtk_widget_get_state (self);
color = color_from_gdk_color (&style->text[state]);
eek_renderer_set_default_foreground_color (priv->renderer, color);
eek_color_free (color);
color = color_from_gdk_color (&style->base[state]);
eek_renderer_set_default_background_color (priv->renderer, color);
eek_color_free (color);
eek_renderer_set_scale_factor (priv->renderer,
gtk_widget_get_scale_factor (self));
}
/* blank background */
eek_renderer_get_background_color (priv->renderer,
EEK_ELEMENT(priv->keyboard),
&background);
cairo_set_source_rgba (cr,
background.red,
background.green,
background.blue,
background.alpha);
cairo_paint (cr);
eek_renderer_render_keyboard (priv->renderer, cr);
/* redraw pressed key */
@ -184,7 +146,8 @@ static void
eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
GtkAllocation *allocation)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self));
if (priv->renderer)
eek_renderer_set_allocation_size (priv->renderer,
@ -195,49 +158,21 @@ eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
size_allocate (self, allocation);
}
static gboolean
eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
GdkEventButton *event)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekKey *key;
key = eek_renderer_find_key_by_position (priv->renderer,
(gdouble)event->x,
(gdouble)event->y);
if (key)
g_signal_emit_by_name (key, "pressed", priv->keyboard);
return TRUE;
static void depress(EekGtkKeyboard *self,
gdouble x, gdouble y, guint32 time) {
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
EekKey *key = eek_renderer_find_key_by_position (priv->renderer, x, y);
if (key) {
eek_keyboard_press_key(priv->keyboard, key, time);
on_key_pressed(key, self);
}
}
static gboolean
eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
GdkEventButton *event)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
GList *list, *head;
static void drag(EekGtkKeyboard *self,
gdouble x, gdouble y, guint32 time) {
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
EekKey *key = eek_renderer_find_key_by_position (priv->renderer, x, y);
list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head))
g_signal_emit_by_name (head->data, "released", priv->keyboard);
g_list_free (list);
return TRUE;
}
static gboolean
eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
GdkEventMotion *event)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekKey *key;
if (event->state == 0)
return FALSE;
key = eek_renderer_find_key_by_position (priv->renderer,
(gdouble)event->x,
(gdouble)event->y);
if (key) {
GList *list, *head;
gboolean found = FALSE;
@ -246,13 +181,93 @@ eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
for (head = list; head; head = g_list_next (head)) {
if (head->data == key)
found = TRUE;
else
g_signal_emit_by_name (head->data, "cancelled", priv->keyboard);
else {
eek_keyboard_release_key(priv->keyboard, EEK_KEY(head->data), time);
on_key_released(key, self);
}
}
g_list_free (list);
if (!found)
g_signal_emit_by_name (key, "pressed", priv->keyboard);
if (!found) {
eek_keyboard_press_key(priv->keyboard, key, time);
on_key_pressed(key, self);
}
}
}
static void release(EekGtkKeyboard *self, guint32 time) {
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
GList *list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (GList *head = list; head; head = g_list_next (head)) {
EekKey *key = EEK_KEY(head->data);
eek_keyboard_release_key(priv->keyboard, key, time);
on_key_released(key, self);
}
g_list_free (list);
}
static gboolean
eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
GdkEventButton *event)
{
if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
depress(EEK_GTK_KEYBOARD(self), event->x, event->y, event->time);
}
return TRUE;
}
// TODO: this belongs more in gtk_keyboard, with a way to find out which key to re-render
static gboolean
eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
GdkEventButton *event)
{
if (event->type == GDK_BUTTON_RELEASE && event->button == 1) {
// TODO: can the event have different coords than the previous move event?
release(EEK_GTK_KEYBOARD(self), event->time);
}
return TRUE;
}
static gboolean
eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
GdkEventMotion *event)
{
if (event->state & GDK_BUTTON1_MASK) {
drag(EEK_GTK_KEYBOARD(self), event->x, event->y, event->time);
}
return TRUE;
}
// Only one touch stream at a time allowed. Others will be completely ignored.
static gboolean
handle_touch_event (GtkWidget *widget,
GdkEventTouch *event)
{
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
if (event->type == GDK_TOUCH_BEGIN) {
if (priv->sequence) {
// Ignore second and following touch points
return FALSE;
}
priv->sequence = event->sequence;
depress(self, event->x, event->y, event->time);
return TRUE;
}
if (priv->sequence != event->sequence) {
return FALSE;
}
if (event->type == GDK_TOUCH_UPDATE) {
drag(self, event->x, event->y, event->time);
}
if (event->type == GDK_TOUCH_END || event->type == GDK_TOUCH_CANCEL) {
// TODO: can the event have different coords than the previous update event?
release(self, event->time);
priv->sequence = NULL;
}
return TRUE;
}
@ -260,7 +275,8 @@ eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
static void
eek_gtk_keyboard_real_unmap (GtkWidget *self)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekGtkKeyboardPrivate *priv =
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self));
if (priv->keyboard) {
GList *list, *head;
@ -270,8 +286,10 @@ eek_gtk_keyboard_real_unmap (GtkWidget *self)
EekKeyboard::key-released signal can remove elements from its
internal copy */
list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head))
g_signal_emit_by_name (head->data, "released", priv->keyboard);
for (head = list; head; head = g_list_next (head)) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey released");
g_signal_emit_by_name (head->data, "released");
}
g_list_free (list);
}
@ -285,7 +303,9 @@ eek_gtk_keyboard_real_query_tooltip (GtkWidget *widget,
gboolean keyboard_tooltip,
GtkTooltip *tooltip)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
EekKey *key;
key = eek_renderer_find_key_by_position (priv->renderer,
@ -306,27 +326,24 @@ static void
eek_gtk_keyboard_set_keyboard (EekGtkKeyboard *self,
EekKeyboard *keyboard)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
if (priv->keyboard == keyboard)
return;
if (priv->keyboard) {
g_signal_handlers_disconnect_by_data(priv->keyboard, self);
g_object_unref (priv->keyboard);
}
priv->keyboard = g_object_ref (keyboard);
priv->key_pressed_handler =
g_signal_connect (priv->keyboard, "key-pressed",
G_CALLBACK(on_key_pressed), self);
priv->key_released_handler =
g_signal_connect (priv->keyboard, "key-released",
G_CALLBACK(on_key_released), self);
priv->key_locked_handler =
g_signal_connect (priv->keyboard, "key-locked",
G_CALLBACK(on_key_locked), self);
priv->key_unlocked_handler =
g_signal_connect (priv->keyboard, "key-unlocked",
G_CALLBACK(on_key_unlocked), self);
priv->key_cancelled_handler =
g_signal_connect (priv->keyboard, "key-cancelled",
G_CALLBACK(on_key_cancelled), self);
priv->symbol_index_changed_handler =
g_signal_connect (priv->keyboard, "symbol-index-changed",
G_CALLBACK(on_symbol_index_changed), self);
g_signal_connect (priv->keyboard, "key-locked",
G_CALLBACK(on_key_locked), self);
g_signal_connect (priv->keyboard, "key-unlocked",
G_CALLBACK(on_key_unlocked), self);
g_signal_connect (priv->keyboard, "symbol-index-changed",
G_CALLBACK(on_symbol_index_changed), self);
}
static void
@ -351,7 +368,8 @@ eek_gtk_keyboard_set_property (GObject *object,
static void
eek_gtk_keyboard_dispose (GObject *object)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(object);
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (object);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
if (priv->renderer) {
g_object_unref (priv->renderer);
@ -359,35 +377,12 @@ eek_gtk_keyboard_dispose (GObject *object)
}
if (priv->keyboard) {
if (g_signal_handler_is_connected (priv->keyboard,
priv->key_pressed_handler))
g_signal_handler_disconnect (priv->keyboard,
priv->key_pressed_handler);
if (g_signal_handler_is_connected (priv->keyboard,
priv->key_released_handler))
g_signal_handler_disconnect (priv->keyboard,
priv->key_released_handler);
if (g_signal_handler_is_connected (priv->keyboard,
priv->key_locked_handler))
g_signal_handler_disconnect (priv->keyboard,
priv->key_locked_handler);
if (g_signal_handler_is_connected (priv->keyboard,
priv->key_unlocked_handler))
g_signal_handler_disconnect (priv->keyboard,
priv->key_unlocked_handler);
if (g_signal_handler_is_connected (priv->keyboard,
priv->key_cancelled_handler))
g_signal_handler_disconnect (priv->keyboard,
priv->key_cancelled_handler);
if (g_signal_handler_is_connected (priv->keyboard,
priv->symbol_index_changed_handler))
g_signal_handler_disconnect (priv->keyboard,
priv->symbol_index_changed_handler);
GList *list, *head;
g_signal_handlers_disconnect_by_data(priv->keyboard, self);
list = eek_keyboard_get_pressed_keys (priv->keyboard);
for (head = list; head; head = g_list_next (head)) {
g_log("squeek", G_LOG_LEVEL_DEBUG, "emit EekKey pressed");
g_signal_emit_by_name (head->data, "released", priv->keyboard);
}
g_list_free (list);
@ -411,9 +406,6 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekGtkKeyboardPrivate));
widget_class->realize = eek_gtk_keyboard_real_realize;
widget_class->unmap = eek_gtk_keyboard_real_unmap;
widget_class->draw = eek_gtk_keyboard_real_draw;
@ -426,6 +418,7 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
eek_gtk_keyboard_real_motion_notify_event;
widget_class->query_tooltip =
eek_gtk_keyboard_real_query_tooltip;
widget_class->touch_event = handle_touch_event;
gobject_class->set_property = eek_gtk_keyboard_set_property;
gobject_class->dispose = eek_gtk_keyboard_dispose;
@ -443,7 +436,7 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
static void
eek_gtk_keyboard_init (EekGtkKeyboard *self)
{
self->priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
/* void */
}
/**
@ -459,15 +452,6 @@ eek_gtk_keyboard_new (EekKeyboard *keyboard)
return g_object_new (EEK_TYPE_GTK_KEYBOARD, "keyboard", keyboard, NULL);
}
static EekColor *
color_from_gdk_color (GdkColor *gdk_color)
{
return eek_color_new (gdk_color->red / (gdouble)0xFFFF,
gdk_color->green / (gdouble)0xFFFF,
gdk_color->blue / (gdouble)0xFFFF,
1.0);
}
static void
magnify_bounds (GtkWidget *self,
EekBounds *bounds,
@ -495,11 +479,14 @@ static void
render_pressed_key (GtkWidget *widget,
EekKey *key)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
EekBounds bounds, large_bounds;
cairo_t *cr;
cr = gdk_cairo_create (GDK_DRAWABLE (gtk_widget_get_window (widget)));
GdkWindow *window = gtk_widget_get_window (widget);
cairo_region_t *region = gdk_window_get_clip_region (window);
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
eek_renderer_get_key_bounds (priv->renderer, key, &bounds, TRUE);
magnify_bounds (widget, &bounds, &large_bounds, 1.5);
@ -508,73 +495,75 @@ render_pressed_key (GtkWidget *widget,
cairo_translate (cr, bounds.x, bounds.y);
eek_renderer_render_key (priv->renderer, cr, key, 1.0, TRUE);
cairo_restore (cr);
/*
cairo_save (cr);
cairo_translate (cr, large_bounds.x, large_bounds.y);
eek_renderer_render_key (priv->renderer, cr, key, 1.5, TRUE);
cairo_restore (cr);
*/
gdk_window_end_draw_frame (window, context);
cairo_destroy (cr);
cairo_region_destroy (region);
}
static void
render_locked_key (GtkWidget *widget,
EekKey *key)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
EekBounds bounds;
cairo_t *cr;
cr = gdk_cairo_create (GDK_DRAWABLE (gtk_widget_get_window (widget)));
GdkWindow *window = gtk_widget_get_window (widget);
cairo_region_t *region = gdk_window_get_clip_region (window);
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
eek_renderer_get_key_bounds (priv->renderer, key, &bounds, TRUE);
cairo_translate (cr, bounds.x, bounds.y);
eek_renderer_render_key (priv->renderer, cr, key, 1.0, TRUE);
cairo_destroy (cr);
gdk_window_end_draw_frame (window, context);
cairo_region_destroy (region);
}
static void
render_released_key (GtkWidget *widget,
EekKey *key)
{
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
EekBounds bounds, large_bounds;
cairo_t *cr;
cr = gdk_cairo_create (GDK_DRAWABLE (gtk_widget_get_window (widget)));
GdkWindow *window = gtk_widget_get_window (widget);
cairo_region_t *region = gdk_window_get_clip_region (window);
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
eek_renderer_get_key_bounds (priv->renderer, key, &bounds, TRUE);
magnify_bounds (widget, &bounds, &large_bounds, 2.0);
cairo_rectangle (cr,
large_bounds.x,
large_bounds.y,
large_bounds.width,
large_bounds.height);
cairo_rectangle (cr,
bounds.x,
bounds.y,
bounds.width,
bounds.height);
cairo_clip (cr);
magnify_bounds (widget, &bounds, &large_bounds, 1.5);
eek_renderer_render_keyboard (priv->renderer, cr);
cairo_destroy (cr);
gdk_window_end_draw_frame (window, context);
cairo_region_destroy (region);
}
static void
on_key_pressed (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data)
on_key_pressed (EekKey *key,
EekGtkKeyboard *self)
{
GtkWidget *widget = user_data;
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
/* renderer may have not been set yet if the widget is a popup */
if (!priv->renderer)
return;
render_pressed_key (widget, key);
render_pressed_key (GTK_WIDGET(self), key);
gtk_widget_queue_draw (GTK_WIDGET(self));
#if HAVE_LIBCANBERRA
ca_gtk_play_for_widget (widget, 0,
@ -586,18 +575,17 @@ on_key_pressed (EekKeyboard *keyboard,
}
static void
on_key_released (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data)
on_key_released (EekKey *key,
EekGtkKeyboard *self)
{
GtkWidget *widget = user_data;
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
/* renderer may have not been set yet if the widget is a popup */
if (!priv->renderer)
return;
render_released_key (widget, key);
render_released_key (GTK_WIDGET(self), key);
gtk_widget_queue_draw (GTK_WIDGET(self));
#if HAVE_LIBCANBERRA
ca_gtk_play_for_widget (widget, 0,
@ -608,34 +596,20 @@ on_key_released (EekKeyboard *keyboard,
#endif
}
static void
on_key_cancelled (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data)
{
GtkWidget *widget = user_data;
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
/* renderer may have not been set yet if the widget is a popup */
if (!priv->renderer)
return;
render_released_key (widget, key);
}
static void
on_key_locked (EekKeyboard *keyboard,
EekKey *key,
gpointer user_data)
{
GtkWidget *widget = user_data;
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (user_data);
/* renderer may have not been set yet if the widget is a popup */
if (!priv->renderer)
return;
render_locked_key (widget, key);
gtk_widget_queue_draw (widget);
}
static void
@ -644,13 +618,14 @@ on_key_unlocked (EekKeyboard *keyboard,
gpointer user_data)
{
GtkWidget *widget = user_data;
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(widget);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (user_data);
/* renderer may have not been set yet if the widget is a popup */
if (!priv->renderer)
return;
render_released_key (widget, key);
gtk_widget_queue_draw (GTK_WIDGET(widget));
}
static void
@ -668,11 +643,9 @@ void
eek_gtk_keyboard_set_theme (EekGtkKeyboard *keyboard,
EekTheme *theme)
{
EekGtkKeyboardPrivate *priv;
g_return_if_fail (EEK_IS_GTK_KEYBOARD(keyboard));
g_return_if_fail (EEK_IS_THEME(theme));
priv = EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (keyboard);
priv->theme = g_object_ref (theme);
}

View File

@ -32,23 +32,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_GTK_KEYBOARD (eek_gtk_keyboard_get_type())
#define EEK_GTK_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboard))
#define EEK_GTK_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboardClass))
#define EEK_IS_GTK_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_GTK_KEYBOARD))
#define EEK_IS_GTK_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_GTK_KEYBOARD))
#define EEK_GTK_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboardClass))
typedef struct _EekGtkKeyboard EekGtkKeyboard;
typedef struct _EekGtkKeyboardClass EekGtkKeyboardClass;
typedef struct _EekGtkKeyboardPrivate EekGtkKeyboardPrivate;
struct _EekGtkKeyboard
{
/*< private >*/
GtkDrawingArea parent;
EekGtkKeyboardPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE (EekGtkKeyboard, eek_gtk_keyboard, EEK, GTK_KEYBOARD, GtkDrawingArea)
struct _EekGtkKeyboardClass
{

View File

@ -1,104 +0,0 @@
/*
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "eek-gtk-renderer.h"
#include "eek-key.h"
G_DEFINE_TYPE (EekGtkRenderer, eek_gtk_renderer, EEK_TYPE_RENDERER);
static cairo_surface_t *
pixbuf_to_cairo_surface (GdkPixbuf *pixbuf)
{
cairo_surface_t *dummy_surface;
cairo_pattern_t *pattern;
cairo_surface_t *surface;
cairo_t *cr;
dummy_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
cr = cairo_create (dummy_surface);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
pattern = cairo_get_source (cr);
cairo_pattern_get_surface (pattern, &surface);
cairo_surface_reference (surface);
cairo_destroy (cr);
cairo_surface_destroy (dummy_surface);
return surface;
}
static cairo_surface_t *
eek_gtk_renderer_real_get_icon_surface (EekRenderer *self,
const gchar *icon_name,
gint size)
{
GdkPixbuf *pixbuf;
GError *error;
cairo_surface_t *surface;
error = NULL;
pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (),
icon_name,
size,
0,
&error);
if (pixbuf == NULL) {
g_warning ("can't get icon pixbuf for %s: %s",
icon_name,
error->message);
g_error_free (error);
return NULL;
}
surface = pixbuf_to_cairo_surface (pixbuf);
g_object_unref (pixbuf);
return surface;
}
static void
eek_gtk_renderer_class_init (EekGtkRendererClass *klass)
{
EekRendererClass *renderer_class = EEK_RENDERER_CLASS (klass);
renderer_class->get_icon_surface = eek_gtk_renderer_real_get_icon_surface;
}
static void
eek_gtk_renderer_init (EekGtkRenderer *self)
{
}
EekRenderer *
eek_gtk_renderer_new (EekKeyboard *keyboard,
PangoContext *pcontext,
GtkWidget *widget)
{
return g_object_new (EEK_TYPE_GTK_RENDERER,
"keyboard", keyboard,
"pango-context", pcontext,
NULL);
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef EEK_GTK_RENDERER_H
#define EEK_GTK_RENDERER_H 1
#include <gtk/gtk.h>
#include "eek-renderer.h"
G_BEGIN_DECLS
#define EEK_TYPE_GTK_RENDERER (eek_gtk_renderer_get_type())
#define EEK_GTK_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_GTK_RENDERER, EekGtkRenderer))
#define EEK_GTK_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_GTK_RENDERER, EekGtkRendererClass))
#define EEK_IS_GTK_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_GTK_RENDERER))
#define EEK_IS_GTK_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_GTK_RENDERER))
#define EEK_GTK_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_GTK_RENDERER, EekGtkRendererClass))
typedef struct _EekGtkRenderer EekGtkRenderer;
typedef struct _EekGtkRendererClass EekGtkRendererClass;
typedef struct _EekGtkRendererPrivate EekGtkRendererPrivate;
struct _EekGtkRenderer {
EekRenderer parent;
EekGtkRendererPrivate *priv;
};
struct _EekGtkRendererClass
{
EekRendererClass parent_class;
/*< private >*/
/* padding */
gpointer pdummy[24];
};
GType eek_gtk_renderer_get_type (void) G_GNUC_CONST;
EekRenderer *eek_gtk_renderer_new (EekKeyboard *keyboard,
PangoContext *pcontext,
GtkWidget *widget);
G_END_DECLS
#endif /* EEK_GTK_RENDERER_H */

View File

@ -25,15 +25,9 @@
* The #EekKeyClass class represents a key.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <string.h>
#define DEBUG 0
#if DEBUG
#include <stdio.h>
#endif
#include "eek-key.h"
#include "eek-section.h"
@ -51,59 +45,30 @@ enum {
};
enum {
PRESSED,
RELEASED,
LOCKED,
UNLOCKED,
CANCELLED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (EekKey, eek_key, EEK_TYPE_ELEMENT);
#define EEK_KEY_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_KEY, EekKeyPrivate))
struct _EekKeyPrivate
typedef struct _EekKeyPrivate
{
guint keycode;
EekSymbolMatrix *symbol_matrix;
gint column;
gint row;
gulong oref;
gulong oref; // UI outline reference
gboolean is_pressed;
gboolean is_locked;
};
} EekKeyPrivate;
static void
eek_key_real_pressed (EekKey *self)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
priv->is_pressed = TRUE;
#if DEBUG
g_debug ("pressed %X", eek_key_get_keycode (self));
#endif
}
static void
eek_key_real_released (EekKey *self)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
priv->is_pressed = FALSE;
#if DEBUG
g_debug ("released %X", eek_key_get_keycode (self));
#endif
}
G_DEFINE_TYPE_WITH_PRIVATE (EekKey, eek_key, EEK_TYPE_ELEMENT)
static void
eek_key_real_locked (EekKey *self)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
EekKeyPrivate *priv = eek_key_get_instance_private (self);
priv->is_locked = TRUE;
#if DEBUG
@ -114,7 +79,7 @@ eek_key_real_locked (EekKey *self)
static void
eek_key_real_unlocked (EekKey *self)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
EekKeyPrivate *priv = eek_key_get_instance_private (self);
priv->is_locked = FALSE;
#if DEBUG
@ -122,22 +87,14 @@ eek_key_real_unlocked (EekKey *self)
#endif
}
static void
eek_key_real_cancelled (EekKey *self)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
priv->is_pressed = FALSE;
#if DEBUG
g_debug ("cancelled %X", eek_key_get_keycode (self));
#endif
}
static void
eek_key_finalize (GObject *object)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(object);
EekKey *self = EEK_KEY (object);
EekKeyPrivate *priv = eek_key_get_instance_private (self);
eek_symbol_matrix_free (priv->symbol_matrix);
G_OBJECT_CLASS (eek_key_parent_class)->finalize (object);
}
@ -214,19 +171,13 @@ eek_key_class_init (EekKeyClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekKeyPrivate));
gobject_class->set_property = eek_key_set_property;
gobject_class->get_property = eek_key_get_property;
gobject_class->finalize = eek_key_finalize;
/* signals */
klass->pressed = eek_key_real_pressed;
klass->released = eek_key_real_released;
klass->locked = eek_key_real_locked;
klass->unlocked = eek_key_real_unlocked;
klass->cancelled = eek_key_real_cancelled;
/**
* EekKey:keycode:
@ -288,42 +239,6 @@ eek_key_class_init (EekKeyClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_OREF, pspec);
/**
* EekKey::pressed:
* @key: an #EekKey
*
* The ::pressed signal is emitted each time @key is shifted to
* the pressed state. The class handler runs before signal
* handlers to allow signal handlers to read the status of @key
* with eek_key_is_pressed().
*/
signals[PRESSED] =
g_signal_new (I_("pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET(EekKeyClass, pressed),
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* EekKey::released:
* @key: an #EekKey
*
* The ::released signal is emitted each time @key is shifted to
* the released state.
*/
signals[RELEASED] =
g_signal_new (I_("released"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyClass, released),
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* EekKey::locked:
* @key: an #EekKey
@ -359,31 +274,12 @@ eek_key_class_init (EekKeyClass *klass)
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* EekKey::cancelled:
* @key: an #EekKey
*
* The ::cancelled signal is emitted each time @key is shifted to
* the cancelled state.
*/
signals[CANCELLED] =
g_signal_new (I_("cancelled"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyClass, cancelled),
NULL,
NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
eek_key_init (EekKey *self)
{
EekKeyPrivate *priv;
priv = self->priv = EEK_KEY_GET_PRIVATE(self);
EekKeyPrivate *priv = eek_key_get_instance_private (self);
priv->symbol_matrix = eek_symbol_matrix_new (0, 0);
}
@ -403,7 +299,10 @@ eek_key_set_keycode (EekKey *key,
guint keycode)
{
g_return_if_fail (EEK_IS_KEY (key));
key->priv->keycode = keycode;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
priv->keycode = keycode;
}
/**
@ -417,7 +316,10 @@ guint
eek_key_get_keycode (EekKey *key)
{
g_return_val_if_fail (EEK_IS_KEY (key), EEK_INVALID_KEYCODE);
return key->priv->keycode;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
return priv->keycode;
}
/**
@ -433,8 +335,10 @@ eek_key_set_symbol_matrix (EekKey *key,
{
g_return_if_fail (EEK_IS_KEY(key));
eek_symbol_matrix_free (key->priv->symbol_matrix);
key->priv->symbol_matrix = eek_symbol_matrix_copy (matrix);
EekKeyPrivate *priv = eek_key_get_instance_private (key);
eek_symbol_matrix_free (priv->symbol_matrix);
priv->symbol_matrix = eek_symbol_matrix_copy (matrix);
}
/**
@ -448,7 +352,10 @@ EekSymbolMatrix *
eek_key_get_symbol_matrix (EekKey *key)
{
g_return_val_if_fail (EEK_IS_KEY(key), NULL);
return key->priv->symbol_matrix;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
return priv->symbol_matrix;
}
/**
@ -536,7 +443,7 @@ eek_key_get_symbol_at_index (EekKey *key,
gint fallback_group,
gint fallback_level)
{
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(key);
EekKeyPrivate *priv = eek_key_get_instance_private (key);
gint num_symbols;
g_return_val_if_fail (fallback_group >= 0, NULL);
@ -588,12 +495,14 @@ eek_key_set_index (EekKey *key,
g_return_if_fail (0 <= column);
g_return_if_fail (0 <= row);
if (key->priv->column != column) {
key->priv->column = column;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
if (priv->column != column) {
priv->column = column;
g_object_notify (G_OBJECT(key), "column");
}
if (key->priv->row != row) {
key->priv->row = row;
if (priv->row != row) {
priv->row = row;
g_object_notify (G_OBJECT(key), "row");
}
}
@ -614,10 +523,12 @@ eek_key_get_index (EekKey *key,
g_return_if_fail (EEK_IS_KEY(key));
g_return_if_fail (column != NULL || row != NULL);
EekKeyPrivate *priv = eek_key_get_instance_private (key);
if (column != NULL)
*column = key->priv->column;
*column = priv->column;
if (row != NULL)
*row = key->priv->row;
*row = priv->row;
}
/**
@ -632,8 +543,11 @@ eek_key_set_oref (EekKey *key,
guint oref)
{
g_return_if_fail (EEK_IS_KEY(key));
if (key->priv->oref != oref) {
key->priv->oref = oref;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
if (priv->oref != oref) {
priv->oref = oref;
g_object_notify (G_OBJECT(key), "oref");
}
}
@ -649,7 +563,10 @@ guint
eek_key_get_oref (EekKey *key)
{
g_return_val_if_fail (EEK_IS_KEY (key), 0);
return key->priv->oref;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
return priv->oref;
}
/**
@ -662,7 +579,10 @@ gboolean
eek_key_is_pressed (EekKey *key)
{
g_return_val_if_fail (EEK_IS_KEY(key), FALSE);
return key->priv->is_pressed;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
return priv->is_pressed;
}
/**
@ -675,5 +595,25 @@ gboolean
eek_key_is_locked (EekKey *key)
{
g_return_val_if_fail (EEK_IS_KEY(key), FALSE);
return key->priv->is_locked;
EekKeyPrivate *priv = eek_key_get_instance_private (key);
return priv->is_locked;
}
void eek_key_set_pressed(EekKey *key, gboolean value)
{
g_return_if_fail (EEK_IS_KEY(key));
EekKeyPrivate *priv = eek_key_get_instance_private (key);
priv->is_pressed = value;
}
gboolean
eek_key_has_label(EekKey *key)
{
EekSymbol *symbol = eek_key_get_symbol(key);
return (eek_symbol_get_label(symbol) != NULL) ||
(eek_symbol_get_icon_name(symbol) != NULL);
}

View File

@ -31,28 +31,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_KEY (eek_key_get_type())
#define EEK_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEY, EekKey))
#define EEK_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_KEY, EekKeyClass))
#define EEK_IS_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEY))
#define EEK_IS_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_KEY))
#define EEK_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_KEY, EekKeyClass))
typedef struct _EekKeyClass EekKeyClass;
typedef struct _EekKeyPrivate EekKeyPrivate;
/**
* EekKey:
*
* The #EekKey structure contains only private data and should only be
* accessed using the provided API.
*/
struct _EekKey
{
/*< private >*/
EekElement parent;
EekKeyPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE(EekKey, eek_key, EEK, KEY, EekElement)
/**
* EekKeyClass:
@ -71,11 +50,8 @@ struct _EekKeyClass
/*< public >*/
/* signals */
void (* pressed) (EekKey *key);
void (* released) (EekKey *key);
void (* locked) (EekKey *key);
void (* unlocked) (EekKey *key);
void (* cancelled) (EekKey *key);
};
GType eek_key_get_type (void) G_GNUC_CONST;
@ -110,6 +86,10 @@ guint eek_key_get_oref (EekKey *key);
gboolean eek_key_is_pressed (EekKey *key);
gboolean eek_key_is_locked (EekKey *key);
void eek_key_set_pressed (EekKey *key,
gboolean value);
gboolean eek_key_has_label (EekKey *key);
G_END_DECLS
#endif /* EEK_KEY_H */

View File

@ -17,9 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <math.h>
#include <pango/pangocairo.h>
@ -199,32 +197,21 @@ void
_eek_rounded_polygon (cairo_t *cr,
gdouble radius,
EekPoint *points,
gint num_points)
guint num_points)
{
gint i, j;
cairo_move_to (cr,
(gdouble) (points[num_points - 1].x +
points[0].x) / 2,
(gdouble) (points[num_points - 1].y +
points[0].y) / 2);
#ifdef KBDRAW_DEBUG
printf (" rounded polygon of radius %f:\n", radius);
#endif
for (i = 0; i < num_points; i++) {
j = (i + 1) % num_points;
for (guint i = 0; i < num_points; i++) {
guint j = (i + 1) % num_points;
rounded_corner (cr, (gdouble) points[i].x,
(gdouble) points[i].y,
(gdouble) (points[i].x + points[j].x) / 2,
(gdouble) (points[i].y + points[j].y) / 2,
radius);
#ifdef KBDRAW_DEBUG
printf (" corner (%d, %d) -> (%d, %d):\n",
points[i].x, points[i].y, points[j].x,
points[j].y);
#endif
};
}
cairo_close_path (cr);
}

View File

@ -27,15 +27,15 @@
* of one or more sections of the #EekSectionClass class.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-keyboard.h"
#include "eek-marshalers.h"
#include "eek-section.h"
#include "eek-key.h"
#include "eek-symbol.h"
#include "eek-enumtypes.h"
#include "eekboard/key-emitter.h"
enum {
PROP_0,
@ -45,17 +45,20 @@ enum {
};
enum {
KEY_PRESSED,
KEY_RELEASED,
KEY_LOCKED,
KEY_UNLOCKED,
KEY_CANCELLED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
enum {
VIEW_LETTERS_LOWER,
VIEW_LETTERS_UPPER,
VIEW_NUMBERS,
VIEW_SYMBOLS
};
G_DEFINE_TYPE (EekKeyboard, eek_keyboard, EEK_TYPE_CONTAINER);
static guint signals[LAST_SIGNAL] = { 0, };
#define EEK_KEYBOARD_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_KEYBOARD, EekKeyboardPrivate))
@ -65,16 +68,19 @@ struct _EekKeyboardPrivate
EekLayout *layout;
EekModifierBehavior modifier_behavior;
EekModifierType modifiers;
unsigned int old_level;
GList *pressed_keys;
GList *locked_keys;
GArray *outline_array;
GHashTable *keycodes;
GHashTable *names;
/* modifiers dynamically assigned at run time */
EekModifierType num_lock_mask;
EekModifierType alt_gr_mask;
};
G_DEFINE_TYPE_WITH_PRIVATE (EekKeyboard, eek_keyboard, EEK_TYPE_CONTAINER);
G_DEFINE_BOXED_TYPE(EekModifierKey, eek_modifier_key,
eek_modifier_key_copy, eek_modifier_key_free);
@ -91,22 +97,6 @@ eek_modifier_key_free (EekModifierKey *modkey)
g_slice_free (EekModifierKey, modkey);
}
static void
on_key_pressed (EekSection *section,
EekKey *key,
EekKeyboard *keyboard)
{
g_signal_emit (keyboard, signals[KEY_PRESSED], 0, key);
}
static void
on_key_released (EekSection *section,
EekKey *key,
EekKeyboard *keyboard)
{
g_signal_emit (keyboard, signals[KEY_RELEASED], 0, key);
}
static void
on_key_locked (EekSection *section,
EekKey *key,
@ -123,14 +113,6 @@ on_key_unlocked (EekSection *section,
g_signal_emit (keyboard, signals[KEY_UNLOCKED], 0, key);
}
static void
on_key_cancelled (EekSection *section,
EekKey *key,
EekKeyboard *keyboard)
{
g_signal_emit (keyboard, signals[KEY_CANCELLED], 0, key);
}
static void
on_symbol_index_changed (EekSection *section,
gint group,
@ -145,9 +127,9 @@ section_child_added_cb (EekContainer *container,
EekElement *element,
EekKeyboard *keyboard)
{
guint keycode = eek_key_get_keycode (EEK_KEY(element));
g_hash_table_insert (keyboard->priv->keycodes,
GUINT_TO_POINTER(keycode),
const gchar *name = eek_element_get_name(element);
g_hash_table_insert (keyboard->priv->names,
(gpointer)name,
element);
}
@ -156,9 +138,9 @@ section_child_removed_cb (EekContainer *container,
EekElement *element,
EekKeyboard *keyboard)
{
guint keycode = eek_key_get_keycode (EEK_KEY(element));
g_hash_table_remove (keyboard->priv->keycodes,
GUINT_TO_POINTER(keycode));
const gchar *name = eek_element_get_name(element);
g_hash_table_remove (keyboard->priv->names,
name);
}
static EekSection *
@ -227,16 +209,61 @@ eek_keyboard_get_property (GObject *object,
}
static void
set_level_from_modifiers (EekKeyboard *self)
set_level_from_modifiers (EekKeyboard *self, EekKey *key)
{
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
gint level = 0;
if (priv->modifiers & priv->alt_gr_mask)
level |= 2;
if (priv->modifiers & EEK_SHIFT_MASK)
level |= 1;
/* The levels are: 0 Letters, 1 Upper case letters, 2 Numbers, 3 Symbols */
/* Use the numbers/letters bit from the old level */
gint level = priv->old_level & 2;
/* Handle non-emitting keys */
if (key) {
const gchar *name = eek_element_get_name(EEK_ELEMENT(key));
if (g_strcmp0(name, "ABC123") == 0)
level ^= 2;
}
level |= ((priv->modifiers & EEK_SHIFT_MASK) ? 1 : 0);
switch (priv->old_level) {
case VIEW_LETTERS_UPPER:
{
/* Redirect upper case letters to numbers instead of symbols, clearing
the shift modifier to keep the modifiers in sync with the level */
if (level == VIEW_SYMBOLS) {
level = VIEW_NUMBERS;
priv->modifiers &= ~EEK_SHIFT_MASK;
}
break;
}
case VIEW_SYMBOLS:
{
/* Redirect symbols to lower case letters instead of upper case,
clearing the shift modifier to keep the modifiers in sync with the
level */
if (level == VIEW_LETTERS_UPPER) {
level = VIEW_LETTERS_LOWER;
priv->modifiers &= ~EEK_SHIFT_MASK;
}
break;
}
case VIEW_LETTERS_LOWER: /* Direct transitions between views */
case VIEW_NUMBERS:
default:
break;
}
if (level == VIEW_NUMBERS || level == VIEW_SYMBOLS)
priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LOCK;
else
priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_LATCH;
priv->old_level = level;
eek_element_set_level (EEK_ELEMENT(self), level);
eek_layout_update_layout(self);
}
static void
@ -278,74 +305,76 @@ set_modifiers_with_key (EekKeyboard *self,
priv->modifiers = modifiers;
}
static void
eek_keyboard_real_key_pressed (EekKeyboard *self,
EekKey *key)
{
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
EekSymbol *symbol;
EekModifierType modifier;
void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key, guint32 timestamp) {
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(keyboard);
eek_key_set_pressed(key, TRUE);
priv->pressed_keys = g_list_prepend (priv->pressed_keys, key);
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
EekSymbol *symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (!symbol)
return;
modifier = eek_symbol_get_modifier_mask (symbol);
EekModifierType modifier = eek_symbol_get_modifier_mask (symbol);
if (priv->modifier_behavior == EEK_MODIFIER_BEHAVIOR_NONE) {
set_modifiers_with_key (self, key, priv->modifiers | modifier);
set_level_from_modifiers (self);
set_modifiers_with_key (keyboard, key, priv->modifiers | modifier);
set_level_from_modifiers (keyboard, key);
}
// "Borrowed" from eek-context-service; doesn't influence the state but forwards the event
guint keycode = eek_key_get_keycode (key);
EekModifierType modifiers = eek_keyboard_get_modifiers (keyboard);
emit_key_activated(keyboard->manager, keyboard, keycode, symbol, modifiers, TRUE, timestamp);
}
static void
eek_keyboard_real_key_released (EekKeyboard *self,
EekKey *key)
{
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
EekSymbol *symbol;
EekModifierType modifier;
void eek_keyboard_release_key( EekKeyboard *keyboard,
EekKey *key,
guint32 timestamp) {
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(keyboard);
EEK_KEYBOARD_GET_CLASS (self)->key_cancelled (self, key);
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (!symbol)
return;
modifier = eek_symbol_get_modifier_mask (symbol);
switch (priv->modifier_behavior) {
case EEK_MODIFIER_BEHAVIOR_NONE:
set_modifiers_with_key (self, key, priv->modifiers & ~modifier);
break;
case EEK_MODIFIER_BEHAVIOR_LOCK:
priv->modifiers ^= modifier;
break;
case EEK_MODIFIER_BEHAVIOR_LATCH:
if (modifier)
set_modifiers_with_key (self, key, priv->modifiers ^ modifier);
else
set_modifiers_with_key (self, key,
(priv->modifiers ^ modifier) & modifier);
break;
}
set_level_from_modifiers (self);
}
static void
eek_keyboard_real_key_cancelled (EekKeyboard *self,
EekKey *key)
{
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
GList *head;
for (head = priv->pressed_keys; head; head = g_list_next (head)) {
for (GList *head = priv->pressed_keys; head; head = g_list_next (head)) {
if (head->data == key) {
priv->pressed_keys = g_list_remove_link (priv->pressed_keys, head);
g_list_free1 (head);
break;
}
}
EekSymbol *symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (!symbol)
return;
EekModifierType modifier = eek_symbol_get_modifier_mask (symbol);
if (!symbol)
return;
modifier = eek_symbol_get_modifier_mask (symbol);
switch (priv->modifier_behavior) {
case EEK_MODIFIER_BEHAVIOR_NONE:
set_modifiers_with_key (keyboard, key, priv->modifiers & ~modifier);
break;
case EEK_MODIFIER_BEHAVIOR_LOCK:
priv->modifiers ^= modifier;
break;
case EEK_MODIFIER_BEHAVIOR_LATCH:
if (modifier)
set_modifiers_with_key (keyboard, key, priv->modifiers ^ modifier);
else
set_modifiers_with_key (keyboard, key,
(priv->modifiers ^ modifier) & modifier);
break;
}
set_level_from_modifiers (keyboard, key);
// "Borrowed" from eek-context-service; doesn't influence the state but forwards the event
guint keycode = eek_key_get_keycode (key);
guint modifiers = eek_keyboard_get_modifiers (keyboard);
emit_key_activated(keyboard->manager, keyboard, keycode, symbol, modifiers, FALSE, timestamp);
}
static void
@ -365,13 +394,13 @@ static void
eek_keyboard_finalize (GObject *object)
{
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
gint i;
guint i;
g_list_free (priv->pressed_keys);
g_list_free_full (priv->locked_keys,
(GDestroyNotify) eek_modifier_key_free);
g_hash_table_destroy (priv->keycodes);
g_hash_table_destroy (priv->names);
for (i = 0; i < priv->outline_array->len; i++) {
EekOutline *outline = &g_array_index (priv->outline_array,
@ -389,16 +418,10 @@ static void
eek_keyboard_real_child_added (EekContainer *self,
EekElement *element)
{
g_signal_connect (element, "key-pressed",
G_CALLBACK(on_key_pressed), self);
g_signal_connect (element, "key-released",
G_CALLBACK(on_key_released), self);
g_signal_connect (element, "key-locked",
G_CALLBACK(on_key_locked), self);
g_signal_connect (element, "key-unlocked",
G_CALLBACK(on_key_unlocked), self);
g_signal_connect (element, "key-cancelled",
G_CALLBACK(on_key_cancelled), self);
g_signal_connect (element, "symbol-index-changed",
G_CALLBACK(on_symbol_index_changed), self);
}
@ -407,11 +430,8 @@ static void
eek_keyboard_real_child_removed (EekContainer *self,
EekElement *element)
{
g_signal_handlers_disconnect_by_func (element, on_key_pressed, self);
g_signal_handlers_disconnect_by_func (element, on_key_released, self);
g_signal_handlers_disconnect_by_func (element, on_key_locked, self);
g_signal_handlers_disconnect_by_func (element, on_key_unlocked, self);
g_signal_handlers_disconnect_by_func (element, on_key_cancelled, self);
}
static void
@ -421,16 +441,9 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekKeyboardPrivate));
klass->create_section = eek_keyboard_real_create_section;
/* signals */
klass->key_pressed = eek_keyboard_real_key_pressed;
klass->key_released = eek_keyboard_real_key_released;
klass->key_cancelled = eek_keyboard_real_key_cancelled;
container_class->child_added = eek_keyboard_real_child_added;
container_class->child_removed = eek_keyboard_real_child_removed;
@ -468,46 +481,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
PROP_MODIFIER_BEHAVIOR,
pspec);
/**
* EekKeyboard::key-pressed:
* @keyboard: an #EekKeyboard
* @key: an #EekKey
*
* The ::key-pressed signal is emitted each time a key in @keyboard
* is shifted to the pressed state.
*/
signals[KEY_PRESSED] =
g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_pressed),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
/**
* EekKeyboard::key-released:
* @keyboard: an #EekKeyboard
* @key: an #EekKey
*
* The ::key-released signal is emitted each time a key in @keyboard
* is shifted to the released state.
*/
signals[KEY_RELEASED] =
g_signal_new (I_("key-released"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_released),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
/**
* EekKeyboard::key-locked:
* @keyboard: an #EekKeyboard
@ -547,26 +520,6 @@ eek_keyboard_class_init (EekKeyboardClass *klass)
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
/**
* EekKeyboard::key-cancelled:
* @keyboard: an #EekKeyboard
* @key: an #EekKey
*
* The ::key-cancelled signal is emitted each time a key in @keyboard
* is shifted to the cancelled state.
*/
signals[KEY_CANCELLED] =
g_signal_new (I_("key-cancelled"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekKeyboardClass, key_cancelled),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
}
static void
@ -575,8 +528,9 @@ eek_keyboard_init (EekKeyboard *self)
self->priv = EEK_KEYBOARD_GET_PRIVATE(self);
self->priv->modifier_behavior = EEK_MODIFIER_BEHAVIOR_NONE;
self->priv->outline_array = g_array_new (FALSE, TRUE, sizeof (EekOutline));
self->priv->keycodes = g_hash_table_new (g_direct_hash, g_direct_equal);
self->priv->names = g_hash_table_new (g_str_hash, g_str_equal);
eek_element_set_symbol_index (EEK_ELEMENT(self), 0, 0);
self->scale = 1.0;
}
/**
@ -595,20 +549,20 @@ eek_keyboard_create_section (EekKeyboard *keyboard)
}
/**
* eek_keyboard_find_key_by_keycode:
* eek_keyboard_find_key_by_name:
* @keyboard: an #EekKeyboard
* @keycode: a keycode
* @name: a key name
*
* Find an #EekKey whose keycode is @keycode.
* Return value: (transfer none): #EekKey whose keycode is @keycode
* Find an #EekKey whose name is @name.
* Return value: (transfer none): #EekKey whose name is @name
*/
EekKey *
eek_keyboard_find_key_by_keycode (EekKeyboard *keyboard,
guint keycode)
eek_keyboard_find_key_by_name (EekKeyboard *keyboard,
const gchar *name)
{
g_return_val_if_fail (EEK_IS_KEYBOARD(keyboard), NULL);
return g_hash_table_lookup (keyboard->priv->keycodes,
GUINT_TO_POINTER(keycode));
return g_hash_table_lookup (keyboard->priv->names,
name);
}
/**
@ -680,7 +634,7 @@ eek_keyboard_set_modifiers (EekKeyboard *keyboard,
{
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
keyboard->priv->modifiers = modifiers;
set_level_from_modifiers (keyboard);
set_level_from_modifiers (keyboard, NULL);
}
/**

View File

@ -26,6 +26,7 @@
#define EEK_KEYBOARD_H 1
#include <glib-object.h>
#include <xkbcommon/xkbcommon.h>
#include "eek-container.h"
#include "eek-types.h"
#include "eek-layout.h"
@ -45,6 +46,10 @@ typedef struct _EekKeyboardPrivate EekKeyboardPrivate;
/**
* EekKeyboard:
*
* Contains the state of the physical keyboard.
*
* Is also a graphical element...
*
* The #EekKeyboard structure contains only private data and should
* only be accessed using the provided API.
*/
@ -54,13 +59,19 @@ struct _EekKeyboard
EekContainer parent;
EekKeyboardPrivate *priv;
struct xkb_keymap *keymap;
int keymap_fd; // keymap formatted as XKB string
size_t keymap_len; // length of the data inside keymap_fd
double scale;
EekboardContextService *manager; // unowned reference
};
/**
* EekKeyboardClass:
* @create_section: virtual function for creating a section
* @find_key_by_keycode: virtual function for finding a key in the
* keyboard by keycode
* @find_key_by_name: virtual function for finding a key in the
* keyboard by name
* @key_pressed: class handler for #EekKeyboard::key-pressed signal
* @key_released: class handler for #EekKeyboard::key-released signal
* @key_locked: class handler for #EekKeyboard::key-locked signal
@ -79,14 +90,8 @@ struct _EekKeyboardClass
/*< public >*/
EekSection *(* create_section) (EekKeyboard *self);
EekKey *(* find_key_by_keycode) (EekKeyboard *self,
guint keycode);
/* signals */
void (* key_pressed) (EekKeyboard *self,
EekKey *key);
void (* key_released) (EekKeyboard *self,
EekKey *key);
EekKey *(* find_key_by_name) (EekKeyboard *self,
const gchar *name);
/*< private >*/
/* obsolete members moved to EekElement */
@ -98,8 +103,6 @@ struct _EekKeyboardClass
EekKey *key);
void (* key_unlocked) (EekKeyboard *self,
EekKey *key);
void (* key_cancelled) (EekKeyboard *self,
EekKey *key);
/*< private >*/
/* padding */
@ -121,12 +124,13 @@ struct _EekModifierKey {
};
typedef struct _EekModifierKey EekModifierKey;
GType eek_keyboard_get_type
(void) G_GNUC_CONST;
EekKeyboard *eek_keyboard_new (EekLayout *layout,
EekKeyboard *eek_keyboard_new (EekboardContextService *manager,
EekLayout *layout,
gdouble initial_width,
gdouble initial_height);
GType eek_keyboard_get_type
(void) G_GNUC_CONST;
EekLayout *eek_keyboard_get_layout
(EekKeyboard *keyboard);
void eek_keyboard_get_size
@ -152,9 +156,9 @@ EekModifierType eek_keyboard_get_modifiers
EekSection *eek_keyboard_create_section
(EekKeyboard *keyboard);
EekKey *eek_keyboard_find_key_by_keycode
EekKey *eek_keyboard_find_key_by_name
(EekKeyboard *keyboard,
guint keycode);
const gchar *name);
guint eek_keyboard_add_outline
(EekKeyboard *keyboard,
@ -188,5 +192,8 @@ EekModifierKey *eek_modifier_key_copy
void eek_modifier_key_free
(EekModifierKey *modkey);
void eek_keyboard_press_key(EekKeyboard *keyboard, EekKey *key, guint32 timestamp);
void eek_keyboard_release_key(EekKeyboard *keyboard, EekKey *key, guint32 timestamp);
G_END_DECLS
#endif /* EEK_KEYBOARD_H */

View File

@ -23,9 +23,7 @@
* @short_description: an #EekSymbol represents an X keysym
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <string.h>
#include <stdlib.h>
@ -50,9 +48,10 @@
#define EEK_KEYSYM_Hyper_L 0xffed
#define EEK_KEYSYM_Hyper_R 0xffee
struct _EekKeysymPrivate {
typedef struct _EekKeysymPrivate
{
guint xkeysym;
};
} EekKeysymPrivate;
struct _EekKeysymEntry {
guint xkeysym;
@ -68,12 +67,11 @@ typedef struct _EekKeysymEntry EekKeysymEntry;
static void eek_serializable_iface_init (EekSerializableIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekKeysym, eek_keysym, EEK_TYPE_SYMBOL,
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
eek_serializable_iface_init));
#define EEK_KEYSYM_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_KEYSYM, EekKeysymPrivate))
G_DEFINE_TYPE_EXTENDED (EekKeysym, eek_keysym, EEK_TYPE_SYMBOL,
0, /* GTypeFlags */
G_ADD_PRIVATE (EekKeysym)
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
eek_serializable_iface_init))
static EekSerializableIface *eek_keysym_parent_serializable_iface;
@ -81,7 +79,8 @@ static void
eek_keysym_real_serialize (EekSerializable *self,
GVariantBuilder *builder)
{
EekKeysymPrivate *priv = EEK_KEYSYM_GET_PRIVATE(self);
EekKeysymPrivate *priv = eek_keysym_get_instance_private (
EEK_KEYSYM(self));
eek_keysym_parent_serializable_iface->serialize (self, builder);
@ -93,7 +92,8 @@ eek_keysym_real_deserialize (EekSerializable *self,
GVariant *variant,
gsize index)
{
EekKeysymPrivate *priv = EEK_KEYSYM_GET_PRIVATE(self);
EekKeysymPrivate *priv = eek_keysym_get_instance_private (
EEK_KEYSYM(self));
index = eek_keysym_parent_serializable_iface->deserialize (self,
variant,
@ -177,7 +177,7 @@ get_modifier_mask (guint xkeysym)
case EEK_KEYSYM_Shift_Lock:
return EEK_SHIFT_MASK;
case EEK_KEYSYM_ISO_Level3_Shift:
return EEK_MOD5_MASK;
return EEK_BUTTON1_MASK;
case EEK_KEYSYM_Control_L:
case EEK_KEYSYM_Control_R:
return EEK_CONTROL_MASK;
@ -200,15 +200,13 @@ get_modifier_mask (guint xkeysym)
static void
eek_keysym_class_init (EekKeysymClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (gobject_class, sizeof (EekKeysymPrivate));
/* void */
}
static void
eek_keysym_init (EekKeysym *self)
{
self->priv = EEK_KEYSYM_GET_PRIVATE(self);
/* void */
}
/**
@ -291,7 +289,7 @@ eek_keysym_new_with_modifier (guint xkeysym,
g_slice_free (EekKeysymEntry, unichar_entry);
}
priv = EEK_KEYSYM_GET_PRIVATE(keysym);
priv = eek_keysym_get_instance_private (keysym);
priv->xkeysym = xkeysym;
return keysym;
@ -345,6 +343,6 @@ eek_keysym_get_xkeysym (EekKeysym *keysym)
EekKeysymPrivate *priv;
g_assert (EEK_IS_KEYSYM(keysym));
priv = EEK_KEYSYM_GET_PRIVATE(keysym);
priv = eek_keysym_get_instance_private (keysym);
return priv->xkeysym;
}

View File

@ -38,27 +38,7 @@ G_BEGIN_DECLS
#define EEK_INVALID_KEYSYM (0)
#define EEK_TYPE_KEYSYM (eek_keysym_get_type())
#define EEK_KEYSYM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEYSYM, EekKeysym))
#define EEK_KEYSYM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_KEYSYM, EekKeysymClass))
#define EEK_IS_KEYSYM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEYSYM))
#define EEK_IS_KEYSYM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_KEYSYM))
#define EEK_KEYSYM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_KEYSYM, EekKeysymClass))
typedef struct _EekKeysymClass EekKeysymClass;
typedef struct _EekKeysymPrivate EekKeysymPrivate;
/**
* EekKeysym:
*
* The #EekKeysym structure contains only private data and should only
* be accessed using the provided API.
*/
struct _EekKeysym {
/*< private >*/
EekSymbol parent;
EekKeysymPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE (EekKeysym, eek_keysym, EEK, KEYSYM, EekSymbol)
struct _EekKeysymClass {
/*< private >*/

View File

@ -26,14 +26,13 @@
* arranges keyboard elements.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-layout.h"
#include "eek-keyboard.h"
#include "eekboard/eekboard-context-service.h"
G_DEFINE_ABSTRACT_TYPE (EekLayout, eek_layout, G_TYPE_OBJECT);
G_DEFINE_ABSTRACT_TYPE (EekLayout, eek_layout, G_TYPE_OBJECT)
static void
eek_layout_class_init (EekLayoutClass *klass)
@ -55,14 +54,135 @@ eek_layout_init (EekLayout *self)
* Create a new #EekKeyboard based on @layout.
*/
EekKeyboard *
eek_keyboard_new (EekLayout *layout,
eek_keyboard_new (EekboardContextService *manager,
EekLayout *layout,
gdouble initial_width,
gdouble initial_height)
{
g_assert (EEK_IS_LAYOUT(layout));
g_assert (EEK_LAYOUT_GET_CLASS(layout)->create_keyboard);
return EEK_LAYOUT_GET_CLASS(layout)->create_keyboard (layout,
return EEK_LAYOUT_GET_CLASS(layout)->create_keyboard (manager,
layout,
initial_width,
initial_height);
}
const double section_spacing = 7.0;
struct place_data {
double desired_width;
double current_offset;
EekKeyboard *keyboard;
};
static void
section_placer(EekElement *element, gpointer user_data)
{
struct place_data *data = (struct place_data*)user_data;
EekBounds section_bounds = {0};
eek_element_get_bounds(element, &section_bounds);
section_bounds.width = data->desired_width;
eek_element_set_bounds(element, &section_bounds);
// Sections are rows now. Gather up all the keys and adjust their bounds.
eek_section_place_keys(EEK_SECTION(element), EEK_KEYBOARD(data->keyboard));
eek_element_get_bounds(element, &section_bounds);
section_bounds.y = data->current_offset;
eek_element_set_bounds(element, &section_bounds);
data->current_offset += section_bounds.height + section_spacing;
}
static void
section_counter(EekElement *element, gpointer user_data) {
double *total_height = user_data;
EekBounds section_bounds = {0};
eek_element_get_bounds(element, &section_bounds);
*total_height += section_bounds.height + section_spacing;
}
void
eek_layout_place_sections(EekKeyboard *keyboard)
{
/* Order rows */
// This needs to be done after outlines, because outlines define key sizes
// TODO: do this only for rows without bounds
// The keyboard width is given by the user via screen size. The height will be given dynamically.
// TODO: calculate max line width beforehand for button centering. Leave keyboard centering to the renderer later
EekBounds keyboard_bounds = {0};
eek_element_get_bounds(EEK_ELEMENT(keyboard), &keyboard_bounds);
struct place_data placer_data = {
.desired_width = keyboard_bounds.width,
.current_offset = 0,
.keyboard = keyboard,
};
eek_container_foreach_child(EEK_CONTAINER(keyboard), section_placer, &placer_data);
double total_height = 0;
eek_container_foreach_child(EEK_CONTAINER(keyboard), section_counter, &total_height);
keyboard_bounds.height = total_height;
eek_element_set_bounds(EEK_ELEMENT(keyboard), &keyboard_bounds);
}
static void scale_bounds_callback (EekElement *element,
gpointer user_data);
static void
scale_bounds (EekElement *element,
gdouble scale)
{
EekBounds bounds;
eek_element_get_bounds (element, &bounds);
bounds.x *= scale;
bounds.y *= scale;
bounds.width *= scale;
bounds.height *= scale;
eek_element_set_bounds (element, &bounds);
if (EEK_IS_CONTAINER(element))
eek_container_foreach_child (EEK_CONTAINER(element),
scale_bounds_callback,
&scale);
}
static void
scale_bounds_callback (EekElement *element,
gpointer user_data)
{
scale_bounds (element, *(gdouble *)user_data);
}
void
eek_layout_scale_keyboard(EekKeyboard *keyboard, gdouble scale)
{
gsize n_outlines;
scale_bounds (EEK_ELEMENT(keyboard), scale);
n_outlines = eek_keyboard_get_n_outlines (keyboard);
for (guint i = 0; i < n_outlines; i++) {
EekOutline *outline = eek_keyboard_get_outline (keyboard, i);
gint j;
for (j = 0; j < outline->num_points; j++) {
outline->points[j].x *= scale;
outline->points[j].y *= scale;
}
}
keyboard->scale = scale;
}
void
eek_layout_update_layout(EekKeyboard *keyboard)
{
eek_layout_scale_keyboard(keyboard, 1.0 / keyboard->scale);
eek_layout_place_sections(keyboard);
eek_layout_scale_keyboard(keyboard, 1.0 / keyboard->scale);
}

View File

@ -31,20 +31,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_LAYOUT (eek_layout_get_type())
#define EEK_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_LAYOUT, EekLayout))
#define EEK_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_LAYOUT, EekLayoutClass))
#define EEK_IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_LAYOUT))
#define EEK_IS_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_LAYOUT))
#define EEK_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_LAYOUT, EekLayoutClass))
typedef struct _EekLayoutClass EekLayoutClass;
typedef struct _EekLayout EekLayout;
struct _EekLayout
{
/*< private >*/
GObject parent;
};
G_DECLARE_DERIVABLE_TYPE (EekLayout, eek_layout, EEK, LAYOUT, GObject)
/**
* EekLayoutClass:
@ -56,7 +43,8 @@ struct _EekLayoutClass
GObjectClass parent_class;
/*< public >*/
EekKeyboard* (* create_keyboard) (EekLayout *self,
EekKeyboard* (* create_keyboard) (EekboardContextService *manager,
EekLayout *self,
gdouble initial_width,
gdouble initial_height);
@ -67,5 +55,11 @@ struct _EekLayoutClass
GType eek_layout_get_type (void) G_GNUC_CONST;
void eek_layout_place_sections(EekKeyboard *keyboard);
void eek_layout_scale_keyboard(EekKeyboard *keyboard, gdouble scale);
void eek_layout_update_layout(EekKeyboard *keyboard);
G_END_DECLS
#endif /* EEK_LAYOUT_H */

View File

@ -1,29 +1,29 @@
/*
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <math.h>
#include <string.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
#include "eek-key.h"
#include "eek-section.h"
@ -36,12 +36,7 @@ enum {
PROP_LAST
};
G_DEFINE_TYPE (EekRenderer, eek_renderer, G_TYPE_OBJECT);
#define EEK_RENDERER_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_RENDERER, EekRendererPrivate))
struct _EekRendererPrivate
typedef struct _EekRendererPrivate
{
EekKeyboard *keyboard;
PangoContext *pcontext;
@ -53,16 +48,20 @@ struct _EekRendererPrivate
gdouble allocation_width;
gdouble allocation_height;
gdouble scale;
gint scale_factor; /* the outputs scale factor */
PangoFontDescription *ascii_font;
PangoFontDescription *font;
GHashTable *outline_surface_cache;
GHashTable *active_outline_surface_cache;
GHashTable *icons;
cairo_surface_t *keyboard_surface;
gulong symbol_index_changed_handler;
EekTheme *theme;
};
} EekRendererPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EekRenderer, eek_renderer, G_TYPE_OBJECT)
static const EekColor DEFAULT_FOREGROUND_COLOR = {0.3, 0.3, 0.3, 1.0};
static const EekColor DEFAULT_BACKGROUND_COLOR = {1.0, 1.0, 1.0, 1.0};
@ -79,7 +78,7 @@ typedef struct _TextProperty TextProperty;
extern void _eek_rounded_polygon (cairo_t *cr,
gdouble radius,
EekPoint *points,
gint num_points);
guint num_points);
static void eek_renderer_real_render_key_label (EekRenderer *self,
PangoLayout *layout,
@ -106,18 +105,18 @@ create_keyboard_surface_key_callback (EekElement *element,
gpointer user_data)
{
CreateKeyboardSurfaceCallbackData *data = user_data;
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(data->renderer);
EekRendererPrivate *priv = eek_renderer_get_instance_private (data->renderer);
EekBounds bounds;
cairo_save (data->cr);
eek_element_get_bounds (element, &bounds);
cairo_translate (data->cr, bounds.x * priv->scale, bounds.y * priv->scale);
cairo_translate (data->cr, bounds.x * priv->scale, bounds.y * priv->scale);
cairo_rectangle (data->cr,
0.0,
0.0,
bounds.width * priv->scale,
bounds.height * priv->scale);
bounds.width * priv->scale + 100,
bounds.height * priv->scale + 100);
cairo_clip (data->cr);
render_key (data->renderer, data->cr, EEK_KEY(element), FALSE);
@ -129,7 +128,7 @@ create_keyboard_surface_section_callback (EekElement *element,
gpointer user_data)
{
CreateKeyboardSurfaceCallbackData *data = user_data;
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(data->renderer);
EekRendererPrivate *priv = eek_renderer_get_instance_private (data->renderer);
EekBounds bounds;
gint angle;
@ -140,7 +139,7 @@ create_keyboard_surface_section_callback (EekElement *element,
angle = eek_section_get_angle (EEK_SECTION(element));
cairo_rotate (data->cr, angle * G_PI / 180);
eek_container_foreach_child (EEK_CONTAINER(element),
create_keyboard_surface_key_callback,
data);
@ -151,7 +150,7 @@ create_keyboard_surface_section_callback (EekElement *element,
static cairo_surface_t *
create_keyboard_surface (EekRenderer *renderer)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(renderer);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
EekBounds bounds;
cairo_surface_t *keyboard_surface;
CreateKeyboardSurfaceCallbackData data;
@ -165,9 +164,14 @@ create_keyboard_surface (EekRenderer *renderer)
&background);
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard), &bounds);
keyboard_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
bounds.width * priv->scale,
bounds.height * priv->scale);
/* Create a surface that encompasses the dimensions of the keyboard as well
as the margin around the edge. */
keyboard_surface = cairo_image_surface_create (
CAIRO_FORMAT_ARGB32,
ceil(((bounds.x * 2) + bounds.width) * priv->scale),
ceil(((bounds.y * 2) + bounds.height) * priv->scale));
data.cr = cairo_create (keyboard_surface);
data.renderer = renderer;
@ -202,11 +206,9 @@ render_key_outline (EekRenderer *renderer,
EekKey *key,
gboolean active)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(renderer);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
EekOutline *outline;
EekBounds bounds;
gdouble scale;
gint i;
guint oref;
EekThemeNode *theme_node;
EekColor foreground, background, gradient_start, gradient_end, border_color;
@ -218,7 +220,7 @@ render_key_outline (EekRenderer *renderer,
outline = eek_keyboard_get_outline (priv->keyboard, oref);
if (outline == NULL)
return;
theme_node = g_object_get_data (G_OBJECT(key),
active ?
"theme-node-pressed" :
@ -233,14 +235,14 @@ render_key_outline (EekRenderer *renderer,
border_width = eek_theme_node_get_border_width (theme_node,
EEK_SIDE_TOP);
border_radius = eek_theme_node_get_border_radius (theme_node,
EEK_SIDE_TOP);
EEK_CORNER_TOPLEFT);
eek_theme_node_get_border_color (theme_node, EEK_SIDE_TOP,
&border_color);
} else {
foreground = priv->default_foreground_color;
background = priv->default_background_color;
gradient_type = EEK_GRADIENT_NONE;
border_width = priv->border_width;
border_width = (gint)round(priv->border_width);
border_radius = -1;
border_color.red = ABS(background.red - foreground.red) * 0.7;
border_color.green = ABS(background.green - foreground.green) * 0.7;
@ -248,21 +250,17 @@ render_key_outline (EekRenderer *renderer,
border_color.alpha = foreground.alpha;
}
/* need to rescale so that the border fit inside the clipping
region */
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
scale = MIN((bounds.width - border_width * 2) / bounds.width,
(bounds.height - border_width * 2) / bounds.height);
eek_element_get_bounds(EEK_ELEMENT(key), &bounds);
outline = eek_outline_copy (outline);
for (i = 0; i < outline->num_points; i++) {
outline->points[i].x *= priv->scale * scale;
outline->points[i].y *= priv->scale * scale;
for (guint i = 0; i < outline->num_points; i++) {
outline->points[i].x *= priv->scale;
outline->points[i].y *= priv->scale;
}
cairo_translate (cr,
border_width * priv->scale * scale,
border_width * priv->scale * scale);
border_width * priv->scale,
border_width * priv->scale);
if (gradient_type != EEK_GRADIENT_NONE) {
cairo_pattern_t *pat;
@ -340,6 +338,10 @@ render_key_outline (EekRenderer *renderer,
outline->num_points);
cairo_stroke (cr);
cairo_translate (cr,
-border_width * priv->scale,
-border_width * priv->scale);
eek_outline_free (outline);
}
@ -355,7 +357,7 @@ static void
calculate_font_size_key_callback (EekElement *element, gpointer user_data)
{
CalculateFontSizeCallbackData *data = user_data;
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(data->renderer);
EekRendererPrivate *priv = eek_renderer_get_instance_private (data->renderer);
gdouble sx, sy;
PangoFontDescription *font;
PangoRectangle extents = { 0, };
@ -415,7 +417,7 @@ calculate_font_size (EekRenderer *renderer,
const PangoFontDescription *base_font,
gboolean ascii)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(renderer);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
CalculateFontSizeCallbackData data;
data.size = G_MAXDOUBLE;
@ -434,7 +436,7 @@ render_key (EekRenderer *self,
EekKey *key,
gboolean active)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(self);
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
EekOutline *outline;
cairo_surface_t *outline_surface;
EekBounds bounds;
@ -445,6 +447,9 @@ render_key (EekRenderer *self,
PangoRectangle extents = { 0, };
EekColor foreground;
if (!eek_key_has_label(key))
return;
oref = eek_key_get_oref (key);
outline = eek_keyboard_get_outline (priv->keyboard, oref);
if (outline == NULL)
@ -464,10 +469,12 @@ render_key (EekRenderer *self,
if (!outline_surface) {
cairo_t *cr;
// Outline will be drawn on the outside of the button, so the
// surface needs to be bigger than the button
outline_surface =
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
bounds.width,
bounds.height);
(int)ceil(bounds.width) + 10,
(int)ceil(bounds.height) + 10);
cr = cairo_create (outline_surface);
/* blank background */
@ -489,44 +496,38 @@ render_key (EekRenderer *self,
cairo_set_source_surface (cr, outline_surface, 0.0, 0.0);
cairo_paint (cr);
eek_renderer_get_foreground_color (self, EEK_ELEMENT(key), &foreground);
/* render icon (if any) */
symbol = eek_key_get_symbol_with_fallback (key, 0, 0);
if (!symbol)
return;
#define SCALE 0.4
if (eek_symbol_get_icon_name (symbol)) {
gint scale = priv->scale_factor;
cairo_surface_t *icon_surface =
eek_renderer_get_icon_surface (self,
eek_symbol_get_icon_name (symbol),
MIN(bounds.width, bounds.height) * 0.7);
SCALE * MIN(bounds.width, bounds.height),
scale);
if (icon_surface) {
gint width = cairo_image_surface_get_width (icon_surface);
gint height = cairo_image_surface_get_height (icon_surface);
gdouble scale;
if (width < bounds.width && height < bounds.height)
scale = 1;
else {
if (height * bounds.width / width <= bounds.height)
scale = bounds.width / width;
else if (width * bounds.height / height <= bounds.width)
scale = bounds.height / height;
else {
if (width * bounds.height < height * bounds.width)
scale = width / bounds.width;
else
scale = height / bounds.height;
}
}
cairo_save (cr);
cairo_translate (cr,
(bounds.width - width * scale) / 2,
(bounds.height - height * scale) / 2);
(bounds.width - width / scale) / 2,
(bounds.height - height / scale) / 2);
cairo_rectangle (cr, 0, 0, width, height);
cairo_clip (cr);
cairo_set_source_surface (cr, icon_surface, 0.0, 0.0);
cairo_paint (cr);
/* Draw the shape of the icon using the foreground color */
cairo_set_source_rgba (cr, foreground.red,
foreground.green,
foreground.blue,
foreground.alpha);
cairo_mask_surface (cr, icon_surface, 0.0, 0.0);
cairo_fill (cr);
cairo_restore (cr);
return;
}
@ -543,7 +544,6 @@ render_key (EekRenderer *self,
(bounds.width - extents.width / PANGO_SCALE) / 2,
(bounds.height - extents.height / PANGO_SCALE) / 2);
eek_renderer_get_foreground_color (self, EEK_ELEMENT(key), &foreground);
cairo_set_source_rgba (cr,
foreground.red,
foreground.green,
@ -606,7 +606,7 @@ eek_renderer_real_render_key_label (EekRenderer *self,
PangoLayout *layout,
EekKey *key)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(self);
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
EekSymbol *symbol;
EekSymbolCategory category;
const gchar *label;
@ -640,7 +640,7 @@ eek_renderer_real_render_key_label (EekRenderer *self,
size = calculate_font_size (self, base_font, FALSE);
priv->font = pango_font_description_copy (base_font);
pango_font_description_set_size (priv->font, size);
pango_font_description_set_size (priv->font, size * 0.6);
}
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
@ -699,7 +699,7 @@ static void
eek_renderer_real_render_keyboard (EekRenderer *self,
cairo_t *cr)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(self);
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
cairo_pattern_t *source;
g_return_if_fail (priv->keyboard);
@ -721,7 +721,8 @@ eek_renderer_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(object);
EekRendererPrivate *priv = eek_renderer_get_instance_private (
EEK_RENDERER(object));
switch (prop_id) {
case PROP_KEYBOARD:
@ -749,7 +750,8 @@ eek_renderer_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(object);
EekRendererPrivate *priv = eek_renderer_get_instance_private (
EEK_RENDERER(object));
switch (prop_id) {
case PROP_KEYBOARD:
@ -764,7 +766,8 @@ eek_renderer_get_property (GObject *object,
static void
eek_renderer_dispose (GObject *object)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(object);
EekRenderer *self = EEK_RENDERER (object);
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
if (priv->keyboard) {
if (g_signal_handler_is_connected (priv->keyboard,
@ -779,6 +782,8 @@ eek_renderer_dispose (GObject *object)
priv->pcontext = NULL;
}
g_clear_pointer (&priv->icons, g_hash_table_destroy);
/* this will release all allocated surfaces and font if any */
invalidate (EEK_RENDERER(object));
@ -788,7 +793,9 @@ eek_renderer_dispose (GObject *object)
static void
eek_renderer_finalize (GObject *object)
{
EekRendererPrivate *priv = EEK_RENDERER_GET_PRIVATE(object);
EekRenderer *self = EEK_RENDERER(object);
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
g_hash_table_destroy (priv->outline_surface_cache);
g_hash_table_destroy (priv->active_outline_surface_cache);
pango_font_description_free (priv->ascii_font);
@ -802,9 +809,6 @@ eek_renderer_class_init (EekRendererClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class,
sizeof (EekRendererPrivate));
klass->render_key_label = eek_renderer_real_render_key_label;
klass->render_key_outline = eek_renderer_real_render_key_outline;
klass->render_key = eek_renderer_real_render_key;
@ -837,9 +841,8 @@ eek_renderer_class_init (EekRendererClass *klass)
static void
eek_renderer_init (EekRenderer *self)
{
EekRendererPrivate *priv;
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
priv = self->priv = EEK_RENDERER_GET_PRIVATE(self);
priv->keyboard = NULL;
priv->pcontext = NULL;
priv->default_foreground_color = DEFAULT_FOREGROUND_COLOR;
@ -848,6 +851,7 @@ eek_renderer_init (EekRenderer *self)
priv->allocation_width = 0.0;
priv->allocation_height = 0.0;
priv->scale = 1.0;
priv->scale_factor = 1;
priv->font = NULL;
priv->outline_surface_cache =
g_hash_table_new_full (g_direct_hash,
@ -861,20 +865,30 @@ eek_renderer_init (EekRenderer *self)
(GDestroyNotify)cairo_surface_destroy);
priv->keyboard_surface = NULL;
priv->symbol_index_changed_handler = 0;
GtkIconTheme *theme = gtk_icon_theme_get_default ();
gtk_icon_theme_add_resource_path (theme, "/sm/puri/squeekboard/icons");
priv->icons = g_hash_table_new_full (g_str_hash,
g_str_equal,
g_free,
(GDestroyNotify)cairo_surface_destroy);
}
static void
invalidate (EekRenderer *renderer)
{
if (renderer->priv->outline_surface_cache)
g_hash_table_remove_all (renderer->priv->outline_surface_cache);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
if (renderer->priv->active_outline_surface_cache)
g_hash_table_remove_all (renderer->priv->active_outline_surface_cache);
if (priv->outline_surface_cache)
g_hash_table_remove_all (priv->outline_surface_cache);
if (renderer->priv->keyboard_surface) {
cairo_surface_destroy (renderer->priv->keyboard_surface);
renderer->priv->keyboard_surface = NULL;
if (priv->active_outline_surface_cache)
g_hash_table_remove_all (priv->active_outline_surface_cache);
if (priv->keyboard_surface) {
cairo_surface_destroy (priv->keyboard_surface);
priv->keyboard_surface = NULL;
}
}
@ -909,10 +923,12 @@ eek_renderer_set_allocation_size (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
g_return_if_fail (width > 0.0 && height > 0.0);
renderer->priv->allocation_width = width;
renderer->priv->allocation_height = height;
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
eek_element_get_bounds (EEK_ELEMENT(renderer->priv->keyboard), &bounds);
priv->allocation_width = width;
priv->allocation_height = height;
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard), &bounds);
if (bounds.height * width / bounds.width <= height)
scale = width / bounds.width;
@ -925,8 +941,8 @@ eek_renderer_set_allocation_size (EekRenderer *renderer,
scale = bounds.height / height;
}
if (scale != renderer->priv->scale) {
renderer->priv->scale = scale;
if (scale != priv->scale) {
priv->scale = scale;
invalidate (renderer);
}
}
@ -940,11 +956,13 @@ eek_renderer_get_size (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
eek_element_get_bounds (EEK_ELEMENT(renderer->priv->keyboard), &bounds);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard), &bounds);
if (width)
*width = bounds.width * renderer->priv->scale;
*width = bounds.width * priv->scale;
if (height)
*height = bounds.height * renderer->priv->scale;
*height = bounds.height * priv->scale;
}
void
@ -963,20 +981,22 @@ eek_renderer_get_key_bounds (EekRenderer *renderer,
g_return_if_fail (EEK_IS_KEY(key));
g_return_if_fail (bounds != NULL);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
section = eek_element_get_parent (EEK_ELEMENT(key));
eek_element_get_bounds (EEK_ELEMENT(key), bounds);
eek_element_get_bounds (section, &section_bounds);
eek_element_get_bounds (EEK_ELEMENT(renderer->priv->keyboard),
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard),
&keyboard_bounds);
if (!rotate) {
bounds->x += keyboard_bounds.x + section_bounds.x;
bounds->y += keyboard_bounds.y + section_bounds.y;
bounds->x *= renderer->priv->scale;
bounds->y *= renderer->priv->scale;
bounds->width *= renderer->priv->scale;
bounds->height *= renderer->priv->scale;
bounds->x *= priv->scale;
bounds->y *= priv->scale;
bounds->width *= priv->scale;
bounds->height *= priv->scale;
return;
}
points[0].x = bounds->x;
@ -1008,24 +1028,39 @@ eek_renderer_get_key_bounds (EekRenderer *renderer,
bounds->y = keyboard_bounds.y + section_bounds.y + min.y;
bounds->width = (max.x - min.x);
bounds->height = (max.y - min.y);
bounds->x *= renderer->priv->scale;
bounds->y *= renderer->priv->scale;
bounds->width *= renderer->priv->scale;
bounds->height *= renderer->priv->scale;
bounds->x *= priv->scale;
bounds->y *= priv->scale;
bounds->width *= priv->scale;
bounds->height *= priv->scale;
}
gdouble
eek_renderer_get_scale (EekRenderer *renderer)
{
g_return_val_if_fail (EEK_IS_RENDERER(renderer), 0);
return renderer->priv->scale;
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
return priv->scale;
}
void
eek_renderer_set_scale_factor (EekRenderer *renderer, gint scale)
{
g_return_if_fail (EEK_IS_RENDERER(renderer));
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
priv->scale_factor = scale;
}
PangoLayout *
eek_renderer_create_pango_layout (EekRenderer *renderer)
{
g_return_val_if_fail (EEK_IS_RENDERER(renderer), NULL);
return pango_layout_new (renderer->priv->pcontext);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
return pango_layout_new (priv->pcontext);
}
void
@ -1061,16 +1096,35 @@ eek_renderer_render_key_outline (EekRenderer *renderer,
cairo_surface_t *
eek_renderer_get_icon_surface (EekRenderer *renderer,
const gchar *icon_name,
gint size)
gint size,
gint scale)
{
EekRendererClass *klass;
GError *error = NULL;
cairo_surface_t *surface;
g_return_val_if_fail (EEK_IS_RENDERER(renderer), NULL);
klass = EEK_RENDERER_GET_CLASS(renderer);
if (klass->get_icon_surface)
return klass->get_icon_surface (renderer, icon_name, size);
return NULL;
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
surface = g_hash_table_lookup (priv->icons, icon_name);
if (!surface) {
surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
icon_name,
size,
scale,
NULL,
0,
&error);
g_hash_table_insert (priv->icons, g_strdup(icon_name), surface);
if (surface == NULL) {
g_warning ("can't get icon surface for %s: %s",
icon_name,
error->message);
g_error_free (error);
return NULL;
}
}
return surface;
}
void
@ -1103,7 +1157,9 @@ eek_renderer_set_default_foreground_color (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
g_return_if_fail (color);
memcpy (&renderer->priv->default_foreground_color, color, sizeof(EekColor));
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
memcpy (&priv->default_foreground_color, color, sizeof(EekColor));
}
void
@ -1113,7 +1169,9 @@ eek_renderer_set_default_background_color (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
g_return_if_fail (color);
memcpy (&renderer->priv->default_background_color, color, sizeof(EekColor));
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
memcpy (&priv->default_background_color, color, sizeof(EekColor));
}
void
@ -1126,11 +1184,13 @@ eek_renderer_get_foreground_color (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
g_return_if_fail (color);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
theme_node = g_object_get_data (G_OBJECT(element), "theme-node");
if (theme_node)
eek_theme_node_get_foreground_color (theme_node, color);
else
memcpy (color, &renderer->priv->default_foreground_color,
memcpy (color, &priv->default_foreground_color,
sizeof(EekColor));
}
@ -1144,11 +1204,13 @@ eek_renderer_get_background_color (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
g_return_if_fail (color);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
theme_node = g_object_get_data (G_OBJECT(element), "theme-node");
if (theme_node)
eek_theme_node_get_background_color (theme_node, color);
else
memcpy (color, &renderer->priv->default_background_color,
memcpy (color, &priv->default_background_color,
sizeof(EekColor));
}
@ -1211,12 +1273,14 @@ find_key_by_position_key_callback (EekElement *element,
points[3].x = points[0].x;
points[3].y = points[2].y;
EekRendererPrivate *priv = eek_renderer_get_instance_private (data->renderer);
for (i = 0; i < G_N_ELEMENTS(points); i++) {
eek_point_rotate (&points[i], data->angle);
points[i].x += data->origin.x;
points[i].y += data->origin.y;
points[i].x *= data->renderer->priv->scale;
points[i].y *= data->renderer->priv->scale;
points[i].x *= priv->scale;
points[i].y *= priv->scale;
}
b1 = sign (&data->point, &points[0], &points[1]) < 0.0;
@ -1271,12 +1335,14 @@ eek_renderer_find_key_by_position (EekRenderer *renderer,
g_return_val_if_fail (EEK_IS_RENDERER(renderer), NULL);
eek_element_get_bounds (EEK_ELEMENT(renderer->priv->keyboard), &bounds);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
if (x < bounds.x * renderer->priv->scale ||
y < bounds.y * renderer->priv->scale ||
x > bounds.width * renderer->priv->scale ||
y > bounds.height * renderer->priv->scale)
eek_element_get_bounds (EEK_ELEMENT(priv->keyboard), &bounds);
if (x < bounds.x * priv->scale ||
y < bounds.y * priv->scale ||
x > bounds.width * priv->scale ||
y > bounds.height * priv->scale)
return NULL;
data.point.x = x;
@ -1286,7 +1352,7 @@ eek_renderer_find_key_by_position (EekRenderer *renderer,
data.key = NULL;
data.renderer = renderer;
eek_container_find (EEK_CONTAINER(renderer->priv->keyboard),
eek_container_find (EEK_CONTAINER(priv->keyboard),
find_key_by_position_section_callback,
&data);
return data.key;
@ -1306,9 +1372,11 @@ create_theme_node_key_callback (EekElement *element,
CreateThemeNodeData *data = user_data;
EekThemeNode *theme_node;
EekRendererPrivate *priv = eek_renderer_get_instance_private (data->renderer);
theme_node = eek_theme_node_new (data->context,
data->parent,
data->renderer->priv->theme,
priv->theme,
EEK_TYPE_KEY,
eek_element_get_name (element),
"key",
@ -1321,7 +1389,7 @@ create_theme_node_key_callback (EekElement *element,
theme_node = eek_theme_node_new (data->context,
data->parent,
data->renderer->priv->theme,
priv->theme,
EEK_TYPE_KEY,
eek_element_get_name (element),
"key",
@ -1340,9 +1408,11 @@ create_theme_node_section_callback (EekElement *element,
CreateThemeNodeData *data = user_data;
EekThemeNode *theme_node, *parent;
EekRendererPrivate *priv = eek_renderer_get_instance_private (data->renderer);
theme_node = eek_theme_node_new (data->context,
data->parent,
data->renderer->priv->theme,
priv->theme,
EEK_TYPE_SECTION,
eek_element_get_name (element),
"section",
@ -1371,22 +1441,25 @@ eek_renderer_set_theme (EekRenderer *renderer,
g_return_if_fail (EEK_IS_RENDERER(renderer));
g_return_if_fail (EEK_IS_THEME(theme));
g_return_if_fail (renderer->priv->keyboard);
if (renderer->priv->theme)
g_object_unref (renderer->priv->theme);
renderer->priv->theme = g_object_ref (theme);
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
g_return_if_fail (priv->keyboard);
if (priv->theme)
g_object_unref (priv->theme);
priv->theme = g_object_ref (theme);
theme_context = eek_theme_context_new ();
theme_node = eek_theme_node_new (theme_context,
NULL,
renderer->priv->theme,
priv->theme,
EEK_TYPE_KEYBOARD,
"keyboard",
"keyboard",
NULL,
NULL);
g_object_set_data_full (G_OBJECT(renderer->priv->keyboard),
g_object_set_data_full (G_OBJECT(priv->keyboard),
"theme-node",
theme_node,
(GDestroyNotify)g_object_unref);
@ -1394,7 +1467,7 @@ eek_renderer_set_theme (EekRenderer *renderer,
data.context = theme_context;
data.parent = theme_node;
data.renderer = renderer;
eek_container_foreach_child (EEK_CONTAINER(renderer->priv->keyboard),
eek_container_foreach_child (EEK_CONTAINER(priv->keyboard),
create_theme_node_section_callback,
&data);
}

View File

@ -31,21 +31,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_RENDERER (eek_renderer_get_type())
#define EEK_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_RENDERER, EekRenderer))
#define EEK_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_RENDERER, EekRendererClass))
#define EEK_IS_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_RENDERER))
#define EEK_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_RENDERER))
#define EEK_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_RENDERER, EekRendererClass))
typedef struct _EekRenderer EekRenderer;
typedef struct _EekRendererClass EekRendererClass;
typedef struct _EekRendererPrivate EekRendererPrivate;
struct _EekRenderer {
GObject parent;
EekRendererPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE (EekRenderer, eek_renderer, EEK, RENDERER, GObject)
struct _EekRendererClass
{
@ -72,7 +58,8 @@ struct _EekRendererClass
cairo_surface_t *(* get_icon_surface) (EekRenderer *self,
const gchar *icon_name,
gint size);
gint size,
gint scale);
/*< private >*/
/* padding */
@ -95,6 +82,8 @@ void eek_renderer_get_key_bounds (EekRenderer *renderer,
gboolean rotate);
gdouble eek_renderer_get_scale (EekRenderer *renderer);
void eek_renderer_set_scale_factor (EekRenderer *renderer,
gint scale);
PangoLayout *eek_renderer_create_pango_layout
(EekRenderer *renderer);
@ -117,7 +106,8 @@ void eek_renderer_render_key (EekRenderer *renderer,
cairo_surface_t *eek_renderer_get_icon_surface (EekRenderer *renderer,
const gchar *icon_name,
gint size);
gint size,
gint scale);
void eek_renderer_render_keyboard (EekRenderer *renderer,
cairo_t *cr);

View File

@ -1,17 +1,17 @@
/*
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
@ -27,9 +27,7 @@
* of one or more keys of the #EekKeyClass class.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <string.h>
@ -45,21 +43,13 @@ enum {
};
enum {
KEY_PRESSED,
KEY_RELEASED,
KEY_LOCKED,
KEY_UNLOCKED,
KEY_CANCELLED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0, };
G_DEFINE_TYPE (EekSection, eek_section, EEK_TYPE_CONTAINER);
#define EEK_SECTION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SECTION, EekSectionPrivate))
struct _EekRow
{
gint num_columns;
@ -68,17 +58,19 @@ struct _EekRow
typedef struct _EekRow EekRow;
struct _EekSectionPrivate
typedef struct _EekSectionPrivate
{
gint angle;
GSList *rows;
EekModifierType modifiers;
};
} EekSectionPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (EekSection, eek_section, EEK_TYPE_CONTAINER)
static gint
eek_section_real_get_n_rows (EekSection *self)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
return g_slist_length (priv->rows);
}
@ -88,7 +80,7 @@ eek_section_real_add_row (EekSection *self,
gint num_columns,
EekOrientation orientation)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
EekRow *row;
row = g_slice_new (EekRow);
@ -103,7 +95,7 @@ eek_section_real_get_row (EekSection *self,
gint *num_columns,
EekOrientation *orientation)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
EekRow *row;
row = g_slist_nth_data (priv->rows, index);
@ -114,20 +106,6 @@ eek_section_real_get_row (EekSection *self,
*orientation = row->orientation;
}
static void
on_pressed (EekKey *key,
EekSection *section)
{
g_signal_emit (section, signals[KEY_PRESSED], 0, key);
}
static void
on_released (EekKey *key,
EekSection *section)
{
g_signal_emit (section, signals[KEY_RELEASED], 0, key);
}
static void
on_locked (EekKey *key,
EekSection *section)
@ -142,16 +120,10 @@ on_unlocked (EekKey *key,
g_signal_emit (section, signals[KEY_UNLOCKED], 0, key);
}
static void
on_cancelled (EekKey *key,
EekSection *section)
{
g_signal_emit (section, signals[KEY_CANCELLED], 0, key);
}
static EekKey *
eek_section_real_create_key (EekSection *self,
guint keycode,
const gchar *name,
gint keycode,
gint column_index,
gint row_index)
{
@ -162,11 +134,14 @@ eek_section_real_create_key (EekSection *self,
num_rows = eek_section_get_n_rows (self);
g_return_val_if_fail (0 <= row_index && row_index < num_rows, NULL);
row = g_slist_nth_data (self->priv->rows, row_index);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
row = g_slist_nth_data (priv->rows, row_index);
if (row->num_columns < column_index + 1)
row->num_columns = column_index + 1;
key = g_object_new (EEK_TYPE_KEY,
"name", name,
"keycode", keycode,
"column", column_index,
"row", row_index,
@ -182,7 +157,7 @@ eek_section_real_create_key (EekSection *self,
static void
set_level_from_modifiers (EekSection *self)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
EekKeyboard *keyboard;
EekModifierType num_lock_mask;
gint level = -1;
@ -197,7 +172,7 @@ set_level_from_modifiers (EekSection *self)
static void
eek_section_real_key_pressed (EekSection *self, EekKey *key)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
EekSymbol *symbol;
EekKeyboard *keyboard;
EekModifierBehavior behavior;
@ -219,7 +194,7 @@ eek_section_real_key_pressed (EekSection *self, EekKey *key)
static void
eek_section_real_key_released (EekSection *self, EekKey *key)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
EekSymbol *symbol;
EekKeyboard *keyboard;
EekModifierBehavior behavior;
@ -249,7 +224,8 @@ eek_section_real_key_released (EekSection *self, EekKey *key)
static void
eek_section_finalize (GObject *object)
{
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(object);
EekSection *self = EEK_SECTION (object);
EekSectionPrivate *priv = eek_section_get_instance_private (self);
GSList *head;
for (head = priv->rows; head; head = g_slist_next (head))
@ -296,22 +272,16 @@ static void
eek_section_real_child_added (EekContainer *self,
EekElement *element)
{
g_signal_connect (element, "pressed", G_CALLBACK(on_pressed), self);
g_signal_connect (element, "released", G_CALLBACK(on_released), self);
g_signal_connect (element, "locked", G_CALLBACK(on_locked), self);
g_signal_connect (element, "unlocked", G_CALLBACK(on_unlocked), self);
g_signal_connect (element, "cancelled", G_CALLBACK(on_cancelled), self);
}
static void
eek_section_real_child_removed (EekContainer *self,
EekElement *element)
{
g_signal_handlers_disconnect_by_func (element, on_pressed, self);
g_signal_handlers_disconnect_by_func (element, on_released, self);
g_signal_handlers_disconnect_by_func (element, on_locked, self);
g_signal_handlers_disconnect_by_func (element, on_unlocked, self);
g_signal_handlers_disconnect_by_func (element, on_cancelled, self);
}
static void
@ -321,8 +291,6 @@ eek_section_class_init (EekSectionClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekSectionPrivate));
klass->get_n_rows = eek_section_real_get_n_rows;
klass->add_row = eek_section_real_add_row;
klass->get_row = eek_section_real_get_row;
@ -353,46 +321,6 @@ eek_section_class_init (EekSectionClass *klass)
PROP_ANGLE,
pspec);
/**
* EekSection::key-pressed:
* @section: an #EekSection
* @key: an #EekKey
*
* The ::key-pressed signal is emitted each time a key in @section
* is shifted to the pressed state.
*/
signals[KEY_PRESSED] =
g_signal_new (I_("key-pressed"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekSectionClass, key_pressed),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
/**
* EekSection::key-released:
* @section: an #EekSection
* @key: an #EekKey
*
* The ::key-released signal is emitted each time a key in @section
* is shifted to the released state.
*/
signals[KEY_RELEASED] =
g_signal_new (I_("key-released"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekSectionClass, key_released),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
/**
* EekSection::key-locked:
* @section: an #EekSection
@ -432,32 +360,12 @@ eek_section_class_init (EekSectionClass *klass)
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
/**
* EekSection::key-cancelled:
* @section: an #EekSection
* @key: an #EekKey
*
* The ::key-cancelled signal is emitted each time a key in @section
* is shifted to the cancelled state.
*/
signals[KEY_CANCELLED] =
g_signal_new (I_("key-cancelled"),
G_TYPE_FROM_CLASS(gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(EekSectionClass, key_cancelled),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
EEK_TYPE_KEY);
}
static void
eek_section_init (EekSection *self)
{
self->priv = EEK_SECTION_GET_PRIVATE (self);
/* void */
}
/**
@ -472,8 +380,11 @@ eek_section_set_angle (EekSection *section,
gint angle)
{
g_return_if_fail (EEK_IS_SECTION(section));
if (section->priv->angle != angle) {
section->priv->angle = angle;
EekSectionPrivate *priv = eek_section_get_instance_private (section);
if (priv->angle != angle) {
priv->angle = angle;
g_object_notify (G_OBJECT(section), "angle");
}
}
@ -488,7 +399,10 @@ gint
eek_section_get_angle (EekSection *section)
{
g_return_val_if_fail (EEK_IS_SECTION(section), -1);
return section->priv->angle;
EekSectionPrivate *priv = eek_section_get_instance_private (section);
return priv->angle;
}
/**
@ -549,6 +463,7 @@ eek_section_get_row (EekSection *section,
/**
* eek_section_create_key:
* @section: an #EekSection
* @name: a name
* @keycode: a keycode
* @column: the column index of the key
* @row: the row index of the key
@ -559,13 +474,112 @@ eek_section_get_row (EekSection *section,
*/
EekKey *
eek_section_create_key (EekSection *section,
guint keycode,
const gchar *name,
gint keycode,
gint column,
gint row)
{
g_return_val_if_fail (EEK_IS_SECTION(section), NULL);
return EEK_SECTION_GET_CLASS(section)->create_key (section,
name,
keycode,
column,
row);
}
const double keyspacing = 4.0;
struct keys_info {
uint count;
double total_width;
double biggest_height;
};
static void
keysizer(EekElement *element, gpointer user_data)
{
EekKey *key = EEK_KEY(element);
EekKeyboard *keyboard = EEK_KEYBOARD(user_data);
uint oref = eek_key_get_oref (key);
EekOutline *outline = eek_keyboard_get_outline (keyboard, oref);
if (outline && outline->num_points > 0) {
double minx = outline->points[0].x;
double maxx = minx;
double miny = outline->points[0].y;
double maxy = miny;
for (uint i = 1; i < outline->num_points; i++) {
EekPoint p = outline->points[i];
if (p.x < minx) {
minx = p.x;
} else if (p.x > maxx) {
maxx = p.x;
}
if (p.y < miny) {
miny = p.y;
} else if (p.y > maxy) {
maxy = p.y;
}
}
EekBounds key_bounds = {0};
eek_element_get_bounds(element, &key_bounds);
key_bounds.height = maxy - miny;
key_bounds.width = maxx - minx;
eek_element_set_bounds(element, &key_bounds);
}
}
static void
keycounter (EekElement *element, gpointer user_data)
{
EekKey *key = EEK_KEY(element);
/* Skip keys without labels for the current level. */
if (!eek_key_has_label(key))
return;
struct keys_info *data = user_data;
data->count++;
EekBounds key_bounds = {0};
eek_element_get_bounds(element, &key_bounds);
data->total_width += key_bounds.width;
if (key_bounds.height > data->biggest_height) {
data->biggest_height = key_bounds.height;
}
}
static void
keyplacer(EekElement *element, gpointer user_data)
{
EekKey *key = EEK_KEY(element);
/* Skip keys without labels for the current level. */
if (!eek_key_has_label(key))
return;
double *current_offset = user_data;
EekBounds key_bounds = {0};
eek_element_get_bounds(element, &key_bounds);
key_bounds.x = *current_offset;
key_bounds.y = 0;
eek_element_set_bounds(element, &key_bounds);
*current_offset += key_bounds.width + keyspacing;
}
void
eek_section_place_keys(EekSection *section, EekKeyboard *keyboard)
{
eek_container_foreach_child(EEK_CONTAINER(section), keysizer, keyboard);
struct keys_info keyinfo = {0};
eek_container_foreach_child(EEK_CONTAINER(section), keycounter, &keyinfo);
EekBounds section_bounds = {0};
eek_element_get_bounds(EEK_ELEMENT(section), &section_bounds);
double key_offset = (section_bounds.width - (keyinfo.total_width + (keyinfo.count - 1) * keyspacing)) / 2;
eek_container_foreach_child(EEK_CONTAINER(section), keyplacer, &key_offset);
section_bounds.height = keyinfo.biggest_height;
eek_element_set_bounds(EEK_ELEMENT(section), &section_bounds);
}

View File

@ -32,28 +32,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_SECTION (eek_section_get_type())
#define EEK_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SECTION, EekSection))
#define EEK_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_SECTION, EekSectionClass))
#define EEK_IS_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SECTION))
#define EEK_IS_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_SECTION))
#define EEK_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_SECTION, EekSectionClass))
typedef struct _EekSectionClass EekSectionClass;
typedef struct _EekSectionPrivate EekSectionPrivate;
/**
* EekSection:
*
* The #EekSection structure contains only private data and should
* only be accessed using the provided API.
*/
struct _EekSection
{
/*< private >*/
EekContainer parent;
EekSectionPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE(EekSection, eek_section, EEK, SECTION, EekContainer)
/**
* EekSectionClass:
@ -83,7 +62,8 @@ struct _EekSectionClass
EekOrientation *orientation);
EekKey *(* create_key) (EekSection *self,
guint keycode,
const gchar *name,
gint keycode,
gint row,
gint column);
@ -120,12 +100,15 @@ void eek_section_get_row (EekSection *section,
EekOrientation *orientation);
EekKey *eek_section_create_key (EekSection *section,
guint keycode,
const gchar *name,
gint keycode,
gint column,
gint row);
EekKey *eek_section_find_key_by_keycode (EekSection *section,
guint keycode);
void eek_section_place_keys (EekSection *section, EekKeyboard *keyboard);
G_END_DECLS
#endif /* EEK_SECTION_H */

View File

@ -27,9 +27,7 @@
* method.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-serializable.h"

View File

@ -25,9 +25,7 @@
* The #EekSymbolClass class represents a symbol assigned to a key.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-symbol.h"
#include "eek-serializable.h"
@ -44,29 +42,31 @@ enum {
PROP_LAST
};
struct _EekSymbolPrivate {
typedef struct _EekSymbolPrivate
{
gchar *name;
gchar *label;
EekSymbolCategory category;
EekModifierType modifier_mask;
gchar *icon_name;
gchar *tooltip;
};
} EekSymbolPrivate;
static void eek_serializable_iface_init (EekSerializableIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekSymbol, eek_symbol, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
eek_serializable_iface_init));
#define EEK_SYMBOL_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SYMBOL, EekSymbolPrivate))
G_DEFINE_TYPE_EXTENDED (EekSymbol,
eek_symbol,
G_TYPE_OBJECT,
0, /* GTypeFlags */
G_ADD_PRIVATE (EekSymbol)
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
eek_serializable_iface_init))
static void
eek_symbol_real_serialize (EekSerializable *self,
GVariantBuilder *builder)
{
EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(self);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (EEK_SYMBOL (self));
#define NOTNULL(s) ((s) != NULL ? (s) : "")
g_variant_builder_add (builder, "s", NOTNULL(priv->name));
g_variant_builder_add (builder, "s", NOTNULL(priv->label));
@ -82,7 +82,7 @@ eek_symbol_real_deserialize (EekSerializable *self,
GVariant *variant,
gsize index)
{
EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(self);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (EEK_SYMBOL (self));
g_variant_get_child (variant, index++, "s", &priv->name);
g_variant_get_child (variant, index++, "s", &priv->label);
@ -172,7 +172,8 @@ eek_symbol_get_property (GObject *object,
static void
eek_symbol_finalize (GObject *object)
{
EekSymbolPrivate *priv = EEK_SYMBOL_GET_PRIVATE(object);
EekSymbol *self = EEK_SYMBOL (object);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (self);
g_free (priv->name);
g_free (priv->label);
@ -187,8 +188,6 @@ eek_symbol_class_init (EekSymbolClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekSymbolPrivate));
gobject_class->set_property = eek_symbol_set_property;
gobject_class->get_property = eek_symbol_get_property;
gobject_class->finalize = eek_symbol_finalize;
@ -241,9 +240,8 @@ eek_symbol_class_init (EekSymbolClass *klass)
static void
eek_symbol_init (EekSymbol *self)
{
EekSymbolPrivate *priv;
EekSymbolPrivate *priv = eek_symbol_get_instance_private (self);
priv = self->priv = EEK_SYMBOL_GET_PRIVATE(self);
priv->category = EEK_SYMBOL_CATEGORY_UNKNOWN;
}
@ -270,11 +268,10 @@ void
eek_symbol_set_name (EekSymbol *symbol,
const gchar *name)
{
EekSymbolPrivate *priv;
g_return_if_fail (EEK_IS_SYMBOL(symbol));
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
g_free (priv->name);
priv->name = g_strdup (name);
}
@ -288,11 +285,10 @@ eek_symbol_set_name (EekSymbol *symbol,
const gchar *
eek_symbol_get_name (EekSymbol *symbol)
{
EekSymbolPrivate *priv;
g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
if (priv->name == NULL || *priv->name == '\0')
return NULL;
return priv->name;
@ -309,11 +305,10 @@ void
eek_symbol_set_label (EekSymbol *symbol,
const gchar *label)
{
EekSymbolPrivate *priv;
g_return_if_fail (EEK_IS_SYMBOL(symbol));
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
g_free (priv->label);
priv->label = g_strdup (label);
}
@ -327,11 +322,10 @@ eek_symbol_set_label (EekSymbol *symbol,
const gchar *
eek_symbol_get_label (EekSymbol *symbol)
{
EekSymbolPrivate *priv;
g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
if (priv->label == NULL || *priv->label == '\0')
return NULL;
return priv->label;
@ -348,11 +342,10 @@ void
eek_symbol_set_category (EekSymbol *symbol,
EekSymbolCategory category)
{
EekSymbolPrivate *priv;
g_return_if_fail (EEK_IS_SYMBOL(symbol));
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
priv->category = category;
}
@ -365,11 +358,10 @@ eek_symbol_set_category (EekSymbol *symbol,
EekSymbolCategory
eek_symbol_get_category (EekSymbol *symbol)
{
EekSymbolPrivate *priv;
g_return_val_if_fail (EEK_IS_SYMBOL(symbol), EEK_SYMBOL_CATEGORY_UNKNOWN);
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
return priv->category;
}
@ -384,11 +376,10 @@ void
eek_symbol_set_modifier_mask (EekSymbol *symbol,
EekModifierType mask)
{
EekSymbolPrivate *priv;
g_return_if_fail (EEK_IS_SYMBOL(symbol));
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
priv->modifier_mask = mask;
}
@ -401,11 +392,10 @@ eek_symbol_set_modifier_mask (EekSymbol *symbol,
EekModifierType
eek_symbol_get_modifier_mask (EekSymbol *symbol)
{
EekSymbolPrivate *priv;
g_return_val_if_fail (EEK_IS_SYMBOL(symbol), 0);
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
return priv->modifier_mask;
}
@ -433,11 +423,10 @@ void
eek_symbol_set_icon_name (EekSymbol *symbol,
const gchar *icon_name)
{
EekSymbolPrivate *priv;
g_return_if_fail (EEK_IS_SYMBOL(symbol));
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
g_free (priv->icon_name);
priv->icon_name = g_strdup (icon_name);
}
@ -451,11 +440,10 @@ eek_symbol_set_icon_name (EekSymbol *symbol,
const gchar *
eek_symbol_get_icon_name (EekSymbol *symbol)
{
EekSymbolPrivate *priv;
g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
if (priv->icon_name == NULL || *priv->icon_name == '\0')
return NULL;
return priv->icon_name;
@ -472,11 +460,10 @@ void
eek_symbol_set_tooltip (EekSymbol *symbol,
const gchar *tooltip)
{
EekSymbolPrivate *priv;
g_return_if_fail (EEK_IS_SYMBOL(symbol));
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
g_free (priv->tooltip);
priv->tooltip = g_strdup (tooltip);
}
@ -490,11 +477,10 @@ eek_symbol_set_tooltip (EekSymbol *symbol,
const gchar *
eek_symbol_get_tooltip (EekSymbol *symbol)
{
EekSymbolPrivate *priv;
g_return_val_if_fail (EEK_IS_SYMBOL(symbol), NULL);
priv = EEK_SYMBOL_GET_PRIVATE(symbol);
EekSymbolPrivate *priv = eek_symbol_get_instance_private (symbol);
if (priv->tooltip == NULL || *priv->tooltip == '\0')
return NULL;
return priv->tooltip;

View File

@ -59,27 +59,7 @@ typedef enum {
} EekSymbolCategory;
#define EEK_TYPE_SYMBOL (eek_symbol_get_type())
#define EEK_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SYMBOL, EekSymbol))
#define EEK_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_SYMBOL, EekSymbolClass))
#define EEK_IS_SYMBOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SYMBOL))
#define EEK_IS_SYMBOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_SYMBOL))
#define EEK_SYMBOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_SYMBOL, EekSymbolClass))
typedef struct _EekSymbolClass EekSymbolClass;
typedef struct _EekSymbolPrivate EekSymbolPrivate;
/**
* EekSymbol:
*
* The #EekSymbol structure contains only private data and should only
* be accessed using the provided API.
*/
struct _EekSymbol {
/*< private >*/
GObject parent;
EekSymbolPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE(EekSymbol, eek_symbol, EEK, SYMBOL, GObject)
/**
* EekSymbolClass:

View File

@ -23,9 +23,7 @@
* @short_description: an #EekText represents a text symbol
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-text.h"
#include "eek-serializable.h"
@ -36,18 +34,20 @@ enum {
PROP_LAST
};
struct _EekTextPrivate {
typedef struct _EekTextPrivate
{
gchar *text;
};
} EekTextPrivate;
static void eek_serializable_iface_init (EekSerializableIface *iface);
G_DEFINE_TYPE_WITH_CODE (EekText, eek_text, EEK_TYPE_SYMBOL,
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
eek_serializable_iface_init));
#define EEK_TEXT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_TEXT, EekTextPrivate))
G_DEFINE_TYPE_EXTENDED (EekText,
eek_text,
EEK_TYPE_SYMBOL,
0, /* GTypeFlags */
G_ADD_PRIVATE (EekText)
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
eek_serializable_iface_init))
static EekSerializableIface *eek_text_parent_serializable_iface;
@ -55,7 +55,7 @@ static void
eek_text_real_serialize (EekSerializable *self,
GVariantBuilder *builder)
{
EekTextPrivate *priv = EEK_TEXT_GET_PRIVATE(self);
EekTextPrivate *priv = eek_text_get_instance_private (EEK_TEXT (self));
eek_text_parent_serializable_iface->serialize (self, builder);
@ -67,7 +67,7 @@ eek_text_real_deserialize (EekSerializable *self,
GVariant *variant,
gsize index)
{
EekTextPrivate *priv = EEK_TEXT_GET_PRIVATE(self);
EekTextPrivate *priv = eek_text_get_instance_private (EEK_TEXT (self));
index = eek_text_parent_serializable_iface->deserialize (self,
variant,
@ -93,7 +93,9 @@ eek_text_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
EekTextPrivate *priv = EEK_TEXT_GET_PRIVATE(object);
EekText *self = EEK_TEXT (object);
EekTextPrivate *priv = eek_text_get_instance_private (self);
switch (prop_id) {
case PROP_TEXT:
g_free (priv->text);
@ -107,11 +109,13 @@ eek_text_set_property (GObject *object,
static void
eek_text_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekTextPrivate *priv = EEK_TEXT_GET_PRIVATE(object);
EekText *self = EEK_TEXT (object);
EekTextPrivate *priv = eek_text_get_instance_private (self);
switch (prop_id) {
case PROP_TEXT:
g_value_set_string (value, priv->text);
@ -125,7 +129,8 @@ eek_text_get_property (GObject *object,
static void
eek_text_finalize (GObject *object)
{
EekTextPrivate *priv = EEK_TEXT_GET_PRIVATE(object);
EekText *self = EEK_TEXT (object);
EekTextPrivate *priv = eek_text_get_instance_private (self);
g_free (priv->text);
G_OBJECT_CLASS (eek_text_parent_class)->finalize (object);
@ -137,8 +142,6 @@ eek_text_class_init (EekTextClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekTextPrivate));
gobject_class->set_property = eek_text_set_property;
gobject_class->get_property = eek_text_get_property;
gobject_class->finalize = eek_text_finalize;
@ -154,7 +157,7 @@ eek_text_class_init (EekTextClass *klass)
static void
eek_text_init (EekText *self)
{
self->priv = EEK_TEXT_GET_PRIVATE(self);
/* void */
}
EekText *
@ -176,7 +179,7 @@ eek_text_new (const gchar *text)
const gchar *
eek_text_get_text (EekText *text)
{
EekTextPrivate *priv = EEK_TEXT_GET_PRIVATE(text);
EekTextPrivate *priv = eek_text_get_instance_private (text);
return priv->text;
}

View File

@ -30,27 +30,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_TEXT (eek_text_get_type())
#define EEK_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_TEXT, EekText))
#define EEK_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_TEXT, EekTextClass))
#define EEK_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_TEXT))
#define EEK_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_TEXT))
#define EEK_TEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_TEXT, EekTextClass))
typedef struct _EekTextClass EekTextClass;
typedef struct _EekTextPrivate EekTextPrivate;
/**
* EekText:
*
* The #EekText structure contains only private data and should only
* be accessed using the provided API.
*/
struct _EekText {
/*< private >*/
EekSymbol parent;
EekTextPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE(EekText, eek_text, EEK, TEXT, EekSymbol)
struct _EekTextClass {
/*< private >*/

View File

@ -19,9 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include "eek-theme.h"
#include "eek-theme-context.h"

View File

@ -23,9 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <stdlib.h>
#include <string.h>
@ -89,9 +87,6 @@ static void eek_theme_node_finalize (GObject *object);
static const EekColor BLACK_COLOR = { 0, 0, 0, 0xff };
static const EekColor TRANSPARENT_COLOR = { 0, 0, 0, 0 };
static const EekColor DEFAULT_SUCCESS_COLOR = { 0x4e, 0x9a, 0x06, 0xff };
static const EekColor DEFAULT_WARNING_COLOR = { 0xf5, 0x79, 0x3e, 0xff };
static const EekColor DEFAULT_ERROR_COLOR = { 0xcc, 0x00, 0x00, 0xff };
static void
eek_theme_node_init (EekThemeNode *self)

View File

@ -43,6 +43,7 @@
* Copyright (C) 2003-2004 Dodji Seketeli. All Rights Reserved.
*/
#define G_LOG_DOMAIN "eek-theme"
#include <stdlib.h>
#include <string.h>
@ -166,103 +167,65 @@ eek_theme_class_init (EekThemeClass *klass)
}
/* This is a workaround for a bug in libcroco < 0.6.2 where
* function starting with 'r' (and 'u') are misparsed. We work
* around this by exploiting the fact that libcroco is incomformant
* with the CSS-spec and case sensitive and pre-convert all
* occurrences of rgba to RGBA. Then we make our own parsing
* code check for RGBA as well.
*/
#if LIBCROCO_VERSION_NUMBER < 602
static gboolean
is_identifier_character (char c)
{
/* Actual CSS rules allow for unicode > 0x00a1 and escaped
* characters, but we'll assume we won't do that in our stylesheets
* or at least not next to the string 'rgba'.
*/
return g_ascii_isalnum(c) || c == '-' || c == '_';
}
static void
convert_rgba_RGBA (char *buf)
{
char *p;
p = strstr (buf, "rgba");
while (p)
{
/* Check if this looks like a complete token; this is to
* avoiding mangling, say, a selector '.rgba-entry' */
if (!((p > buf && is_identifier_character (*(p - 1))) ||
(is_identifier_character (*(p + 4)))))
memcpy(p, "RGBA", 4);
p += 4;
p = strstr (p, "rgba");
}
}
static CRStyleSheet *
parse_stylesheet (const char *filename,
GError **error)
{
enum CRStatus status;
char *contents;
gsize length;
CRStyleSheet *stylesheet = NULL;
if (filename == NULL)
return NULL;
if (!g_file_get_contents (filename, &contents, &length, error))
return NULL;
convert_rgba_RGBA (contents);
status = cr_om_parser_simply_parse_buf ((const guchar *) contents,
length,
CR_UTF_8,
&stylesheet);
g_free (contents);
if (status != CR_OK)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Error parsing stylesheet '%s'; errcode:%d", filename, status);
return NULL;
}
return stylesheet;
}
CRDeclaration *
_eek_theme_parse_declaration_list (const char *str)
{
char *copy = g_strdup (str);
CRDeclaration *result;
convert_rgba_RGBA (copy);
result = cr_declaration_parse_list_from_buf ((const guchar *)copy,
CR_UTF_8);
g_free (copy);
return result;
}
#else /* LIBCROCO_VERSION_NUMBER >= 602 */
static CRStyleSheet *
parse_stylesheet (const char *filename,
GError **error)
{
enum CRStatus status;
CRStyleSheet *stylesheet;
g_autoptr (GFileInputStream) stream = NULL;
g_autoptr (GFileInfo) info = NULL;
g_autoptr (GFile) file = NULL;
g_autofree guchar* contents = NULL;
goffset size;
gsize out = 0;
GError *err = NULL;
if (filename == NULL)
return NULL;
status = cr_om_parser_simply_parse_file ((const guchar *) filename,
CR_UTF_8,
&stylesheet);
g_debug ("Parsing %s", filename);
if (g_strcmp0 (filename, "resource://") > 0) {
file = g_file_new_for_uri (filename);
stream = g_file_read (file, NULL, &err);
if (!stream) {
g_warning ("Failed to open %s: %s", filename, err->message);
g_clear_error (&err);
return NULL;
}
info = g_file_input_stream_query_info (stream,
G_FILE_ATTRIBUTE_STANDARD_SIZE,
NULL,
&err);
if (!info) {
g_warning ("Failed to stat %s: %s", filename, err->message);
g_clear_error (&err);
return NULL;
}
size = g_file_info_get_size (info);
contents = g_malloc0 (size);
if (!g_input_stream_read_all (G_INPUT_STREAM (stream),
contents,
size,
&out,
NULL,
&err)) {
g_warning ("Failed to read %s: %s", filename, err->message);
g_clear_error (&err);
return NULL;
}
status = cr_om_parser_simply_parse_buf (contents,
size,
CR_UTF_8,
&stylesheet);
} else {
status = cr_om_parser_simply_parse_file ((const guchar *) filename,
CR_UTF_8,
&stylesheet);
}
if (status != CR_OK)
{
@ -280,7 +243,6 @@ _eek_theme_parse_declaration_list (const char *str)
return cr_declaration_parse_list_from_buf ((const guchar *)str,
CR_UTF_8);
}
#endif /* LIBCROCO_VERSION_NUMBER < 602 */
/* Just g_warning for now until we have something nicer to do */
static CRStyleSheet *

View File

@ -24,9 +24,7 @@
* @short_description: Miscellaneous types used in Libeek
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <string.h>
#include <math.h>

View File

@ -150,6 +150,8 @@ typedef struct _EekBounds EekBounds;
typedef struct _EekOutline EekOutline;
typedef struct _EekColor EekColor;
typedef struct _EekboardContextService EekboardContextService;
/**
* EekPoint:
* @x: X coordinate of the point
@ -212,7 +214,7 @@ struct _EekOutline
/*< public >*/
gdouble corner_radius;
EekPoint *points;
gint num_points;
guint num_points;
};
GType eek_outline_get_type (void) G_GNUC_CONST;

View File

@ -1,30 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libeek-xkb
Description: A Library to Create Keyboard-like UI (XKB Support)
URL: http://fedorahosted.org/eekboard/
Version: @VERSION@
Requires: eek-@EEK_API_VERSION@ gtk+-x11-@GTK_API_VERSION@
Libs: -L${libdir} -leek-xkb
Cflags: -I${includedir}/eek-@EEK_API_VERSION@

View File

@ -1,679 +0,0 @@
/*
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
/**
* SECTION:eek-xkb-layout
* @short_description: Layout engine using XKB configuration
*
* The #EekXkbLayout inherits #EekLayout class and arranges keyboard
* elements using XKB.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <X11/keysym.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBgeom.h>
#include <string.h>
#include <stdarg.h>
#include <gio/gio.h>
#include "eek-xkb-layout.h"
#include "eek-keyboard.h"
#include "eek-section.h"
#include "eek-key.h"
#include "eek-keysym.h"
#define XKB_COMPONENT_MASK (XkbGBN_GeometryMask | \
XkbGBN_KeyNamesMask | \
XkbGBN_OtherNamesMask | \
XkbGBN_SymbolsMask | \
XkbGBN_IndicatorMapMask)
static void initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_TYPE_WITH_CODE (EekXkbLayout, eek_xkb_layout, EEK_TYPE_LAYOUT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init));
#define EEK_XKB_LAYOUT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
enum {
PROP_0,
PROP_DISPLAY,
PROP_LAST
};
struct _EekXkbLayoutPrivate
{
/* Configuration names that should synch'ed to the symbolic names
in priv->xkb->names. Since we use GLib's memory allocator,
don't store any address returned from the X server here. */
XkbComponentNamesRec names;
Display *display;
/* Actual XKB configuration of DISPLAY. */
XkbDescRec *xkb;
/* Hash table to cache orefs by shape address. */
GHashTable *shape_oref_hash;
gint scale_numerator;
gint scale_denominator;
};
static guint find_keycode (EekXkbLayout *layout,
gchar *key_name);
static gboolean get_keyboard_from_server (EekXkbLayout *layout,
GError **error);
static gboolean get_names_from_server (EekXkbLayout *layout,
GError **error);
static void setup_scaling (EekXkbLayout *layout,
gdouble width,
gdouble height);
G_INLINE_FUNC gint
xkb_to_pixmap_coord (EekXkbLayout *layout,
gint n)
{
EekXkbLayoutPrivate *priv = layout->priv;
return n * priv->scale_numerator / priv->scale_denominator;
}
G_INLINE_FUNC gdouble
xkb_to_pixmap_double (EekXkbLayout *layout,
gdouble d)
{
EekXkbLayoutPrivate *priv = layout->priv;
return d * priv->scale_numerator / priv->scale_denominator;
}
static void
create_key (EekXkbLayout *layout,
EekKeyboard *keyboard,
EekSection *section,
gint column,
gint row,
gdouble x,
gdouble y,
XkbKeyRec *xkbkey)
{
XkbGeometryRec *xkbgeometry;
XkbBoundsRec *xkbbounds;
XkbShapeRec *xkbshape;
XkbOutlineRec *xkboutline;
EekXkbLayoutPrivate *priv = layout->priv;
EekKey *key;
EekBounds bounds;
EekSymbolMatrix *matrix = NULL;
gchar name[XkbKeyNameLength + 1];
KeyCode keycode;
gint num_groups, num_levels;
guint oref;
gpointer v;
xkbgeometry = priv->xkb->geom;
xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
if (g_hash_table_lookup_extended (priv->shape_oref_hash, xkbshape,
NULL, &v)) {
oref = GPOINTER_TO_UINT(v);
} else {
EekOutline *outline;
xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
xkbshape->primary;
outline = g_slice_new (EekOutline);
outline->corner_radius = xkb_to_pixmap_coord(layout,
xkboutline->corner_radius);
if (xkboutline->num_points <= 2) { /* rectangular */
gdouble x1, y1, x2, y2;
outline->num_points = 4;
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
outline->num_points);
if (xkboutline->num_points == 1) {
x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
} else {
x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
}
outline->points[0].x = outline->points[3].x = x1;
outline->points[0].y = outline->points[1].y = y1;
outline->points[1].x = outline->points[2].x = x2;
outline->points[2].y = outline->points[3].y = y2;
} else { /* polygon */
gint i;
outline->num_points = xkboutline->num_points;
outline->points = g_new0 (EekPoint, outline->num_points);
for (i = 0; i < xkboutline->num_points; i++) {
outline->points[i].x =
xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
outline->points[i].y =
xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
}
}
oref = eek_keyboard_add_outline (keyboard, outline);
eek_outline_free (outline);
g_hash_table_insert (priv->shape_oref_hash, xkbshape,
GUINT_TO_POINTER(oref));
}
memset (name, 0, sizeof name);
memcpy (name, xkbkey->name.name, sizeof name - 1);
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
bounds.width = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
bounds.height = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
keycode = find_keycode (layout, name);
if (keycode == EEK_INVALID_KEYCODE) {
num_groups = num_levels = 0;
matrix = eek_symbol_matrix_new (0, 0);
} else {
KeySym keysym;
gint i, j;
num_groups = XkbKeyNumGroups (priv->xkb, keycode);
num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
matrix = eek_symbol_matrix_new (num_groups, num_levels);
for (i = 0; i < num_groups; i++)
for (j = 0; j < num_levels; j++) {
EekModifierType modifier;
keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
modifier = XkbKeysymToModifiers (priv->display, keysym);
matrix->data[i * num_levels + j] =
EEK_SYMBOL(eek_keysym_new_with_modifier (keysym,
modifier));
}
}
key = eek_section_create_key (section, keycode, column, row);
eek_element_set_name (EEK_ELEMENT(key), name);
eek_element_set_bounds (EEK_ELEMENT(key), &bounds);
eek_key_set_symbol_matrix (key, matrix);
eek_symbol_matrix_free (matrix);
eek_key_set_oref (key, oref);
}
static void
create_section (EekXkbLayout *layout,
EekKeyboard *keyboard,
XkbSectionRec *xkbsection)
{
XkbGeometryRec *xkbgeometry;
EekXkbLayoutPrivate *priv;
EekSection *section;
EekBounds bounds;
gchar *name;
gfloat left, top;
gint i, j;
bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
bounds.width = xkb_to_pixmap_coord(layout, xkbsection->width);
bounds.height = xkb_to_pixmap_coord(layout, xkbsection->height);
priv = layout->priv;
xkbgeometry = priv->xkb->geom;
section = eek_keyboard_create_section (keyboard);
name = XGetAtomName (priv->display, xkbsection->name);
eek_element_set_name (EEK_ELEMENT(section), name);
XFree (name);
eek_element_set_bounds (EEK_ELEMENT(section), &bounds);
eek_section_set_angle (section,
/* angle is in tenth of degree */
xkbsection->angle / 10);
for (i = 0; i < xkbsection->num_rows; i++) {
XkbRowRec *xkbrow;
xkbrow = &xkbsection->rows[i];
left = xkbrow->left;
top = xkbrow->top;
eek_section_add_row (section,
xkbrow->num_keys,
xkbrow->vertical ?
EEK_ORIENTATION_VERTICAL :
EEK_ORIENTATION_HORIZONTAL);
for (j = 0; j < xkbrow->num_keys; j++) {
XkbKeyRec *xkbkey;
XkbBoundsRec *xkbbounds;
xkbkey = &xkbrow->keys[j];
if (xkbrow->vertical)
top += xkbkey->gap;
else
left += xkbkey->gap;
create_key (layout, keyboard, section, j, i, left, top, xkbkey);
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
if (xkbrow->vertical)
top += xkbbounds->y2 - xkbbounds->y1;
else
left += xkbbounds->x2 - xkbbounds->x1;
}
}
}
static void
create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
{
EekXkbLayoutPrivate *priv = layout->priv;
XkbGeometryRec *xkbgeometry;
EekBounds bounds;
gint i;
g_return_if_fail (priv->xkb);
g_return_if_fail (priv->xkb->geom);
xkbgeometry = priv->xkb->geom;
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
setup_scaling (EEK_XKB_LAYOUT(layout), bounds.width, bounds.height);
bounds.x = bounds.y = 0;
bounds.width = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
bounds.height = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
for (i = 0; i < xkbgeometry->num_sections; i++) {
XkbSectionRec *xkbsection;
xkbsection = &xkbgeometry->sections[i];
create_section (layout, keyboard, xkbsection);
}
eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
}
static EekKeyboard *
eek_xkb_layout_real_create_keyboard (EekLayout *self,
gdouble initial_width,
gdouble initial_height)
{
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
EekBounds bounds;
EekKeyboard *keyboard;
keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", self, NULL);
bounds.x = bounds.y = 0.0;
bounds.width = initial_width;
bounds.height = initial_height;
eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
/* resolve modifiers dynamically assigned at run time */
eek_keyboard_set_num_lock_mask (keyboard,
XkbKeysymToModifiers (priv->display,
XK_Num_Lock));
eek_keyboard_set_alt_gr_mask (keyboard,
XkbKeysymToModifiers (priv->display,
XK_ISO_Level3_Shift));
if (priv->shape_oref_hash)
g_hash_table_destroy (priv->shape_oref_hash);
priv->shape_oref_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
create_keyboard (EEK_XKB_LAYOUT(self), keyboard);
g_hash_table_destroy (priv->shape_oref_hash);
return keyboard;
}
static void
eek_xkb_layout_finalize (GObject *object)
{
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
g_free (priv->names.keycodes);
g_free (priv->names.geometry);
g_free (priv->names.symbols);
XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
}
static void
eek_xkb_layout_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
switch (prop_id) {
case PROP_DISPLAY:
layout->priv->display = g_value_get_pointer (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_xkb_layout_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekXkbLayout *layout = EEK_XKB_LAYOUT (object);
switch (prop_id) {
case PROP_DISPLAY:
g_value_set_pointer (value, layout->priv->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
{
EekLayoutClass *layout_class = EEK_LAYOUT_CLASS (klass);
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
layout_class->create_keyboard = eek_xkb_layout_real_create_keyboard;
gobject_class->finalize = eek_xkb_layout_finalize;
gobject_class->set_property = eek_xkb_layout_set_property;
gobject_class->get_property = eek_xkb_layout_get_property;
pspec = g_param_spec_pointer ("display",
"Display",
"X Display",
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (gobject_class, PROP_DISPLAY, pspec);
}
static void
eek_xkb_layout_init (EekXkbLayout *self)
{
self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
}
static gboolean
get_names_from_server (EekXkbLayout *layout,
GError **error)
{
EekXkbLayoutPrivate *priv = layout->priv;
gchar *name;
XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
if (priv->xkb->names->keycodes <= 0)
g_warning ("XKB keycodes setting is not loaded properly");
else {
name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
if (!name)
g_warning ("Can't get the name of keycodes");
else if (!priv->names.keycodes ||
g_strcmp0 (name, priv->names.keycodes)) {
g_free (priv->names.keycodes);
priv->names.keycodes = g_strdup (name);
XFree (name);
}
}
if (priv->xkb->names->geometry <= 0)
g_warning ("XKB geometry setting is not loaded");
else {
name = XGetAtomName (priv->display, priv->xkb->names->geometry);
if (!name)
g_warning ("Can't get the name of geometry");
else if (!priv->names.geometry ||
g_strcmp0 (name, priv->names.geometry)) {
g_free (priv->names.geometry);
priv->names.geometry = g_strdup (name);
XFree (name);
}
}
if (priv->xkb->names->symbols <= 0)
g_warning ("XKB symbols setting is not loaded");
else {
name = XGetAtomName (priv->display, priv->xkb->names->symbols);
if (!name)
g_warning ("Can't get the name of symbols");
else if (!priv->names.symbols ||
g_strcmp0 (name, priv->names.symbols)) {
g_free (priv->names.symbols);
priv->names.symbols = g_strdup (name);
XFree (name);
}
}
return TRUE;
}
/**
* eek_xkb_layout_new:
*
* Create a new #EekXkbLayout.
*/
EekLayout *
eek_xkb_layout_new (Display *display,
GError **error)
{
return (EekLayout *) g_initable_new (EEK_TYPE_XKB_LAYOUT,
NULL,
error,
"display", display,
NULL);
}
/**
* eek_xkb_layout_set_names: (skip)
* @layout: an #EekXkbLayout
* @names: XKB component names
* @error: a #GError
*
* Set the XKB component names to @layout.
* Returns: %TRUE if the component names are successfully set, %FALSE otherwise
*/
gboolean
eek_xkb_layout_set_names (EekXkbLayout *layout,
XkbComponentNamesRec *names,
GError **error)
{
if (g_strcmp0 (names->keycodes, layout->priv->names.keycodes)) {
g_free (layout->priv->names.keycodes);
layout->priv->names.keycodes = g_strdup (names->keycodes);
}
if (g_strcmp0 (names->geometry, layout->priv->names.geometry)) {
g_free (layout->priv->names.geometry);
layout->priv->names.geometry = g_strdup (names->geometry);
}
if (g_strcmp0 (names->symbols, layout->priv->names.symbols)) {
g_free (layout->priv->names.symbols);
layout->priv->names.symbols = g_strdup (names->symbols);
}
return get_keyboard_from_server (layout, error);
}
static gboolean
get_keyboard_from_server (EekXkbLayout *layout,
GError **error)
{
EekXkbLayoutPrivate *priv = layout->priv;
if (priv->xkb) {
XkbFreeKeyboard (priv->xkb, 0, True);
priv->xkb = NULL;
}
if (priv->names.keycodes && priv->names.geometry && priv->names.symbols) {
priv->xkb = XkbGetKeyboardByName (priv->display,
XkbUseCoreKbd,
&priv->names,
0,
XKB_COMPONENT_MASK,
False);
} else {
priv->xkb = XkbGetKeyboard (priv->display,
XKB_COMPONENT_MASK,
XkbUseCoreKbd);
if (!get_names_from_server (layout, error)) {
XkbFreeKeyboard (priv->xkb, 0, True);
priv->xkb = NULL;
}
}
if (priv->xkb == NULL) {
g_set_error (error,
EEK_ERROR,
EEK_ERROR_LAYOUT_ERROR,
"can't get keyboard from server");
g_free (priv->names.keycodes);
priv->names.keycodes = NULL;
g_free (priv->names.geometry);
priv->names.geometry = NULL;
g_free (priv->names.symbols);
priv->names.symbols = NULL;
return FALSE;
}
return TRUE;
}
static guint
find_keycode (EekXkbLayout *layout, gchar *key_name)
{
#define KEYSYM_NAME_MAX_LENGTH 4
guint keycode;
gint i, j;
XkbKeyNamePtr pkey;
XkbKeyAliasPtr palias;
guint is_name_matched;
gchar *src, *dst;
EekXkbLayoutPrivate *priv = layout->priv;
if (!priv->xkb)
return EEK_INVALID_KEYCODE;
pkey = priv->xkb->names->keys + priv->xkb->min_key_code;
for (keycode = priv->xkb->min_key_code;
keycode <= priv->xkb->max_key_code; keycode++) {
is_name_matched = 1;
src = key_name;
dst = pkey->name;
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
if ('\0' == *src)
break;
if (*src++ != *dst++) {
is_name_matched = 0;
break;
}
}
if (is_name_matched)
return keycode;
pkey++;
}
palias = priv->xkb->names->key_aliases;
for (j = priv->xkb->names->num_key_aliases; --j >= 0;) {
is_name_matched = 1;
src = key_name;
dst = palias->alias;
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
if ('\0' == *src)
break;
if (*src++ != *dst++) {
is_name_matched = 0;
break;
}
}
if (is_name_matched) {
keycode = find_keycode (layout, palias->real);
return keycode;
}
palias++;
}
return EEK_INVALID_KEYCODE;
}
static void
setup_scaling (EekXkbLayout *layout,
gdouble width,
gdouble height)
{
EekXkbLayoutPrivate *priv = layout->priv;
g_return_if_fail (priv->xkb);
g_return_if_fail (priv->xkb->geom->width_mm > 0);
g_return_if_fail (priv->xkb->geom->height_mm > 0);
if (width * priv->xkb->geom->height_mm <
height * priv->xkb->geom->width_mm) {
priv->scale_numerator = width;
priv->scale_denominator = priv->xkb->geom->width_mm;
} else {
priv->scale_numerator = height;
priv->scale_denominator = priv->xkb->geom->height_mm;
}
}
static gboolean
initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
EekXkbLayout *layout = EEK_XKB_LAYOUT (initable);
if (!get_keyboard_from_server (layout, error))
return FALSE;
if (!get_names_from_server (layout, error))
return FALSE;
return TRUE;
}
static void
initable_iface_init (GInitableIface *initable_iface)
{
initable_iface->init = initable_init;
}

View File

@ -1,72 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
#error "Only <eek/eek-xkb.h> can be included directly."
#endif
#ifndef EEK_XKB_LAYOUT_H
#define EEK_XKB_LAYOUT_H 1
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include "eek-layout.h"
G_BEGIN_DECLS
#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
typedef struct _EekXkbLayout EekXkbLayout;
typedef struct _EekXkbLayoutClass EekXkbLayoutClass;
typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
struct _EekXkbLayout
{
/*< private >*/
EekLayout parent;
EekXkbLayoutPrivate *priv;
};
struct _EekXkbLayoutClass
{
/*< private >*/
EekLayoutClass parent_class;
/*< private >*/
/* padding */
gpointer pdummy[24];
};
GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
EekLayout *eek_xkb_layout_new (Display *display,
GError **error);
gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
XkbComponentNamesRec *names,
GError **error);
G_END_DECLS
#endif /* #ifndef EEK_XKB_LAYOUT_H */

View File

@ -1,26 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef EEK_XKB_H
#define EEK_XKB_H 1
#include "eek.h"
#include "eek-xkb-layout.h"
#endif /* EEK_XKB_H */

View File

@ -1,30 +0,0 @@
# Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
# Copyright (C) 2010-2011 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libeek-xkl
Description: A Library to Create Keyboard-like UI (Libxklavier Support)
URL: http://fedorahosted.org/eekboard/
Version: @VERSION@
Requires: eek-@EEK_API_VERSION@ libxklavier
Libs: -L${libdir} -leek-xkl
Cflags: -I${includedir}/eek-@EEK_API_VERSION@

View File

@ -1,663 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
/**
* SECTION:eek-xkl-layout
* @short_description: Layout engine using Libxklavier configuration
*
* The #EekXklLayout is a simple wrapper around #EekXkbLayout class
* to use Libxklavier configuration.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <libxklavier/xklavier.h>
#include <gio/gio.h>
#include <string.h>
#include "eek-xkl-layout.h"
#define noKBDRAW_DEBUG
static GInitableIface *parent_initable_iface;
static void initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_TYPE_WITH_CODE (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init));
#define EEK_XKL_LAYOUT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutPrivate))
enum {
PROP_0,
PROP_MODEL,
PROP_LAYOUTS,
PROP_VARIANTS,
PROP_OPTIONS,
PROP_LAST
};
struct _EekXklLayoutPrivate
{
XklEngine *engine;
XklConfigRec *config;
};
/* from gnome-keyboard-properties-xkbpv.c:
* BAD STYLE: Taken from xklavier_private_xkb.h
* Any ideas on architectural improvements are WELCOME
*/
extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine,
const XklConfigRec * data,
XkbComponentNamesPtr
component_names);
extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
XkbComponentNamesPtr
component_names);
static gboolean set_xkb_component_names (EekXklLayout *layout,
XklConfigRec *config);
static void
eek_xkl_layout_dispose (GObject *object)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (object);
if (priv->config) {
g_object_unref (priv->config);
priv->config = NULL;
}
G_OBJECT_CLASS (eek_xkl_layout_parent_class)->dispose (object);
}
static void
eek_xkl_layout_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
EekXklLayout *layout = EEK_XKL_LAYOUT(object);
switch (prop_id) {
case PROP_MODEL:
eek_xkl_layout_set_model (layout, g_value_get_string (value));
break;
case PROP_LAYOUTS:
eek_xkl_layout_set_layouts (layout, g_value_get_boxed (value));
break;
case PROP_VARIANTS:
eek_xkl_layout_set_variants (layout, g_value_get_boxed (value));
break;
case PROP_OPTIONS:
eek_xkl_layout_set_options (layout, g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_xkl_layout_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
EekXklLayout *layout = EEK_XKL_LAYOUT(object);
switch (prop_id) {
case PROP_MODEL:
g_value_set_string (value,
eek_xkl_layout_get_model (layout));
break;
case PROP_LAYOUTS:
g_value_set_boxed (value,
eek_xkl_layout_get_layouts (layout));
break;
case PROP_VARIANTS:
g_value_set_boxed (value,
eek_xkl_layout_get_variants (layout));
break;
case PROP_OPTIONS:
g_value_set_boxed (value,
eek_xkl_layout_get_options (layout));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
eek_xkl_layout_class_init (EekXklLayoutClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekXklLayoutPrivate));
gobject_class->dispose = eek_xkl_layout_dispose;
gobject_class->set_property = eek_xkl_layout_set_property;
gobject_class->get_property = eek_xkl_layout_get_property;
/**
* EekXklLayout:model:
*
* The libxklavier model name of #EekXklLayout.
*/
pspec = g_param_spec_string ("model",
"Model",
"Libxklavier model",
NULL,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_MODEL, pspec);
/**
* EekXklLayout:layouts:
*
* The libxklavier layout names of #EekXklLayout.
*/
pspec = g_param_spec_boxed ("layouts",
"Layouts",
"Libxklavier layouts",
G_TYPE_STRV,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_LAYOUTS, pspec);
/**
* EekXklLayout:variants:
*
* The libxklavier variant names of #EekXklLayout.
*/
pspec = g_param_spec_boxed ("variants",
"Variants",
"Libxklavier variants",
G_TYPE_STRV,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_VARIANTS, pspec);
/**
* EekXklLayout:options:
*
* The libxklavier option names of #EekXklLayout.
*/
pspec = g_param_spec_boxed ("options",
"Options",
"Libxklavier options",
G_TYPE_STRV,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class, PROP_OPTIONS, pspec);
}
static void
eek_xkl_layout_init (EekXklLayout *self)
{
self->priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
}
/**
* eek_xkl_layout_new:
*
* Create a new #EekXklLayout.
*/
EekLayout *
eek_xkl_layout_new (Display *display, GError **error)
{
return (EekLayout *) g_initable_new (EEK_TYPE_XKL_LAYOUT,
NULL,
error,
"display", display,
NULL);
}
G_INLINE_FUNC void
merge_xkl_config_rec (XklConfigRec *dst, XklConfigRec *src)
{
if (src->model) {
g_free (dst->model);
dst->model = g_strdup (src->model);
}
if (src->layouts) {
g_strfreev (dst->layouts);
dst->layouts = g_strdupv (src->layouts);
}
if (src->variants) {
g_strfreev (dst->variants);
dst->variants = g_strdupv (src->variants);
}
if (src->options) {
g_strfreev (dst->options);
dst->options = g_strdupv (src->options);
}
}
/**
* eek_xkl_layout_set_config: (skip)
* @layout: an #EekXklLayout
* @config: Libxklavier configuration
*
* Reconfigure @layout with @config.
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_set_config (EekXklLayout *layout,
XklConfigRec *config)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
XklConfigRec *c;
gboolean retval;
g_return_val_if_fail (priv, FALSE);
c = xkl_config_rec_new ();
merge_xkl_config_rec (c, priv->config);
merge_xkl_config_rec (c, config);
retval = set_xkb_component_names (layout, c);
g_object_unref (c);
merge_xkl_config_rec (priv->config, config);
return retval;
}
/**
* eek_xkl_layout_set_config_full:
* @layout: an #EekXklLayout
* @model: Libxklavier model name
* @layouts: Libxklavier layouts
* @variants: Libxklavier variants
* @options: Libxklavier options
*
* Reconfigure @layout with @model, @layouts, @variants, and @options.
* This function is merely a wrapper around
* eek_xkl_layout_set_config() to avoid passing a pointer of
* XklConfigRec, which is not currently available in the
* gobject-introspection repository.
*
* Returns: %TRUE if the current layout changed, %FALSE otherwise
* Since: 0.0.2
*/
gboolean
eek_xkl_layout_set_config_full (EekXklLayout *layout,
gchar *model,
gchar **layouts,
gchar **variants,
gchar **options)
{
XklConfigRec *config;
gboolean retval;
config = xkl_config_rec_new ();
config->model = g_strdup (model);
config->layouts = g_strdupv (layouts);
config->variants = g_strdupv (variants);
config->options = g_strdupv (options);
retval = eek_xkl_layout_set_config (layout, config);
g_object_unref (config);
return retval;
}
/**
* eek_xkl_layout_set_model:
* @layout: an #EekXklLayout
* @model: model name
*
* Set the model name of @layout configuration (in the Libxklavier terminology).
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_set_model (EekXklLayout *layout,
const gchar *model)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
XklConfigRec *config;
gboolean retval;
g_return_val_if_fail (priv, FALSE);
config = xkl_config_rec_new ();
/* config->model will be freed on g_object_unref (config) */
if (model)
config->model = g_strdup (model);
else
config->model = NULL;
retval = eek_xkl_layout_set_config (layout, config);
g_object_unref (config);
return retval;
}
/**
* eek_xkl_layout_set_layouts:
* @layout: an #EekXklLayout
* @layouts: layout names
*
* Set the layout names of @layout (in the Libxklavier terminology).
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_set_layouts (EekXklLayout *layout,
gchar **layouts)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
XklConfigRec *config;
gboolean retval;
g_return_val_if_fail (priv, FALSE);
config = xkl_config_rec_new ();
/* config->layouts will be freed on g_object_unref (config) */
if (layouts)
config->layouts = g_strdupv (layouts);
else
config->layouts = layouts;
retval = eek_xkl_layout_set_config (layout, config);
g_object_unref (config);
return retval;
}
/**
* eek_xkl_layout_set_variants:
* @layout: an #EekXklLayout
* @variants: variant names
*
* Set the variant names of @layout (in the Libxklavier terminology).
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_set_variants (EekXklLayout *layout,
gchar **variants)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
XklConfigRec *config;
gboolean retval;
g_return_val_if_fail (priv, FALSE);
config = xkl_config_rec_new ();
/* config->variants will be freed on g_object_unref (config) */
if (variants)
config->variants = g_strdupv (variants);
else
config->variants = NULL;
retval = eek_xkl_layout_set_config (layout, config);
g_object_unref (config);
return retval;
}
/**
* eek_xkl_layout_set_options:
* @layout: an #EekXklLayout
* @options: option names
*
* Set the option names of @layout (in the Libxklavier terminology).
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_set_options (EekXklLayout *layout,
gchar **options)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
XklConfigRec *config;
gboolean retval;
g_return_val_if_fail (priv, FALSE);
config = xkl_config_rec_new ();
/* config->options will be freed on g_object_unref (config) */
if (options)
config->options = options;
else
config->options = NULL;
retval = eek_xkl_layout_set_config (layout, config);
g_object_unref (config);
return retval;
}
/**
* eek_xkl_layout_enable_option:
* @layout: an #EekXklLayout
* @option: option name
*
* Set the option of @layout (in the Libxklavier terminology).
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_enable_option (EekXklLayout *layout,
const gchar *option)
{
gchar **options, **_options;
gint i, j;
options = eek_xkl_layout_get_options (layout);
for (i = 0; options && options[i]; i++)
if (g_strcmp0 (options[i], option) == 0)
return TRUE;
_options = g_new0 (gchar *, (i + 2));
for (j = 0; j < i; j++)
_options[j] = g_strdup (options[j]);
_options[i] = g_strdup (option);
/* eek_xkl_layout_set_options() will free _options and its elements. */
return eek_xkl_layout_set_options (layout, _options);
}
/**
* eek_xkl_layout_disable_option:
* @layout: an #EekXklLayout
* @option: option name
*
* Unset the option of @layout (in the Libxklavier terminology).
* Returns: %TRUE if the current layout changed, %FALSE otherwise
*/
gboolean
eek_xkl_layout_disable_option (EekXklLayout *layout,
const gchar *option)
{
gchar **options, **_options;
gint i, j, k;
options = eek_xkl_layout_get_options (layout);
if (!options)
return TRUE;
for (i = 0, k = 0; options[i]; i++)
if (g_strcmp0 (options[i], option) == 0)
k = i;
if (options[k] == NULL)
return TRUE;
_options = g_new0 (gchar *, i);
for (j = 0; j < k; j++)
_options[j] = g_strdup (options[j]);
for (j = k + 1; j < i; j++)
_options[j] = g_strdup (options[j]);
/* eek_xkl_layout_set_options() will free _options and its elements. */
return eek_xkl_layout_set_options (layout, _options);
}
/**
* eek_xkl_layout_get_model:
* @layout: an #EekXklLayout
*
* Get the model name of @layout configuration (in the Libxklavier terminology).
*/
gchar *
eek_xkl_layout_get_model (EekXklLayout *layout)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
g_return_val_if_fail (priv, NULL);
return g_strdup (priv->config->model);
}
/**
* eek_xkl_layout_get_layouts:
* @layout: an #EekXklLayout
*
* Get the layout names of @layout configuration (in the Libxklavier
* terminology).
*/
gchar **
eek_xkl_layout_get_layouts (EekXklLayout *layout)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
g_return_val_if_fail (priv, NULL);
return g_strdupv (priv->config->layouts);
}
/**
* eek_xkl_layout_get_variants:
* @layout: an #EekXklLayout
*
* Get the variant names of @layout configuration (in the Libxklavier
* terminology).
*/
gchar **
eek_xkl_layout_get_variants (EekXklLayout *layout)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
g_return_val_if_fail (priv, NULL);
return g_strdupv (priv->config->variants);
}
/**
* eek_xkl_layout_get_options:
* @layout: an #EekXklLayout
*
* Get the option names of @layout configuration (in the Libxklavier
* terminology).
*/
gchar **
eek_xkl_layout_get_options (EekXklLayout *layout)
{
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
g_return_val_if_fail (priv, NULL);
return g_strdupv (priv->config->options);
}
static gboolean
set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
{
EekXklLayoutPrivate *priv = layout->priv;
XkbComponentNamesRec names;
gboolean retval = FALSE;
#if DEBUG
if (config->layouts) {
gint i;
fprintf (stderr, "layout = ");
for (i = 0; config->layouts[i] != NULL; i++)
fprintf (stderr, "\"%s\" ", config->layouts[i]);
fputc ('\n', stderr);
} else
fprintf (stderr, "layouts = NULL\n");
if (config->variants) {
gint i;
fprintf (stderr, "variant = ");
for (i = 0; config->variants[i]; i++)
fprintf (stderr, "\"%s\" ", config->variants[i]);
fputc ('\n', stderr);
} else
fprintf (stderr, "variants = NULL\n");
if (config->options) {
gint i;
fprintf (stderr, "option = ");
for (i = 0; config->options[i]; i++)
fprintf (stderr, "\"%s\" ", config->options[i]);
fputc ('\n', stderr);
} else
fprintf (stderr, "options = NULL\n");
#endif
if (xkl_xkb_config_native_prepare (priv->engine, config, &names)) {
GError *error = NULL;
retval = eek_xkb_layout_set_names (EEK_XKB_LAYOUT(layout),
&names,
&error);
if (!retval)
g_warning ("can't set XKB layout");
xkl_xkb_config_native_cleanup (priv->engine, &names);
}
return retval;
}
/**
* eek_xkl_layout_get_option:
* @layout: an #EekXklLayout
* @option: option name
*
* Tell if the option of @layout (in the Libxklavier terminology) is set.
* Returns: %TRUE if the option is set, %FALSE otherwise
*/
gboolean
eek_xkl_layout_get_option (EekXklLayout *layout,
const gchar *option)
{
gchar **options;
gint i;
options = eek_xkl_layout_get_options (layout);
for (i = 0; options && options[i]; i++)
if (g_strcmp0 (options[i], option) == 0)
return TRUE;
return FALSE;
}
static gboolean
initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
EekXklLayout *layout = EEK_XKL_LAYOUT (initable);
Display *display;
if (!parent_initable_iface->init (initable, cancellable, error))
return FALSE;
layout->priv->config = xkl_config_rec_new ();
g_object_get (G_OBJECT (initable),
"display", &display,
NULL);
layout->priv->engine = xkl_engine_get_instance (display);
if (!xkl_config_rec_get_from_server (layout->priv->config,
layout->priv->engine)) {
g_set_error (error,
EEK_ERROR,
EEK_ERROR_LAYOUT_ERROR,
"can't load libxklavier configuration");
return FALSE;
}
set_xkb_component_names (layout, layout->priv->config);
return TRUE;
}
static void
initable_iface_init (GInitableIface *initable_iface)
{
parent_initable_iface = g_type_interface_peek_parent (initable_iface);
initable_iface->init = initable_init;
}

View File

@ -1,97 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
#error "Only <eek/eek-xkl.h> can be included directly."
#endif
#ifndef EEK_XKL_LAYOUT_H
#define EEK_XKL_LAYOUT_H 1
#include <libxklavier/xklavier.h>
#include "eek-xkb-layout.h"
G_BEGIN_DECLS
#define EEK_TYPE_XKL_LAYOUT (eek_xkl_layout_get_type())
#define EEK_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayout))
#define EEK_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
#define EEK_IS_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKL_LAYOUT))
#define EEK_IS_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKL_LAYOUT))
#define EEK_XKL_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
typedef struct _EekXklLayout EekXklLayout;
typedef struct _EekXklLayoutClass EekXklLayoutClass;
typedef struct _EekXklLayoutPrivate EekXklLayoutPrivate;
struct _EekXklLayout
{
/*< private >*/
EekXkbLayout parent;
EekXklLayoutPrivate *priv;
};
struct _EekXklLayoutClass
{
/*< private >*/
EekXkbLayoutClass parent_class;
/*< private >*/
/* padding */
gpointer pdummy[24];
};
GType eek_xkl_layout_get_type (void) G_GNUC_CONST;
EekLayout *eek_xkl_layout_new (Display *display,
GError **error);
gboolean eek_xkl_layout_set_config (EekXklLayout *layout,
XklConfigRec *config);
gboolean eek_xkl_layout_set_config_full (EekXklLayout *layout,
gchar *model,
gchar **layouts,
gchar **variants,
gchar **options);
gboolean eek_xkl_layout_set_model (EekXklLayout *layout,
const gchar *model);
gboolean eek_xkl_layout_set_layouts (EekXklLayout *layout,
gchar **layouts);
gboolean eek_xkl_layout_set_variants (EekXklLayout *layout,
gchar **variants);
gboolean eek_xkl_layout_set_options (EekXklLayout *layout,
gchar **options);
gboolean eek_xkl_layout_enable_option (EekXklLayout *layout,
const gchar *option);
gboolean eek_xkl_layout_disable_option (EekXklLayout *layout,
const gchar *option);
gchar *eek_xkl_layout_get_model (EekXklLayout *layout);
gchar **eek_xkl_layout_get_layouts (EekXklLayout *layout);
gchar **eek_xkl_layout_get_variants (EekXklLayout *layout);
gchar **eek_xkl_layout_get_options (EekXklLayout *layout);
gboolean eek_xkl_layout_get_option (EekXklLayout *layout,
const gchar *option);
G_END_DECLS
#endif /* #ifndef EEK_XKL_LAYOUT_H */

View File

@ -1,26 +0,0 @@
/*
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef EEK_XKL_H
#define EEK_XKL_H 1
#include "eek.h"
#include "eek-xkl-layout.h"
#endif /* EEK_XKL_H */

View File

@ -1,7 +1,7 @@
/*
/*
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2011 Red Hat, Inc.
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ -21,10 +21,9 @@
* @short_description: Layout engine which loads layout information from XML
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <gio/gio.h> /* GResource */
#include <stdlib.h>
#include <string.h>
@ -35,6 +34,8 @@
#include "eek-keysym.h"
#include "eek-text.h"
#include "squeekboard-resources.h"
enum {
PROP_0,
PROP_ID,
@ -43,19 +44,18 @@ enum {
static void initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_TYPE_WITH_CODE (EekXmlLayout, eek_xml_layout, EEK_TYPE_LAYOUT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init));
#define EEK_XML_LAYOUT_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XML_LAYOUT, EekXmlLayoutPrivate))
struct _EekXmlLayoutPrivate
typedef struct _EekXmlLayoutPrivate
{
gchar *id;
gchar *keyboards_dir;
EekXmlKeyboardDesc *desc;
};
} EekXmlLayoutPrivate;
G_DEFINE_TYPE_EXTENDED (EekXmlLayout, eek_xml_layout, EEK_TYPE_LAYOUT,
0, /* GTypeFlags */
G_ADD_PRIVATE(EekXmlLayout)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init))
G_DEFINE_BOXED_TYPE(EekXmlKeyboardDesc, eek_xml_keyboard_desc, eek_xml_keyboard_desc_copy, eek_xml_keyboard_desc_free);
@ -360,11 +360,6 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
if (g_strcmp0 (data->element_stack->data, "geometry") == 0)
eek_element_set_bounds (EEK_ELEMENT(data->keyboard), &bounds);
else if (g_strcmp0 (data->element_stack->data, "section") == 0)
eek_element_set_bounds (EEK_ELEMENT(data->section), &bounds);
else if (g_strcmp0 (data->element_stack->data, "key") == 0)
eek_element_set_bounds (EEK_ELEMENT(data->key), &bounds);
goto out;
}
@ -410,17 +405,23 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
"no \"keycode\" attribute for \"key\"");
return;
}
keycode = strtoul (attribute, NULL, 10);
data->key = eek_section_create_key (data->section,
keycode,
data->num_columns,
data->num_rows - 1);
keycode = strtol (attribute, NULL, 10);
attribute = get_attribute (attribute_names, attribute_values,
"name");
if (attribute != NULL)
eek_element_set_name (EEK_ELEMENT(data->key), attribute);
if (attribute == NULL) {
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_MISSING_ATTRIBUTE,
"no \"name\" attribute for \"key\"");
return;
}
data->key = eek_section_create_key (data->section,
g_strdup (attribute),
keycode,
data->num_columns,
data->num_rows - 1);
attribute = get_attribute (attribute_names, attribute_values,
"oref");
@ -455,7 +456,7 @@ geometry_start_element_callback (GMarkupParseContext *pcontext,
"corner-radius");
if (attribute != NULL)
data->corner_radius = g_strtod (attribute, NULL);
goto out;
}
@ -504,7 +505,6 @@ geometry_end_element_callback (GMarkupParseContext *pcontext,
{
GeometryParseData *data = user_data;
GSList *head = data->element_stack;
gint i;
g_free (head->data);
data->element_stack = g_slist_next (data->element_stack);
@ -536,7 +536,8 @@ geometry_end_element_callback (GMarkupParseContext *pcontext,
outline->num_points = g_slist_length (data->points);
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
outline->num_points);
for (head = data->points = g_slist_reverse (data->points), i = 0;
guint i;
for (i = 0, head = data->points = g_slist_reverse (data->points);
head && i < outline->num_points;
head = g_slist_next (head), i++) {
memcpy (&outline->points[i], head->data, sizeof (EekPoint));
@ -625,27 +626,24 @@ symbols_start_element_callback (GMarkupParseContext *pcontext,
return;
if (g_strcmp0 (element_name, "key") == 0) {
guint keycode;
attribute = get_attribute (attribute_names, attribute_values,
"keycode");
"name");
if (attribute == NULL) {
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_MISSING_ATTRIBUTE,
"no \"keycode\" attribute for \"key\"");
"no \"name\" attribute for \"key\"");
return;
}
keycode = strtoul (attribute, NULL, 10);
data->key = eek_keyboard_find_key_by_keycode (data->keyboard,
keycode);
data->key = eek_keyboard_find_key_by_name (data->keyboard,
attribute);
if (data->key == NULL) {
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
"no such keycode %u", keycode);
return;
"no such key %s", attribute);
}
attribute = get_attribute (attribute_names, attribute_values,
@ -721,6 +719,10 @@ symbols_end_element_callback (GMarkupParseContext *pcontext,
text = g_strndup (data->text->str, data->text->len);
if (g_strcmp0 (element_name, "key") == 0) {
if (!data->key) {
return;
}
gint num_symbols = g_slist_length (data->symbols);
gint levels = num_symbols / data->groups;
EekSymbolMatrix *matrix = eek_symbol_matrix_new (data->groups,
@ -896,42 +898,41 @@ static const GMarkupParser prerequisites_parser = {
};
static EekKeyboard *
eek_xml_layout_real_create_keyboard (EekLayout *self,
eek_xml_layout_real_create_keyboard (EekboardContextService *manager,
EekLayout *self,
gdouble initial_width,
gdouble initial_height)
{
EekXmlLayout *layout = EEK_XML_LAYOUT (self);
EekKeyboard *keyboard;
gchar *filename, *path;
GList *loaded;
GError *error;
EekXmlLayoutPrivate *priv = eek_xml_layout_get_instance_private (layout);
gboolean retval;
/* Create an empty keyboard to which geometry and symbols
information are applied. */
keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", layout, NULL);
EekKeyboard *keyboard = g_object_new (EEK_TYPE_KEYBOARD, "layout", layout, NULL);
keyboard->manager = manager;
/* Read geometry information. */
filename = g_strdup_printf ("%s.xml", layout->priv->desc->geometry);
path = g_build_filename (layout->priv->keyboards_dir, "geometry", filename, NULL);
gchar *filename = g_strdup_printf ("%s.xml", priv->desc->geometry);
gchar *path = g_build_filename (priv->keyboards_dir, "geometry", filename, NULL);
g_free (filename);
error = NULL;
GError *error = NULL;
retval = parse_geometry (path, keyboard, &error);
g_free (path);
if (!retval) {
g_object_unref (keyboard);
g_warning ("can't parse geometry file %s: %s",
layout->priv->desc->geometry,
priv->desc->geometry,
error->message);
g_error_free (error);
return NULL;
}
/* Read symbols information. */
loaded = NULL;
retval = parse_symbols_with_prerequisites (layout->priv->keyboards_dir,
layout->priv->desc->symbols,
GList *loaded = NULL;
retval = parse_symbols_with_prerequisites (priv->keyboards_dir,
priv->desc->symbols,
keyboard,
&loaded,
&error);
@ -939,18 +940,20 @@ eek_xml_layout_real_create_keyboard (EekLayout *self,
if (!retval) {
g_object_unref (keyboard);
g_warning ("can't parse symbols file %s: %s",
layout->priv->desc->symbols,
priv->desc->symbols,
error->message);
g_error_free (error);
return NULL;
}
/* Fit keyboard in the given width and hight. */
eek_layout_place_sections(keyboard);
/* Fit keyboard in the given width and height. */
scale_keyboard (keyboard, initial_width, initial_height);
/* Use pre-defined modifier mask here. */
eek_keyboard_set_num_lock_mask (keyboard, EEK_MOD2_MASK);
eek_keyboard_set_alt_gr_mask (keyboard, EEK_MOD5_MASK);
eek_keyboard_set_alt_gr_mask (keyboard, EEK_BUTTON1_MASK);
return keyboard;
}
@ -962,10 +965,12 @@ eek_xml_layout_set_property (GObject *object,
GParamSpec *pspec)
{
EekXmlLayout *layout = EEK_XML_LAYOUT (object);
EekXmlLayoutPrivate *priv = eek_xml_layout_get_instance_private (layout);
switch (prop_id) {
case PROP_ID:
g_free (layout->priv->id);
layout->priv->id = g_value_dup_string (value);
g_free (priv->id);
priv->id = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -980,9 +985,11 @@ eek_xml_layout_get_property (GObject *object,
GParamSpec *pspec)
{
EekXmlLayout *layout = EEK_XML_LAYOUT (object);
EekXmlLayoutPrivate *priv = eek_xml_layout_get_instance_private (layout);
switch (prop_id) {
case PROP_ID:
g_value_set_string (value, layout->priv->id);
g_value_set_string (value, priv->id);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -993,7 +1000,8 @@ eek_xml_layout_get_property (GObject *object,
static void
eek_xml_layout_finalize (GObject *object)
{
EekXmlLayoutPrivate *priv = EEK_XML_LAYOUT_GET_PRIVATE (object);
EekXmlLayoutPrivate *priv = eek_xml_layout_get_instance_private (
EEK_XML_LAYOUT (object));
g_free (priv->id);
@ -1012,8 +1020,6 @@ eek_xml_layout_class_init (EekXmlLayoutClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (gobject_class, sizeof (EekXmlLayoutPrivate));
layout_class->create_keyboard = eek_xml_layout_real_create_keyboard;
gobject_class->set_property = eek_xml_layout_set_property;
@ -1032,7 +1038,7 @@ eek_xml_layout_class_init (EekXmlLayoutClass *klass)
static void
eek_xml_layout_init (EekXmlLayout *self)
{
self->priv = EEK_XML_LAYOUT_GET_PRIVATE (self);
/* void */
}
EekLayout *
@ -1051,16 +1057,17 @@ initable_init (GInitable *initable,
GError **error)
{
EekXmlLayout *layout = EEK_XML_LAYOUT (initable);
EekXmlLayoutPrivate *priv = eek_xml_layout_get_instance_private (layout);
GList *keyboards, *p;
gchar *path;
EekXmlKeyboardDesc *desc;
layout->priv->keyboards_dir = (gchar *) g_getenv ("EEKBOARD_KEYBOARDSDIR");
if (layout->priv->keyboards_dir == NULL)
layout->priv->keyboards_dir = KEYBOARDSDIR;
layout->priv->keyboards_dir = g_strdup (layout->priv->keyboards_dir);
priv->keyboards_dir = g_strdup ((gchar *) g_getenv ("EEKBOARD_KEYBOARDSDIR"));
path = g_build_filename (layout->priv->keyboards_dir, "keyboards.xml", NULL);
if (priv->keyboards_dir == NULL)
priv->keyboards_dir = g_strdup ("resource:///sm/puri/squeekboard/keyboards/");
path = g_build_filename (priv->keyboards_dir, "keyboards.xml", NULL);
keyboards = parse_keyboards (path, error);
g_free (path);
if (error && *error)
@ -1068,7 +1075,7 @@ initable_init (GInitable *initable,
for (p = keyboards; p; p = p->next) {
desc = p->data;
if (g_strcmp0 (desc->id, layout->priv->id) == 0)
if (g_strcmp0 (desc->id, priv->id) == 0)
break;
}
if (p == NULL) {
@ -1076,12 +1083,12 @@ initable_init (GInitable *initable,
EEK_ERROR,
EEK_ERROR_LAYOUT_ERROR,
"no such keyboard %s",
layout->priv->id);
priv->id);
return FALSE;
}
keyboards = g_list_remove_link (keyboards, p);
layout->priv->desc = p->data;
priv->desc = p->data;
g_list_free_1 (p);
g_list_free_full (keyboards, (GDestroyNotify) keyboard_desc_free);
@ -1109,7 +1116,7 @@ eek_xml_list_keyboards (void)
keyboards_dir = g_getenv ("EEKBOARD_KEYBOARDSDIR");
if (keyboards_dir == NULL)
keyboards_dir = KEYBOARDSDIR;
keyboards_dir = g_strdup ("resource:///sm/puri/squeekboard/keyboards/");
path = g_build_filename (keyboards_dir, "keyboards.xml", NULL);
keyboards = parse_keyboards (path, NULL);
g_free (path);
@ -1146,7 +1153,9 @@ parse_geometry (const gchar *path, EekKeyboard *keyboard, GError **error)
GFileInputStream *input;
gboolean retval;
file = g_file_new_for_path (path);
file = g_str_has_prefix (path, "resource://")
? g_file_new_for_uri (path)
: g_file_new_for_path (path);
input = g_file_read (file, NULL, error);
g_object_unref (file);
@ -1251,7 +1260,9 @@ parse_symbols (const gchar *path, EekKeyboard *keyboard, GError **error)
GFileInputStream *input;
gboolean retval;
file = g_file_new_for_path (path);
file = g_str_has_prefix (path, "resource://")
? g_file_new_for_uri (path)
: g_file_new_for_path (path);
input = g_file_read (file, NULL, error);
g_object_unref (file);
@ -1284,7 +1295,9 @@ parse_prerequisites (const gchar *path, GError **error)
GList *prerequisites;
gboolean retval;
file = g_file_new_for_path (path);
file = g_str_has_prefix (path, "resource://")
? g_file_new_for_uri (path)
: g_file_new_for_path (path);
input = g_file_read (file, NULL, error);
g_object_unref (file);
@ -1319,7 +1332,9 @@ parse_keyboards (const gchar *path, GError **error)
GList *keyboards;
gboolean retval;
file = g_file_new_for_path (path);
file = g_str_has_prefix (path, "resource://")
? g_file_new_for_uri (path)
: g_file_new_for_path (path);
input = g_file_read (file, NULL, error);
g_object_unref (file);
@ -1345,43 +1360,12 @@ parse_keyboards (const gchar *path, GError **error)
return keyboards;
}
static void scale_bounds_callback (EekElement *element,
gpointer user_data);
static void
scale_bounds (EekElement *element,
gdouble scale)
{
EekBounds bounds;
eek_element_get_bounds (element, &bounds);
bounds.x *= scale;
bounds.y *= scale;
bounds.width *= scale;
bounds.height *= scale;
eek_element_set_bounds (element, &bounds);
if (EEK_IS_CONTAINER(element))
eek_container_foreach_child (EEK_CONTAINER(element),
scale_bounds_callback,
&scale);
}
static void
scale_bounds_callback (EekElement *element,
gpointer user_data)
{
scale_bounds (element, *(gdouble *)user_data);
}
static void scale_keyboard (EekKeyboard *keyboard,
gdouble width,
gdouble height)
{
gdouble scale;
EekBounds bounds;
gsize n_outlines;
guint i;
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
@ -1390,18 +1374,7 @@ static void scale_keyboard (EekKeyboard *keyboard,
else
scale = height / bounds.height;
scale_bounds (EEK_ELEMENT(keyboard), scale);
n_outlines = eek_keyboard_get_n_outlines (keyboard);
for (i = 0; i < n_outlines; i++) {
EekOutline *outline = eek_keyboard_get_outline (keyboard, i);
gint j;
for (j = 0; j < outline->num_points; j++) {
outline->points[j].x *= scale;
outline->points[j].y *= scale;
}
}
eek_layout_scale_keyboard(keyboard, scale);
}
static gboolean

View File

@ -29,29 +29,7 @@
G_BEGIN_DECLS
#define EEK_TYPE_XML_LAYOUT (eek_xml_layout_get_type())
#define EEK_XML_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XML_LAYOUT, EekXmlLayout))
#define EEK_XML_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XML_LAYOUT, EekXmlLayoutClass))
#define EEK_IS_XML_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XML_LAYOUT))
#define EEK_IS_XML_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XML_LAYOUT))
#define EEK_XML_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XML_LAYOUT, EekXmlLayoutClass))
typedef struct _EekXmlLayout EekXmlLayout;
typedef struct _EekXmlLayoutClass EekXmlLayoutClass;
typedef struct _EekXmlLayoutPrivate EekXmlLayoutPrivate;
/**
* EekXmlLayout:
*
* The #EekXmlLayout structure contains only private data and should
* only be accessed using the provided API.
*/
struct _EekXmlLayout
{
/*< private >*/
EekLayout parent;
EekXmlLayoutPrivate *priv;
};
G_DECLARE_DERIVABLE_TYPE (EekXmlLayout, eek_xml_layout, EEK, XML_LAYOUT, EekLayout)
/**
* EekXmlLayoutClass:

Some files were not shown because too many files have changed in this diff Show More