Skip to content

Commit

Permalink
2006-02-28 Matthew Allum <[email protected]>
Browse files Browse the repository at this point in the history
        * 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
  • Loading branch information
mallum committed Feb 28, 2006
1 parent e5532c5 commit 2f3b941
Show file tree
Hide file tree
Showing 7 changed files with 116 additions and 14 deletions.
19 changes: 19 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
2006-02-28 Matthew Allum <[email protected]>

* 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 <[email protected]>

* README:
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AC_PREREQ(2.53)
AC_INIT([matchbox-keyboard], 0.0.0, [[email protected]])
AC_INIT([matchbox-keyboard], 0.1, [[email protected]])
AC_CONFIG_SRCDIR([src/matchbox-keyboard.c])

AM_INIT_AUTOMAKE()
Expand All @@ -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]],
Expand Down
4 changes: 3 additions & 1 deletion layouts/Makefile.am
Original file line number Diff line number Diff line change
@@ -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)
60 changes: 60 additions & 0 deletions layouts/keyboard-numpad.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<keyboard>

<options>
<!-- not yet implemented -->
</options>

<layout id="defualt keyboard">

<row>

<space width="500" extended="true"/>

<key>
<default display="9" />
</key>
<key>
<default display="8" />
</key>
<key>
<default display="7" />
</key>

</row>
<row>
<space width="500" extended="true"/>
<key>
<default display="6" />
</key>
<key>
<default display="5" />
</key>
<key>
<default display="4" />
</key>
</row>
<row>
<space width="500" extended="true"/>
<key>
<default display="3" />
</key>

<key>
<default display="2" />
</key>
<key>
<default display="1" />
</key>
</row>
<row>
<space width="500" extended="true"/>
<key>
<default display="0" />
</key>
</row>

</layout>


</keyboard>
8 changes: 8 additions & 0 deletions src/matchbox-keyboard-ui-xft-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
29 changes: 21 additions & 8 deletions src/matchbox-keyboard-ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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++;
}

Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/matchbox-keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 2f3b941

Please sign in to comment.