~azzar1/unity/fix-trash-li-blocking

« back to all changes in this revision

Viewing changes to services/panel-service.c

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include <gdk/gdkx.h>
32
32
 
33
33
#include <X11/extensions/XInput2.h>
 
34
#include <X11/XKBlib.h>
34
35
 
35
36
#include "panel-marshal.h"
36
37
 
55
56
  gint32 timeouts[N_TIMEOUT_SLOTS];
56
57
 
57
58
  IndicatorObjectEntry *last_entry;
 
59
  GtkWidget *menubar;
 
60
  GtkWidget *offscreen_window;
58
61
  GtkMenu *last_menu;
59
62
  guint32  last_menu_id;
60
63
  guint32  last_menu_move_id;
96
99
static const gchar * indicator_order[][2] = {
97
100
  {"libappmenu.so", NULL},                    /* indicator-appmenu" */
98
101
  {"libapplication.so", NULL},                /* indicator-application" */
 
102
  {"libprintersmenu.so", NULL},               /* indicator-printers */
99
103
  {"libapplication.so", "gsd-keyboard-xkb"},  /* keyboard layout selector */
100
104
  {"libmessaging.so", NULL},                  /* indicator-messages */
101
105
  {"libpower.so", NULL},                      /* indicator-power */
138
142
 
139
143
  gdk_window_remove_filter (NULL, (GdkFilterFunc)event_filter, object);
140
144
 
 
145
  if (G_IS_OBJECT (priv->menubar))
 
146
    {
 
147
      g_object_unref (priv->menubar);
 
148
      priv->menubar = NULL;
 
149
    }
 
150
 
 
151
  if (G_IS_OBJECT (priv->offscreen_window))
 
152
    {
 
153
      g_object_unref (priv->offscreen_window);
 
154
      priv->offscreen_window = NULL;
 
155
    }
 
156
 
 
157
  if (G_IS_OBJECT (priv->last_menu))
 
158
    {
 
159
      g_object_unref (priv->last_menu);
 
160
      priv->last_menu = NULL;
 
161
    }
 
162
 
141
163
  if (priv->initial_sync_id)
142
164
    {
143
165
      g_source_remove (priv->initial_sync_id);
249
271
 
250
272
      if (event->evtype == XI_KeyRelease)
251
273
        {
252
 
          if (XKeycodeToKeysym(event->display, event->detail, 0) == GDK_KEY_F10)
 
274
          if (XkbKeycodeToKeysym(event->display, event->detail, 0, 0) == GDK_KEY_F10)
253
275
          {
254
 
            if (GTK_MENU (priv->last_menu))
 
276
            if (GTK_IS_MENU (priv->last_menu))
255
277
              gtk_menu_popdown (GTK_MENU (priv->last_menu));
256
278
          }
257
279
        }
414
436
  PanelServicePrivate *priv;
415
437
  priv = self->priv = GET_PRIVATE (self);
416
438
 
 
439
  priv->offscreen_window = gtk_offscreen_window_new ();
 
440
  priv->menubar = gtk_menu_bar_new ();
 
441
  gtk_container_add (GTK_CONTAINER (priv->offscreen_window), priv->menubar);
 
442
 
417
443
  gdk_window_add_filter (NULL, (GdkFilterFunc)event_filter, self);
418
444
 
419
445
  priv->entry2indicator_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
1104
1130
 
1105
1131
  g_signal_handler_disconnect (priv->last_menu, priv->last_menu_id);
1106
1132
  g_signal_handler_disconnect (priv->last_menu, priv->last_menu_move_id);
 
1133
 
 
1134
  GtkWidget *top_win = gtk_widget_get_toplevel (GTK_WIDGET (priv->last_menu));
 
1135
  if (GTK_IS_WINDOW (top_win))
 
1136
    gtk_window_set_attached_to (GTK_WINDOW (top_win), NULL);
 
1137
 
1107
1138
  priv->last_menu = NULL;
1108
1139
  priv->last_menu_id = 0;
1109
1140
  priv->last_menu_move_id = 0;
1476
1507
                            G_CALLBACK (gtk_widget_destroyed), &priv->last_menu);
1477
1508
        }
1478
1509
 
 
1510
      GtkWidget *top_widget = gtk_widget_get_toplevel (GTK_WIDGET (priv->last_menu));
 
1511
 
 
1512
      if (GTK_IS_WINDOW (top_widget))
 
1513
        {
 
1514
          GtkWindow *top_win = GTK_WINDOW (top_widget);
 
1515
 
 
1516
          if (gtk_window_get_attached_to (top_win) != priv->menubar)
 
1517
            gtk_window_set_attached_to (top_win, priv->menubar);
 
1518
        }
 
1519
 
1479
1520
      priv->last_entry = entry;
1480
1521
      priv->last_x = x;
1481
1522
      priv->last_y = y;
1486
1527
                                                        G_CALLBACK (on_active_menu_move_current), self);
1487
1528
 
1488
1529
      indicator_object_entry_activate (object, entry, CurrentTime);
 
1530
 
1489
1531
      gtk_menu_popup (priv->last_menu, NULL, NULL, positon_menu, self, 0, CurrentTime);
1490
1532
      GdkWindow *gdkwin = gtk_widget_get_window (GTK_WIDGET (priv->last_menu));
1491
1533
      if (gdkwin != NULL)
1513
1555
   * active application (which will make it change colour (as state changes), which
1514
1556
   * then looks like flickering to the user.
1515
1557
   */
1516
 
  if (GTK_MENU (last_menu))
 
1558
  if (GTK_IS_MENU (last_menu))
1517
1559
    gtk_menu_popdown (GTK_MENU (last_menu));
1518
1560
}
1519
1561