Compare commits
	
		
			2 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8c0b55d7f8 | |||
| 72da6d02ae | 
@ -23,12 +23,10 @@
 | 
			
		||||
 * @short_description: a #GtkWidget displaying #EekKeyboard
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_CONFIG_H
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#endif  /* HAVE_CONFIG_H */
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_LIBCANBERRA
 | 
			
		||||
#include <canberra-gtk.h>
 | 
			
		||||
#ifdef HAVE_GSOUND
 | 
			
		||||
#include <gsound.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <math.h>
 | 
			
		||||
@ -58,6 +56,9 @@ typedef struct _EekGtkKeyboardPrivate
 | 
			
		||||
    EekRenderer *renderer;
 | 
			
		||||
    EekKeyboard *keyboard;
 | 
			
		||||
    EekTheme *theme;
 | 
			
		||||
#ifdef HAVE_GSOUND
 | 
			
		||||
    GSoundContext *sound_ctx;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    GdkEventSequence *sequence; // unowned reference
 | 
			
		||||
} EekGtkKeyboardPrivate;
 | 
			
		||||
@ -438,7 +439,16 @@ eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
 | 
			
		||||
static void
 | 
			
		||||
eek_gtk_keyboard_init (EekGtkKeyboard *self)
 | 
			
		||||
{
 | 
			
		||||
    /* void */
 | 
			
		||||
#if HAVE_GSOUND
 | 
			
		||||
    EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
 | 
			
		||||
    GError *err = NULL;
 | 
			
		||||
 | 
			
		||||
    priv->sound_ctx = gsound_context_new(NULL, &err);
 | 
			
		||||
    if (!priv->sound_ctx) {
 | 
			
		||||
        g_warning ("GSound init failed: %s", err->message);
 | 
			
		||||
        g_clear_error (&err);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -567,11 +577,11 @@ on_key_pressed (EekKey      *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,
 | 
			
		||||
                            CA_PROP_EVENT_ID, "button-pressed",
 | 
			
		||||
                            CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
 | 
			
		||||
                            CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
 | 
			
		||||
#if HAVE_GSOUND
 | 
			
		||||
    g_return_if_fail (GSOUND_IS_CONTEXT (priv->sound_ctx));
 | 
			
		||||
    gsound_context_play_simple(priv->sound_ctx, NULL, NULL,
 | 
			
		||||
                               GSOUND_ATTR_EVENT_ID, "button-pressed",
 | 
			
		||||
                               GSOUND_ATTR_EVENT_DESCRIPTION, "Button pressed",
 | 
			
		||||
                               NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
@ -589,11 +599,11 @@ on_key_released (EekKey      *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,
 | 
			
		||||
                            CA_PROP_EVENT_ID, "button-released",
 | 
			
		||||
                            CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
 | 
			
		||||
                            CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
 | 
			
		||||
#if HAVE_GSOUND
 | 
			
		||||
    g_return_if_fail (GSOUND_IS_CONTEXT (priv->sound_ctx));
 | 
			
		||||
    gsound_context_play_simple(priv->sound_ctx, NULL, NULL,
 | 
			
		||||
                               GSOUND_ATTR_EVENT_ID, "button-released",
 | 
			
		||||
                               GSOUND_ATTR_EVENT_DESCRIPTION, "Button released",
 | 
			
		||||
                               NULL);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								meson.build
									
									
									
									
									
								
							@ -3,12 +3,14 @@ project(
 | 
			
		||||
    'c', 'rust',
 | 
			
		||||
    version: '1.0.10',
 | 
			
		||||
    license: 'GPLv3',
 | 
			
		||||
    meson_version: '>=0.43.0',
 | 
			
		||||
    meson_version: '>=0.49.0',
 | 
			
		||||
    default_options: [ 'warning_level=1', 'buildtype=debugoptimized', 'c_std=gnu11' ],
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
i18n = import('i18n')
 | 
			
		||||
 | 
			
		||||
conf_data = configuration_data()
 | 
			
		||||
 | 
			
		||||
if get_option('buildtype').startswith('debug')
 | 
			
		||||
    add_project_arguments('-DDEBUG=1', language : 'c')
 | 
			
		||||
endif
 | 
			
		||||
@ -26,6 +28,22 @@ else
 | 
			
		||||
endif
 | 
			
		||||
dbusdir = join_paths(depdatadir, 'dbus-1/interfaces')
 | 
			
		||||
 | 
			
		||||
gsound_dep = dependency('gsound', required : false)
 | 
			
		||||
if gsound_dep.found()
 | 
			
		||||
  conf_data.set10('HAVE_GSOUND', true)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
summary = [
 | 
			
		||||
        '',
 | 
			
		||||
        '------------------',
 | 
			
		||||
        'squeekboard @0@'.format(meson.project_version()),
 | 
			
		||||
        '',
 | 
			
		||||
        '   gsound: @0@'.format(conf_data.get('HAVE_GSOUND', false)),
 | 
			
		||||
        '------------------',
 | 
			
		||||
        ''
 | 
			
		||||
]
 | 
			
		||||
message('\n'.join(summary))
 | 
			
		||||
 | 
			
		||||
subdir('data')
 | 
			
		||||
subdir('protocols')
 | 
			
		||||
subdir('eek')
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										6
									
								
								src/config.h.in
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								src/config.h.in
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * Autogenerated by the Meson build system.
 | 
			
		||||
 * Do not edit, your changes will be lost.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#mesondefine HAVE_GSOUND
 | 
			
		||||
@ -4,7 +4,10 @@ dbus_src = gnome.gdbus_codegen(
 | 
			
		||||
    join_paths(meson.source_root() / 'data' / 'dbus', 'sm.puri.OSK0.xml')
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
config_h = configure_file(input: 'config.h.in', output: 'config.h',configuration: conf_data)
 | 
			
		||||
 | 
			
		||||
sources = [
 | 
			
		||||
  config_h,
 | 
			
		||||
  'imservice.c',
 | 
			
		||||
  'server-context-service.c',
 | 
			
		||||
  'server-main.c',
 | 
			
		||||
@ -60,6 +63,7 @@ deps = [
 | 
			
		||||
  cc.find_library('dl'),
 | 
			
		||||
  cc.find_library('pthread'),
 | 
			
		||||
#  dependency('libxklavier'), # FIXME remove
 | 
			
		||||
  gsound_dep,
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
# Replacement for eekboard-server
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user