]> git.mdlowis.com Git - proto/windowlab.git/commitdiff
removed more functionality
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 23 May 2019 02:57:32 +0000 (22:57 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 23 May 2019 02:57:32 +0000 (22:57 -0400)
Makefile
client.c
events.c
main.c
manage.c
windowlab.h

index 71c7e6d14c7e7ad7e7c87cd6bec925581472030d..725b4547731f26eb772cf03f0d9d1b74ee034ee0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,13 +18,6 @@ CONFDIR = /etc/X11/windowlab
 # Set this to the location of the global configuration files
 SYSCONFDIR = $(CONFPREFIX)$(CONFDIR)
 
-# Information about the location of the menurc file
-ifndef MENURC
-MENURC = $(SYSCONFDIR)/windowlab.menurc
-endif
-
-DEFINES += -DDEF_MENURC="\"$(MENURC)\""
-
 # Uncomment for debugging info (abandon all hope, ye who enter here)
 #DEFINES += -DDEBUG
 
index b31e2747e790ccfbae6515913e0b8995e17b9c67..4455168cdb9ca315c383667b4bc670b8ed0931a2 100644 (file)
--- a/client.c
+++ b/client.c
@@ -189,11 +189,11 @@ void redraw(Client *c)
     // clear text part of bar
     if (c == focused_client)
     {
-        XFillRectangle(dsply, c->frame, active_gc, 0, 0, c->width - ((BARHEIGHT() - DEF_BORDERWIDTH) * 3), BARHEIGHT() - DEF_BORDERWIDTH);
+        XFillRectangle(dsply, c->frame, active_gc, 0, 0, c->width - (BARHEIGHT() - DEF_BORDERWIDTH), BARHEIGHT() - DEF_BORDERWIDTH);
     }
     else
     {
-        XFillRectangle(dsply, c->frame, inactive_gc, 0, 0, c->width - ((BARHEIGHT() - DEF_BORDERWIDTH) * 3), BARHEIGHT() - DEF_BORDERWIDTH);
+        XFillRectangle(dsply, c->frame, inactive_gc, 0, 0, c->width - (BARHEIGHT() - DEF_BORDERWIDTH), BARHEIGHT() - DEF_BORDERWIDTH);
     }
     if (!c->trans && c->name != NULL)
     {
@@ -201,14 +201,10 @@ void redraw(Client *c)
     }
     if (c == focused_client)
     {
-        draw_hide_button(c, &text_gc, &active_gc);
-        draw_toggledepth_button(c, &text_gc, &active_gc);
         draw_close_button(c, &text_gc, &active_gc);
     }
     else
     {
-        draw_hide_button(c, &text_gc, &inactive_gc);
-        draw_toggledepth_button(c, &text_gc, &inactive_gc);
         draw_close_button(c, &text_gc, &inactive_gc);
     }
 }
@@ -291,34 +287,6 @@ Client *get_prev_focused(void)
     return prev_focused;
 }
 
-void draw_hide_button(Client *c, GC *detail_gc, GC *background_gc)
-{
-    int x, topleft_offset;
-    x = c->width - ((BARHEIGHT() - DEF_BORDERWIDTH) * 3);
-    topleft_offset = (BARHEIGHT() / 2) - 5; // 5 being ~half of 9
-    XFillRectangle(dsply, c->frame, *background_gc, x, 0, BARHEIGHT() - DEF_BORDERWIDTH, BARHEIGHT() - DEF_BORDERWIDTH);
-
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 4, topleft_offset + 2, x + topleft_offset + 4, topleft_offset + 0);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 6, topleft_offset + 2, x + topleft_offset + 7, topleft_offset + 1);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 6, topleft_offset + 4, x + topleft_offset + 8, topleft_offset + 4);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 6, topleft_offset + 6, x + topleft_offset + 7, topleft_offset + 7);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 4, topleft_offset + 6, x + topleft_offset + 4, topleft_offset + 8);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 2, topleft_offset + 6, x + topleft_offset + 1, topleft_offset + 7);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 2, topleft_offset + 4, x + topleft_offset + 0, topleft_offset + 4);
-    XDrawLine(dsply, c->frame, *detail_gc, x + topleft_offset + 2, topleft_offset + 2, x + topleft_offset + 1, topleft_offset + 1);
-}
-
-void draw_toggledepth_button(Client *c, GC *detail_gc, GC *background_gc)
-{
-    int x, topleft_offset;
-    x = c->width - ((BARHEIGHT() - DEF_BORDERWIDTH) * 2);
-    topleft_offset = (BARHEIGHT() / 2) - 6; // 6 being ~half of 11
-    XFillRectangle(dsply, c->frame, *background_gc, x, 0, BARHEIGHT() - DEF_BORDERWIDTH, BARHEIGHT() - DEF_BORDERWIDTH);
-
-    XDrawRectangle(dsply, c->frame, *detail_gc, x + topleft_offset, topleft_offset, 7, 7);
-    XDrawRectangle(dsply, c->frame, *detail_gc, x + topleft_offset + 3, topleft_offset + 3, 7, 7);
-}
-
 void draw_close_button(Client *c, GC *detail_gc, GC *background_gc)
 {
     int x, topleft_offset;
index ece31447b56cf3387b729f14875c2597e55f598e..50a06afaddc6fc15b3ff2d2a99d2d71a96c39a11 100644 (file)
--- a/events.c
+++ b/events.c
@@ -21,7 +21,6 @@
 #include <X11/Xatom.h>
 #include "windowlab.h"
 
-static void handle_key_press(XKeyEvent *);
 static void handle_button_press(XButtonEvent *);
 static void handle_windowbar_click(XButtonEvent *, Client *);
 static unsigned int box_clicked(Client *, int);
@@ -33,7 +32,6 @@ static void handle_destroy_event(XDestroyWindowEvent *);
 static void handle_client_message(XClientMessageEvent *);
 static void handle_property_change(XPropertyEvent *);
 static void handle_enter_event(XCrossingEvent *);
-static void handle_colormap_change(XColormapEvent *);
 static void handle_expose_event(XExposeEvent *);
 
 static int interruptible_XNextEvent(XEvent *event);
@@ -53,9 +51,6 @@ void do_event_loop(void)
 #endif
         switch (ev.type)
         {
-            case KeyPress:
-                handle_key_press(&ev.xkey);
-                break;
             case ButtonPress:
                 handle_button_press(&ev.xbutton);
                 break;
@@ -74,9 +69,6 @@ void do_event_loop(void)
             case ClientMessage:
                 handle_client_message(&ev.xclient);
                 break;
-            case ColormapNotify:
-                handle_colormap_change(&ev.xcolormap);
-                break;
             case PropertyNotify:
                 handle_property_change(&ev.xproperty);
                 break;
@@ -90,20 +82,6 @@ void do_event_loop(void)
     }
 }
 
-static void handle_key_press(XKeyEvent *e)
-{
-    KeySym key = XKeycodeToKeysym(dsply, e->keycode, 0);
-    switch (key)
-    {
-        case KEY_FULLSCREEN:
-            toggle_fullscreen(focused_client);
-            break;
-        case KEY_TOGGLEZ:
-            raise_lower(focused_client);
-            break;
-    }
-}
-
 /* Someone clicked a button. If it was on the root, we get the click
  * by default. If it's on a window frame, we get it as well. If it's
  * on a client window, it may still fall through to us if the client
@@ -125,12 +103,6 @@ static void handle_button_press(XButtonEvent *e)
             XAllowEvents(dsply, ReplayPointer, CurrentTime);
         }
     }
-    else if (e->window == root)
-    {
-#ifdef DEBUG
-        dump_clients();
-#endif
-    }
     else
     {
         // pass event on
@@ -207,9 +179,6 @@ static void handle_windowbar_click(XButtonEvent *e, Client *c)
                 case 1:
                     raise_lower(c);
                     break;
-                case 2:
-                    hide(c);
-                    break;
             }
         }
     }
@@ -247,17 +216,8 @@ static unsigned int box_clicked(Client *c, int x)
 
 static void draw_button(Client *c, GC *detail_gc, GC *background_gc, unsigned int which_box)
 {
-    switch (which_box)
-    {
-        case 0:
-            draw_close_button(c, detail_gc, background_gc);
-            break;
-        case 1:
-            draw_toggledepth_button(c, detail_gc, background_gc);
-            break;
-        case 2:
-            draw_hide_button(c, detail_gc, background_gc);
-            break;
+    if (which_box == 0) {
+        draw_close_button(c, detail_gc, background_gc);
     }
 }
 
@@ -364,7 +324,6 @@ static void handle_map_request(XMapRequestEvent *e)
     Client *c = find_client(e->window, WINDOW);
     if (c != NULL)
     {
-        unhide(c);
     }
     else
     {
@@ -410,10 +369,7 @@ static void handle_unmap_event(XUnmapEvent *e)
 static void handle_destroy_event(XDestroyWindowEvent *e)
 {
     Client *c = find_client(e->window, WINDOW);
-    if (c != NULL)
-    {
-        remove_client(c, WITHDRAW);
-    }
+    if (c) remove_client(c, WITHDRAW);
 }
 
 /* If a client wants to iconify itself (boo! hiss!) it must send a
@@ -422,11 +378,6 @@ static void handle_destroy_event(XDestroyWindowEvent *e)
 
 static void handle_client_message(XClientMessageEvent *e)
 {
-    Client *c = find_client(e->window, WINDOW);
-    if (c != NULL && e->message_type == wm_change_state && e->format == 32 && e->data.l[0] == IconicState)
-    {
-        hide(c);
-    }
 }
 
 /* All that we have cached is the name and the size hints, so we only
@@ -480,26 +431,6 @@ static void handle_enter_event(XCrossingEvent *e)
         }
 }
 
-/* Here's part 2 of our colormap policy: when a client installs a new
- * colormap on itself, set the display's colormap to that. Arguably,
- * this is bad, because we should only set the colormap if that client
- * has the focus. However, clients don't usually set colormaps at
- * random when you're not interacting with them, so I think we're
- * safe. If you have an 8-bit display and this doesn't work for you,
- * by all means yell at me, but very few people have 8-bit displays
- * these days. */
-
-static void handle_colormap_change(XColormapEvent *e)
-{
-    Client *c = find_client(e->window, WINDOW);
-    //if (c != NULL && e->c_new) // use c_new for c++
-    if (c != NULL && e->new)
-    {
-        c->cmap = e->colormap;
-        XInstallColormap(dsply, c->cmap);
-    }
-}
-
 /* If we were covered by multiple windows, we will usually get
  * multiple expose events, so ignore them unless e->count (the number
  * of outstanding exposes) is zero. */
diff --git a/main.c b/main.c
index 6c6909489ca42a0c1d6a16c50a6477c28aa00917..5696be248cdf6bc97129fcda35cebdcbb2b5c05f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -34,8 +34,6 @@ XColor border_col, text_col, active_col, depressed_col, inactive_col, selected_c
 Cursor resize_curs;
 Atom wm_state, wm_change_state, wm_protos, wm_delete, wm_cmapwins;
 Client *head_client = NULL, *focused_client = NULL, *topmost_client = NULL, *fullscreen_client = NULL;
-unsigned int in_taskbar = 0; // actually, we don't know yet
-unsigned int showing_taskbar = 1;
 unsigned int focus_count = 0;
 Rect fs_prevdims;
 char *opt_font = DEF_FONT;
index f5dc746daa489085720223b205f9d694cd77fc02..26879d3b341e55c7809eeb60bbf0aea4d123145d 100644 (file)
--- a/manage.c
+++ b/manage.c
@@ -20,9 +20,6 @@
 
 #include "windowlab.h"
 
-static void limit_size(Client *, Rect *);
-static int get_incsize(Client *, unsigned int *, unsigned int *, Rect *, int);
-
 void raise_lower(Client *c)
 {
     if (c != NULL)
@@ -40,114 +37,6 @@ void raise_lower(Client *c)
     }
 }
 
-/* increment ignore_unmap here and decrement it in handle_unmap_event in events.c */
-
-void hide(Client *c)
-{
-    if (c != NULL)
-    {
-        if (!c->hidden)
-        {
-            c->ignore_unmap++;
-            c->hidden = 1;
-            if (c == topmost_client)
-            {
-                topmost_client = NULL;
-            }
-            XUnmapWindow(dsply, c->frame);
-            XUnmapWindow(dsply, c->window);
-            set_wm_state(c, IconicState);
-            check_focus(get_prev_focused());
-        }
-    }
-}
-
-void unhide(Client *c)
-{
-    if (c != NULL)
-    {
-        if (c->hidden)
-        {
-            c->hidden = 0;
-            topmost_client = c;
-            XMapWindow(dsply, c->window);
-            XMapRaised(dsply, c->frame);
-            set_wm_state(c, NormalState);
-        }
-    }
-}
-
-void toggle_fullscreen(Client *c)
-{
-    int xoffset, yoffset, maxwinwidth, maxwinheight;
-    if (c != NULL && !c->trans)
-    {
-        if (c == fullscreen_client) // reset to original size
-        {
-            c->x = fs_prevdims.x;
-            c->y = fs_prevdims.y;
-            c->width = fs_prevdims.width;
-            c->height = fs_prevdims.height;
-            XMoveResizeWindow(dsply, c->frame, c->x, c->y - BARHEIGHT(), c->width, c->height + BARHEIGHT());
-            XMoveResizeWindow(dsply, c->window, 0, BARHEIGHT(), c->width, c->height);
-            send_config(c);
-            fullscreen_client = NULL;
-            showing_taskbar = 1;
-        }
-        else // make fullscreen
-        {
-            xoffset = yoffset = 0;
-            maxwinwidth = DisplayWidth(dsply, screen);
-            maxwinheight = DisplayHeight(dsply, screen) - BARHEIGHT();
-            if (fullscreen_client != NULL) // reset existing fullscreen window to original size
-            {
-                fullscreen_client->x = fs_prevdims.x;
-                fullscreen_client->y = fs_prevdims.y;
-                fullscreen_client->width = fs_prevdims.width;
-                fullscreen_client->height = fs_prevdims.height;
-                XMoveResizeWindow(dsply, fullscreen_client->frame, fullscreen_client->x, fullscreen_client->y - BARHEIGHT(), fullscreen_client->width, fullscreen_client->height + BARHEIGHT());
-                XMoveResizeWindow(dsply, fullscreen_client->window, 0, BARHEIGHT(), fullscreen_client->width, fullscreen_client->height);
-                send_config(fullscreen_client);
-            }
-            fs_prevdims.x = c->x;
-            fs_prevdims.y = c->y;
-            fs_prevdims.width = c->width;
-            fs_prevdims.height = c->height;
-            c->x = 0 - BORDERWIDTH(c);
-            c->y = BARHEIGHT() - BORDERWIDTH(c);
-            c->width = maxwinwidth;
-            c->height = maxwinheight;
-            if (c->size->flags & PMaxSize || c->size->flags & PResizeInc)
-            {
-                if (c->size->flags & PResizeInc)
-                {
-                    Rect maxwinsize;
-                    maxwinsize.x = xoffset;
-                    maxwinsize.width = maxwinwidth;
-                    maxwinsize.y = yoffset;
-                    maxwinsize.height = maxwinheight;
-                    get_incsize(c, (unsigned int *)&c->size->max_width, (unsigned int *)&c->size->max_height, &maxwinsize, PIXELS);
-                }
-                if (c->size->max_width < maxwinwidth)
-                {
-                    c->width = c->size->max_width;
-                    xoffset = (maxwinwidth - c->width) / 2;
-                }
-                if (c->size->max_height < maxwinheight)
-                {
-                    c->height = c->size->max_height;
-                    yoffset = (maxwinheight - c->height) / 2;
-                }
-            }
-            XMoveResizeWindow(dsply, c->frame, c->x, c->y, maxwinwidth, maxwinheight);
-            XMoveResizeWindow(dsply, c->window, xoffset, yoffset, c->width, c->height);
-            send_config(c);
-            fullscreen_client = c;
-            showing_taskbar = in_taskbar;
-        }
-    }
-}
-
 /* The name of this function is a bit misleading: if the client
  * doesn't listen to WM_DELETE then we just terminate it with extreme
  * prejudice. */
@@ -349,95 +238,6 @@ void resize(Client *c, int x, int y)
     XDestroyWindow(dsply, resize_win);
 }
 
-static void limit_size(Client *c, Rect *newdims)
-{
-    int dw, dh;
-    dw = DisplayWidth(dsply, screen);
-    dh = DisplayHeight(dsply, screen);
-
-    if (c->size->flags & PMinSize)
-    {
-        if (newdims->width < c->size->min_width)
-        {
-            newdims->width = c->size->min_width;
-        }
-        if (newdims->height < c->size->min_height)
-        {
-            newdims->height = c->size->min_height;
-        }
-    }
-
-    if (c->size->flags & PMaxSize)
-    {
-        if (newdims->width > c->size->max_width)
-        {
-            newdims->width = c->size->max_width;
-        }
-        if (newdims->height > c->size->max_height)
-        {
-            newdims->height = c->size->max_height;
-        }
-    }
-
-    if (newdims->width < MINWINWIDTH)
-    {
-        newdims->width = MINWINWIDTH;
-    }
-    if (newdims->height < MINWINHEIGHT)
-    {
-        newdims->height = MINWINHEIGHT;
-    }
-
-    if (newdims->width > dw)
-    {
-        newdims->width = dw;
-    }
-    if (newdims->height > (dh - BARHEIGHT()))
-    {
-        newdims->height = (dh - BARHEIGHT());
-    }
-}
-
-/* If the window in question has a ResizeInc int, then it wants to be
- * resized in multiples of some (x,y). Here we set x_ret and y_ret to
- * the number of multiples (if mode == INCREMENTS) or the correct size
- * in pixels for said multiples (if mode == PIXELS). */
-
-static int get_incsize(Client *c, unsigned int *x_ret, unsigned int *y_ret, Rect *newdims, int mode)
-{
-    int basex, basey;
-    if (c->size->flags & PResizeInc)
-    {
-        basex = (c->size->flags & PBaseSize) ? c->size->base_width : (c->size->flags & PMinSize) ? c->size->min_width : 0;
-        basey = (c->size->flags & PBaseSize) ? c->size->base_height : (c->size->flags & PMinSize) ? c->size->min_height : 0;
-        // work around broken apps that set their resize increments to 0
-        if (mode == PIXELS)
-        {
-            if (c->size->width_inc != 0)
-            {
-                *x_ret = newdims->width - ((newdims->width - basex) % c->size->width_inc);
-            }
-            if (c->size->height_inc != 0)
-            {
-                *y_ret = newdims->height - ((newdims->height - basey) % c->size->height_inc);
-            }
-        }
-        else // INCREMENTS
-        {
-            if (c->size->width_inc != 0)
-            {
-                *x_ret = (newdims->width - basex) / c->size->width_inc;
-            }
-            if (c->size->height_inc != 0)
-            {
-                *y_ret = (newdims->height - basey) / c->size->height_inc;
-            }
-        }
-        return 1;
-    }
-    return 0;
-}
-
 void write_titletext(Client *c, Window bar_win)
 {
     if (!c->trans && c->name != NULL)
index a7255b650e72d20875d9b0ed522f2b61683dfa43..e00454005ad2c9c656bff7f77af0108eb5f218de 100644 (file)
@@ -242,22 +242,4 @@ extern void dump(Client *);
 extern void dump_clients(void);
 #endif
 
-// taskbar.c
-extern Window taskbar;
-extern XftDraw *tbxftdraw;
-extern void make_taskbar(void);
-extern void cycle_previous(void);
-extern void cycle_next(void);
-extern void lclick_taskbar(int);
-extern void rclick_taskbar(int);
-extern void rclick_root(void);
-extern void redraw_taskbar(void);
-extern float get_button_width(void);
-
-// menufile.c
-extern int do_menuitems;
-extern MenuItem* menuitems;
-extern unsigned int num_menuitems;
-extern void get_menuitems(void);
-extern void free_menuitems(void);
 #endif /* WINDOWLAB_H */