bugratpoison - Bugs: bug #64707, PATCH: add set-variable to remove...

 
 

bug #64707: PATCH: add set-variable to remove the border from fullscreen frames

Submitter:  None
Submitted:  Fri 22 Sep 2023 03:34:08 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 22 Sep 2023 07:48:55 PM UTC, comment #1: 

Sorry, have not seen the "onlyborder" setting in git branch.
So, this patch is obsolete, feel free to remove/ignore it.

Kind Regards,
Alex.

Anonymous
Fri 22 Sep 2023 03:34:08 AM UTC, original submission:  

Hello everyone,

The attached patch removes the "border" from the frames maximized
to the size of the whole screen.  Sometimes ratpoison users may
want to remove the border when there is just one window visible.

Since I'm just an amateur to rat poisoning, any advice and recommendations on patch are very welcome.

Kind Regards,
Alexandr Savca <alexandr.savca89@gmail.com>

--- PATCH ---

diff '--color=auto' -pruN ratpoison-1.4.9.orig/doc/ratpoison.man.1 ratpoison-1.4.9.onlynoborder/doc/ratpoison.man.1
--- ratpoison-1.4.9.orig/doc/ratpoison.man.1 2023-09-22 03:22:59.838831636 +0300
+++ ratpoison-1.4.9.onlynoborder/doc/ratpoison.man.1 2023-09-22 05:58:09.289799486 +0300
@@ -1155,6 +1155,17 @@ Selects how thick the frame around windo
 Default is
 \fR1\fR.
 .TP 8n
+\fBonlynoborder\fR \fR0\fR | \fR1\fR
+Determine whether to remove
+\fBborder\fR
+from the frames maximized to the size of the whole screen
+(\fR1\fR)
+or not
+(\fR0\fR).
+.sp
+Default is
+\fR0\fR.
+.TP 8n
 \fBbarborder\fR \fIpixels\fR
 Selects how thick the frame around
 \fBratpoison\fR's
diff '--color=auto' -pruN ratpoison-1.4.9.orig/doc/ratpoison.mdoc.1 ratpoison-1.4.9.onlynoborder/doc/ratpoison.mdoc.1
--- ratpoison-1.4.9.orig/doc/ratpoison.mdoc.1 2023-09-22 03:22:59.838831636 +0300
+++ ratpoison-1.4.9.onlynoborder/doc/ratpoison.mdoc.1 2023-09-22 05:52:37.685800631 +0300
@@ -992,6 +992,16 @@ Selects how thick the frame around windo
 .Pp
 Default is
 .Li 1 .
+.It Cm onlynoborder Li 0 | 1
+Determine whether to remove
+.Ic border
+from the frames maximized to the size of the whole screen
+.Pq Li 1
+or not
+.Pq Li 0 .
+.Pp
+Default is
+.Li 0 .
 .It Cm barborder Ar pixels
 Selects how thick the frame around
 .Nm Ap
diff '--color=auto' -pruN ratpoison-1.4.9.orig/doc/ratpoison.texi ratpoison-1.4.9.onlynoborder/doc/ratpoison.texi
--- ratpoison-1.4.9.orig/doc/ratpoison.texi 2023-09-22 03:22:59.837831636 +0300
+++ ratpoison-1.4.9.onlynoborder/doc/ratpoison.texi 2023-09-22 06:10:20.493796961 +0300
@@ -437,6 +437,15 @@ When called with no arguments, the curre
 returned.
 @end deffn
 
+@deffn Command {set onlynoborder} @var{n}
+Remove the @command{border} from the frames maximized to the size of
+the whole screen. Sometimes you may want to remove the border when
+there is just one window visible.
+
+When called with no arguments, the current setting is
+returned.
+@end deffn
+
 @node Window Classes
 @section Window Classes
 
diff '--color=auto' -pruN ratpoison-1.4.9.orig/src/actions.c ratpoison-1.4.9.onlynoborder/src/actions.c
--- ratpoison-1.4.9.orig/src/actions.c 2023-09-22 03:22:59.835831636 +0300
+++ ratpoison-1.4.9.onlynoborder/src/actions.c 2023-09-22 05:25:47.978806190 +0300
@@ -181,6 +181,7 @@ static cmdret * set_framemsgwait(struct
 static cmdret set_startupmessage(struct cmdarg *args);
 static cmdret set_warp(struct cmdarg *args);
 static cmdret set_rudeness(struct cmdarg *args);
+static cmdret set_onlynoborder(struct cmdarg *args);
 
 /* command function prototypes. */
 static cmdret cmd_abort (int interactive, struct cmdarg *args);
@@ -360,6 +361,7 @@ init_set_vars (void)
   add_set_var ("maxsizegravity", set_maxsizegravity, 1, "", arg_GRAVITY);
   add_set_var ("maxundos", set_maxundos, 1, "", arg_NUMBER);
   add_set_var ("msgwait", set_msgwait, 1, "", arg_NUMBER);
+  add_set_var ("onlynoborder", set_onlynoborder, 1, "", arg_NUMBER);
   add_set_var ("padding", set_padding, 4, "", arg_NUMBER, "", arg_NUMBER, "",
                arg_NUMBER, "", arg_NUMBER);
   add_set_var ("resizeunit", set_resizeunit, 1, "", arg_NUMBER);
@@ -4145,6 +4147,29 @@ set_padding (struct cmdarg **args)
 
   return cmdret_new (RET_SUCCESS, NULL);
 }
+
+static cmdret *
+set_onlynoborder (struct cmdarg **args)
+{
+  rp_window *win;
+
+  if (args[0] == NULL)
+    return cmdret_new (RET_SUCCESS, "%d", defaults.onlynoborder);
+
+  if (ARG(0,number) < 0)
+    return cmdret_new (RET_FAILURE, "onlynoborder: %s", invalid_negative_arg);
+
+  defaults.onlynoborder = ARG(0,number);
+
+  /* Update all the visible windows. */
+  list_for_each_entry (win,&rp_mapped_window,node)
+    {
+      if (win_get_frame (win))
+        maximize (win);
+    }
+
+  return cmdret_new (RET_SUCCESS, NULL);
+}
 
 static cmdret *
 set_border (struct cmdarg **args)
diff '--color=auto' -pruN ratpoison-1.4.9.orig/src/data.h ratpoison-1.4.9.onlynoborder/src/data.h
--- ratpoison-1.4.9.orig/src/data.h 2023-09-22 03:22:59.836831636 +0300
+++ ratpoison-1.4.9.onlynoborder/src/data.h 2023-09-22 06:11:33.994796707 +0300
@@ -301,6 +301,9 @@ struct rp_defaults
 
   /* Frame indicator format */
   char *frame_fmt;
+
+  /* Disable border for fullscreen frames */
+  int onlynoborder;
 };
 
 /* Information about a child process. */
diff '--color=auto' -pruN ratpoison-1.4.9.orig/src/main.c ratpoison-1.4.9.onlynoborder/src/main.c
--- ratpoison-1.4.9.orig/src/main.c 2023-09-22 03:22:59.837831636 +0300
+++ ratpoison-1.4.9.onlynoborder/src/main.c 2023-09-22 04:13:08.777821244 +0300
@@ -581,6 +581,7 @@ init_defaults (void)
   defaults.history_expansion = False;
   defaults.frame_selectors = xstrdup ("");
   defaults.maxundos = 20;
+  defaults.onlynoborder = 0;
 }
 
 int
diff '--color=auto' -pruN ratpoison-1.4.9.orig/src/manage.c ratpoison-1.4.9.onlynoborder/src/manage.c
--- ratpoison-1.4.9.orig/src/manage.c 2023-09-22 03:22:59.837831636 +0300
+++ ratpoison-1.4.9.onlynoborder/src/manage.c 2023-09-22 05:25:40.110806217 +0300
@@ -364,6 +364,18 @@ window_is_transient (rp_window *win)
     ;
 }
 
+/* This function is used to determine if the frame should be treated
+   as a fullscreen. */
+int
+frame_is_fullscreen (rp_frame *frame, rp_screen *s)
+{
+  /* check if current frame occupy the entire screen */
+  return frame->x == defaults.padding_left &&
+         frame->y == defaults.padding_top  &&
+         frame->width  == screen_width (s) &&
+         frame->height == screen_height (s);
+}
+
 static Atom
 get_net_wm_window_type (rp_window *win)
 {
@@ -612,6 +624,7 @@ static void
 maximize_transient (rp_window *win)
 {
   rp_frame *frame;
+  rp_screen *s;
   int maxx, maxy;
 
   frame = win_get_frame (win);
@@ -620,8 +633,13 @@ maximize_transient (rp_window *win)
   if (frame == NULL)
     return;
 
+  s = frames_screen (frame);
+
   /* Set the window's border */
-  win->border = defaults.window_border_width;
+  if (defaults.onlynoborder && frame_is_fullscreen (frame, s))
+    win->border = 0;
+  else
+    win->border = defaults.window_border_width;
 
   /* Always use the window's current width and height for
      transients. */
@@ -671,12 +689,14 @@ maximize_transient (rp_window *win)
   win->height = maxy;
 }
 
+
 /* set a good standard window's x,y,width,height fields to maximize
    the window. */
 static void
 maximize_normal (rp_window *win)
 {
   rp_frame *frame;
+  rp_screen *s;
   int maxx, maxy;
 
   frame = win_get_frame (win);
@@ -685,8 +705,13 @@ maximize_normal (rp_window *win)
   if (frame == NULL)
     return;
 
-  /* Set the window's border */
-  win->border = defaults.window_border_width;
+  s = frames_screen (frame);
+
+  /* Set the window's border. */
+  if (defaults.onlynoborder && frame_is_fullscreen (frame, s))
+    win->border = 0;
+  else
+    win->border = defaults.window_border_width;
 
   /* Honour the window's maximum size */
   if (win->hints->flags & PMaxSize)
diff '--color=auto' -pruN ratpoison-1.4.9.orig/src/manage.h ratpoison-1.4.9.onlynoborder/src/manage.h
--- ratpoison-1.4.9.orig/src/manage.h 2023-09-22 03:22:59.837831636 +0300
+++ ratpoison-1.4.9.onlynoborder/src/manage.h 2023-09-22 05:20:04.173807377 +0300
@@ -38,6 +38,8 @@ void set_state (rp_window *win, int stat
 long get_state (rp_window *win);
 
 int window_is_transient (rp_window *win);
+int frame_is_fullscreen (rp_frame *frame, rp_screen *s);
+
 void update_window_information (rp_window *win);
 void map_window (rp_window *win);
 
-- PATCH-END --

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #55156:  onlynoborder.patch added by None (7KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follows 1 latest change.

Date Changed by Updated Field Previous Value => Replaced by
2023-09-22 None Attached File- Added onlynoborder.patch, #55156

Back to the top

Powered by Savane 3.14-3b9d.
Corresponding source code