This commit is contained in:
purplerain 2024-10-06 22:00:57 +00:00
parent 50c8bafd9f
commit ac06c97e30
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
820 changed files with 467502 additions and 386453 deletions

View file

@ -114,7 +114,7 @@ void RelieveWindow(Window win,int x,int y,int w,int h,
/************************************************************************
*
* Sizes and creates the window
* Sizes and creates the window
*
***********************************************************************/
XSizeHints mysizehints;
@ -146,7 +146,7 @@ void CreateWindow(int x,int y, int w, int h)
mysizehints.max_width = w + BAR_WIDTH + PAD_WIDTH3;
mysizehints.max_height = h + BAR_WIDTH + PAD_WIDTH3;
mysizehints.win_gravity = NorthWestGravity;
mysizehints.win_gravity = NorthWestGravity;
if(d_depth < 2)
{
@ -180,21 +180,21 @@ void CreateWindow(int x,int y, int w, int h)
gcm = GCForeground|GCBackground;
gcv.foreground = hilite_pix;
gcv.background = hilite_pix;
ReliefGC = XCreateGC(dpy, Root, gcm, &gcv);
ReliefGC = XCreateGC(dpy, Root, gcm, &gcv);
gcm = GCForeground|GCBackground;
gcv.foreground = shadow_pix;
gcv.background = shadow_pix;
ShadowGC = XCreateGC(dpy, Root, gcm, &gcv);
ShadowGC = XCreateGC(dpy, Root, gcm, &gcv);
_XA_WM_COLORMAP_WINDOWS = XInternAtom (dpy, "WM_COLORMAP_WINDOWS", False);
}
/****************************************************************************
*
*
* Loads a single color
*
****************************************************************************/
****************************************************************************/
Pixel GetColor(char *name)
{
XColor color;
@ -202,11 +202,11 @@ Pixel GetColor(char *name)
XGetWindowAttributes(dpy,Root,&attributes);
color.pixel = 0;
if (!XParseColor (dpy, attributes.colormap, name, &color))
if (!XParseColor (dpy, attributes.colormap, name, &color))
{
nocolor("parse",name);
}
else if(!XAllocColor (dpy, attributes.colormap, &color))
else if(!XAllocColor (dpy, attributes.colormap, &color))
{
nocolor("alloc",name);
}
@ -250,7 +250,7 @@ void Loop(Window target)
exposed = 1;
RedrawWindow(target);
break;
case ConfigureNotify:
XGetGeometry(dpy,main_win,&root,&x,&y,
(unsigned int *)&tw,(unsigned int *)&th,
@ -276,7 +276,7 @@ void Loop(Window target)
RedrawWindow(target);
}
break;
case ButtonPress:
if((Event.xbutton.y > Height-BAR_WIDTH) &&
(Event.xbutton.x < SCROLL_BAR_WIDTH+PAD_WIDTH3))
@ -324,7 +324,7 @@ void Loop(Window target)
RedrawWindow(target);
}
else if((Event.xbutton.y > Height- BAR_WIDTH ) &&
(Event.xbutton.x < Width- BAR_WIDTH))
(Event.xbutton.x < Width- BAR_WIDTH))
{
motion=HORIZONTAL;
target_x_offset=(Event.xbutton.x -PAD_WIDTH3-SCROLL_BAR_WIDTH)*
@ -332,14 +332,14 @@ void Loop(Window target)
(Width-BAR_WIDTH-PAD_WIDTH3-2*SCROLL_BAR_WIDTH);
if(target_x_offset < 0)
target_x_offset = 0;
if(target_x_offset + Width - BAR_WIDTH -PAD_WIDTH3> target_width)
target_x_offset = target_width - Width + BAR_WIDTH+PAD_WIDTH3;
XMoveWindow(dpy,target,-target_x_offset, -target_y_offset);
RedrawWindow(target);
}
else if((Event.xbutton.y > Height- BAR_WIDTH ) &&
(Event.xbutton.x > Width- BAR_WIDTH))
(Event.xbutton.x > Width- BAR_WIDTH))
{
exposed = 2;
motion=QUIT;
@ -417,7 +417,7 @@ void Loop(Window target)
(Width-BAR_WIDTH-PAD_WIDTH3-2*SCROLL_BAR_WIDTH);
if(target_x_offset < 0)
target_x_offset = 0;
if(target_x_offset + Width - BAR_WIDTH -PAD_WIDTH3> target_width)
target_x_offset = target_width - Width + BAR_WIDTH+PAD_WIDTH3;
XMoveWindow(dpy,target,-target_x_offset, -target_y_offset);
@ -473,7 +473,7 @@ void Loop(Window target)
(Width-BAR_WIDTH-PAD_WIDTH3-2*SCROLL_BAR_WIDTH);
if(target_x_offset < 0)
target_x_offset = 0;
if(target_x_offset + Width - BAR_WIDTH -PAD_WIDTH3> target_width)
target_x_offset = target_width - Width + BAR_WIDTH+PAD_WIDTH3;
XMoveWindow(dpy,target,-target_x_offset, -target_y_offset);
@ -488,7 +488,7 @@ void Loop(Window target)
RedrawWindow(target);
break;
case ClientMessage:
if ((Event.xclient.format==32) &&
if ((Event.xclient.format==32) &&
(Event.xclient.data.l[0]==wm_del_win))
{
DeadPipe(1);
@ -505,8 +505,8 @@ void Loop(Window target)
{
if (XGetWindowProperty (dpy,
target, Event.xproperty.atom, 0,
MAX_ICON_NAME_LEN, False, XA_STRING,
&actual,&actual_format, &nitems,
MAX_ICON_NAME_LEN, False, XA_STRING,
&actual,&actual_format, &nitems,
&bytesafter, (unsigned char **) &prop)
== Success && (prop != NULL))
change_icon_name(prop);
@ -519,7 +519,7 @@ void Loop(Window target)
XSetWMHints(dpy,main_win, wmhints);
XFree(wmhints);
}
else if(Event.xproperty.atom == XA_WM_NORMAL_HINTS)
else if(Event.xproperty.atom == XA_WM_NORMAL_HINTS)
{
/* don't do Normal Hints. They alter the size of the window */
}
@ -527,7 +527,7 @@ void Loop(Window target)
{
}
break;
case DestroyNotify:
DeadPipe(1);
break;
@ -561,7 +561,7 @@ void Loop(Window target)
/************************************************************************
*
* Draw the window
* Draw the window
*
***********************************************************************/
void RedrawWindow(Window target)
@ -573,7 +573,7 @@ void RedrawWindow(Window target)
while (XCheckTypedWindowEvent (dpy, main_win, Expose, &dummy))
exposed |= 1;
XSetWindowBorderWidth(dpy,target,0);
RelieveWindow(main_win,PAD_WIDTH3-2,PAD_WIDTH3-2,
@ -676,11 +676,11 @@ void RedrawWindow(Window target)
void change_window_name(char *str)
{
XTextProperty name;
if(str == NULL)
return;
if (XStringListToTextProperty(&str,1,&name) == 0)
if (XStringListToTextProperty(&str,1,&name) == 0)
{
fprintf(stderr,"%s: cannot allocate window name",MyName);
return;
@ -696,9 +696,9 @@ void change_window_name(char *str)
void change_icon_name(char *str)
{
XTextProperty name;
if(str == NULL)return;
if (XStringListToTextProperty(&str,1,&name) == 0)
if (XStringListToTextProperty(&str,1,&name) == 0)
{
fprintf(stderr,"%s: cannot allocate window name",MyName);
return;
@ -718,7 +718,7 @@ void GrabWindow(Window target)
Atom actual = None;
int actual_format;
unsigned long nitems, bytesafter;
XUnmapWindow(dpy,target);
XSync(dpy,0);
XGetGeometry(dpy,target,&root,&x,&y,
@ -741,8 +741,8 @@ void GrabWindow(Window target)
temp = NULL;
if (XGetWindowProperty (dpy,
target, XA_WM_ICON_NAME, 0,
MAX_ICON_NAME_LEN, False, XA_STRING,
&actual,&actual_format, &nitems,
MAX_ICON_NAME_LEN, False, XA_STRING,
&actual,&actual_format, &nitems,
&bytesafter, (unsigned char **) &prop)
== Success && (prop != NULL))
{
@ -752,7 +752,7 @@ void GrabWindow(Window target)
change_window_name(temp);
{
XWMHints *wmhints;
wmhints = XGetWMHints(dpy,target);
if(wmhints != NULL)
{
@ -767,7 +767,7 @@ void GrabWindow(Window target)
XSetWindowColormap(dpy,main_win,xwa.colormap);
}
}
XMapWindow(dpy,main_win);
RedrawWindow(target);
XFree(temp);
@ -779,9 +779,9 @@ void GrabWindow(Window target)
void RedrawLeftButton(GC rgc, GC sgc,int x1,int y1)
{
XSegment seg[4];
XSegment seg[4];
int i=0;
seg[i].x1 = x1+1; seg[i].y1 = y1+SCROLL_BAR_WIDTH/2;
seg[i].x2 = x1+SCROLL_BAR_WIDTH - 2; seg[i++].y2 = y1+1;
@ -806,7 +806,7 @@ void RedrawLeftButton(GC rgc, GC sgc,int x1,int y1)
void RedrawRightButton(GC rgc, GC sgc,int x1,int y1)
{
XSegment seg[4];
XSegment seg[4];
int i=0;
seg[i].x1 = x1+1; seg[i].y1 = y1+1;
@ -834,7 +834,7 @@ void RedrawRightButton(GC rgc, GC sgc,int x1,int y1)
void RedrawTopButton(GC rgc, GC sgc,int x1,int y1)
{
XSegment seg[4];
XSegment seg[4];
int i=0;
seg[i].x1 = x1+SCROLL_BAR_WIDTH/2; seg[i].y1 = y1+1;
@ -861,7 +861,7 @@ void RedrawTopButton(GC rgc, GC sgc,int x1,int y1)
void RedrawBottomButton(GC rgc, GC sgc,int x1, int y1)
{
XSegment seg[4];
XSegment seg[4];
int i=0;
seg[i].x1 = x1+1; seg[i].y1 = y1+1;
@ -885,4 +885,4 @@ void RedrawBottomButton(GC rgc, GC sgc,int x1, int y1)
seg[i].x2 = x1+SCROLL_BAR_WIDTH/2; seg[i++].y2 = y1+SCROLL_BAR_WIDTH - 1;
XDrawSegments(dpy, main_win, sgc, seg, i);
}