]>
Dogcows Code - chaz/openbox/blob - plugins/menu/client_menu.c
50ebc7cf6fa379bad2f1f81b3b3af55e3d10381f
3 #include "kernel/menu.h"
4 #include "kernel/screen.h"
5 #include "kernel/client.h"
6 #include "kernel/openbox.h"
8 #include "kernel/frame.h"
10 #include "render/theme.h"
12 static char *PLUGIN_NAME
= "client_menu";
14 static Menu
*send_to_menu
;
15 static Menu
*layer_menu
;
21 #define CLIENT_MENU(m) ((Menu *)m)
22 #define CLIENT_MENU_DATA(m) ((Client_Menu_Data *)((Menu *)m)->plugin_data)
25 void client_menu_clean_up(Menu
*m
) {
28 void client_send_to_update(Menu
*self
)
32 for (i
= 0; i
< screen_num_desktops
; ++i
) {
34 Action
*a
= action_from_string("sendtodesktop");
35 a
->data
.sendto
.desk
= i
;
36 a
->data
.sendto
.follow
= FALSE
;
37 e
= menu_entry_new(screen_desktop_names
[i
], a
);
38 menu_add_entry(self
, e
);
41 menu_render_full(self
);
44 void client_menu_show(Menu
*self
, int x
, int y
, Client
*client
)
47 g_assert(!self
->invalid
);
50 newy
= MAX(client
->frame
->area
.y
+ client
->frame
->size
.top
, y
);
51 newy
-= ob_rr_theme
->bwidth
;
53 POINT_SET(self
->location
,
54 MIN(x
, screen_physical_size
.width
- self
->size
.width
-
55 ob_rr_theme
->bwidth
* 2),
56 MIN(newy
, screen_physical_size
.height
- self
->size
.height
-
57 ob_rr_theme
->bwidth
* 2));
58 XMoveWindow(ob_display
, self
->frame
, self
->location
.x
, self
->location
.y
);
61 XMapWindow(ob_display
, self
->frame
);
62 stacking_raise(MENU_AS_WINDOW(self
));
64 } else if (self
->shown
&& self
->open_submenu
) {
65 menu_hide(self
->open_submenu
);
69 void plugin_setup_config() { }
71 void plugin_shutdown() { }
73 void plugin_destroy (Menu
*m
)
77 void *plugin_create() /* TODO: need config */
79 Menu
*m
= menu_new_full(NULL
, "client-menu", NULL
,
80 /*client_menu_show*/NULL
, NULL
);
81 menu_add_entry(m
, menu_entry_new_submenu("Send To Workspace",
83 send_to_menu
->parent
= m
;
85 menu_add_entry(m
, menu_entry_new("Iconify",
86 action_from_string("iconify")));
87 menu_add_entry(m
, menu_entry_new("Raise",
88 action_from_string("raise")));
89 menu_add_entry(m
, menu_entry_new("Lower",
90 action_from_string("lower")));
91 menu_add_entry(m
, menu_entry_new("Close",
92 action_from_string("close")));
93 menu_add_entry(m
, menu_entry_new("Shade",
94 action_from_string("toggleshade")));
95 menu_add_entry(m
, menu_entry_new("Omnipresent",
96 action_from_string("toggleomnipresent")));
97 menu_add_entry(m
, menu_entry_new("Decorations",
98 action_from_string("toggledecorations")));
99 menu_add_entry(m
, menu_entry_new_submenu("Layers",
101 layer_menu
->parent
= m
;
116 void plugin_startup()
119 /* create a Send To Workspace Menu */
120 send_to_menu
= menu_new_full(NULL
, "send-to-workspace",
121 NULL
, NULL
, client_send_to_update
);
123 layer_menu
= menu_new(NULL
, "layer", NULL
);
124 menu_add_entry(layer_menu
, menu_entry_new("Top Layer",
125 action_from_string("sendtotoplayer")));
126 menu_add_entry(layer_menu
, menu_entry_new("Normal Layer",
127 action_from_string("sendtonormallayer")));
128 menu_add_entry(layer_menu
, menu_entry_new("Bottom Layer",
129 action_from_string("sendtobottomlayer")));
131 t
= (Menu
*)plugin_create("client_menu");
This page took 0.040861 seconds and 4 git commands to generate.