fixed order of transient monitor applicaion and rule application
183dc670
1 file(s) · +22 −18
| 1046 | 1046 | die("fatal: could not malloc() %u bytes\n", sizeof(Client)); |
|
| 1047 | 1047 | *c = cz; |
|
| 1048 | 1048 | c->win = w; |
|
| 1049 | - | c->mon = selmon; |
|
| 1049 | + | ||
| 1050 | + | if(XGetTransientForHint(dpy, w, &trans)) |
|
| 1051 | + | t = wintoclient(trans); |
|
| 1052 | + | if(t) { |
|
| 1053 | + | c->mon = t->mon; |
|
| 1054 | + | c->tags = t->tags; |
|
| 1055 | + | } |
|
| 1056 | + | else { |
|
| 1057 | + | c->mon = selmon; |
|
| 1058 | + | applyrules(c); |
|
| 1059 | + | } |
|
| 1050 | 1060 | ||
| 1051 | 1061 | /* geometry */ |
|
| 1052 | - | c->x = wa->x + selmon->wx; |
|
| 1053 | - | c->y = wa->y + selmon->wy; |
|
| 1062 | + | c->x = wa->x + c->mon->wx; |
|
| 1063 | + | c->y = wa->y + c->mon->wy; |
|
| 1054 | 1064 | c->w = wa->width; |
|
| 1055 | 1065 | c->h = wa->height; |
|
| 1056 | 1066 | c->oldbw = wa->border_width; |
|
| 1057 | - | if(c->w == selmon->mw && c->h == selmon->mh) { |
|
| 1058 | - | c->x = selmon->mx; |
|
| 1059 | - | c->y = selmon->my; |
|
| 1067 | + | if(c->w == c->mon->mw && c->h == c->mon->mh) { |
|
| 1068 | + | c->x = c->mon->mx; |
|
| 1069 | + | c->y = c->mon->my; |
|
| 1060 | 1070 | c->bw = 0; |
|
| 1061 | 1071 | } |
|
| 1062 | 1072 | else { |
|
| 1063 | - | if(c->x + WIDTH(c) > selmon->mx + selmon->mw) |
|
| 1064 | - | c->x = selmon->mx + selmon->mw - WIDTH(c); |
|
| 1065 | - | if(c->y + HEIGHT(c) > selmon->my + selmon->mh) |
|
| 1066 | - | c->y = selmon->my + selmon->mh - HEIGHT(c); |
|
| 1067 | - | c->x = MAX(c->x, selmon->mx); |
|
| 1073 | + | if(c->x + WIDTH(c) > c->mon->mx + c->mon->mw) |
|
| 1074 | + | c->x = c->mon->mx + c->mon->mw - WIDTH(c); |
|
| 1075 | + | if(c->y + HEIGHT(c) > c->mon->my + c->mon->mh) |
|
| 1076 | + | c->y = c->mon->my + c->mon->mh - HEIGHT(c); |
|
| 1077 | + | c->x = MAX(c->x, c->mon->mx); |
|
| 1068 | 1078 | /* only fix client y-offset, if the client center might cover the bar */ |
|
| 1069 | 1079 | c->y = MAX(c->y, ((c->mon->by == 0) && (c->x + (c->w / 2) >= c->mon->wx) |
|
| 1070 | - | && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : selmon->my); |
|
| 1080 | + | && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); |
|
| 1071 | 1081 | c->bw = borderpx; |
|
| 1072 | 1082 | } |
|
| 1073 | 1083 | ||
| 1079 | 1089 | XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); |
|
| 1080 | 1090 | grabbuttons(c, False); |
|
| 1081 | 1091 | updatetitle(c); |
|
| 1082 | - | if(XGetTransientForHint(dpy, w, &trans)) |
|
| 1083 | - | t = wintoclient(trans); |
|
| 1084 | - | if(t) |
|
| 1085 | - | c->tags = t->tags; |
|
| 1086 | - | else |
|
| 1087 | - | applyrules(c); |
|
| 1088 | 1092 | if(!c->isfloating) |
|
| 1089 | 1093 | c->isfloating = trans != None || c->isfixed; |
|
| 1090 | 1094 | if(c->isfloating) |
|