Lines Matching refs:tmp_win

92 static Window CreateHighlightWindow(TwmWindow *tmp_win);
93 static void CreateWindowTitlebarButtons(TwmWindow *tmp_win);
149 TwmWindow *tmp_win; /* new twm window structure */
174 tmp_win = (TwmWindow *) calloc(1, sizeof(TwmWindow));
175 if (tmp_win == NULL) {
179 tmp_win->w = w;
180 tmp_win->zoomed = ZOOM_NONE;
181 tmp_win->iconmgr = (short) iconm;
182 tmp_win->iconmgrp = iconp;
183 tmp_win->cmaps.number_cwins = 0;
185 XSelectInput(dpy, tmp_win->w, PropertyChangeMask);
187 XGetWindowAttributes(dpy, tmp_win->w, &tmp_win->attr);
189 if (!I18N_FetchName(dpy, tmp_win->w, &name))
191 tmp_win->xclass = NoClass;
192 XGetClassHint(dpy, tmp_win->w, &tmp_win->xclass);
193 FetchWmProtocols(tmp_win);
194 FetchWmColormapWindows(tmp_win);
197 tmp_win->name = strdup(NoName);
199 tmp_win->name = strdup(name);
203 if (GetWindowConfig(tmp_win,
209 tmp_win->attr.x = saved_x;
210 tmp_win->attr.y = saved_y;
212 tmp_win->widthEverChangedByUser = width_ever_changed_by_user;
213 tmp_win->heightEverChangedByUser = height_ever_changed_by_user;
216 tmp_win->attr.width = saved_width;
219 tmp_win->attr.height = saved_height;
224 tmp_win->widthEverChangedByUser = False;
225 tmp_win->heightEverChangedByUser = False;
233 if (tmp_win->attr.width > Scr->MaxWindowWidth)
234 tmp_win->attr.width = Scr->MaxWindowWidth;
235 if (tmp_win->attr.height > Scr->MaxWindowHeight)
236 tmp_win->attr.height = Scr->MaxWindowHeight;
238 tmp_win->wmhints = XGetWMHints(dpy, tmp_win->w);
240 if (tmp_win->wmhints) {
242 tmp_win->wmhints->initial_state = IconicState;
243 tmp_win->wmhints->flags |= StateHint;
247 tmp_win->wmhints->icon_x = restore_icon_x;
248 tmp_win->wmhints->icon_y = restore_icon_y;
249 tmp_win->wmhints->flags |= IconPositionHint;
253 if (tmp_win->wmhints && (tmp_win->wmhints->flags & WindowGroupHint))
254 tmp_win->group = tmp_win->wmhints->window_group;
256 tmp_win->group = tmp_win->w /* NULL */ ;
263 tmp_win->transient = (short) Transient(tmp_win->w, &tmp_win->transientfor);
265 tmp_win->nameChanged = 0;
266 if (tmp_win->xclass.res_name == NULL)
267 tmp_win->xclass.res_name = NoName;
268 if (tmp_win->xclass.res_class == NULL)
269 tmp_win->xclass.res_class = NoName;
271 tmp_win->full_name = strdup(tmp_win->name);
272 namelen = (int) strlen(tmp_win->name);
274 tmp_win->highlight = Scr->Highlight &&
275 (!short_lookup LookInList(Scr->NoHighlight, tmp_win->full_name,
276 &tmp_win->xclass));
278 tmp_win->stackmode = Scr->StackMode &&
279 (!short_lookup LookInList(Scr->NoStackModeL, tmp_win->full_name,
280 &tmp_win->xclass));
282 tmp_win->titlehighlight = Scr->TitleHighlight &&
283 (!short_lookup LookInList(Scr->NoTitleHighlight, tmp_win->full_name,
284 &tmp_win->xclass));
286 tmp_win->auto_raise = short_lookup LookInList(Scr->AutoRaise,
287 tmp_win->full_name,
288 &tmp_win->xclass);
289 if (tmp_win->auto_raise)
292 tmp_win->iconify_by_unmapping = iconm ? FALSE :
293 !short_lookup LookInList(Scr->DontIconify, tmp_win->full_name,
294 &tmp_win->xclass);
297 tmp_win->iconify_by_unmapping = Scr->IconifyByUnmapping;
299 tmp_win->iconify_by_unmapping |=
300 short_lookup LookInList(Scr->IconifyByUn, tmp_win->full_name,
301 &tmp_win->xclass);
303 if (LookInList(Scr->WindowRingL, tmp_win->full_name, &tmp_win->xclass)) {
305 tmp_win->ring.next = Scr->Ring->ring.next;
307 Scr->Ring->ring.next->ring.prev = tmp_win;
308 Scr->Ring->ring.next = tmp_win;
309 tmp_win->ring.prev = Scr->Ring;
312 tmp_win->ring.next = tmp_win->ring.prev = Scr->Ring = tmp_win;
316 tmp_win->ring.next = tmp_win->ring.prev = NULL;
317 tmp_win->ring.cursor_valid = False;
319 tmp_win->squeeze_info = NULL;
325 if (!LookInList(Scr->DontSqueezeTitleL, tmp_win->full_name,
326 &tmp_win->xclass)) {
327 tmp_win->squeeze_info = (SqueezeInfo *)
328 LookInList(Scr->SqueezeTitleL, tmp_win->full_name,
329 &tmp_win->xclass);
330 if (!tmp_win->squeeze_info) {
333 tmp_win->squeeze_info = &default_squeeze;
338 tmp_win->old_bw = tmp_win->attr.border_width;
341 tmp_win->frame_bw = tmp_win->old_bw;
344 tmp_win->frame_bw = Scr->BorderWidth;
346 bw2 = tmp_win->frame_bw * 2;
348 tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw;
350 tmp_win->title_height = 0;
351 if (LookInList(Scr->MakeTitle, tmp_win->full_name, &tmp_win->xclass))
352 tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw;
353 if (LookInList(Scr->NoTitle, tmp_win->full_name, &tmp_win->xclass))
354 tmp_win->title_height = 0;
357 if (tmp_win->transient && !Scr->DecorateTransients)
358 tmp_win->title_height = 0;
360 if (LookInList(Scr->StartIconified, tmp_win->full_name, &tmp_win->xclass)) {
361 if (!tmp_win->wmhints) {
362 tmp_win->wmhints = (XWMHints *) malloc(sizeof(XWMHints));
363 tmp_win->wmhints->flags = 0;
365 tmp_win->wmhints->initial_state = IconicState;
366 tmp_win->wmhints->flags |= StateHint;
369 GetWindowSizeHints(tmp_win);
380 GetGravityOffsets(tmp_win, &gravx, &gravy);
394 if (tmp_win->transient ||
395 (tmp_win->hints.flags & USPosition) ||
396 ((tmp_win->hints.flags & PPosition) && Scr->UsePPosition &&
398 tmp_win->attr.x != 0 || tmp_win->attr.y != 0)))
407 if ((PlaceX + tmp_win->attr.width) > Scr->MyDisplayWidth) {
408 PlaceX = Scr->MyDisplayWidth - tmp_win->attr.width;
414 if ((PlaceY + tmp_win->attr.height) > Scr->MyDisplayHeight) {
415 PlaceY = Scr->MyDisplayHeight - tmp_win->attr.height;
422 tmp_win->attr.x = PlaceX;
423 tmp_win->attr.y = PlaceY;
428 if (!(tmp_win->wmhints && tmp_win->wmhints->flags & StateHint &&
429 tmp_win->wmhints->initial_state == IconicState)) {
492 tmp_win->name,
508 tmp_win->name, namelen);
510 AddingW = tmp_win->attr.width + bw2;
511 AddingH = tmp_win->attr.height + tmp_win->title_height + bw2;
529 tmp_win->frame_bw, tmp_win->title_height);
595 tmp_win->frame_bw, tmp_win->title_height);
613 int dx = (tmp_win->attr.width / 4);
614 int dy = (tmp_win->attr.height / 4);
622 dx += (tmp_win->frame_bw + 1);
623 dy += (bw2 + tmp_win->title_height + 1);
636 AddStartResize(tmp_win, AddingX, AddingY, AddingW, AddingH);
655 AddEndResize(tmp_win);
673 DoResize(AddingX, AddingY, tmp_win);
696 ConstrainSize(tmp_win, &AddingW, &AddingH); /* w/o borders */
709 tmp_win->attr.x = AddingX;
710 tmp_win->attr.y = AddingY + tmp_win->title_height;
711 tmp_win->attr.width = AddingW - bw2;
712 tmp_win->attr.height = AddingH - tmp_win->title_height - bw2;
721 tmp_win->attr.y -= gravy * tmp_win->title_height;
726 tmp_win->attr.x,
727 tmp_win->attr.y, tmp_win->attr.width, tmp_win->attr.height);
731 int delta = tmp_win->attr.border_width - tmp_win->frame_bw;
733 tmp_win->attr.x += gravx * delta;
734 tmp_win->attr.y += gravy * delta;
737 tmp_win->title_width = tmp_win->attr.width;
739 if (tmp_win->old_bw)
740 XSetWindowBorderWidth(dpy, tmp_win->w, 0);
742 tmp_win->name_width = MyFont_TextWidth(&Scr->TitleBarFont, tmp_win->name,
745 if (!I18N_GetIconName(dpy, tmp_win->w, &name)) {
746 tmp_win->icon_name = strdup(tmp_win->name);
750 tmp_win->icon_name = strdup(tmp_win->name);
753 tmp_win->icon_name = strdup(name);
758 tmp_win->iconified = FALSE;
759 tmp_win->icon = FALSE;
760 tmp_win->icon_on = FALSE;
771 if (XGetGeometry(dpy, tmp_win->w, &wdummy, &dummy, &dummy,
773 free(tmp_win);
779 tmp_win->next = Scr->TwmRoot.next;
781 Scr->TwmRoot.next->prev = tmp_win;
782 tmp_win->prev = &Scr->TwmRoot;
783 Scr->TwmRoot.next = tmp_win;
787 tmp_win->border = Scr->BorderColor;
788 tmp_win->icon_border = Scr->IconBorderColor;
789 tmp_win->border_tile.fore = Scr->BorderTileC.fore;
790 tmp_win->border_tile.back = Scr->BorderTileC.back;
791 tmp_win->title.fore = Scr->TitleC.fore;
792 tmp_win->title.back = Scr->TitleC.back;
793 tmp_win->iconc.fore = Scr->IconC.fore;
794 tmp_win->iconc.back = Scr->IconC.back;
796 GetColorFromList(Scr->BorderColorL, tmp_win->full_name,
797 &tmp_win->xclass, &tmp_win->border);
798 GetColorFromList(Scr->IconBorderColorL, tmp_win->full_name,
799 &tmp_win->xclass, &tmp_win->icon_border);
800 GetColorFromList(Scr->BorderTileForegroundL, tmp_win->full_name,
801 &tmp_win->xclass, &tmp_win->border_tile.fore);
802 GetColorFromList(Scr->BorderTileBackgroundL, tmp_win->full_name,
803 &tmp_win->xclass, &tmp_win->border_tile.back);
804 GetColorFromList(Scr->TitleForegroundL, tmp_win->full_name,
805 &tmp_win->xclass, &tmp_win->title.fore);
806 GetColorFromList(Scr->TitleBackgroundL, tmp_win->full_name,
807 &tmp_win->xclass, &tmp_win->title.back);
808 GetColorFromList(Scr->IconForegroundL, tmp_win->full_name,
809 &tmp_win->xclass, &tmp_win->iconc.fore);
810 GetColorFromList(Scr->IconBackgroundL, tmp_win->full_name,
811 &tmp_win->xclass, &tmp_win->iconc.back);
815 tmp_win->frame_x = tmp_win->attr.x + tmp_win->old_bw - tmp_win->frame_bw;
816 tmp_win->frame_y = tmp_win->attr.y - tmp_win->title_height +
817 tmp_win->old_bw - tmp_win->frame_bw;
818 tmp_win->frame_width = tmp_win->attr.width;
819 tmp_win->frame_height = tmp_win->attr.height + tmp_win->title_height;
823 attributes.border_pixel = tmp_win->border;
828 if (tmp_win->attr.save_under) {
833 tmp_win->frame = XCreateWindow(dpy, Scr->Root, tmp_win->frame_x,
834 tmp_win->frame_y,
835 (unsigned int) tmp_win->frame_width,
836 (unsigned int) tmp_win->frame_height,
837 (unsigned int) tmp_win->frame_bw,
842 if (tmp_win->title_height) {
846 attributes.border_pixel = tmp_win->border;
847 attributes.background_pixel = tmp_win->title.back;
848 tmp_win->title_w = XCreateWindow(dpy, tmp_win->frame,
849 -tmp_win->frame_bw,
850 -tmp_win->frame_bw,
851 (unsigned int) tmp_win->attr.width,
853 (unsigned int) tmp_win->frame_bw,
859 tmp_win->title_w = 0;
860 tmp_win->squeeze_info = NULL;
863 if (tmp_win->highlight) {
864 tmp_win->gray = XCreatePixmapFromBitmapData(dpy, Scr->Root,
867 tmp_win->border_tile.fore,
868 tmp_win->border_tile.back,
871 SetBorder(tmp_win, False);
874 tmp_win->gray = None;
876 if (tmp_win->title_w) {
877 CreateWindowTitlebarButtons(tmp_win);
878 ComputeTitleLocation(tmp_win);
879 XMoveWindow(dpy, tmp_win->title_w, tmp_win->title_x, tmp_win->title_y);
880 XDefineCursor(dpy, tmp_win->title_w, Scr->TitleCursor);
888 XChangeWindowAttributes(dpy, tmp_win->w, valuemask, &attributes);
891 XShapeSelectInput(dpy, tmp_win->w, ShapeNotifyMask);
893 if (tmp_win->title_w) {
894 XMapWindow(dpy, tmp_win->title_w);
902 XShapeSelectInput(dpy, tmp_win->w, ShapeNotifyMask);
903 XShapeQueryExtents(dpy, tmp_win->w,
906 tmp_win->wShaped = (short) boundingShaped;
909 if (!tmp_win->iconmgr)
910 XAddToSaveSet(dpy, tmp_win->w);
912 XReparentWindow(dpy, tmp_win->w, tmp_win->frame, 0, tmp_win->title_height);
919 tmp_win->mapped = FALSE;
921 SetupFrame(tmp_win, tmp_win->frame_x, tmp_win->frame_y,
922 tmp_win->frame_width, tmp_win->frame_height, -1, True);
927 tmp_win->icon_w = (Window) 0;
929 if (!tmp_win->iconmgr) {
930 GrabButtons(tmp_win);
931 GrabKeys(tmp_win);
934 (void) AddIconManager(tmp_win);
936 XSaveContext(dpy, tmp_win->w, TwmContext, (XPointer) tmp_win);
937 XSaveContext(dpy, tmp_win->w, ScreenContext, (XPointer) Scr);
938 XSaveContext(dpy, tmp_win->frame, TwmContext, (XPointer) tmp_win);
939 XSaveContext(dpy, tmp_win->frame, ScreenContext, (XPointer) Scr);
940 if (tmp_win->title_height) {
944 XSaveContext(dpy, tmp_win->title_w, TwmContext, (XPointer) tmp_win);
945 XSaveContext(dpy, tmp_win->title_w, ScreenContext, (XPointer) Scr);
947 XSaveContext(dpy, tmp_win->titlebuttons[i].window, TwmContext,
948 (XPointer) tmp_win);
949 XSaveContext(dpy, tmp_win->titlebuttons[i].window, ScreenContext,
952 if (tmp_win->hilite_w) {
953 XSaveContext(dpy, tmp_win->hilite_w, TwmContext,
954 (XPointer) tmp_win);
955 XSaveContext(dpy, tmp_win->hilite_w, ScreenContext, (XPointer) Scr);
967 return (tmp_win);
1026 * \param[in] tmp_win the twm window structure to use
1029 GrabButtons(TwmWindow *tmp_win)
1037 * tmp_win->w . This was not ICCCM compliant and was changed.
1039 XGrabButton(dpy, (unsigned) i, (unsigned) j, tmp_win->frame,
1051 * \param[in] tmp_win the twm window structure to use
1054 GrabKeys(TwmWindow *tmp_win)
1062 XGrabKey(dpy, tmp->keycode, (unsigned) tmp->mods, tmp_win->w, True,
1067 if (tmp_win->icon_w)
1069 tmp_win->icon_w, True, GrabModeAsync, GrabModeAsync);
1073 if (tmp_win->title_w)
1075 tmp_win->title_w, True, GrabModeAsync, GrabModeAsync);
1079 XGrabKey(dpy, tmp->keycode, (unsigned) tmp->mods, tmp_win->w, True,
1081 if (tmp_win->icon_w)
1083 tmp_win->icon_w, True, GrabModeAsync, GrabModeAsync);
1084 if (tmp_win->title_w)
1086 tmp_win->title_w, True, GrabModeAsync, GrabModeAsync);
1107 CreateHighlightWindow(TwmWindow *tmp_win)
1130 Scr->hilitePm = XCreateBitmapFromData(dpy, tmp_win->title_w,
1137 pm = XCreatePixmap(dpy, tmp_win->title_w,
1141 gcv.foreground = tmp_win->title.fore;
1142 gcv.background = tmp_win->title.back;
1164 attributes.background_pixel = tmp_win->title.fore;
1167 w = XCreateWindow(dpy, tmp_win->title_w, 0, Scr->FramePadding,
1196 ComputeWindowTitleOffsets(TwmWindow *tmp_win, int width, Bool squeeze)
1198 tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width);
1199 if (tmp_win->hilite_w || Scr->TBInfo.nright > 0)
1200 tmp_win->highlightx += Scr->TitlePadding;
1201 tmp_win->rightx = width - Scr->TBInfo.rightoff;
1202 if (squeeze && tmp_win->squeeze_info) {
1203 int rx = (tmp_win->highlightx +
1204 (tmp_win->hilite_w
1208 if (rx < tmp_win->rightx)
1209 tmp_win->rightx = rx;
1273 CreateWindowTitlebarButtons(TwmWindow *tmp_win)
1281 if (tmp_win->title_height == 0) {
1282 tmp_win->hilite_w = 0;
1290 ComputeWindowTitleOffsets(tmp_win, tmp_win->attr.width, False);
1293 rightx = tmp_win->rightx;
1296 attributes.background_pixel = tmp_win->title.back;
1297 attributes.border_pixel = tmp_win->title.fore;
1304 tmp_win->titlebuttons = NULL;
1307 tmp_win->titlebuttons = (TBWindow *)
1309 if (!tmp_win->titlebuttons) {
1318 for (tb = Scr->TBInfo.head, tbw = tmp_win->titlebuttons; tb;
1332 tbw->window = XCreateWindow(dpy, tmp_win->title_w, x, y, h, h,
1342 tmp_win->hilite_w = (tmp_win->titlehighlight
1343 ? CreateHighlightWindow(tmp_win) : None);
1345 XMapSubwindows(dpy, tmp_win->title_w);
1346 if (tmp_win->hilite_w)
1347 XUnmapWindow(dpy, tmp_win->hilite_w);