aboutsummaryrefslogtreecommitdiffstats
path: root/scrsize.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2001-11-24 02:01:26 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2001-11-24 02:01:26 +0000
commit975c8f9d43d4026bf1d669b08646e9d29a9d02e4 (patch)
treefd8aed139ffef712ccbb2d392c13b3949b0192c5 /scrsize.c
parent[w3m-dev 02530] segfault for bad cookie from local (diff)
downloadw3m-975c8f9d43d4026bf1d669b08646e9d29a9d02e4.tar.gz
w3m-975c8f9d43d4026bf1d669b08646e9d29a9d02e4.zip
run make indent
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;
}