2
* Copyright © 2006 Novell, Inc.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
19
* Author: David Reveman <davidr@novell.com>
22
#include "gtk-window-decorator.h"
25
action_menu_unmap (GObject *object)
27
action_menu_mapped = FALSE;
31
position_action_menu (GtkMenu *menu,
37
WnckWindow *win = (WnckWindow *) user_data;
38
decor_frame_t *frame = gwd_get_decor_frame (get_frame_type (win));
39
decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
40
gint bx, by, width, height;
42
wnck_window_get_client_window_geometry (win, x, y, &width, &height);
44
if ((*theme_get_button_position) (d, BUTTON_MENU, width, height,
45
&bx, &by, &width, &height))
46
*x = *x - frame->win_extents.left + bx;
48
gwd_decor_frame_unref (frame);
50
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
54
gtk_widget_size_request (GTK_WIDGET (menu), &req);
55
*x = MAX (0, *x - req.width + width);
62
action_menu_map (WnckWindow *win,
66
GdkDisplay *gdkdisplay;
69
gdkdisplay = gdk_display_get_default ();
70
screen = gdk_display_get_default_screen (gdkdisplay);
74
if (action_menu_mapped)
76
gtk_widget_destroy (action_menu);
77
action_menu_mapped = FALSE;
82
gtk_widget_destroy (action_menu);
85
switch (wnck_window_get_window_type (win)) {
86
case WNCK_WINDOW_DESKTOP:
87
case WNCK_WINDOW_DOCK:
88
/* don't allow window action */
90
case WNCK_WINDOW_NORMAL:
91
case WNCK_WINDOW_DIALOG:
93
#ifndef HAVE_LIBWNCK_2_19_4
94
case WNCK_WINDOW_MODAL_DIALOG:
97
case WNCK_WINDOW_TOOLBAR:
98
case WNCK_WINDOW_MENU:
99
case WNCK_WINDOW_UTILITY:
100
case WNCK_WINDOW_SPLASHSCREEN:
101
/* allow window action menu */
105
action_menu = wnck_create_window_action_menu (win);
107
gtk_menu_set_screen (GTK_MENU (action_menu), screen);
109
g_signal_connect_object (G_OBJECT (action_menu), "unmap",
110
G_CALLBACK (action_menu_unmap),
113
gtk_widget_show (action_menu);
115
if (!button || button == 1)
117
gtk_menu_popup (GTK_MENU (action_menu),
119
position_action_menu, (gpointer) win,
125
gtk_menu_popup (GTK_MENU (action_menu),
132
action_menu_mapped = TRUE;