Пример #1
0
/*
 * update_window_decoration_state
 *
 * Returns: void
 * Description: helper function to update the state of the decor_t
 */
void
update_window_decoration_state (WnckWindow *win)
{
    decor_t *d = g_object_get_data (G_OBJECT (win), "decor");

    d->state = wnck_window_get_state (win);
}
Пример #2
0
static void
button_toggled_cb (GtkToggleButton* button)
{
  if (gtk_toggle_button_get_active (button))
    {
      GtkWidget* item = NULL;
      GList    * window;

      g_return_if_fail (!menu);

      menu = g_object_ref_sink (gtk_menu_new ());
      item = gtk_menu_item_new_with_label (wnck_workspace_get_name (PRIV (button)->workspace));
      gtk_widget_set_sensitive (item, FALSE);
#if 0
      g_signal_connect (item, "select",
                        G_CALLBACK (select_cb), PRIV (button)->workspace);
      g_signal_connect (item, "deselect",
                        G_CALLBACK (unselect_cb), PRIV (button)->workspace);
#endif
      gtk_widget_show (item);
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);

      item = gtk_separator_menu_item_new ();
      gtk_widget_show (item);
      gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);

      for (window = wnck_screen_get_windows (wnck_workspace_get_screen (PRIV (button)->workspace)); window; window = window->next)
        {
          if (!wnck_window_is_on_workspace (window->data, PRIV (button)->workspace) ||
              (wnck_window_get_state (window->data) & WNCK_WINDOW_STATE_SKIP_TASKLIST))
            {
              continue;
            }

          item = window_menu_item_new (window->data);
          gtk_widget_show (item);
          gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        }

      gtk_menu_attach_to_widget (GTK_MENU (menu),
                                 GTK_WIDGET (button),
                                 NULL);

      gtk_menu_set_screen (GTK_MENU (menu),
                           gtk_widget_get_screen (GTK_WIDGET (button)));
      gtk_menu_popup (GTK_MENU (menu),
                      NULL, NULL,
                      menu_position_func, button,
                      0, gtk_get_current_event_time ());

      g_object_add_weak_pointer (G_OBJECT (menu), (gpointer*)&menu);

      g_signal_connect (menu, "selection-done",
                        G_CALLBACK (untoggle), button);
    }
}
Пример #3
0
/*
 * populate_state
 *
 * Returns void
 * Description: Sets the window state flags for compiz to know what state of
 * window this decoration is for
 */
unsigned int
populate_frame_state (decor_t *d)
{
    unsigned int frame_state = 0;

    WnckWindowState win_state;
    const unsigned int n_state_bits = 3;
    unsigned int i;

    if (d->active)
        frame_state |= DECOR_WINDOW_STATE_FOCUS;

    struct typestrings {
        unsigned int wnck_flag;
        unsigned int decor_flag;
    } state_bits[] =
    {
        { WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY, DECOR_WINDOW_STATE_MAXIMIZED_VERT },
        { WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY, DECOR_WINDOW_STATE_MAXIMIZED_HORZ },
        { WNCK_WINDOW_STATE_SHADED, DECOR_WINDOW_STATE_SHADED }
    };

    /* Not possible to match further than active or not if there is
     * no window but FIXME we might want to do that later down the line */
    if (!d->win)
        return frame_state == 0;

    win_state = wnck_window_get_state (d->win);

    for (i = 0; i < n_state_bits; ++i)
    {
        if (win_state & state_bits[i].wnck_flag)
            frame_state |= state_bits[i].decor_flag;
    }

    return frame_state;
}