Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 880995
Collapse All | Expand All

(-)sithwm-1.2.3/Makefile (-9 / +3 lines)
Lines 35-49 Link Here
35
35
36
DEFINES += -DVERSION=\"$(version),\ Maul\" $(DEBIAN) -DCONFDIR=\"$(confdir)\" 
36
DEFINES += -DVERSION=\"$(version),\ Maul\" $(DEBIAN) -DCONFDIR=\"$(confdir)\" 
37
37
38
OPT_$(CC) = -Os
38
CFLAGS ?= -march=native -O3 -g
39
OPT_cc  = -xO2
39
CFLAGS += -std=gnu2x $(INCLUDES) $(DEFINES)
40
41
EXDEFS= $(OPT_$(CC))
42
EXDEFS_d = -g
43
44
CFLAGS_$(CC) = -std=c99 -Wall
45
CFLAGS_cc  = 
46
CFLAGS += $(CFLAGS_$(CC)) $(INCLUDES) $(DEFINES) $(EXDEFS$(D))
47
40
48
LDFLAGS += $(LDPATH) $(LIBS)
41
LDFLAGS += $(LDPATH) $(LIBS)
49
42
Lines 65-70 Link Here
65
	if [ -f sithwm.exe ]; then mv sithwm.exe sithwm; fi
58
	if [ -f sithwm.exe ]; then mv sithwm.exe sithwm; fi
66
	mkdir -p $(prefix)/bin $(prefix)/share/man/man1 $(confdir)
59
	mkdir -p $(prefix)/bin $(prefix)/share/man/man1 $(confdir)
67
	install sithwm $(prefix)/bin
60
	install sithwm $(prefix)/bin
61
	install xwmpid $(prefix)/bin
68
	install sithwm.1 $(prefix)/share/man/man1
62
	install sithwm.1 $(prefix)/share/man/man1
69
	install default.sithwmrc $(confdir)
63
	install default.sithwmrc $(confdir)
70
	@if test -x /usr/bin/update-menus; then \
64
	@if test -x /usr/bin/update-menus; then \
(-)sithwm-1.2.3/client.c (+38 lines)
Lines 248-250 Link Here
248
   }
248
   }
249
   get_client_props(c);
249
   get_client_props(c);
250
}
250
}
251
252
void sendcmessage(Window w, Atom a, long x, int isroot)
253
{
254
	XEvent ev;
255
	int status;
256
	long mask;
257
258
	memset(&ev, 0, sizeof(ev));
259
	ev.xclient.type = ClientMessage;
260
	ev.xclient.window = w;
261
	ev.xclient.message_type = a;
262
	ev.xclient.format = 32;
263
	ev.xclient.data.l[0] = x;
264
	ev.xclient.data.l[1] = CurrentTime;
265
	mask = NoEventMask;
266
	if(isroot)
267
		mask = SubstructureRedirectMask;
268
	status = XSendEvent(dpy, w, False, mask, &ev);
269
	if(status==0)
270
		fprintf(stderr, "sithwm: sendcmessage failed\n");
271
}
272
273
void sendconfig(Client* c)
274
{
275
	XConfigureEvent ce;
276
277
	ce.type = ConfigureNotify;
278
	ce.event = c->dyn.window;
279
	ce.window = c->dyn.window;
280
	ce.x = c->dyn.area.pos.x;
281
	ce.y = c->dyn.area.pos.y;
282
	ce.width = c->dyn.area.w;
283
	ce.height = c->dyn.area.h;
284
	//ce.border_width = c->dyn.border;
285
	ce.above = None;
286
	ce.override_redirect = 0;
287
	XSendEvent(dpy, c->dyn.window, False, StructureNotifyMask, (XEvent *) & ce);
288
}
(-)sithwm-1.2.3/default.sithwmrc (-1 / +6 lines)
Lines 1-3 Link Here
1
cmd "xterm" "xterm"
2
cmd "firefox" "firefox-bin"
3
cmd "jdownloader" "/opt/jd2/JDownloader2"
4
cmd "uget" "uget-gtk"
5
cmd "exit" "kill `xwmpid sithwm`"
1
6
2
# menu "Apps"
7
# menu "Apps"
3
#     menu "Viewers"
8
#     menu "Viewers"
Lines 74-80 Link Here
74
79
75
key std		Escape		kill
80
key std		Escape		kill
76
key std,shift	Escape		kill,abs
81
key std,shift	Escape		kill,abs
77
82
key std		F4		exit			  -1
78
key std		a		maxim,raise,mouse
83
key std		a		maxim,raise,mouse
79
key std		f		fix
84
key std		f		fix
80
85
(-)sithwm-1.2.3/events.c (-3 / +6 lines)
Lines 160-166 Link Here
160
	    else
160
	    else
161
#endif
161
#endif
162
	    {
162
	    {
163
	       KeySym key = XKeycodeToKeysym(dpy,zevent.xkey.keycode,0);
163
	       KeySym key = XLookupKeysym(&zevent.xkey,0);
164
	       do_func(screen, &zevent, key);
164
	       do_func(screen, &zevent, key);
165
	    }
165
	    }
166
	    break;
166
	    break;
Lines 273-279 Link Here
273
      int iter=0;
273
      int iter=0;
274
      for (ScreenInfo*s2=screens+num_screens-1 ; s2>= screens ; s2--) {
274
      for (ScreenInfo*s2=screens+num_screens-1 ; s2>= screens ; s2--) {
275
         Window root_r;
275
         Window root_r;
276
         unsigned int mask;
276
         unsigned int mask = NoEventMask;
277
         int rx,ry;
277
         int rx,ry;
278
         for (Window win_r = s2->root; iter<2; iter++)
278
         for (Window win_r = s2->root; iter<2; iter++)
279
         {
279
         {
Lines 450-456 Link Here
450
	    current_screen->hist[current_screen->hist_index] = current_screen->area.pos;
450
	    current_screen->hist[current_screen->hist_index] = current_screen->area.pos;
451
	 }
451
	 }
452
	 if (thewt>230 && lock_command) {
452
	 if (thewt>230 && lock_command) {
453
	    system(lock_command);
453
	    int i = system(lock_command);
454
	    if (i == 0 || i == -1)
455
	       LOG_ERROR("Lock command system(%s) failed: %d \n", lock_command, i);
456
454
	    thewt = 0;
457
	    thewt = 0;
455
	 }
458
	 }
456
#endif
459
#endif
(-)sithwm-1.2.3/main.c (-3 / +7 lines)
Lines 15-20 Link Here
15
int	    font_height;
15
int	    font_height;
16
unsigned int     numlockmask;
16
unsigned int     numlockmask;
17
17
18
Atom xa_wm_exit;
19
Atom xa_wm_restart;
18
Atom xa_wm_state;
20
Atom xa_wm_state;
19
Atom xa_wm_protos;
21
Atom xa_wm_protos;
20
Atom xa_wm_delete;
22
Atom xa_wm_delete;
Lines 41-48 Link Here
41
   XSetErrorHandler(handle_xerror);
43
   XSetErrorHandler(handle_xerror);
42
   /* XSynchronize(dpy, True); */
44
   /* XSynchronize(dpy, True); */
43
45
44
   xa_wm_state = XInternAtom(dpy, "WM_STATE", False);
46
   xa_wm_exit    = XInternAtom(dpy, "WM_EXIT"         , False);
45
   xa_wm_protos = XInternAtom(dpy, "WM_PROTOCOLS", False);
47
   xa_wm_restart = XInternAtom(dpy, "WM_RESTART"      , False);
48
   xa_wm_state   = XInternAtom(dpy, "WM_STATE"        , False);
49
   xa_wm_protos  = XInternAtom(dpy, "WM_PROTOCOLS"    , False);
46
   xa_wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
50
   xa_wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
47
51
48
   font = XLoadQueryFont(dpy, opt_font);
52
   font = XLoadQueryFont(dpy, opt_font);
Lines 153-159 Link Here
153
157
154
   for (char**aaa = argv;*(++aaa);) {
158
   for (char**aaa = argv;*(++aaa);) {
155
      if (aaa[0][0] != '-') {
159
      if (aaa[0][0] != '-') {
156
	 strncpy(global_buffer, aaa[0], sizeof global_buffer);
160
	 strncpy(global_buffer, aaa[0], sizeof global_buffer - 1);
157
         parse_rc_line();
161
         parse_rc_line();
158
      }
162
      }
159
   }
163
   }
(-)sithwm-1.2.3/menu.c (-10 / +18 lines)
Lines 60-65 Link Here
60
   { "circulate", FUNC_CIRCUL<<FUNC_SHIFT},
60
   { "circulate", FUNC_CIRCUL<<FUNC_SHIFT},
61
   { "hist", (FUNC_HIST<<FUNC_SHIFT)|FMOD_RAISE},
61
   { "hist", (FUNC_HIST<<FUNC_SHIFT)|FMOD_RAISE},
62
   { "view_hist", (FUNC_VIEW_HIST<<FUNC_SHIFT)|FMOD_RAISE},
62
   { "view_hist", (FUNC_VIEW_HIST<<FUNC_SHIFT)|FMOD_RAISE},
63
   { "exit", FUNC_EXIT<<FUNC_SHIFT},
64
   { "restart", FUNC_RESTART<<FUNC_SHIFT},
63
   { "kill", FUNC_KILL<<FUNC_SHIFT},
65
   { "kill", FUNC_KILL<<FUNC_SHIFT},
64
   { "lower", FUNC_LOWER<<FUNC_SHIFT},
66
   { "lower", FUNC_LOWER<<FUNC_SHIFT},
65
   { "enter", XACT_ENTER<<FUNC_SHIFT},
67
   { "enter", XACT_ENTER<<FUNC_SHIFT},
Lines 192-197 Link Here
192
	 c->dyn.area = c->hist[c->hist_index];
194
	 c->dyn.area = c->hist[c->hist_index];
193
      break;
195
      break;
194
#endif
196
#endif
197
   case FUNC_EXIT: {
198
      sendcmessage(DefaultRootWindow(dpy), xa_wm_exit, 0L, 1);
199
      XSync(dpy, False);
200
      exit(EXIT_SUCCESS);
201
   }
202
   case FUNC_RESTART: {
203
      sendcmessage(DefaultRootWindow(dpy), xa_wm_restart, 0L, 1);
204
      XSync(dpy, False);
205
      exit(EXIT_SUCCESS);
206
   }
207
195
   case FUNC_KILL: {
208
   case FUNC_KILL: {
196
      int i, n, found = 0;
209
      int i, n, found = 0;
197
      Atom *protocols;
210
      Atom *protocols;
Lines 202-216 Link Here
202
	       found++;
215
	       found++;
203
	 XFree(protocols);
216
	 XFree(protocols);
204
      }
217
      }
218
205
      if (found) {
219
      if (found) {
206
	 XEvent ev;
220
	 sendcmessage(c->dyn.window, xa_wm_protos, xa_wm_delete, 0);
207
	 ev.type = ClientMessage;
221
	 XSync(dpy, False);
208
	 ev.xclient.window = c->dyn.window;
209
	 ev.xclient.message_type = xa_wm_protos;
210
	 ev.xclient.format = 32;
211
	 ev.xclient.data.l[0] = xa_wm_delete;
212
	 ev.xclient.data.l[1] = CurrentTime;
213
	 XSendEvent(dpy, c->dyn.window, False, NoEventMask, &ev);
214
      } else
222
      } else
215
	 XKillClient(dpy, c->dyn.window);
223
	 XKillClient(dpy, c->dyn.window);
216
   } break;
224
   } break;
Lines 304-310 Link Here
304
312
305
            if (t->mask>=(FUNC_SPAWN<<FUNC_SHIFT) && !strng
313
            if (t->mask>=(FUNC_SPAWN<<FUNC_SHIFT) && !strng
306
                && z->mask>=(FUNC_SPAWN<<FUNC_SHIFT))
314
                && z->mask>=(FUNC_SPAWN<<FUNC_SHIFT))
307
               LOG_ERROR("Err, Not a mask:%s %s %p %p\n", tmp, strng, tmp, strng);
315
               LOG_ERROR("Err, Not a mask:%s NULL %p %p\n", tmp, tmp, strng);
308
	 }
316
	 }
309
      }
317
      }
310
      if (!found) {
318
      if (!found) {
Lines 578-584 Link Here
578
   char akey = 0;
586
   char akey = 0;
579
   if (evnt) switch (evnt->type) {
587
   if (evnt) switch (evnt->type) {
580
   case KeyPress:
588
   case KeyPress:
581
      key = XKeycodeToKeysym(dpy, evnt->xkey.keycode, 0);
589
      key = XLookupKeysym(&evnt->xkey, 0);
582
      char* sym=XKeysymToString(key);
590
      char* sym=XKeysymToString(key);
583
      if (sym && sym[1] == 0 ) {
591
      if (sym && sym[1] == 0 ) {
584
         akey = tolower(sym[0]);
592
         akey = tolower(sym[0]);
(-)sithwm-1.2.3/misc.c (-2 / +6 lines)
Lines 21-31 Link Here
21
            char *dot = strchr(colon, '.');
21
            char *dot = strchr(colon, '.');
22
            if (!dot)
22
            if (!dot)
23
               dot = colon + strlen(colon);
23
               dot = colon + strlen(colon);
24
            snprintf(dot, 5, ".%ld", current_screen-screens);
24
            snprintf(dot, strlen(dot), ".%d", (int8_t)(current_screen-screens));
25
            putenv(ebuf);
25
            putenv(ebuf);
26
         }
26
         }
27
	 snprintf(global_buffer, sizeof global_buffer, "%s&", command);
27
	 snprintf(global_buffer, sizeof global_buffer, "%s&", command);
28
	 system(global_buffer);
28
	 int i = system(global_buffer);
29
	 if(i == 0 || i == -1)
30
	 	LOG_ERROR("Global buffer system(%s) failed: %d \n", global_buffer, i);
31
29
      }
32
      }
30
      _exit(0);
33
      _exit(0);
31
   }
34
   }
Lines 93-95 Link Here
93
   }
96
   }
94
   return 0;
97
   return 0;
95
}
98
}
99
(-)sithwm-1.2.3/sithwm.h (-4 / +6 lines)
Lines 138-143 Link Here
138
extern Atom xa_wm_state;
138
extern Atom xa_wm_state;
139
extern Atom xa_wm_delete;
139
extern Atom xa_wm_delete;
140
extern Atom xa_wm_protos;
140
extern Atom xa_wm_protos;
141
extern Atom xa_wm_exit;
142
extern Atom xa_wm_restart;
141
143
142
/* Things that affect user interaction */
144
/* Things that affect user interaction */
143
145
Lines 178-184 Link Here
178
void get_client_props(Client*client);
180
void get_client_props(Client*client);
179
181
180
enum {
182
enum {
181
182
   /* Functions, normally shifted left */
183
   /* Functions, normally shifted left */
183
184
184
   /* this first group requires a focused window to work on */
185
   /* this first group requires a focused window to work on */
Lines 191-200 Link Here
191
192
192
   /* this group should work anyway, make sure FUNC_MENU is first */
193
   /* this group should work anyway, make sure FUNC_MENU is first */
193
   FUNC_MENU, FUNC_PAN, FUNC_NEXT_SCREEN,
194
   FUNC_MENU, FUNC_PAN, FUNC_NEXT_SCREEN,
194
   FUNC_VIEW_HIST, FUNC_SPAWN,
195
   FUNC_VIEW_HIST, FUNC_SPAWN, FUNC_EXIT, FUNC_RESTART,
195
196
196
	/* Only for window actions so it dont matter where they
197
   /* Only for window actions so it dont matter where they are placed. */
197
           are placed. */
198
	XACT_ENTER, XACT_NEW, XACT_DELETED,
198
	XACT_ENTER, XACT_NEW, XACT_DELETED,
199
199
200
	FUNC_MAX,
200
	FUNC_MAX,
Lines 213-218 Link Here
213
	FMOD_POPUP	= 0x800,
213
	FMOD_POPUP	= 0x800,
214
};
214
};
215
215
216
void sendcmessage(Window w, Atom a, long x, int isroot);
217
void sendconfig(Client* c);
216
void select_client(Client *c, unsigned int func);
218
void select_client(Client *c, unsigned int func);
217
Client* select_window(Window w, unsigned int func);
219
Client* select_window(Window w, unsigned int func);
218
220
(-)sithwm-1.2.3/xwmpid (+10 lines)
Line 0 Link Here
1
#!/bin/sh
2
ActiveWindowManagerPID()
3
{
4
	local windowManager="$1"
5
	local windowManagerPIDs="$(pidof "$windowManager")"
6
	local displayNumber="$(echo $DISPLAY | awk 'BEGIN { FS = "[:.]" } { print $2 }')"
7
	ps e -p "$windowManagerPIDs" | awk -v n="$displayNumber" '$0 ~ " DISPLAY=:" n "[\n .]" { print $1 }'
8
}
9
10
echo "$(ActiveWindowManagerPID $1)"

Return to bug 880995