mirror of
https://github.com/amiwm/amiwm.git
synced 2026-03-24 01:24:15 +00:00
Merge pull request #22 from phillbush/fullscreen
Make fullscreen work on GTK applications
This commit is contained in:
17
icc.c
17
icc.c
@@ -16,15 +16,17 @@ extern struct Library *XLibBase;
|
||||
|
||||
extern void redraw(Client *, Window);
|
||||
|
||||
Atom utf8_string, net_wm_name;
|
||||
Atom wm_state, wm_change_state, wm_protocols, wm_delete, wm_take_focus;
|
||||
Atom wm_colormaps, wm_name, wm_normal_hints, wm_hints, wm_icon_name, wm_class;
|
||||
Atom net_supported, net_wm_state, net_wm_state_fullscreen;
|
||||
Atom net_supporting_wm_check, net_supported, net_wm_state, net_wm_state_fullscreen;
|
||||
Atom amiwm_screen, swm_vroot, amiwm_wflags, amiwm_appiconmsg, amiwm_appwindowmsg;
|
||||
|
||||
extern Display *dpy;
|
||||
|
||||
void init_atoms()
|
||||
{
|
||||
utf8_string = XInternAtom(dpy, "UTF8_STRING", False);
|
||||
wm_state = XInternAtom(dpy, "WM_STATE", False);
|
||||
wm_change_state = XInternAtom(dpy, "WM_CHANGE_STATE", False);
|
||||
wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False);
|
||||
@@ -37,6 +39,8 @@ void init_atoms()
|
||||
wm_icon_name = XInternAtom(dpy, "WM_ICON_NAME", False);
|
||||
wm_class = XInternAtom(dpy, "WM_CLASS", False);
|
||||
net_supported = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||
net_supporting_wm_check = XInternAtom(dpy, "_NET_SUPPORTING_WM_CHECK", False);
|
||||
net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False);
|
||||
net_wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
|
||||
net_wm_state_fullscreen = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||
amiwm_screen = XInternAtom(dpy, "AMIWM_SCREEN", False);
|
||||
@@ -46,14 +50,21 @@ void init_atoms()
|
||||
amiwm_appwindowmsg = XInternAtom(dpy, "AMIWM_APPWINDOWMSG", False);
|
||||
}
|
||||
|
||||
void setsupports(Window root)
|
||||
void setsupports(Window root, Window checkwin)
|
||||
{
|
||||
Atom atoms[] = {
|
||||
net_wm_state_fullscreen
|
||||
net_wm_state,
|
||||
net_wm_state_fullscreen,
|
||||
};
|
||||
XChangeProperty(dpy, root, net_supported, XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char *)atoms,
|
||||
sizeof(atoms)/sizeof(atoms[0]));
|
||||
XChangeProperty(dpy, root, net_supporting_wm_check, XA_WINDOW, 32,
|
||||
PropModeReplace, (void *)(Window[]){checkwin}, 1);
|
||||
XChangeProperty(dpy, checkwin, net_supporting_wm_check, XA_WINDOW, 32,
|
||||
PropModeReplace, (void *)(Window[]){checkwin}, 1);
|
||||
XChangeProperty(dpy, checkwin, net_wm_name, utf8_string, 8,
|
||||
PropModeReplace, (void *)"AmiWM", 5);
|
||||
}
|
||||
|
||||
void setstringprop(Window w, Atom a, char *str)
|
||||
|
||||
2
icc.h
2
icc.h
@@ -6,7 +6,7 @@
|
||||
#include "client.h"
|
||||
|
||||
extern void init_atoms(void);
|
||||
extern void setsupports(Window);
|
||||
extern void setsupports(Window, Window);
|
||||
extern void sendcmessage(Window, Atom, long);
|
||||
extern void getproto(Client *c);
|
||||
extern void getwmstate(Client *c);
|
||||
|
||||
19
main.c
19
main.c
@@ -91,6 +91,7 @@ Scrn *dragscreen=NULL, *menuactive=NULL;
|
||||
static int d_offset=0;
|
||||
static fd_set master_fd_set;
|
||||
static int max_fd=0;
|
||||
static Window *checkwins;
|
||||
char *free_screentitle=NULL;
|
||||
char *x_server=NULL;
|
||||
int shape_event_base, shape_error_base, shape_extn=0;
|
||||
@@ -857,11 +858,15 @@ static void update_clock(void *dontcare)
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
int sc;
|
||||
extern void free_prefs();
|
||||
struct coevent *e;
|
||||
flushmodules();
|
||||
flushclients();
|
||||
scr = get_front_scr();
|
||||
for(sc=0; checkwins!=NULL && sc<ScreenCount(dpy); sc++)
|
||||
XDestroyWindow(dpy, checkwins[sc]);
|
||||
free(checkwins);
|
||||
while(scr)
|
||||
closescreen();
|
||||
free_prefs();
|
||||
@@ -966,13 +971,19 @@ int main(int argc, char *argv[])
|
||||
|
||||
lookup_keysyms(dpy, &meta_mask, &switch_mask);
|
||||
|
||||
for(sc=0; sc<ScreenCount(dpy); sc++)
|
||||
if(sc==DefaultScreen(dpy) || prefs.manage_all)
|
||||
if(!getscreenbyroot(RootWindow(dpy, sc))) {
|
||||
checkwins = calloc(ScreenCount(dpy), sizeof(*checkwins));
|
||||
for(sc=0; sc<ScreenCount(dpy); sc++) {
|
||||
if(sc==DefaultScreen(dpy) || prefs.manage_all) {
|
||||
Window root = RootWindow(dpy, sc);
|
||||
checkwins[sc] = XCreateSimpleWindow(dpy, root, 0, 0, 1, 1, 1, 1, 1);
|
||||
setsupports(scr->root, checkwins[sc]);
|
||||
if(!getscreenbyroot(root)) {
|
||||
char buf[64];
|
||||
sprintf(buf, "Screen.%d", sc);
|
||||
openscreen((sc? strdup(buf):"Workbench Screen"), RootWindow(dpy, sc));
|
||||
openscreen((sc? strdup(buf):"Workbench Screen"), root);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
if(!front)
|
||||
openscreen("Workbench Screen", DefaultRootWindow(dpy));
|
||||
|
||||
Reference in New Issue
Block a user