Compare commits

...

25 Commits

Author SHA1 Message Date
05cefd5ae0 data: rename the desktop files 2024-11-29 01:06:20 +01:00
83c0dd01df Import the newer scripts from DeforaOS configure 2020-11-19 03:15:40 +01:00
9fa098deab Also install the COPYING file 2020-02-03 05:23:51 +01:00
0cbc1b6ce0 Code cleanup 2020-02-03 05:23:43 +01:00
375f124fa6 Set the vendor to "Desktop" 2020-02-03 05:17:28 +01:00
a79858d452 Update the translations 2020-01-12 07:48:50 +01:00
11cc3458f2 Update the copyright notice 2020-01-12 07:48:38 +01:00
bc097b7d39 Use PROGNAME_KEYBOARDCTL 2020-01-12 07:48:30 +01:00
f5d00f5ac1 About to release DeforaOS Keyboard 0.4.0 2020-01-12 07:43:33 +01:00
7acf53d551 Extend the README file 2020-01-12 07:43:14 +01:00
bb15f6d342 Add experimental support for the euro sign
This is only implemented in the French keyboard for the moment.
It still conflicts with other modifiers.
2020-01-12 07:35:02 +01:00
8b655f7ecf Code cleanup 2020-01-12 06:35:50 +01:00
47f2de95f3 Support different layout for special keys 2020-01-12 06:33:47 +01:00
9c8afe4d40 Update the copyright notice 2020-01-12 06:30:03 +01:00
1c8c458658 Code cleanup 2020-01-12 06:29:52 +01:00
52c276678f Extend the support for the French keyboard 2020-01-12 05:12:26 +01:00
88cbf8961d Update the copyright notice 2020-01-12 04:39:47 +01:00
bf17f07bc3 Add initial support for differing keyboard layouts
This is plain ugly though. It will have to be re-designed.
2020-01-12 04:39:14 +01:00
ceac882f17 Update the copyright notice 2020-01-12 04:36:30 +01:00
6e3930a363 Use PROGNAME_KEYBOARD 2020-01-12 04:36:21 +01:00
46e4b0ac65 Update the copyright notice 2020-01-12 03:33:03 +01:00
679370c103 Use HTTPS for links 2020-01-12 03:32:37 +01:00
2b4a05ab74 Merge branch 'khorben/gtk3' 2020-01-12 03:31:16 +01:00
47cd7628bd Build with Gtk+ 3 by default 2020-01-12 03:31:03 +01:00
502036e1e7 Stick to the default stack protector 2017-07-26 15:30:52 +02:00
15 changed files with 567 additions and 127 deletions

View File

@ -8,11 +8,13 @@ This program emulates a physical keyboard by providing a virtual interface on
screen. It currently supports four modes:
* docked, where it will occupy the bottom of the screen;
* popup, likewise as a popup window;
* windowed, where it can be found in the system tray (default)
* windowed, where it can be found in the system tray (the default)
* embedded, which outputs its window ID for inclusion within another program.
Additionally, it can be piloted through its companion tool, `desktopctl(1)`.
Keyboard is part of the DeforaOS Project, found at https://www.defora.org/.
Compiling Keyboard
------------------
@ -27,6 +29,20 @@ on most systems:
$ make
The following command will then install Keyboard:
$ make install
To install (or package) Keyboard in a different location:
$ make clean
$ make PREFIX="/another/prefix" install
Keyboard also supports `DESTDIR`, to be installed in a staging directory; for
instance:
$ make DESTDIR="/staging/directory" PREFIX="/another/prefix" install
On some systems, the Makefiles shipped can be re-generated accordingly thanks to
the DeforaOS configure tool.

View File

@ -1,4 +1,4 @@
dist=Makefile,deforaos-keyboard.desktop
dist=Makefile,org.defora.keyboard.desktop
[deforaos-keyboard.desktop]
[org.defora.keyboard.desktop]
install=$(PREFIX)/share/applications

View File

@ -1,14 +1,14 @@
# $Id$
# Copyright (c) 2014 Pierre Pronchery <khorben@defora.org>
# Copyright (c) 2014-2020 Pierre Pronchery <khorben@defora.org>
# Spanish translations for Keyboard package.
# This file is distributed under the same license as the Keyboard package.
# Pierre Pronchery <khorben@defora.org>, 2014.
#
msgid ""
msgstr ""
"Project-Id-Version: Keyboard 0.2.1\n"
"Project-Id-Version: Keyboard 0.4.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-24 04:16+0200\n"
"POT-Creation-Date: 2020-01-12 07:47+0100\n"
"PO-Revision-Date: 2014-12-28 20:19+0100\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: Spanish\n"
@ -18,45 +18,46 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/keyboard.c:117
#: ../src/keyboard.c:145
msgid "_Quit"
msgstr "_Salir"
#: ../src/keyboard.c:124
#: ../src/keyboard.c:152
msgid "_Hide"
msgstr "_Ocultar"
#: ../src/keyboard.c:132 ../src/keyboard.c:134
#: ../src/keyboard.c:160 ../src/keyboard.c:162
msgid "_About"
msgstr "_Acerca de"
#: ../src/keyboard.c:141
#: ../src/keyboard.c:169
msgid "_File"
msgstr "_Archivo"
#: ../src/keyboard.c:142
#: ../src/keyboard.c:170
msgid "_View"
msgstr "_Ver"
#: ../src/keyboard.c:143
#: ../src/keyboard.c:171
msgid "_Help"
msgstr "_Ayuda"
#: ../src/keyboard.c:451
#: ../src/keyboard.c:816
msgid "Virtual keyboard"
msgstr ""
#: ../src/keyboard.c:571
#: ../src/keyboard.c:936
msgid "Keyboard"
msgstr "Teclado"
#: ../src/keyboard.c:690
#: ../src/keyboard.c:1055
msgid "Virtual keyboard for the DeforaOS desktop"
msgstr "Teclado virtual para el escritorio de DeforaOS"
#: ../src/keyboardctl.c:83
#: ../src/keyboardctl.c:87
#, c-format
msgid ""
"Usage: keyboardctl [-H|-S]\n"
"Usage: %s [-H|-S]\n"
" -H\tHide the keyboard\n"
" -S\tShow the keyboard\n"
msgstr ""
@ -64,8 +65,9 @@ msgstr ""
#: ../src/main.c:92
#, c-format
msgid ""
"Usage: %s [-d|-p|-w|-x][-f font][-m monitor][-n]\n"
"Usage: %s [-d|-p|-w|-x][-f font][-l layout][-m monitor][-n]\n"
" -d\tStart in docked mode\n"
" -l\tSelect a different layout\n"
" -p\tStart as a popup window\n"
" -w\tStart in windowed mode\n"
" -x\tStart in embedded mode\n"

View File

@ -1,14 +1,14 @@
# $Id$
# Copyright (c) 2012-2013 Pierre Pronchery <khorben@defora.org>
# Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org>
# French translations for Keyboard package.
# This file is distributed under the same license as the Keyboard package.
# Pierre Pronchery <khorben@defora.org>, 2012.
#
msgid ""
msgstr ""
"Project-Id-Version: Keyboard 0.2.0\n"
"Project-Id-Version: Keyboard 0.4.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-24 04:16+0200\n"
"POT-Creation-Date: 2020-01-12 07:47+0100\n"
"PO-Revision-Date: 2012-05-20 14:32+0200\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
@ -18,57 +18,59 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/keyboard.c:117
#: ../src/keyboard.c:145
msgid "_Quit"
msgstr "_Quitter"
#: ../src/keyboard.c:124
#: ../src/keyboard.c:152
msgid "_Hide"
msgstr "Masquer"
#: ../src/keyboard.c:132 ../src/keyboard.c:134
#: ../src/keyboard.c:160 ../src/keyboard.c:162
msgid "_About"
msgstr "À propos"
#: ../src/keyboard.c:141
#: ../src/keyboard.c:169
msgid "_File"
msgstr "_Fichier"
#: ../src/keyboard.c:142
#: ../src/keyboard.c:170
msgid "_View"
msgstr "_Vue"
#: ../src/keyboard.c:143
#: ../src/keyboard.c:171
msgid "_Help"
msgstr "_Aide"
#: ../src/keyboard.c:451
#: ../src/keyboard.c:816
msgid "Virtual keyboard"
msgstr "Clavier virtuel"
#: ../src/keyboard.c:571
#: ../src/keyboard.c:936
msgid "Keyboard"
msgstr "Clavier"
#: ../src/keyboard.c:690
#: ../src/keyboard.c:1055
msgid "Virtual keyboard for the DeforaOS desktop"
msgstr "Clavier virtuel pour l'environnement DeforaOS"
#: ../src/keyboardctl.c:83
#: ../src/keyboardctl.c:87
#, c-format
msgid ""
"Usage: keyboardctl [-H|-S]\n"
"Usage: %s [-H|-S]\n"
" -H\tHide the keyboard\n"
" -S\tShow the keyboard\n"
msgstr ""
"Usage: keyboardctl [-H|-S]\n"
"Usage: %s [-H|-S]\n"
" -H\tMasquer le clavier\n"
" -S\tAfficher le clavier\n"
#: ../src/main.c:92
#, c-format
msgid ""
"Usage: %s [-d|-p|-w|-x][-f font][-m monitor][-n]\n"
"Usage: %s [-d|-p|-w|-x][-f font][-l layout][-m monitor][-n]\n"
" -d\tStart in docked mode\n"
" -l\tSelect a different layout\n"
" -p\tStart as a popup window\n"
" -w\tStart in windowed mode\n"
" -x\tStart in embedded mode\n"
@ -76,8 +78,9 @@ msgid ""
" -m\tPlace on a particular monitor (in docked or popup mode)\n"
" -n\tStart without showing up directly (if not embedded)\n"
msgstr ""
"Usage: %s [-d|-p|-w|-x][-f police][-m moniteur][-n]\n"
"Usage: %s [-d|-p|-w|-x][-f police][-l langue][-m moniteur][-n]\n"
" -d\tDémarrer comme un dock\n"
" -l\tSpécifier la langue utilisée pour le clavier\n"
" -p\tDémarrer comme une fenêtre popup\n"
" -w\tDémarrer comme une fenêtre\n"
" -x\tDémarrer en mode embarqué\n"

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2010-2015 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2010-2020 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,8 +25,8 @@
#variables
CONFIGSH="${0%/gettext.sh}/../config.sh"
PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh"
LOCALEDIR="$PREFIX/share/locale"
POTFILES="POTFILES"
PROGNAME="gettext.sh"
@ -40,6 +40,8 @@ MSGMERGE="msgmerge"
RM="rm -f"
XGETTEXT="xgettext --force-po"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#debug
@ -112,7 +114,7 @@ _gettext_pot()
clean=0
install=0
uninstall=0
while getopts "ciuP:" name; do
while getopts "ciO:uP:" name; do
case "$name" in
c)
clean=1
@ -121,6 +123,9 @@ while getopts "ciuP:" name; do
uninstall=0
install=1
;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
u)
install=0
uninstall=1
@ -135,7 +140,7 @@ while getopts "ciuP:" name; do
esac
done
shift $(($OPTIND - 1))
if [ $# -eq 0 ]; then
if [ $# -lt 1 ]; then
_usage
exit $?
fi

View File

@ -1,9 +1,14 @@
vendor=Desktop
package=Keyboard
version=0.3.1
version=0.4.0
config=h,sh
subdirs=data,include,po,src,src/widget,tools
config=h,sh
dist=COPYING,Makefile,README.md,config.h,config.sh
#dist
[COPYING]
install=$(PREFIX)/share/doc/$(PACKAGE)
[README.md]
install=$(PREFIX)/share/doc/Keyboard
install=$(PREFIX)/share/doc/$(PACKAGE)

View File

@ -1,6 +1,6 @@
/* $Id$ */
static char const _copyright[] =
"Copyright © 2011-2016 Pierre Pronchery <khorben@defora.org>";
"Copyright © 2011-2020 Pierre Pronchery <khorben@defora.org>";
/* This file is part of DeforaOS Desktop Keyboard */
static char const _license[] =
"All rights reserved.\n"
@ -33,9 +33,11 @@ static char const _license[] =
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#include <libintl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@ -55,6 +57,10 @@ static char const _license[] =
#define _(string) gettext(string)
#define N_(string) (string)
#ifndef PROGNAME_KEYBOARD
# define PROGNAME_KEYBOARD "keyboard"
#endif
/* Keyboard */
/* private */
@ -104,6 +110,21 @@ typedef struct _KeyboardLayoutDefinition
KeyboardKeyDefinition const * keys;
} KeyboardLayoutDefinition;
typedef enum _KeyboardLayoutType
{
KLT_QWERTY = 0,
KLT_QWERTZ,
KLT_AZERTY
} KeyboardLayoutType;
#define KLT_LAST KLT_AZERTY
#define KLT_COUNT (KLT_LAST + 1)
typedef struct _KeyboardLayoutTypeName
{
KeyboardLayoutType type;
char const * name;
} KeyboardLayoutTypeName;
/* constants */
static char const * _authors[] =
@ -112,6 +133,13 @@ static char const * _authors[] =
NULL
};
static const KeyboardLayoutTypeName _keyboard_layout_type_name[] =
{
{ KLT_QWERTY, "us" },
{ KLT_QWERTZ, "de" },
{ KLT_AZERTY, "fr" }
};
static const DesktopMenu _keyboard_menu_file[] =
{
{ N_("_Quit"), G_CALLBACK(on_file_quit), GTK_STOCK_QUIT,
@ -146,7 +174,7 @@ static const DesktopMenubar _keyboard_menubar[] =
/* variables */
static KeyboardKeyDefinition const _keyboard_layout_letters[] =
static KeyboardKeyDefinition const _keyboard_layout_letters_qwerty[] =
{
{ 0, 2, 0, XK_q, "q" },
{ 0, 0, XK_Shift_L, XK_Q, "Q" },
@ -216,6 +244,174 @@ static KeyboardKeyDefinition const _keyboard_layout_letters[] =
{ 0, 0, 0, 0, NULL }
};
static KeyboardKeyDefinition const _keyboard_layout_letters_qwertz[] =
{
{ 0, 2, 0, XK_q, "q" },
{ 0, 0, XK_Shift_L, XK_Q, "Q" },
{ 0, 2, 0, XK_w, "w" },
{ 0, 0, XK_Shift_L, XK_W, "W" },
{ 0, 2, 0, XK_e, "e" },
{ 0, 0, XK_Shift_L, XK_E, "E" },
{ 0, 2, 0, XK_r, "r" },
{ 0, 0, XK_Shift_L, XK_R, "R" },
{ 0, 2, 0, XK_t, "t" },
{ 0, 0, XK_Shift_L, XK_T, "T" },
{ 0, 2, 0, XK_z, "z" },
{ 0, 0, XK_Shift_L, XK_Z, "Z" },
{ 0, 2, 0, XK_u, "u" },
{ 0, 0, XK_Shift_L, XK_U, "U" },
{ 0, 2, 0, XK_i, "i" },
{ 0, 0, XK_Shift_L, XK_I, "I" },
{ 0, 2, 0, XK_o, "o" },
{ 0, 0, XK_Shift_L, XK_O, "O" },
{ 0, 2, 0, XK_p, "p" },
{ 0, 0, XK_Shift_L, XK_P, "P" },
{ 1, 1, 0, 0, NULL },
{ 1, 2, 0, XK_a, "a" },
{ 1, 0, XK_Shift_L, XK_A, "A" },
{ 1, 2, 0, XK_s, "s" },
{ 1, 0, XK_Shift_L, XK_S, "S" },
{ 1, 2, 0, XK_d, "d" },
{ 1, 0, XK_Shift_L, XK_D, "D" },
{ 1, 2, 0, XK_f, "f" },
{ 1, 0, XK_Shift_L, XK_F, "F" },
{ 1, 2, 0, XK_g, "g" },
{ 1, 0, XK_Shift_L, XK_G, "G" },
{ 1, 2, 0, XK_h, "h" },
{ 1, 0, XK_Shift_L, XK_H, "H" },
{ 1, 2, 0, XK_j, "j" },
{ 1, 0, XK_Shift_L, XK_J, "J" },
{ 1, 2, 0, XK_k, "k" },
{ 1, 0, XK_Shift_L, XK_K, "K" },
{ 1, 2, 0, XK_l, "l" },
{ 1, 0, XK_Shift_L, XK_L, "L" },
{ 2, 2, 0, XK_Shift_L, "\xe2\x87\xa7" },
{ 2, 2, 0, XK_y, "y" },
{ 2, 0, XK_Shift_L, XK_Y, "Y" },
{ 2, 2, 0, XK_x, "x" },
{ 2, 0, XK_Shift_L, XK_X, "X" },
{ 2, 2, 0, XK_c, "c" },
{ 2, 0, XK_Shift_L, XK_C, "C" },
{ 2, 2, 0, XK_v, "v" },
{ 2, 0, XK_Shift_L, XK_V, "V" },
{ 2, 2, 0, XK_b, "b" },
{ 2, 0, XK_Shift_L, XK_B, "B" },
{ 2, 2, 0, XK_n, "n" },
{ 2, 0, XK_Shift_L, XK_N, "N" },
{ 2, 2, 0, XK_m, "m" },
{ 2, 0, XK_Shift_L, XK_M, "M" },
{ 2, 2, 0, XK_comma, "," },
{ 2, 0, XK_Shift_L, XK_comma, "<" },
{ 2, 2, 0, XK_period, "." },
{ 2, 0, XK_Shift_L, XK_period, ">" },
{ 3, 3, 0, 0, NULL },
{ 3, 3, 0, XK_Control_L, "Ctrl" },
{ 3, 3, 0, XK_Alt_L, "Alt" },
{ 3, 5, 0, XK_space, " " },
{ 3, 0, XK_Shift_L, XK_space, " " },
{ 3, 3, 0, XK_Return, "\xe2\x86\xb2" },
{ 3, 3, 0, XK_BackSpace, "\xe2\x8c\xab" },
{ 0, 0, 0, 0, NULL }
};
static KeyboardKeyDefinition const _keyboard_layout_letters_azerty[] =
{
{ 0, 2, 0, XK_a, "a" },
{ 0, 0, XK_Shift_L, XK_A, "A" },
{ 0, 2, 0, XK_z, "z" },
{ 0, 0, XK_Shift_L, XK_Z, "Z" },
{ 0, 2, 0, XK_e, "e" },
{ 0, 0, XK_Shift_L, XK_E, "E" },
#if 0 /* def XK_CURRENCY */
{ 0, 0, XK_Alt_R, XK_EuroSign, "" },
#else
{ 0, 0, XK_Alt_R, XK_E, "" },
#endif
{ 0, 2, 0, XK_r, "r" },
{ 0, 0, XK_Shift_L, XK_R, "R" },
{ 0, 2, 0, XK_t, "t" },
{ 0, 0, XK_Shift_L, XK_T, "T" },
{ 0, 2, 0, XK_y, "y" },
{ 0, 0, XK_Shift_L, XK_Y, "Y" },
{ 0, 2, 0, XK_u, "u" },
{ 0, 0, XK_Shift_L, XK_U, "U" },
{ 0, 2, 0, XK_i, "i" },
{ 0, 0, XK_Shift_L, XK_I, "I" },
{ 0, 2, 0, XK_o, "o" },
{ 0, 0, XK_Shift_L, XK_O, "O" },
{ 0, 2, 0, XK_p, "p" },
{ 0, 0, XK_Shift_L, XK_P, "P" },
{ 0, 2, 0, XK_asciicircum, "^" },
{ 0, 0, XK_Shift_L, XK_quotedbl, "\"" },
{ 0, 2, 0, XK_dollar, "$" },
{ 0, 0, XK_Shift_L, XK_sterling, "£" },
{ 1, 1, 0, 0, NULL },
{ 1, 2, 0, XK_q, "q" },
{ 1, 0, XK_Shift_L, XK_Q, "Q" },
{ 1, 2, 0, XK_s, "s" },
{ 1, 0, XK_Shift_L, XK_S, "S" },
{ 1, 2, 0, XK_d, "d" },
{ 1, 0, XK_Shift_L, XK_D, "D" },
{ 1, 2, 0, XK_f, "f" },
{ 1, 0, XK_Shift_L, XK_F, "F" },
{ 1, 2, 0, XK_g, "g" },
{ 1, 0, XK_Shift_L, XK_G, "G" },
{ 1, 2, 0, XK_h, "h" },
{ 1, 0, XK_Shift_L, XK_H, "H" },
{ 1, 2, 0, XK_j, "j" },
{ 1, 0, XK_Shift_L, XK_J, "J" },
{ 1, 2, 0, XK_k, "k" },
{ 1, 0, XK_Shift_L, XK_K, "K" },
{ 1, 2, 0, XK_l, "l" },
{ 1, 0, XK_Shift_L, XK_L, "L" },
{ 1, 2, 0, XK_m, "m" },
{ 1, 0, XK_Shift_L, XK_M, "M" },
{ 1, 2, 0, XK_ugrave, "ù" },
{ 1, 0, XK_Shift_L, XK_percent, "%" },
{ 1, 2, 0, XK_asterisk, "*" },
{ 1, 0, XK_Shift_L, XK_mu, "µ" },
{ 2, 2, 0, XK_Shift_L, "\xe2\x87\xa7" },
{ 2, 2, 0, XK_less, "<" },
{ 2, 0, XK_Shift_L, XK_less, ">" },
{ 2, 2, 0, XK_w, "w" },
{ 2, 0, XK_Shift_L, XK_W, "W" },
{ 2, 2, 0, XK_x, "x" },
{ 2, 0, XK_Shift_L, XK_X, "X" },
{ 2, 2, 0, XK_c, "c" },
{ 2, 0, XK_Shift_L, XK_C, "C" },
{ 2, 2, 0, XK_v, "v" },
{ 2, 0, XK_Shift_L, XK_V, "V" },
{ 2, 2, 0, XK_b, "b" },
{ 2, 0, XK_Shift_L, XK_B, "B" },
{ 2, 2, 0, XK_n, "n" },
{ 2, 0, XK_Shift_L, XK_N, "N" },
{ 2, 2, 0, XK_comma, "," },
{ 2, 0, XK_Shift_L, XK_question, "?" },
{ 2, 2, 0, XK_semicolon, ";" },
{ 2, 0, XK_Shift_L, XK_period, "." },
{ 2, 2, 0, XK_colon, ":" },
{ 2, 0, XK_Shift_L, XK_slash, "/" },
{ 2, 2, 0, XK_exclam, "!" },
{ 2, 0, XK_Shift_L, XK_paragraph, "§" },
{ 3, 3, 0, 0, NULL },
{ 3, 3, 0, XK_Control_L, "Ctrl" },
{ 3, 3, 0, XK_Alt_L, "Alt" },
{ 3, 7, 0, XK_space, " " },
{ 3, 0, XK_Shift_L, XK_space, " " },
{ 3, 3, 0, XK_Alt_R, "Alt Gr" },
{ 3, 0, XK_Shift_L, XK_Alt_R, "Alt Gr" },
{ 3, 3, 0, XK_Return, "\xe2\x86\xb2" },
{ 3, 3, 0, XK_BackSpace, "\xe2\x8c\xab" },
{ 0, 0, 0, 0, NULL }
};
static KeyboardKeyDefinition const * _keyboard_layout_letters_definition[KLT_COUNT] =
{
_keyboard_layout_letters_qwerty,
_keyboard_layout_letters_qwertz,
_keyboard_layout_letters_azerty
};
static KeyboardKeyDefinition const _keyboard_layout_keypad[] =
{
{ 0, 3, 0, XK_Num_Lock, "Num" },
@ -259,13 +455,17 @@ static KeyboardKeyDefinition const _keyboard_layout_keypad[] =
{ 0, 0, 0, 0, NULL }
};
static KeyboardKeyDefinition const _keyboard_layout_special[] =
static KeyboardKeyDefinition const _keyboard_layout_special_qwerty[] =
{
{ 0, 3, 0, XK_Escape, "Esc" },
{ 0, 2, 0, XK_F1, "F1" },
{ 0, 0, XK_Shift_L, XK_F5, "F5" },
{ 0, 2, 0, XK_F2, "F2" },
{ 0, 0, XK_Shift_L, XK_F6, "F6" },
{ 0, 2, 0, XK_F3, "F3" },
{ 0, 0, XK_Shift_L, XK_F7, "F7" },
{ 0, 2, 0, XK_F4, "F4" },
{ 0, 0, XK_Shift_L, XK_F8, "F8" },
{ 0, 1, 0, 0, NULL },
{ 0, 2, 0, XK_F5, "F5" },
{ 0, 0, XK_Shift_L, XK_F9, "F9" },
@ -276,28 +476,28 @@ static KeyboardKeyDefinition const _keyboard_layout_special[] =
{ 0, 2, 0, XK_F8, "F8" },
{ 0, 0, XK_Shift_L, XK_F12, "F12" },
{ 1, 2, 0, XK_1, "1" },
{ 1, 0, XK_Shift_L, XK_1, "!" },
{ 1, 0, XK_Shift_L, XK_exclam, "!" },
{ 1, 2, 0, XK_2, "2" },
{ 1, 0, XK_Shift_L, XK_2, "@" },
{ 1, 0, XK_Shift_L, XK_at, "@" },
{ 1, 2, 0, XK_3, "3" },
{ 1, 0, XK_Shift_L, XK_3, "#" },
{ 1, 0, XK_Shift_L, XK_numbersign, "#" },
{ 1, 2, 0, XK_4, "4" },
{ 1, 0, XK_Shift_L, XK_4, "$" },
{ 1, 0, XK_Shift_L, XK_dollar, "$" },
{ 1, 2, 0, XK_5, "5" },
{ 1, 0, XK_Shift_L, XK_5, "%" },
{ 1, 0, XK_Shift_L, XK_percent, "%" },
{ 1, 2, 0, XK_6, "6" },
{ 1, 0, XK_Shift_L, XK_6, "^" },
{ 1, 0, XK_Shift_L, XK_asciicircum, "^" },
{ 1, 2, 0, XK_7, "7" },
{ 1, 0, XK_Shift_L, XK_7, "&" },
{ 1, 0, XK_Shift_L, XK_ampersand, "&" },
{ 1, 2, 0, XK_8, "8" },
{ 1, 0, XK_Shift_L, XK_8, "*" },
{ 1, 0, XK_Shift_L, XK_asterisk, "*" },
{ 1, 2, 0, XK_9, "9" },
{ 1, 0, XK_Shift_L, XK_9, "(" },
{ 1, 0, XK_Shift_L, XK_parenleft, "(" },
{ 1, 2, 0, XK_0, "0" },
{ 1, 0, XK_Shift_L, XK_0, ")" },
{ 1, 0, XK_Shift_L, XK_parenright, ")" },
{ 2, 3, 0, XK_Tab, "\xe2\x86\xb9" },
{ 2, 2, 0, XK_grave, "`" },
{ 2, 0, XK_Shift_L, XK_grave, "~" },
{ 2, 0, XK_Shift_L, XK_asciitilde, "~" },
{ 2, 2, 0, XK_minus, "-" },
{ 2, 0, XK_Shift_L, XK_minus, "_" },
{ 2, 2, 0, XK_equal, "=" },
@ -327,11 +527,148 @@ static KeyboardKeyDefinition const _keyboard_layout_special[] =
{ 0, 0, 0, 0, NULL }
};
static KeyboardLayoutDefinition _keyboard_layout[KLS_COUNT] =
static KeyboardKeyDefinition const _keyboard_layout_special_qwertz[] =
{
{ "Abc", _keyboard_layout_letters },
{ "123", _keyboard_layout_keypad },
{ ",./", _keyboard_layout_special }
{ 0, 3, 0, XK_Escape, "Esc" },
{ 0, 2, 0, XK_F1, "F1" },
{ 0, 0, XK_Shift_L, XK_F5, "F5" },
{ 0, 2, 0, XK_F2, "F2" },
{ 0, 0, XK_Shift_L, XK_F6, "F6" },
{ 0, 2, 0, XK_F3, "F3" },
{ 0, 0, XK_Shift_L, XK_F7, "F7" },
{ 0, 2, 0, XK_F4, "F4" },
{ 0, 0, XK_Shift_L, XK_F8, "F8" },
{ 0, 1, 0, 0, NULL },
{ 0, 2, 0, XK_F5, "F5" },
{ 0, 0, XK_Shift_L, XK_F9, "F9" },
{ 0, 2, 0, XK_F6, "F6" },
{ 0, 0, XK_Shift_L, XK_F10, "F10" },
{ 0, 2, 0, XK_F7, "F7" },
{ 0, 0, XK_Shift_L, XK_F11, "F11" },
{ 0, 2, 0, XK_F8, "F8" },
{ 0, 0, XK_Shift_L, XK_F12, "F12" },
{ 1, 2, 0, XK_1, "1" },
{ 1, 0, XK_Shift_L, XK_exclam, "!" },
{ 1, 2, 0, XK_2, "2" },
{ 1, 0, XK_Shift_L, XK_at, "@" },
{ 1, 2, 0, XK_3, "3" },
{ 1, 0, XK_Shift_L, XK_numbersign, "#" },
{ 1, 2, 0, XK_4, "4" },
{ 1, 0, XK_Shift_L, XK_dollar, "$" },
{ 1, 2, 0, XK_5, "5" },
{ 1, 0, XK_Shift_L, XK_percent, "%" },
{ 1, 2, 0, XK_6, "6" },
{ 1, 0, XK_Shift_L, XK_asciicircum, "^" },
{ 1, 2, 0, XK_7, "7" },
{ 1, 0, XK_Shift_L, XK_ampersand, "&" },
{ 1, 2, 0, XK_8, "8" },
{ 1, 0, XK_Shift_L, XK_asterisk, "*" },
{ 1, 2, 0, XK_9, "9" },
{ 1, 0, XK_Shift_L, XK_parenleft, "(" },
{ 1, 2, 0, XK_0, "0" },
{ 1, 0, XK_Shift_L, XK_parenright, ")" },
{ 2, 3, 0, XK_Tab, "\xe2\x86\xb9" },
{ 2, 2, 0, XK_grave, "`" },
{ 2, 0, XK_Shift_L, XK_asciitilde, "~" },
{ 2, 2, 0, XK_minus, "-" },
{ 2, 0, XK_Shift_L, XK_minus, "_" },
{ 2, 2, 0, XK_equal, "=" },
{ 2, 0, XK_Shift_L, XK_equal, "+" },
{ 2, 2, 0, XK_backslash, "\\" },
{ 2, 0, XK_Shift_L, XK_backslash, "|" },
{ 2, 2, 0, XK_bracketleft, "[" },
{ 2, 0, XK_Shift_L, XK_bracketleft, "{" },
{ 2, 2, 0, XK_bracketright, "]" },
{ 2, 0, XK_Shift_L, XK_bracketright, "}" },
{ 2, 2, 0, XK_semicolon, ";" },
{ 2, 0, XK_Shift_L, XK_semicolon, ":" },
{ 2, 2, 0, XK_apostrophe, "'" },
{ 2, 0, XK_Shift_L, XK_apostrophe, "\"" },
{ 3, 3, 0, 0, NULL },
{ 3, 2, 0, XK_Shift_L, "\xe2\x87\xa7" },
{ 3, 3, 0, XK_space, " " },
{ 3, 0, XK_Shift_L, XK_space, " " },
{ 3, 2, 0, XK_comma, "," },
{ 3, 0, XK_Shift_L, XK_comma, "<" },
{ 3, 2, 0, XK_period, "." },
{ 2, 0, XK_Shift_L, XK_period, ">" },
{ 3, 2, 0, XK_slash, "/" },
{ 3, 0, XK_Shift_L, XK_slash, "?" },
{ 3, 3, 0, XK_Return, "\xe2\x86\xb2" },
{ 3, 3, 0, XK_BackSpace, "\xe2\x8c\xab" },
{ 0, 0, 0, 0, NULL }
};
static KeyboardKeyDefinition const _keyboard_layout_special_azerty[] =
{
{ 0, 3, 0, XK_Escape, "Esc" },
{ 0, 1, 0, 0, NULL },
{ 0, 2, 0, XK_F1, "F1" },
{ 0, 0, XK_Shift_L, XK_F5, "F5" },
{ 0, 2, 0, XK_F2, "F2" },
{ 0, 0, XK_Shift_L, XK_F6, "F6" },
{ 0, 2, 0, XK_F3, "F3" },
{ 0, 0, XK_Shift_L, XK_F7, "F7" },
{ 0, 2, 0, XK_F4, "F4" },
{ 0, 0, XK_Shift_L, XK_F8, "F8" },
{ 0, 2, 0, XK_F5, "F5" },
{ 0, 0, XK_Shift_L, XK_F9, "F9" },
{ 0, 2, 0, XK_F6, "F6" },
{ 0, 0, XK_Shift_L, XK_F10, "F10" },
{ 0, 2, 0, XK_F7, "F7" },
{ 0, 0, XK_Shift_L, XK_F11, "F11" },
{ 0, 2, 0, XK_F8, "F8" },
{ 0, 0, XK_Shift_L, XK_F12, "F12" },
{ 1, 1, 0, 0, NULL },
{ 1, 2, 0, XK_ampersand, "&" },
{ 1, 0, XK_Shift_L, XK_1, "1" },
{ 1, 2, 0, XK_eacute, "é" },
{ 1, 0, XK_Shift_L, XK_2, "2" },
{ 1, 2, 0, XK_quotedbl, "\"" },
{ 1, 0, XK_Shift_L, XK_3, "3" },
{ 1, 2, 0, XK_apostrophe, "'" },
{ 1, 0, XK_Shift_L, XK_4, "4" },
{ 1, 2, 0, XK_parenleft, "(" },
{ 1, 0, XK_Shift_L, XK_5, "5" },
{ 1, 2, 0, XK_minus, "-" },
{ 1, 0, XK_Shift_L, XK_6, "6" },
{ 1, 2, 0, XK_egrave, "è" },
{ 1, 0, XK_Shift_L, XK_7, "7" },
{ 1, 2, 0, XK_underscore, "_" },
{ 1, 0, XK_Shift_L, XK_8, "8" },
{ 1, 2, 0, XK_ccedilla, "ç" },
{ 1, 0, XK_Shift_L, XK_9, "9" },
{ 1, 2, 0, XK_aacute, "à" },
{ 1, 0, XK_Shift_L, XK_0, "0" },
{ 2, 2, 0, XK_Tab, "\xe2\x86\xb9" },
{ 2, 2, 0, XK_twosuperior, "²" },
{ 2, 2, 0, XK_asciitilde, "~" },
{ 2, 2, 0, XK_numbersign, "#" },
{ 2, 2, 0, XK_braceleft, "{" },
{ 2, 2, 0, XK_bracketleft, "[" },
{ 2, 2, 0, XK_bracketright, "]" },
{ 2, 2, 0, XK_braceright, "}" },
{ 2, 2, 0, XK_parenright, ")" },
{ 2, 0, XK_Shift_L, XK_degree, "°" },
{ 2, 2, 0, XK_equal, "=" },
{ 2, 0, XK_Shift_L, XK_plus, "+" },
{ 3, 3, 0, 0, NULL },
{ 3, 2, 0, XK_Shift_L, "\xe2\x87\xa7" },
{ 3, 2, 0, XK_bracketleft, "|" },
{ 3, 2, 0, XK_grave, "`" },
{ 3, 2, 0, XK_backslash, "\\" },
{ 3, 2, 0, XK_asciicircum, "^" },
{ 3, 2, 0, XK_at, "@" },
{ 3, 3, 0, XK_Return, "\xe2\x86\xb2" },
{ 3, 3, 0, XK_BackSpace, "\xe2\x8c\xab" },
{ 0, 0, 0, 0, NULL }
};
static KeyboardKeyDefinition const * _keyboard_layout_special_definition[KLT_COUNT] =
{
_keyboard_layout_special_qwerty,
_keyboard_layout_special_qwertz,
_keyboard_layout_special_azerty
};
@ -340,6 +677,8 @@ static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
KeyboardLayoutDefinition * definitions,
size_t definitions_cnt, KeyboardLayoutSection section);
static void _keyboard_error(Keyboard * keyboard, char const * format, ...);
/* public */
/* functions */
@ -365,6 +704,14 @@ Keyboard * keyboard_new(KeyboardPrefs * prefs)
GdkColor gray = { 0x90909090, 0x9090, 0x9090, 0x9090 };
#endif
unsigned long id;
KeyboardLayoutDefinition layout[KLS_COUNT] =
{
{ "Abc", _keyboard_layout_letters_qwerty },
{ "123", _keyboard_layout_keypad },
{ ",./", _keyboard_layout_special_qwerty }
};
size_t i;
KeyboardLayoutTypeName const * typename;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
@ -423,14 +770,32 @@ Keyboard * keyboard_new(KeyboardPrefs * prefs)
vbox = widget;
}
/* layouts */
if((widget = _keyboard_add_layout(keyboard, _keyboard_layout,
KLS_COUNT, KLS_LETTERS)) != NULL)
if(prefs->layout != NULL)
{
for(i = 0; i < sizeof(_keyboard_layout_type_name)
/ sizeof(*_keyboard_layout_type_name); i++)
{
typename = &_keyboard_layout_type_name[i];
if(strcasecmp(prefs->layout, typename->name) == 0)
{
layout[KLS_LETTERS].keys = _keyboard_layout_letters_definition[typename->type];
layout[KLS_SPECIAL].keys = _keyboard_layout_special_definition[typename->type];
break;
}
typename = NULL;
}
if(typename == NULL)
_keyboard_error(NULL, "%s: Unsupported layout",
prefs->layout);
}
if((widget = _keyboard_add_layout(keyboard, layout, KLS_COUNT,
KLS_LETTERS)) != NULL)
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
if((widget = _keyboard_add_layout(keyboard, _keyboard_layout,
KLS_COUNT, KLS_KEYPAD)) != NULL)
if((widget = _keyboard_add_layout(keyboard, layout, KLS_COUNT,
KLS_KEYPAD)) != NULL)
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
if((widget = _keyboard_add_layout(keyboard, _keyboard_layout,
KLS_COUNT, KLS_SPECIAL)) != NULL)
if((widget = _keyboard_add_layout(keyboard, layout, KLS_COUNT,
KLS_SPECIAL)) != NULL)
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
gtk_widget_show(vbox);
if(prefs->mode == KEYBOARD_MODE_EMBEDDED)
@ -695,7 +1060,7 @@ void keyboard_show_about(Keyboard * keyboard)
desktop_about_dialog_set_name(keyboard->ab_window, PACKAGE);
desktop_about_dialog_set_version(keyboard->ab_window, VERSION);
desktop_about_dialog_set_website(keyboard->ab_window,
"http://www.defora.org/");
"https://www.defora.org/");
g_signal_connect_swapped(keyboard->ab_window, "delete-event",
G_CALLBACK(_about_on_closex), keyboard);
gtk_widget_show(keyboard->ab_window);
@ -714,6 +1079,10 @@ static gboolean _about_on_closex(gpointer data)
/* private */
/* keyboard_add_layout */
static void _layout_clicked(GtkWidget * widget, gpointer data);
static void _layout_selector(Keyboard * keyboard, KeyboardLayout * layout,
KeyboardLayoutDefinition * definitions,
size_t definitions_cnt, KeyboardLayoutSection section,
unsigned int row, unsigned int column, unsigned width);
static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
KeyboardLayoutDefinition * definitions,
@ -724,17 +1093,11 @@ static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
KeyboardKeyDefinition const * keys;
size_t i;
KeyboardKey * key;
GtkWidget * label;
GtkWidget * widget;
unsigned long l;
#if GTK_CHECK_VERSION(3, 0, 0)
gboolean dark = FALSE;
GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
#else
GdkColor black = { 0x00000000, 0x0000, 0x0000, 0x0000 };
GdkColor white = { 0xffffffff, 0xffff, 0xffff, 0xffff };
GdkColor gray = { 0xd0d0d0d0, 0xd0d0, 0xd0d0, 0xd0d0 };
#if !GTK_CHECK_VERSION(3, 0, 0)
const GdkColor black = { 0x00000000, 0x0000, 0x0000, 0x0000 };
const GdkColor white = { 0xffffffff, 0xffff, 0xffff, 0xffff };
const GdkColor gray = { 0xd0d0d0d0, 0xd0d0, 0xd0d0, 0xd0d0 };
#endif
if((p = realloc(keyboard->layouts, sizeof(*p) * (keyboard->layouts_cnt
@ -743,10 +1106,6 @@ static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
keyboard->layouts = p;
if((layout = keyboard_layout_new()) == NULL)
return NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
g_object_get(gtk_settings_get_default(),
"gtk-application-prefer-dark-theme", &dark, NULL);
#endif
keyboard->layouts[keyboard->layouts_cnt++] = layout;
keys = definitions[section].keys;
for(i = 0; keys[i].width != 0; i++)
@ -769,27 +1128,8 @@ static GtkWidget * _keyboard_add_layout(Keyboard * keyboard,
keys[i + 1].keysym, keys[i + 1].label);
}
}
l = (section + 1) % definitions_cnt;
label = gtk_label_new(definitions[l].label);
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_override_color(label, GTK_STATE_FLAG_NORMAL,
dark ? &white : &black);
#else
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &black);
#endif
gtk_widget_override_font(label, keyboard->font);
widget = gtk_button_new();
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_override_background_color(widget, GTK_STATE_FLAG_NORMAL,
dark ? &black : &white);
#else
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &white);
#endif
gtk_container_add(GTK_CONTAINER(widget), label);
g_object_set_data(G_OBJECT(widget), "layout", (void *)l);
g_signal_connect(widget, "clicked", G_CALLBACK(_layout_clicked),
keyboard);
keyboard_layout_add_widget(layout, 3, 0, 3, widget);
_layout_selector(keyboard, layout, definitions, definitions_cnt,
section, 3, 0, 3);
widget = keyboard_layout_get_widget(layout);
gtk_widget_show_all(widget);
gtk_widget_set_no_show_all(widget, TRUE);
@ -814,3 +1154,61 @@ static void _layout_clicked(GtkWidget * widget, gpointer data)
break;
}
}
static void _layout_selector(Keyboard * keyboard, KeyboardLayout * layout,
KeyboardLayoutDefinition * definitions,
size_t definitions_cnt, KeyboardLayoutSection section,
unsigned int row, unsigned int column, unsigned int width)
{
unsigned long l;
GtkWidget * label;
GtkWidget * widget;
#if GTK_CHECK_VERSION(3, 0, 0)
gboolean dark = FALSE;
const GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 };
const GdkRGBA white = { 1.0, 1.0, 1.0, 1.0 };
#else
const GdkColor black = { 0x00000000, 0x0000, 0x0000, 0x0000 };
const GdkColor white = { 0xffffffff, 0xffff, 0xffff, 0xffff };
#endif
#if GTK_CHECK_VERSION(3, 0, 0)
g_object_get(gtk_settings_get_default(),
"gtk-application-prefer-dark-theme", &dark, NULL);
#endif
l = (section + 1) % definitions_cnt;
label = gtk_label_new(definitions[l].label);
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_override_color(label, GTK_STATE_FLAG_NORMAL,
dark ? &white : &black);
#else
gtk_widget_modify_fg(label, GTK_STATE_NORMAL, &black);
#endif
gtk_widget_override_font(label, keyboard->font);
widget = gtk_button_new();
#if GTK_CHECK_VERSION(3, 0, 0)
gtk_widget_override_background_color(widget, GTK_STATE_FLAG_NORMAL,
dark ? &black : &white);
#else
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &white);
#endif
gtk_container_add(GTK_CONTAINER(widget), label);
g_object_set_data(G_OBJECT(widget), "layout", (void *)l);
g_signal_connect(widget, "clicked", G_CALLBACK(_layout_clicked),
keyboard);
keyboard_layout_add_widget(layout, row, column, width, widget);
}
/* keyboard_error */
static void _keyboard_error(Keyboard * keyboard, char const * format, ...)
{
va_list ap;
/* TODO add support for error dialog messages */
va_start(ap, format);
fprintf(stderr, "%s: ", PROGNAME_KEYBOARD);
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
va_end(ap);
}

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010-2016 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2010-2020 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Keyboard */
/* All rights reserved.
*
@ -53,6 +53,7 @@ typedef struct _KeyboardPrefs
{
int monitor;
char const * font;
char const * layout;
KeyboardMode mode;
int wait;
} KeyboardPrefs;

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2012-2016 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Keyboard */
/* All rights reserved.
*
@ -50,6 +50,10 @@
# define LOCALEDIR DATADIR "/locale"
#endif
#ifndef PROGNAME_KEYBOARDCTL
# define PROGNAME_KEYBOARDCTL "keyboardctl"
#endif
/* keyboardctl */
/* private */
@ -71,7 +75,7 @@ static int _keyboardctl(KeyboardMessage message, unsigned int arg1)
/* error */
static int _error(char const * message, int ret)
{
fputs("keyboardctl: ", stderr);
fputs(PROGNAME_KEYBOARDCTL ": ", stderr);
perror(message);
return ret;
}
@ -80,9 +84,9 @@ static int _error(char const * message, int ret)
/* usage */
static int _usage(void)
{
fputs(_("Usage: keyboardctl [-H|-S]\n"
fprintf(stderr, _("Usage: %s [-H|-S]\n"
" -H Hide the keyboard\n"
" -S Show the keyboard\n"), stderr);
" -S Show the keyboard\n"), PROGNAME_KEYBOARDCTL);
return 1;
}

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010-2016 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2010-2020 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Keyboard */
/* All rights reserved.
*
@ -146,7 +146,7 @@ KeyboardKey * keyboard_layout_add(KeyboardLayout * layout, unsigned int row,
options, 2, 2);
p->keys[p->keys_cnt++] = ret;
}
p->width+=width;
p->width += width;
return ret;
}

View File

@ -1,5 +1,5 @@
/* $Id$ */
/* Copyright (c) 2010-2016 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2010-2020 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Keyboard */
/* All rights reserved.
*
@ -40,17 +40,17 @@
#define _(string) gettext(string)
/* constants */
#ifndef PROGNAME
# define PROGNAME "keyboard"
#ifndef PROGNAME_KEYBOARD
# define PROGNAME_KEYBOARD "keyboard"
#endif
#ifndef PREFIX
# define PREFIX "/usr/local"
# define PREFIX "/usr/local"
#endif
#ifndef DATADIR
# define DATADIR PREFIX "/share"
# define DATADIR PREFIX "/share"
#endif
#ifndef LOCALEDIR
# define LOCALEDIR DATADIR "/locale"
# define LOCALEDIR DATADIR "/locale"
#endif
@ -80,7 +80,7 @@ static int _keyboard(KeyboardPrefs * prefs)
/* error */
static int _error(char const * message, int ret)
{
fputs(PROGNAME ": ", stderr);
fputs(PROGNAME_KEYBOARD ": ", stderr);
perror(message);
return ret;
}
@ -89,14 +89,17 @@ static int _error(char const * message, int ret)
/* usage */
static int _usage(void)
{
fprintf(stderr, _("Usage: %s [-d|-p|-w|-x][-f font][-m monitor][-n]\n"
fprintf(stderr, _("Usage: %s [-d|-p|-w|-x][-f font][-l layout]"
"[-m monitor][-n]\n"
" -d Start in docked mode\n"
" -l Select a different layout\n"
" -p Start as a popup window\n"
" -w Start in windowed mode\n"
" -x Start in embedded mode\n"
" -f Set the font used for the keys\n"
" -m Place on a particular monitor (in docked or popup mode)\n"
" -n Start without showing up directly (if not embedded)\n"), PROGNAME);
" -n Start without showing up directly (if not embedded)\n"),
PROGNAME_KEYBOARD);
return 1;
}
@ -116,7 +119,7 @@ int main(int argc, char * argv[])
textdomain(PACKAGE);
memset(&prefs, 0, sizeof(prefs));
gtk_init(&argc, &argv);
while((o = getopt(argc, argv, "df:m:npwx")) != -1)
while((o = getopt(argc, argv, "df:l:m:npwx")) != -1)
switch(o)
{
case 'd':
@ -125,6 +128,9 @@ int main(int argc, char * argv[])
case 'f':
prefs.font = optarg;
break;
case 'l':
prefs.layout = optarg;
break;
case 'm':
prefs.monitor = strtol(optarg, &p, 10);
if(optarg[0] == '\0' || *p != '\0')

View File

@ -1,6 +1,6 @@
targets=keyboard,keyboardctl
cflags_force=`pkg-config --cflags libDesktop`
cflags=-W -Wall -g -O2 -pedantic -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all
cflags=-W -Wall -g -O2 -pedantic -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libDesktop`
ldflags=-pie -Wl,-z,relro -Wl,-z,now
dist=Makefile,callbacks.h,common.h,key.h,keyboard.h,layout.h

View File

@ -1,6 +1,6 @@
targets=keyboard
cflags_force=-W `pkg-config --cflags libDesktop x11` -fPIC
cflags=-Wall -g -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector-all
cflags_force=`pkg-config --cflags libDesktop x11` -fPIC
cflags=-W -Wall -g -O2 -pedantic -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libDesktop x11` -lXtst
ldflags=-Wl,-z,relro -Wl,-z,now
dist=Makefile

View File

@ -1,12 +1,12 @@
targets=plug,snooper,xkey
cflags=-W -Wall -g -O2 -pedantic -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector-all
cflags=-W -Wall -g -O2 -pedantic -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags=-pie -Wl,-z,relro -Wl,-z,now
#for Gtk+ 2
cflags_force=`pkg-config --cflags gtk+-2.0`
ldflags_force=`pkg-config --libs gtk+-2.0`
#cflags_force=`pkg-config --cflags gtk+-2.0`
#ldflags_force=`pkg-config --libs gtk+-2.0`
#for Gtk+ 3
#cflags_force=`pkg-config --cflags gtk+-3.0`
#ldflags_force=`pkg-config --libs gtk+-3.0`
cflags_force=`pkg-config --cflags gtk+-3.0`
ldflags_force=`pkg-config --libs gtk+-3.0`
dist=Makefile
[plug]