Merge branch 'atkwindow'

This commit is contained in:
Alejandro Piñeiro 2011-08-30 12:26:35 +02:00
commit f1a7cd7c0f
4 changed files with 24 additions and 137 deletions

View File

@ -38,16 +38,6 @@
#include "cally-stage.h"
#include "cally-actor-private.h"
enum {
ACTIVATE,
CREATE,
DEACTIVATE,
DESTROY,
LAST_SIGNAL
};
static guint cally_stage_signals [LAST_SIGNAL] = { 0, };
static void cally_stage_class_init (CallyStageClass *klass);
static void cally_stage_init (CallyStage *stage);
@ -56,6 +46,9 @@ static void cally_stage_real_initialize (AtkObject *obj,
gpointer data);
static AtkStateSet* cally_stage_ref_state_set (AtkObject *obj);
/* AtkWindow */
static void cally_stage_window_interface_init (AtkWindowIface *iface);
/* Auxiliar */
static void cally_stage_activate_cb (ClutterStage *stage,
gpointer data);
@ -63,7 +56,11 @@ static void cally_stage_deactivate_cb (ClutterStage *stage,
gpointer data);
G_DEFINE_TYPE (CallyStage, cally_stage, CALLY_TYPE_GROUP);
G_DEFINE_TYPE_WITH_CODE (CallyStage,
cally_stage,
CALLY_TYPE_GROUP,
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
cally_stage_window_interface_init));
#define CALLY_STAGE_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), CALLY_TYPE_STAGE, CallyStagePrivate))
@ -85,88 +82,6 @@ cally_stage_class_init (CallyStageClass *klass)
class->ref_state_set = cally_stage_ref_state_set;
g_type_class_add_private (gobject_class, sizeof (CallyStagePrivate));
/**
* CallyStage::activate:
* @cally_actor: the object which received the signal
*
* The ::activate signal is emitted when the stage receives the key
* focus from the underlying window system.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:activate"
*
* Since: 1.4
*/
cally_stage_signals [ACTIVATE] =
g_signal_new ("activate",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* CallyStage::create:
* @cally_actor: the object which received the signal
*
* The ::create signal is emitted when the stage is created.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:create"
*
* Since: 1.4
*/
cally_stage_signals [CREATE] =
g_signal_new ("create",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* CallyStage::deactivate:
* @cally_actor: the object which received the signal
*
* The ::deactivate signal is emitted when the stage loses key focus
* from the underlying window system.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:deactivate"
*
* Since: 1.4
*/
cally_stage_signals [DEACTIVATE] =
g_signal_new ("deactivate",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* CallyStage::destroy:
* @cally_actor: the object which received the signal
*
* The ::destroy signal is emitted when the stage is destroyed.
*
* Toolkit implementation note: it is used when anyone adds a global
* event listener to "window:destroy"
*
* Since: 1.4
*/
cally_stage_signals [DESTROY] =
g_signal_new ("destroy",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
0, /* default signal handler */
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
}
static void
@ -246,6 +161,13 @@ cally_stage_ref_state_set (AtkObject *obj)
return state_set;
}
/* AtkWindow */
static void
cally_stage_window_interface_init (AtkWindowIface *iface)
{
/* At this moment AtkWindow is just about signals */
}
/* Auxiliar */
static void
cally_stage_activate_cb (ClutterStage *stage,
@ -262,7 +184,7 @@ cally_stage_activate_cb (ClutterStage *stage,
atk_object_notify_state_change (ATK_OBJECT (cally_stage),
ATK_STATE_ACTIVE, TRUE);
g_signal_emit (cally_stage, cally_stage_signals [ACTIVATE], 0);
g_signal_emit_by_name (cally_stage, "activate", 0);
}
static void
@ -280,5 +202,5 @@ cally_stage_deactivate_cb (ClutterStage *stage,
atk_object_notify_state_change (ATK_OBJECT (cally_stage),
ATK_STATE_ACTIVE, FALSE);
g_signal_emit (cally_stage, cally_stage_signals [DEACTIVATE], 0);
g_signal_emit_by_name (cally_stage, "deactivate", 0);
}

View File

@ -89,7 +89,6 @@ static void insert_hf (gpointer k
gpointer value,
gpointer data);
static AtkKeyEventStruct * atk_key_event_from_clutter_event_key (ClutterKeyEvent *event);
static void do_window_event_initialization (void);
/* This is just a copy of the Gail one, a shared library or place to
@ -184,33 +183,7 @@ cally_util_add_global_event_listener (GSignalEmissionHook listener,
split_string = g_strsplit (event_type, ":", 3);
if (split_string)
{
if (!strcmp ("window", split_string[0]))
{
/* Using ClutterStage as the window equivalent, although
several methods (move, etc) are missing. This would be
probably defined for other window-related classes (MxWindow)
FIXME: for this reason, this process should be extendable
on the future.*/
static gboolean initialized = FALSE;
if (initialized == FALSE)
{
do_window_event_initialization ();
initialized = TRUE;
}
rc = add_listener (listener, "CallyStage", split_string[1], event_type);
}
else
{
rc = add_listener (listener, split_string[1], split_string[2], event_type);
}
g_strfreev (split_string);
}
rc = add_listener (listener, split_string[1], split_string[2], event_type);
return rc;
}
@ -543,12 +516,3 @@ cally_util_stage_removed_cb (ClutterStageManager *stage_manager,
g_signal_handlers_disconnect_by_func (stage, cally_key_snooper_cb, NULL);
}
static void
do_window_event_initialization (void)
{
/*
* Ensure that CallyStageClass exists.
*/
g_type_class_unref (g_type_class_ref (CALLY_TYPE_STAGE));
}

View File

@ -116,7 +116,7 @@ AC_HEADER_STDC
m4_define([glib_req_version], [2.26.0])
m4_define([cogl_req_version], [1.7.6])
m4_define([json_glib_req_version], [0.12.0])
m4_define([atk_req_version], [1.17])
m4_define([atk_req_version], [2.1.5])
m4_define([cairo_req_version], [1.10])
m4_define([pango_req_version], [1.20])
m4_define([gi_req_version], [0.9.5])

View File

@ -31,6 +31,7 @@
*/
#include <atk/atk.h>
#include <clutter/clutter.h>
#include <cally/cally.h>
#include "cally-examples-util.h"
@ -163,10 +164,10 @@ main (int argc, char *argv[])
atk_remove_key_event_listener (id_2);
/* event listeners */
atk_add_global_event_listener (window_event_listener, "window:create");
atk_add_global_event_listener (window_event_listener, "window:destroy");
atk_add_global_event_listener (window_event_listener, "window:activate");
atk_add_global_event_listener (window_event_listener, "window:deactivate");
atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:create");
atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:destroy");
atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:activate");
atk_add_global_event_listener (window_event_listener, "Atk:AtkWindow:deactivate");
stage = clutter_stage_get_default ();
make_ui (stage);