cleanup: Remove dead fullscreen mode
This commit is contained in:
@ -51,7 +51,6 @@ enum {
|
|||||||
PROP_0, // Magic: without this, keyboard is not useable in g_object_notify
|
PROP_0, // Magic: without this, keyboard is not useable in g_object_notify
|
||||||
PROP_KEYBOARD,
|
PROP_KEYBOARD,
|
||||||
PROP_VISIBLE,
|
PROP_VISIBLE,
|
||||||
PROP_FULLSCREEN,
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,7 +69,6 @@ static guint signals[LAST_SIGNAL] = { 0, };
|
|||||||
struct _EekboardContextServicePrivate {
|
struct _EekboardContextServicePrivate {
|
||||||
gboolean enabled;
|
gboolean enabled;
|
||||||
gboolean visible;
|
gboolean visible;
|
||||||
gboolean fullscreen;
|
|
||||||
|
|
||||||
LevelKeyboard *keyboard; // currently used keyboard
|
LevelKeyboard *keyboard; // currently used keyboard
|
||||||
GHashTable *keyboard_hash; // a table of available keyboards, per layout
|
GHashTable *keyboard_hash; // a table of available keyboards, per layout
|
||||||
@ -170,9 +168,6 @@ eekboard_context_service_set_property (GObject *object,
|
|||||||
case PROP_VISIBLE:
|
case PROP_VISIBLE:
|
||||||
context->priv->visible = g_value_get_boolean (value);
|
context->priv->visible = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
case PROP_FULLSCREEN:
|
|
||||||
context->priv->fullscreen = g_value_get_boolean (value);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -194,9 +189,6 @@ eekboard_context_service_get_property (GObject *object,
|
|||||||
case PROP_VISIBLE:
|
case PROP_VISIBLE:
|
||||||
g_value_set_boolean (value, context->priv->visible);
|
g_value_set_boolean (value, context->priv->visible);
|
||||||
break;
|
break;
|
||||||
case PROP_FULLSCREEN:
|
|
||||||
g_value_set_boolean (value, context->priv->fullscreen);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -401,20 +393,6 @@ eekboard_context_service_class_init (EekboardContextServiceClass *klass)
|
|||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_VISIBLE,
|
PROP_VISIBLE,
|
||||||
pspec);
|
pspec);
|
||||||
|
|
||||||
/**
|
|
||||||
* EekboardContextService:fullscreen:
|
|
||||||
*
|
|
||||||
* Flag to indicate if keyboard is rendered in fullscreen mode.
|
|
||||||
*/
|
|
||||||
pspec = g_param_spec_boolean ("fullscreen",
|
|
||||||
"Fullscreen",
|
|
||||||
"Fullscreen",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READWRITE);
|
|
||||||
g_object_class_install_property (gobject_class,
|
|
||||||
PROP_FULLSCREEN,
|
|
||||||
pspec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -524,19 +502,6 @@ eekboard_context_service_get_keyboard (EekboardContextService *context)
|
|||||||
return context->priv->keyboard;
|
return context->priv->keyboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* eekboard_context_service_get_fullscreen:
|
|
||||||
* @context: an #EekboardContextService
|
|
||||||
*
|
|
||||||
* Check if keyboard is rendered in fullscreen mode in @context.
|
|
||||||
* Returns: %TRUE or %FALSE
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
eekboard_context_service_get_fullscreen (EekboardContextService *context)
|
|
||||||
{
|
|
||||||
return context->priv->fullscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
||||||
const LevelKeyboard *keyboard)
|
const LevelKeyboard *keyboard)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -98,8 +98,6 @@ void eekboard_context_service_hide_keyboard
|
|||||||
(EekboardContextService *context);
|
(EekboardContextService *context);
|
||||||
void eekboard_context_service_destroy (EekboardContextService *context);
|
void eekboard_context_service_destroy (EekboardContextService *context);
|
||||||
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
LevelKeyboard *eekboard_context_service_get_keyboard(EekboardContextService *context);
|
||||||
gboolean eekboard_context_service_get_fullscreen
|
|
||||||
(EekboardContextService *context);
|
|
||||||
|
|
||||||
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
void eekboard_context_service_set_keymap(EekboardContextService *context,
|
||||||
const LevelKeyboard *keyboard);
|
const LevelKeyboard *keyboard);
|
||||||
|
|||||||
@ -52,17 +52,6 @@ struct _ServerContextServiceClass {
|
|||||||
|
|
||||||
G_DEFINE_TYPE (ServerContextService, server_context_service, EEKBOARD_TYPE_CONTEXT_SERVICE);
|
G_DEFINE_TYPE (ServerContextService, server_context_service, EEKBOARD_TYPE_CONTEXT_SERVICE);
|
||||||
|
|
||||||
static void set_geometry (ServerContextService *context);
|
|
||||||
|
|
||||||
static void
|
|
||||||
on_monitors_changed (GdkScreen *screen,
|
|
||||||
ServerContextService *context)
|
|
||||||
|
|
||||||
{
|
|
||||||
if (context->window)
|
|
||||||
set_geometry (context);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_destroy (GtkWidget *widget, gpointer user_data)
|
on_destroy (GtkWidget *widget, gpointer user_data)
|
||||||
{
|
{
|
||||||
@ -108,15 +97,6 @@ on_notify_keyboard (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
on_notify_fullscreen (GObject *object,
|
|
||||||
GParamSpec *spec,
|
|
||||||
ServerContextService *context)
|
|
||||||
{
|
|
||||||
if (context->window)
|
|
||||||
set_geometry (context);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_notify_map (GObject *object,
|
on_notify_map (GObject *object,
|
||||||
ServerContextService *context)
|
ServerContextService *context)
|
||||||
@ -132,49 +112,6 @@ on_notify_unmap (GObject *object,
|
|||||||
g_object_set (context, "visible", FALSE, NULL);
|
g_object_set (context, "visible", FALSE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_geometry (ServerContextService *context)
|
|
||||||
{
|
|
||||||
GdkScreen *screen = gdk_screen_get_default ();
|
|
||||||
GdkWindow *root = gdk_screen_get_root_window (screen);
|
|
||||||
GdkDisplay *display = gdk_display_get_default ();
|
|
||||||
GdkMonitor *monitor = gdk_display_get_monitor_at_window (display, root);
|
|
||||||
LevelKeyboard *keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
|
||||||
|
|
||||||
GdkRectangle rect;
|
|
||||||
|
|
||||||
gdk_monitor_get_geometry (monitor, &rect);
|
|
||||||
EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(keyboard));
|
|
||||||
|
|
||||||
if (eekboard_context_service_get_fullscreen (EEKBOARD_CONTEXT_SERVICE(context))) {
|
|
||||||
gint width = rect.width;
|
|
||||||
gint height = rect.height;
|
|
||||||
|
|
||||||
if (width > height) {
|
|
||||||
width *= context->size_constraint_landscape[0];
|
|
||||||
height *= context->size_constraint_landscape[1];
|
|
||||||
} else {
|
|
||||||
width *= context->size_constraint_portrait[0];
|
|
||||||
height *= context->size_constraint_portrait[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (width * bounds.height > height * bounds.width)
|
|
||||||
width = (height / bounds.height) * bounds.width;
|
|
||||||
else
|
|
||||||
height = (width / bounds.width) * bounds.height;
|
|
||||||
|
|
||||||
gtk_window_resize (GTK_WINDOW(context->widget), width, height);
|
|
||||||
|
|
||||||
gtk_window_move (GTK_WINDOW(context->window),
|
|
||||||
(rect.width - width) / 2,
|
|
||||||
rect.height - height);
|
|
||||||
|
|
||||||
gtk_window_set_decorated (GTK_WINDOW(context->window), FALSE);
|
|
||||||
gtk_window_set_resizable (GTK_WINDOW(context->window), FALSE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define KEYBOARD_HEIGHT 210
|
#define KEYBOARD_HEIGHT 210
|
||||||
static void
|
static void
|
||||||
make_window (ServerContextService *context)
|
make_window (ServerContextService *context)
|
||||||
@ -238,7 +175,6 @@ make_widget (ServerContextService *context)
|
|||||||
gtk_widget_set_has_tooltip (context->widget, TRUE);
|
gtk_widget_set_has_tooltip (context->widget, TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
|
gtk_container_add (GTK_CONTAINER(context->window), context->widget);
|
||||||
gtk_widget_show (context->widget);
|
gtk_widget_show (context->widget);
|
||||||
set_geometry (context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -365,21 +301,10 @@ server_context_service_class_init (ServerContextServiceClass *klass)
|
|||||||
static void
|
static void
|
||||||
server_context_service_init (ServerContextService *context)
|
server_context_service_init (ServerContextService *context)
|
||||||
{
|
{
|
||||||
GdkScreen *screen = gdk_screen_get_default ();
|
|
||||||
|
|
||||||
g_signal_connect (screen,
|
|
||||||
"monitors-changed",
|
|
||||||
G_CALLBACK(on_monitors_changed),
|
|
||||||
context);
|
|
||||||
g_signal_connect (context,
|
g_signal_connect (context,
|
||||||
"notify::keyboard",
|
"notify::keyboard",
|
||||||
G_CALLBACK(on_notify_keyboard),
|
G_CALLBACK(on_notify_keyboard),
|
||||||
context);
|
context);
|
||||||
|
|
||||||
g_signal_connect (context,
|
|
||||||
"notify::fullscreen",
|
|
||||||
G_CALLBACK(on_notify_fullscreen),
|
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EekboardContextService *
|
EekboardContextService *
|
||||||
|
|||||||
Reference in New Issue
Block a user