From 2f3b941597abbf4f3e13763ac241d04eda3be323 Mon Sep 17 00:00:00 2001 From: mallum Date: Tue, 28 Feb 2006 20:09:26 +0000 Subject: [PATCH] 2006-02-28 Matthew Allum * configure.ac: Make version 0.1. Make cairo usage explicit. * layouts/Makefile.am: * layouts/keyboard-numpad.xml: New Layout. * src/matchbox-keyboard-ui-xft-backend.c: (mb_kbd_ui_xft_redraw_key): * src/matchbox-keyboard-ui.c: (mb_kdb_ui_unit_key_size), (mb_kbd_ui_allocate_ui_layout), (mb_kbd_ui_handle_configure), (mb_kbd_ui_event_loop): * src/matchbox-keyboard.c: (mb_kbd_new): Fixups for layout on small screens and improvements for high DPI layouts. git-svn-id: https://svn.o-hand.com/repos/matchbox/trunk/matchbox-keyboard@1314 b067294f-1dea-0310-9683-c47a78595994 --- ChangeLog | 19 ++++++++ configure.ac | 6 +-- layouts/Makefile.am | 4 +- layouts/keyboard-numpad.xml | 60 ++++++++++++++++++++++++++ src/matchbox-keyboard-ui-xft-backend.c | 8 ++++ src/matchbox-keyboard-ui.c | 29 +++++++++---- src/matchbox-keyboard.c | 4 +- 7 files changed, 116 insertions(+), 14 deletions(-) create mode 100644 layouts/keyboard-numpad.xml diff --git a/ChangeLog b/ChangeLog index 4ca9708..051e6e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2006-02-28 Matthew Allum + + * configure.ac: + Make version 0.1. Make cairo usage explicit. + + * layouts/Makefile.am: + * layouts/keyboard-numpad.xml: + New Layout. + + * src/matchbox-keyboard-ui-xft-backend.c: + (mb_kbd_ui_xft_redraw_key): + * src/matchbox-keyboard-ui.c: (mb_kdb_ui_unit_key_size), + (mb_kbd_ui_allocate_ui_layout), (mb_kbd_ui_handle_configure), + (mb_kbd_ui_event_loop): + * src/matchbox-keyboard.c: (mb_kbd_new): + Fixups for layout on small screens and improvements for high + DPI layouts. + + 2005-10-27 Matthew Allum * README: diff --git a/configure.ac b/configure.ac index e18d1d2..a17b4a0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.53) -AC_INIT([matchbox-keyboard], 0.0.0, [mallum@handhelds.org]) +AC_INIT([matchbox-keyboard], 0.1, [mallum@handhelds.org]) AC_CONFIG_SRCDIR([src/matchbox-keyboard.c]) AM_INIT_AUTOMAKE() @@ -26,9 +26,9 @@ AC_TYPE_SIGNAL AC_FUNC_STAT AC_ARG_ENABLE(cairo, - [ --disable-cairo disable Cairo support [default=auto]], + [ --enable-cairo enable experimental Cairo support [default=no]], enable_cairo=$enableval, - enable_cairo=yes) + enable_cairo=no) AC_ARG_ENABLE(examples, [ --enable-examples Build embedding examples ( requires GTK ) [default=no]], diff --git a/layouts/Makefile.am b/layouts/Makefile.am index 1c3f542..13a8365 100644 --- a/layouts/Makefile.am +++ b/layouts/Makefile.am @@ -1,3 +1,5 @@ keyboardsdir = $(datadir)/matchbox-keyboard keyboards_DATA = keyboard.xml keyboard-extended.xml keyboard-dvorak.xml \ - keyboard-ru.xml keyboard-fi.xml + keyboard-ru.xml keyboard-fi.xml keyboard-numpad.xml + +EXTRA_DIST = $(keyboards_DATA) \ No newline at end of file diff --git a/layouts/keyboard-numpad.xml b/layouts/keyboard-numpad.xml new file mode 100644 index 0000000..40efeb6 --- /dev/null +++ b/layouts/keyboard-numpad.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/matchbox-keyboard-ui-xft-backend.c b/src/matchbox-keyboard-ui-xft-backend.c index c13d472..f2f82b1 100644 --- a/src/matchbox-keyboard-ui-xft-backend.c +++ b/src/matchbox-keyboard-ui-xft-backend.c @@ -135,6 +135,14 @@ mb_kbd_ui_xft_redraw_key(MBKeyboardUI *ui, MBKeyboardKey *key) rect.width = mb_kbd_key_width(key); rect.height = mb_kbd_key_height(key); + /* Hacky clip to work around issues with off by ones in layout code :( */ + + if (rect.x + rect.width >= mb_kbd_ui_x_win_width(ui)) + rect.width = mb_kbd_ui_x_win_width(ui) - rect.x - 1; + + if (rect.y + rect.height >= mb_kbd_ui_x_win_height(ui)) + rect.height = mb_kbd_ui_x_win_height(ui) - rect.y - 1; + /* clear it */ XSetForeground(xdpy, xft_backend->xgc, WhitePixel(xdpy, xscreen)); diff --git a/src/matchbox-keyboard-ui.c b/src/matchbox-keyboard-ui.c index d1aaa0b..44d7502 100644 --- a/src/matchbox-keyboard-ui.c +++ b/src/matchbox-keyboard-ui.c @@ -274,6 +274,13 @@ mb_kdb_ui_unit_key_size(MBKeyboardUI *ui, int *width, int *height) } row_item = util_list_next(row_item); } + + /* FIXME: hack for small displays */ + if (mb_kbd_ui_display_height(ui) <= 320) + { + *height += 4; + } + } static void @@ -410,7 +417,9 @@ mb_kbd_ui_allocate_ui_layout(MBKeyboardUI *ui, && mb_kbd_key_get_extended(key_item->data)) continue; - if (mb_kbd_key_get_fill(key_item->data)) + if (mb_kbd_key_get_fill(key_item->data) + || mb_kbd_ui_display_height(ui) <= 320 + || mb_kbd_ui_display_width(ui) <= 320 ) n_fillers++; } @@ -425,7 +434,9 @@ mb_kbd_ui_allocate_ui_layout(MBKeyboardUI *ui, && mb_kbd_key_get_extended(key_item->data)) continue; - if (mb_kbd_key_get_fill(key_item->data)) + if (mb_kbd_key_get_fill(key_item->data) + || mb_kbd_ui_display_height(ui) <= 320 + || mb_kbd_ui_display_width(ui) <= 320 ) { int old_w; List *nudge_key_item = util_list_next(key_item); @@ -1007,8 +1018,8 @@ mb_kbd_ui_event_loop(MBKeyboardUI *ui) struct timeval tvt; /* Key repeat - values for standard xorg install ( xset q) */ - int repeat_delay = 500 * 10000; - int repeat_rate = 30 * 10000; + int repeat_delay = 100 * 10000; + int repeat_rate = 30 * 1000; tvt.tv_sec = 0; tvt.tv_usec = repeat_delay; @@ -1026,23 +1037,25 @@ mb_kbd_ui_event_loop(MBKeyboardUI *ui) key = mb_kbd_locate_key(ui->kbd, xev.xbutton.x, xev.xbutton.y); if (key) { - /* Hack if we never go a release event */ + /* Hack if we never get a release event */ if (key != mb_kbd_get_held_key(ui->kbd)) { - mb_kbd_key_release(ui->kbd); + mb_kbd_key_release(ui->kbd); tvt.tv_usec = repeat_delay; } + else + tvt.tv_usec = repeat_rate; DBG("found key for press"); mb_kbd_key_press(key); - tvt.tv_usec = repeat_rate; + } break; case ButtonRelease: if (mb_kbd_get_held_key(ui->kbd) != NULL) { mb_kbd_key_release(ui->kbd); - tvt.tv_usec = repeat_delay; + tvt.tv_usec = repeat_delay; } break; case ConfigureNotify: diff --git a/src/matchbox-keyboard.c b/src/matchbox-keyboard.c index 69f72f0..045ff82 100644 --- a/src/matchbox-keyboard.c +++ b/src/matchbox-keyboard.c @@ -48,7 +48,7 @@ mb_kbd_new (int argc, char **argv) kb->row_spacing = 5; kb->font_family = strdup("sans"); - kb->font_pt_size = 6; + kb->font_pt_size = 5; kb->font_variant = strdup("bold"); for (i = 1; i < argc; i++) @@ -77,7 +77,7 @@ mb_kbd_new (int argc, char **argv) kb->key_pad = 0; kb->col_spacing = 0; kb->row_spacing = 0; - kb->font_pt_size = 6; + kb->font_pt_size = 8; } if (!mb_kbd_config_load(kb, variant))