equal
deleted
inserted
replaced
978 } |
978 } |
979 |
979 |
980 void |
980 void |
981 initfont(const char *fontstr) { |
981 initfont(const char *fontstr) { |
982 char *def, **missing; |
982 char *def, **missing; |
983 int i, n; |
983 int n; |
984 |
984 |
985 missing = NULL; |
985 missing = NULL; |
986 dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); |
986 dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); |
987 if(missing) { |
987 if(missing) { |
988 while(n--) |
988 while(n--) |
994 char **font_names; |
994 char **font_names; |
995 |
995 |
996 dc.font.ascent = dc.font.descent = 0; |
996 dc.font.ascent = dc.font.descent = 0; |
997 XExtentsOfFontSet(dc.font.set); |
997 XExtentsOfFontSet(dc.font.set); |
998 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); |
998 n = XFontsOfFontSet(dc.font.set, &xfonts, &font_names); |
999 for(i = 0, dc.font.ascent = 0, dc.font.descent = 0; i < n; i++) { |
999 while(n--) { |
1000 dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); |
1000 dc.font.ascent = MAX(dc.font.ascent, (*xfonts)->ascent); |
1001 dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent); |
1001 dc.font.descent = MAX(dc.font.descent,(*xfonts)->descent); |
1002 xfonts++; |
1002 xfonts++; |
1003 } |
1003 } |
1004 } |
1004 } |
1012 dc.font.height = dc.font.ascent + dc.font.descent; |
1012 dc.font.height = dc.font.ascent + dc.font.descent; |
1013 } |
1013 } |
1014 |
1014 |
1015 Bool |
1015 Bool |
1016 isprotodel(Client *c) { |
1016 isprotodel(Client *c) { |
1017 int i, n; |
1017 int n; |
1018 Atom *protocols; |
1018 Atom *protocols; |
1019 Bool ret = False; |
1019 Bool ret = False; |
1020 |
1020 |
1021 if(XGetWMProtocols(dpy, c->win, &protocols, &n)) { |
1021 if(XGetWMProtocols(dpy, c->win, &protocols, &n)) { |
1022 for(i = 0; !ret && i < n; i++) |
1022 while(!ret && n--) |
1023 if(protocols[i] == wmatom[WMDelete]) |
1023 ret = protocols[n] == wmatom[WMDelete]; |
1024 ret = True; |
|
1025 XFree(protocols); |
1024 XFree(protocols); |
1026 } |
1025 } |
1027 return ret; |
1026 return ret; |
1028 } |
1027 } |
1029 |
1028 |
1030 #ifdef XINERAMA |
1029 #ifdef XINERAMA |
1031 static Bool |
1030 static Bool |
1032 isuniquegeom(XineramaScreenInfo *unique, size_t len, XineramaScreenInfo *info) { |
1031 isuniquegeom(XineramaScreenInfo *unique, size_t n, XineramaScreenInfo *info) { |
1033 unsigned int i; |
1032 while(n--) |
1034 |
1033 if(unique[n].x_org == info->x_org && unique[n].y_org == info->y_org |
1035 for(i = 0; i < len; i++) |
1034 && unique[n].width == info->width && unique[n].height == info->height) |
1036 if(unique[i].x_org == info->x_org && unique[i].y_org == info->y_org |
|
1037 && unique[i].width == info->width && unique[i].height == info->height) |
|
1038 return False; |
1035 return False; |
1039 return True; |
1036 return True; |
1040 } |
1037 } |
1041 #endif /* XINERAMA */ |
1038 #endif /* XINERAMA */ |
1042 |
1039 |