~azzar1/unity/fix-734900

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/nux-base-window-accessible.cpp

  • Committer: Alejandro Piñeiro
  • Date: 2011-08-01 17:53:14 UTC
  • Revision ID: apinheiro@igalia.com-20110801175314-f5fpngwq2nx0tpm3
[a11y] Code style review using tools/apply_unity_formatting.sh

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
static void nux_base_window_accessible_init(NuxBaseWindowAccessible* base_window_accessible);
61
61
 
62
62
/* AtkObject.h */
63
 
static void       nux_base_window_accessible_initialize      (AtkObject *accessible,
64
 
                                                              gpointer   data);
65
 
static AtkObject *nux_base_window_accessible_get_parent      (AtkObject *obj);
66
 
static AtkStateSet *nux_base_window_accessible_ref_state_set (AtkObject *obj);
 
63
static void       nux_base_window_accessible_initialize(AtkObject* accessible,
 
64
                                                        gpointer   data);
 
65
static AtkObject* nux_base_window_accessible_get_parent(AtkObject* obj);
 
66
static AtkStateSet* nux_base_window_accessible_ref_state_set(AtkObject* obj);
67
67
 
68
68
/* private */
69
 
static void         on_change_keyboard_receiver_cb            (AtkObject *accessible,
70
 
                                                               gboolean focus_in);
 
69
static void         on_change_keyboard_receiver_cb(AtkObject* accessible,
 
70
                                                   gboolean focus_in);
71
71
 
72
72
G_DEFINE_TYPE(NuxBaseWindowAccessible, nux_base_window_accessible,  NUX_TYPE_VIEW_ACCESSIBLE)
73
73
 
166
166
nux_base_window_accessible_initialize(AtkObject* accessible,
167
167
                                      gpointer data)
168
168
{
169
 
  nux::Object *nux_object = NULL;
170
 
  nux::BaseWindow *bwindow = NULL;
 
169
  nux::Object* nux_object = NULL;
 
170
  nux::BaseWindow* bwindow = NULL;
171
171
 
172
 
  ATK_OBJECT_CLASS (nux_base_window_accessible_parent_class)->initialize (accessible, data);
 
172
  ATK_OBJECT_CLASS(nux_base_window_accessible_parent_class)->initialize(accessible, data);
173
173
 
174
174
  accessible->role = ATK_ROLE_WINDOW;
175
175
 
176
 
  nux_object = nux_object_accessible_get_object (NUX_OBJECT_ACCESSIBLE (accessible));
177
 
  bwindow = dynamic_cast<nux::BaseWindow *>(nux_object);
 
176
  nux_object = nux_object_accessible_get_object(NUX_OBJECT_ACCESSIBLE(accessible));
 
177
  bwindow = dynamic_cast<nux::BaseWindow*>(nux_object);
178
178
 
179
179
  /* This gives us if the window has the underlying key input */
180
 
  bwindow->OnStartKeyboardReceiver.connect (sigc::bind (sigc::ptr_fun (on_change_keyboard_receiver_cb),
181
 
                                                        accessible, TRUE));
182
 
  bwindow->OnStopKeyboardReceiver.connect (sigc::bind (sigc::ptr_fun (on_change_keyboard_receiver_cb),
183
 
                                                       accessible, FALSE));
 
180
  bwindow->OnStartKeyboardReceiver.connect(sigc::bind(sigc::ptr_fun(on_change_keyboard_receiver_cb),
 
181
                                                      accessible, TRUE));
 
182
  bwindow->OnStopKeyboardReceiver.connect(sigc::bind(sigc::ptr_fun(on_change_keyboard_receiver_cb),
 
183
                                                     accessible, FALSE));
184
184
}
185
185
 
186
186
static AtkObject*
221
221
 
222
222
/* private */
223
223
static void
224
 
check_active (NuxBaseWindowAccessible *self)
 
224
check_active(NuxBaseWindowAccessible* self)
225
225
{
226
226
  gint signal_id;
227
227
  gboolean is_active;
229
229
  is_active = (self->priv->key_focused || self->priv->child_key_focused);
230
230
 
231
231
  if (self->priv->active != is_active)
232
 
    {
233
 
      self->priv->active = is_active;
234
 
 
235
 
      if (is_active)
236
 
        signal_id = ACTIVATE;
237
 
      else
238
 
        signal_id = DEACTIVATE;
239
 
 
240
 
      atk_object_notify_state_change (ATK_OBJECT (self),
241
 
                                      ATK_STATE_ACTIVE, is_active);
242
 
      g_signal_emit (self, signals [signal_id], 0);
243
 
    }
 
232
  {
 
233
    self->priv->active = is_active;
 
234
 
 
235
    if (is_active)
 
236
      signal_id = ACTIVATE;
 
237
    else
 
238
      signal_id = DEACTIVATE;
 
239
 
 
240
    atk_object_notify_state_change(ATK_OBJECT(self),
 
241
                                   ATK_STATE_ACTIVE, is_active);
 
242
    g_signal_emit(self, signals [signal_id], 0);
 
243
  }
244
244
}
245
245
 
246
246
static void
247
 
on_change_keyboard_receiver_cb (AtkObject *object,
248
 
                                gboolean focus_in)
 
247
on_change_keyboard_receiver_cb(AtkObject* object,
 
248
                               gboolean focus_in)
249
249
{
250
 
  NuxBaseWindowAccessible *self = NULL;
 
250
  NuxBaseWindowAccessible* self = NULL;
251
251
 
252
252
  /* On the base window, we suppose that the window is active if it
253
253
     has the key focus (see nux::InputArea) */
254
 
  self = NUX_BASE_WINDOW_ACCESSIBLE (object);
 
254
  self = NUX_BASE_WINDOW_ACCESSIBLE(object);
255
255
 
256
256
  if (self->priv->key_focused != focus_in)
257
 
    {
258
 
      self->priv->key_focused = focus_in;
 
257
  {
 
258
    self->priv->key_focused = focus_in;
259
259
 
260
 
      check_active (self);
261
 
    }
 
260
    check_active(self);
 
261
  }
262
262
}
263
263
 
264
264
/* public */
265
265
void
266
 
nux_base_window_set_child_key_focused (NuxBaseWindowAccessible *self,
267
 
                                       gboolean value)
 
266
nux_base_window_set_child_key_focused(NuxBaseWindowAccessible* self,
 
267
                                      gboolean value)
268
268
{
269
 
  g_return_if_fail (NUX_IS_BASE_WINDOW_ACCESSIBLE (self));
 
269
  g_return_if_fail(NUX_IS_BASE_WINDOW_ACCESSIBLE(self));
270
270
 
271
271
  if (self->priv->child_key_focused != value)
272
 
    {
273
 
      self->priv->child_key_focused = value;
274
 
      check_active (self);
275
 
    }
 
272
  {
 
273
    self->priv->child_key_focused = value;
 
274
    check_active(self);
 
275
  }
276
276
}