Put first icon in bottom right.
Also drop use of IconUp and IconDown.
This commit is contained in:
parent
3830011bc5
commit
b4207174da
@ -1,3 +1,10 @@
|
|||||||
|
2019-10-21 Mike Small <smallm@sdf.org>
|
||||||
|
|
||||||
|
* src/icons.h: Remove IconUp and IconDown from icons interface
|
||||||
|
and remove callers.
|
||||||
|
|
||||||
|
* src/icons.cc (PlaceIcon): put first icon in bottom right.
|
||||||
|
|
||||||
2019-10-12 Mike Small <smallm@sdf.org>
|
2019-10-12 Mike Small <smallm@sdf.org>
|
||||||
|
|
||||||
* src/icons.cc (PlaceIcon): stop hard coding the minimum x for
|
* src/icons.cc (PlaceIcon): stop hard coding the minimum x for
|
||||||
|
@ -1196,7 +1196,6 @@ HandleDestroyNotify(void)
|
|||||||
XDestroyWindow(dpy, Tmp_win->frame);
|
XDestroyWindow(dpy, Tmp_win->frame);
|
||||||
if (Tmp_win->icon_w && !Tmp_win->icon_not_ours) {
|
if (Tmp_win->icon_w && !Tmp_win->icon_not_ours) {
|
||||||
XDestroyWindow(dpy, Tmp_win->icon_w);
|
XDestroyWindow(dpy, Tmp_win->icon_w);
|
||||||
IconDown (Tmp_win);
|
|
||||||
}
|
}
|
||||||
Tmp_win->prev->next = Tmp_win->next;
|
Tmp_win->prev->next = Tmp_win->next;
|
||||||
if (Tmp_win->next != NULL)
|
if (Tmp_win->next != NULL)
|
||||||
|
32
src/icons.cc
32
src/icons.cc
@ -32,7 +32,6 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "twm.h"
|
#include "twm.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
@ -41,6 +40,8 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
// DEBUG
|
||||||
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const int icon_area_w = 70;
|
const int icon_area_w = 70;
|
||||||
@ -76,9 +77,11 @@ PlaceIcon(TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y)
|
|||||||
|
|
||||||
int y = 0;
|
int y = 0;
|
||||||
vector<Span> occupied;
|
vector<Span> occupied;
|
||||||
|
cerr << "tmp_win: " << tmp_win->name << '\n';
|
||||||
for (TwmWindow* pw = Scr->TwmRoot.next; pw; pw = pw->next) {
|
for (TwmWindow* pw = Scr->TwmRoot.next; pw; pw = pw->next) {
|
||||||
// Iconified means was it ever iconified.
|
// Iconified means was it ever iconified.
|
||||||
if (pw->iconified) {
|
if (pw->iconified) {
|
||||||
|
cerr << "pw, iconfified: " << pw->name << '\n';
|
||||||
Window root;
|
Window root;
|
||||||
int icon_x, icon_y;
|
int icon_x, icon_y;
|
||||||
unsigned icon_w, icon_h, border_width, depth;
|
unsigned icon_w, icon_h, border_width, depth;
|
||||||
@ -91,6 +94,8 @@ PlaceIcon(TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
cerr << "pw, non-iconfified: " << pw->name << '\n';
|
||||||
|
|
||||||
// A small non-iconified window sitting where an icon would? E.g. xclock.
|
// A small non-iconified window sitting where an icon would? E.g. xclock.
|
||||||
// I assume here that non-iconified windows that look like icons won't
|
// I assume here that non-iconified windows that look like icons won't
|
||||||
// ever be iconified, making this an either or decision.
|
// ever be iconified, making this an either or decision.
|
||||||
@ -103,17 +108,22 @@ PlaceIcon(TwmWindow *tmp_win, int def_x, int def_y, int *final_x, int *final_y)
|
|||||||
}
|
}
|
||||||
const int h = tmp_win->icon_w_height ? tmp_win->icon_w_height : 64;
|
const int h = tmp_win->icon_w_height ? tmp_win->icon_w_height : 64;
|
||||||
|
|
||||||
sort(occupied.begin(), occupied.end());
|
if (occupied.size() == 0) {
|
||||||
int prev = 0;
|
y = Scr->MyDisplayHeight - h;
|
||||||
for (auto span : occupied) {
|
}
|
||||||
if (span.p1 - prev >= h) {
|
else {
|
||||||
if (span.p1 - prev >= h + 2*icon_pad)
|
sort(occupied.begin(), occupied.end());
|
||||||
y = prev + icon_pad;
|
int prev = 0;
|
||||||
else
|
for (auto span : occupied) {
|
||||||
y = prev;
|
if (span.p1 - prev >= h) {
|
||||||
break;
|
if (span.p1 - prev >= h + 2*icon_pad)
|
||||||
|
y = prev + icon_pad;
|
||||||
|
else
|
||||||
|
y = prev;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
prev = span.p2;
|
||||||
}
|
}
|
||||||
prev = span.p2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y) {
|
if (y) {
|
||||||
|
@ -40,8 +40,6 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
#define EXTERN extern
|
#define EXTERN extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EXTERN void IconUp ( TwmWindow *tmp_win );
|
EXTERN void CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y);
|
||||||
EXTERN void IconDown ( TwmWindow *tmp_win );
|
|
||||||
EXTERN void CreateIconWindow ( TwmWindow *tmp_win, int def_x, int def_y );
|
|
||||||
|
|
||||||
#endif /* ICONS_H */
|
#endif /* ICONS_H */
|
||||||
|
@ -2310,7 +2310,6 @@ DeIconify(TwmWindow *tmp_win)
|
|||||||
|
|
||||||
if (tmp_win->icon_w) {
|
if (tmp_win->icon_w) {
|
||||||
XUnmapWindow(dpy, tmp_win->icon_w);
|
XUnmapWindow(dpy, tmp_win->icon_w);
|
||||||
IconDown (tmp_win);
|
|
||||||
}
|
}
|
||||||
if ((Scr->WarpCursor ||
|
if ((Scr->WarpCursor ||
|
||||||
LookInList(Scr->WarpCursorL, tmp_win->full_name, &tmp_win->classh)) &&
|
LookInList(Scr->WarpCursorL, tmp_win->full_name, &tmp_win->classh)) &&
|
||||||
@ -2340,7 +2339,6 @@ DeIconify(TwmWindow *tmp_win)
|
|||||||
|
|
||||||
if (t->icon_w) {
|
if (t->icon_w) {
|
||||||
XUnmapWindow(dpy, t->icon_w);
|
XUnmapWindow(dpy, t->icon_w);
|
||||||
IconDown (t);
|
|
||||||
}
|
}
|
||||||
t->icon = FALSE;
|
t->icon = FALSE;
|
||||||
t->icon_on = FALSE;
|
t->icon_on = FALSE;
|
||||||
@ -2361,8 +2359,6 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
|
|||||||
|
|
||||||
if (tmp_win->icon_w == (Window) 0)
|
if (tmp_win->icon_w == (Window) 0)
|
||||||
CreateIconWindow(tmp_win, def_x, def_y);
|
CreateIconWindow(tmp_win, def_x, def_y);
|
||||||
else
|
|
||||||
IconUp(tmp_win);
|
|
||||||
XMapRaised(dpy, tmp_win->icon_w);
|
XMapRaised(dpy, tmp_win->icon_w);
|
||||||
|
|
||||||
XGetWindowAttributes(dpy, tmp_win->w, &winattrs);
|
XGetWindowAttributes(dpy, tmp_win->w, &winattrs);
|
||||||
|
Loading…
Reference in New Issue
Block a user