File: windowmenu.cc

package info (click to toggle)
aewm%2B%2B 1.1.2-5.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 216 kB
  • sloc: cpp: 3,016; makefile: 80; sh: 35
file content (53 lines) | stat: -rw-r--r-- 898 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* 
 * frankhale@gmail.com
 * http://frankhale.org
 *
 * This code is released under the GPL license www.gnu.org
 */
#include "aewm.hh"

WindowMenu::WindowMenu(Display * dpy) : GenericMenu(dpy)
{
	updateWindowMenu();
}

void WindowMenu::updateWindowMenu()
{
	char* temp = new char[wm->getMaxDesktops()];
	for(int i=0; i<wm->getMaxDesktops(); i++)
	{
		sprintf(temp, "%d", i);
		
		insert(temp,"", SEND_TO_DESKTOP);
	}		
	delete [] temp;

	updateMenu();
	
	addToMenuList(this);
}

void WindowMenu::handleButtonReleaseEvent(XButtonEvent *e)
{
	int desktop=0;
	
	GenericMenu::handleButtonReleaseEvent(e);

	switch (e->button) 
	{
		case Button1:
			if (curr) 
			{
				switch(	curr->function )
				{
					case SEND_TO_DESKTOP:
						desktop = atoi(curr->name.c_str());
						if(client) client->setDesktop(desktop);
						hideAllVisibleSubmenus();
					break;
				
				}										
			}	
		break;
	} 
}