aboutsummaryrefslogtreecommitdiffstats
path: root/scrsize.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scrsize.c70
1 files changed, 37 insertions, 33 deletions
diff --git a/scrsize.c b/scrsize.c
index 3c3c652..b45009a 100644
--- a/scrsize.c
+++ b/scrsize.c
@@ -2,7 +2,7 @@
* Copyright (c) 1999, NBG01720@nifty.ne.jp
*
* To compile this program:
- * gcc -D__ST_MT_ERRNO__ -O2 -s -Zomf -Zmtd -lX11 scrsize.c
+ * gcc -D__ST_MT_ERRNO__ -O2 -s -Zomf -Zmtd -lX11 scrsize.c
*
* When I wrote this routine, I consulted some part of the source code of the
* xwininfo utility by X Consortium.
@@ -36,38 +36,42 @@
#include <stdlib.h>
#include <stdio.h>
-int main(){
- char*cp;
- Display*dpy;
- Window window;
- XWindowAttributes win_attributes;
- XSizeHints hints;
- long longjunk;
- int dst[2];
+int
+main()
+{
+ char *cp;
+ Display *dpy;
+ Window window;
+ XWindowAttributes win_attributes;
+ XSizeHints hints;
+ long longjunk;
+ int dst[2];
- _scrsize(dst);
- cp=getenv("WINDOWID");
- if(cp){
- dpy=XOpenDisplay(NULL);
- if(dpy){
- if(XGetWindowAttributes(dpy,window=atol(cp),&win_attributes))
- if(XGetWMNormalHints(dpy,window,&hints,&longjunk))
- if(hints.flags&PResizeInc&&hints.width_inc&&hints.height_inc){
- if(hints.flags&(PBaseSize|PMinSize)){
- if(hints.flags&PBaseSize){
- win_attributes.width -=hints.base_width;
- win_attributes.height-=hints.base_height;
- }else{
- win_attributes.width -=hints.min_width;
- win_attributes.height-=hints.min_height;
- }
- }
- dst[0]=win_attributes.width /hints.width_inc;
- dst[1]=win_attributes.height/hints.height_inc;
- }
- XCloseDisplay(dpy);
+ _scrsize(dst);
+ cp = getenv("WINDOWID");
+ if (cp) {
+ dpy = XOpenDisplay(NULL);
+ if (dpy) {
+ if (XGetWindowAttributes(dpy, window = atol(cp), &win_attributes))
+ if (XGetWMNormalHints(dpy, window, &hints, &longjunk))
+ if (hints.flags & PResizeInc && hints.width_inc
+ && hints.height_inc) {
+ if (hints.flags & (PBaseSize | PMinSize)) {
+ if (hints.flags & PBaseSize) {
+ win_attributes.width -= hints.base_width;
+ win_attributes.height -= hints.base_height;
+ }
+ else {
+ win_attributes.width -= hints.min_width;
+ win_attributes.height -= hints.min_height;
+ }
+ }
+ dst[0] = win_attributes.width / hints.width_inc;
+ dst[1] = win_attributes.height / hints.height_inc;
+ }
+ XCloseDisplay(dpy);
+ }
}
- }
- printf("%i %i\n",dst[0],dst[1]);
- return 0;
+ printf("%i %i\n", dst[0], dst[1]);
+ return 0;
}