add mouse action : maximize_restore, fixed issue 125
git-svn-id: http://tint2.googlecode.com/svn/trunk@156 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
parent
027411ca16
commit
fe2111c8fd
8 changed files with 50 additions and 36 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2009-08-09
|
||||||
|
- add mouse action : maximize_restore
|
||||||
|
- fixed issue 125
|
||||||
|
|
||||||
2009-07-28
|
2009-07-28
|
||||||
- some tint2conf code
|
- some tint2conf code
|
||||||
|
|
||||||
|
|
|
@ -226,6 +226,8 @@ void get_action (char *event, int *action)
|
||||||
*action = SHADE;
|
*action = SHADE;
|
||||||
else if (strcmp (event, "toggle_iconify") == 0)
|
else if (strcmp (event, "toggle_iconify") == 0)
|
||||||
*action = TOGGLE_ICONIFY;
|
*action = TOGGLE_ICONIFY;
|
||||||
|
else if (strcmp (event, "maximize_restore") == 0)
|
||||||
|
*action = MAXIMIZE_RESTORE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -664,8 +666,10 @@ int parse_line (const char *line)
|
||||||
void config_finish ()
|
void config_finish ()
|
||||||
{
|
{
|
||||||
if (panel_config->monitor > (server.nb_monitor-1)) {
|
if (panel_config->monitor > (server.nb_monitor-1)) {
|
||||||
fprintf(stderr, "tint2 exit : monitor %d not found.\n", panel_config->monitor+1);
|
// server.nb_monitor minimum value is 1 (see get_monitors_and_desktops())
|
||||||
exit(0);
|
// and panel_config->monitor is higher
|
||||||
|
fprintf(stderr, "warning : monitor not found. tint2 default to monitor 1.\n");
|
||||||
|
panel_config->monitor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// alloc panels
|
// alloc panels
|
||||||
|
|
|
@ -54,6 +54,8 @@ void server_init_atoms ()
|
||||||
server.atom._NET_WM_DESKTOP = XInternAtom (server.dsp, "_NET_WM_DESKTOP", False);
|
server.atom._NET_WM_DESKTOP = XInternAtom (server.dsp, "_NET_WM_DESKTOP", False);
|
||||||
server.atom.WM_STATE = XInternAtom (server.dsp, "WM_STATE", False);
|
server.atom.WM_STATE = XInternAtom (server.dsp, "WM_STATE", False);
|
||||||
server.atom._NET_WM_STATE = XInternAtom (server.dsp, "_NET_WM_STATE", False);
|
server.atom._NET_WM_STATE = XInternAtom (server.dsp, "_NET_WM_STATE", False);
|
||||||
|
server.atom._NET_WM_STATE_MAXIMIZED_VERT = XInternAtom (server.dsp, "_NET_WM_STATE_MAXIMIZED_VERT", False);
|
||||||
|
server.atom._NET_WM_STATE_MAXIMIZED_HORZ = XInternAtom (server.dsp, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
|
||||||
server.atom._NET_WM_STATE_SHADED = XInternAtom (server.dsp, "_NET_WM_STATE_SHADED", False);
|
server.atom._NET_WM_STATE_SHADED = XInternAtom (server.dsp, "_NET_WM_STATE_SHADED", False);
|
||||||
server.atom._NET_WM_STATE_BELOW = XInternAtom (server.dsp, "_NET_WM_STATE_BELOW", False);
|
server.atom._NET_WM_STATE_BELOW = XInternAtom (server.dsp, "_NET_WM_STATE_BELOW", False);
|
||||||
server.atom._NET_WM_STATE_MODAL = XInternAtom (server.dsp, "_NET_WM_STATE_MODAL", False);
|
server.atom._NET_WM_STATE_MODAL = XInternAtom (server.dsp, "_NET_WM_STATE_MODAL", False);
|
||||||
|
|
|
@ -37,6 +37,8 @@ typedef struct Global_atom
|
||||||
Atom _NET_WM_DESKTOP;
|
Atom _NET_WM_DESKTOP;
|
||||||
Atom WM_STATE;
|
Atom WM_STATE;
|
||||||
Atom _NET_WM_STATE;
|
Atom _NET_WM_STATE;
|
||||||
|
Atom _NET_WM_STATE_MAXIMIZED_VERT;
|
||||||
|
Atom _NET_WM_STATE_MAXIMIZED_HORZ;
|
||||||
Atom _NET_WM_STATE_SHADED;
|
Atom _NET_WM_STATE_SHADED;
|
||||||
Atom _NET_WM_STATE_BELOW;
|
Atom _NET_WM_STATE_BELOW;
|
||||||
Atom _NET_WM_STATE_MODAL;
|
Atom _NET_WM_STATE_MODAL;
|
||||||
|
|
48
src/tint.c
48
src/tint.c
|
@ -53,7 +53,7 @@ void init ()
|
||||||
signal(SIGINT, signal_handler);
|
signal(SIGINT, signal_handler);
|
||||||
signal(SIGTERM, signal_handler);
|
signal(SIGTERM, signal_handler);
|
||||||
signal(SIGHUP, signal_handler);
|
signal(SIGHUP, signal_handler);
|
||||||
signal(SIGCLD, SIG_IGN); // don't have to wait() after fork()
|
signal(SIGCHLD, SIG_IGN); // don't have to wait() after fork()
|
||||||
|
|
||||||
// set global data
|
// set global data
|
||||||
memset(&server, 0, sizeof(Server_global));
|
memset(&server, 0, sizeof(Server_global));
|
||||||
|
@ -114,24 +114,33 @@ void cleanup()
|
||||||
|
|
||||||
void window_action (Task *tsk, int action)
|
void window_action (Task *tsk, int action)
|
||||||
{
|
{
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case CLOSE:
|
case CLOSE:
|
||||||
set_close (tsk->win);
|
set_close (tsk->win);
|
||||||
break;
|
break;
|
||||||
case TOGGLE:
|
case TOGGLE:
|
||||||
set_active(tsk->win);
|
set_active(tsk->win);
|
||||||
break;
|
break;
|
||||||
case ICONIFY:
|
case ICONIFY:
|
||||||
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||||
break;
|
break;
|
||||||
case TOGGLE_ICONIFY:
|
case TOGGLE_ICONIFY:
|
||||||
if (tsk == task_active) XIconifyWindow (server.dsp, tsk->win, server.screen);
|
if (tsk == task_active) XIconifyWindow (server.dsp, tsk->win, server.screen);
|
||||||
else set_active (tsk->win);
|
else set_active (tsk->win);
|
||||||
break;
|
break;
|
||||||
case SHADE:
|
case SHADE:
|
||||||
window_toggle_shade (tsk->win);
|
window_toggle_shade (tsk->win);
|
||||||
break;
|
break;
|
||||||
}
|
case MAXIMIZE_RESTORE:
|
||||||
|
window_maximize_restore (tsk->win);
|
||||||
|
break;
|
||||||
|
case MAXIMIZE:
|
||||||
|
window_maximize_restore (tsk->win);
|
||||||
|
break;
|
||||||
|
case RESTORE:
|
||||||
|
window_maximize_restore (tsk->win);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -382,6 +391,7 @@ void event_property_notify (XEvent *e)
|
||||||
init_precision();
|
init_precision();
|
||||||
task_urgent = 0;
|
task_urgent = 0;
|
||||||
}
|
}
|
||||||
|
// put active state on all task (multi_desktop)
|
||||||
if (t) {
|
if (t) {
|
||||||
for (i=0 ; i < nb_panel ; i++) {
|
for (i=0 ; i < nb_panel ; i++) {
|
||||||
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
for (j=0 ; j < panel1[i].nb_desktop ; j++) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ FXint fxmalloc(void** ptr,unsigned long size){
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// mouse actions
|
// mouse actions
|
||||||
enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY };
|
enum { NONE=0, CLOSE, TOGGLE, ICONIFY, SHADE, TOGGLE_ICONIFY, MAXIMIZE_RESTORE, MAXIMIZE, RESTORE };
|
||||||
|
|
||||||
#define ALLDESKTOP 0xFFFFFFFF
|
#define ALLDESKTOP 0xFFFFFFFF
|
||||||
|
|
||||||
|
|
|
@ -65,22 +65,13 @@ void window_toggle_shade (Window win)
|
||||||
send_event32 (win, server.atom._NET_WM_STATE, 2, server.atom._NET_WM_STATE_SHADED, 0);
|
send_event32 (win, server.atom._NET_WM_STATE, 2, server.atom._NET_WM_STATE_SHADED, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int x11_send_expose(Display *dpy, Window dst, int x, int y, int width, int height)
|
void window_maximize_restore (Window win)
|
||||||
{
|
{
|
||||||
XEvent xe;
|
send_event32 (win, server.atom._NET_WM_STATE, 2, server.atom._NET_WM_STATE_MAXIMIZED_VERT, 0);
|
||||||
int rc;
|
send_event32 (win, server.atom._NET_WM_STATE, 2, server.atom._NET_WM_STATE_MAXIMIZED_HORZ, 0);
|
||||||
xe.type = Expose;
|
|
||||||
xe.xexpose.window = dst;
|
|
||||||
xe.xexpose.x = x;
|
|
||||||
xe.xexpose.y = y;
|
|
||||||
xe.xexpose.width = width;
|
|
||||||
xe.xexpose.height = height;
|
|
||||||
xe.xexpose.count = 0;
|
|
||||||
rc = XSendEvent(tray_data.dpy, dst, True, NoEventMask, &xe);
|
|
||||||
return x11_ok() && rc != 0;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
int window_is_hidden (Window win)
|
int window_is_hidden (Window win)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ int window_is_hidden (Window win);
|
||||||
int window_is_active (Window win);
|
int window_is_active (Window win);
|
||||||
int get_icon_count (long *data, int num);
|
int get_icon_count (long *data, int num);
|
||||||
long *get_best_icon (long *data, int icon_count, int num, int *iw, int *ih, int best_icon_size);
|
long *get_best_icon (long *data, int icon_count, int num, int *iw, int *ih, int best_icon_size);
|
||||||
|
void window_maximize_restore (Window win);
|
||||||
void window_toggle_shade (Window win);
|
void window_toggle_shade (Window win);
|
||||||
int window_get_desktop (Window win);
|
int window_get_desktop (Window win);
|
||||||
void windows_set_desktop (Window win, int desktop);
|
void windows_set_desktop (Window win, int desktop);
|
||||||
|
|
Loading…
Reference in a new issue