unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* GTK interface modification
@ 2018-08-13 23:14 DJ Stauffer
  2018-08-14  8:09 ` martin rudalics
  2018-08-14  8:17 ` Yuri Khan
  0 siblings, 2 replies; 7+ messages in thread
From: DJ Stauffer @ 2018-08-13 23:14 UTC (permalink / raw)
  To: emacs-devel

Hello.

There is a modification I would like to make to Emacs' GTK interface.  I 
have tried a number of solutions to give myself a visual cue as to which 
window in a frame is selected, including changing the color of the 
non-selected windows' backgrounds, changes to the powerline colors, 
etc.  However, I have not found any of this solutions to be 
satisfactory, and occasionally I will still start typing text intended 
for one window when a different window is actually selected.

What I'd like to do is put a one or two pixel border (of whatever color 
I configure, naturally) around the outer edge of the window, to indicate 
that the window is selected.

I have also tried just changing the background color of the fringes, but 
I was unhappy with the results of that also, and would really prefer a 
border around the whole outer edge of the window.

So, I'm looking for suggestions as to where to start.  I realize the C 
code, in particular, the display code is far from simple, but I am 
willing to give it a try.  If anyone has any pointers/recommendations on 
how to accomplish this, I would very much appreciate it.

DJ




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GTK interface modification
  2018-08-13 23:14 GTK interface modification DJ Stauffer
@ 2018-08-14  8:09 ` martin rudalics
  2018-08-15  6:34   ` DJ Stauffer
  2018-08-14  8:17 ` Yuri Khan
  1 sibling, 1 reply; 7+ messages in thread
From: martin rudalics @ 2018-08-14  8:09 UTC (permalink / raw)
  To: DJ Stauffer, emacs-devel

 > What I'd like to do is put a one or two pixel border (of whatever
 > color I configure, naturally) around the outer edge of the window,
 > to indicate that the window is selected.

It won't be easy.  First you will have to decide whether that border
should go away when the window is deselected or you just want to
change its appearance.  I'd choose the latter because you only have to
redraw the border when a window gets (de-)selected and not the rest of
the window.

Then you have to make sure that the position and size of the window's
text area are calculated correctly.  Hence window_text_bottom_y and
the window_box functions in xdisp.c have to be modified accordingly.

And finally you have to actually redraw the border when a window gets
(de-)selected, the appropriate moments given by the mode-line code.

BTW, there's no sense to make this GTK specific.  Drawing windows is
handled by Emacs itself with some toolkit support for the scroll bars.

Good luck, martin



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GTK interface modification
  2018-08-13 23:14 GTK interface modification DJ Stauffer
  2018-08-14  8:09 ` martin rudalics
@ 2018-08-14  8:17 ` Yuri Khan
  2018-08-15  6:35   ` DJ Stauffer
  1 sibling, 1 reply; 7+ messages in thread
From: Yuri Khan @ 2018-08-14  8:17 UTC (permalink / raw)
  To: emacsdev; +Cc: Emacs developers

On Tue, Aug 14, 2018 at 6:15 AM DJ Stauffer <emacsdev@djstauffer.com> wrote:

> There is a modification I would like to make to Emacs' GTK interface.  I
> have tried a number of solutions to give myself a visual cue as to which
> window in a frame is selected, including changing the color of the
> non-selected windows' backgrounds, changes to the powerline colors,
> etc.

This made me think how I know which frame and window is selected. In
my case, the active frame has a colored title bar while an inactive
frame’s title bar is gray; and the most prominent feature that
distinguishes the selected window for me is the blinking cursor.

How visible is your cursor?



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GTK interface modification
  2018-08-14  8:09 ` martin rudalics
@ 2018-08-15  6:34   ` DJ Stauffer
  2018-08-15  8:07     ` martin rudalics
  0 siblings, 1 reply; 7+ messages in thread
From: DJ Stauffer @ 2018-08-15  6:34 UTC (permalink / raw)
  To: emacs-devel

On 08/14/2018 03:09 AM, martin rudalics wrote:

 > > What I'd like to do is put a one or two pixel border (of whatever
 > > color I configure, naturally) around the outer edge of the window,
 > > to indicate that the window is selected.
 >
 > It won't be easy.  First you will have to decide whether that border
 > should go away when the window is deselected or you just want to
 > change its appearance.  I'd choose the latter because you only have to
 > redraw the border when a window gets (de-)selected and not the rest of
 > the window.

  ^ Yeah, that's kind of how I figured it would work.

 >
 > Then you have to make sure that the position and size of the window's
 > text area are calculated correctly.  Hence window_text_bottom_y and
 > the window_box functions in xdisp.c have to be modified accordingly.
 >

^ Yeah I figured that I'd be modifying xdisp.c -- I've done a bit of 
that in the past when modifying someone else's patch years ago.

 > And finally you have to actually redraw the border when a window gets
 > (de-)selected, the appropriate moments given by the mode-line code.

^ Is this also in xdisp.c, or is that code elsewhere?

 >
 > BTW, there's no sense to make this GTK specific.  Drawing windows is
 > handled by Emacs itself with some toolkit support for the scroll bars.

^ I was trying to specify that I wanted something to work in the 
graphical version of emacs (and wasn't worried about the terminal 
version, for obvious reasons ) -- since I primarily use the graphical 
version.  I probably should have worded that differently, but the GTK 
version is the only one I ever use, so that's what pops in my head when 
thinking of the graphical version.

Thanks for the help.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GTK interface modification
  2018-08-14  8:17 ` Yuri Khan
@ 2018-08-15  6:35   ` DJ Stauffer
  0 siblings, 0 replies; 7+ messages in thread
From: DJ Stauffer @ 2018-08-15  6:35 UTC (permalink / raw)
  To: emacs-devel

On 08/14/2018 03:17 AM, Yuri Khan wrote:
> On Tue, Aug 14, 2018 at 6:15 AM DJ Stauffer <emacsdev@djstauffer.com> wrote:
>
>> There is a modification I would like to make to Emacs' GTK interface.  I
>> have tried a number of solutions to give myself a visual cue as to which
>> window in a frame is selected, including changing the color of the
>> non-selected windows' backgrounds, changes to the powerline colors,
>> etc.
> This made me think how I know which frame and window is selected. In
> my case, the active frame has a colored title bar while an inactive
> frame’s title bar is gray; and the most prominent feature that
> distinguishes the selected window for me is the blinking cursor.
>
> How visible is your cursor?

Yeah,  the powerline changes in my setup to indicate the current window, 
and the cursor is set to block mode, so it is about as visible as I'd 
want it.  Currently I use autodim mode to change the background color of 
the non-selected windows to a grayish version of my normal background 
color.  That works OK, but as a result, it is not as pleasant to read 
from those windows when I need to.  I would prefer to have the 
non-selected windows have the same background color so that syntax 
highlighting looks the same in all windows. Without autodim enabled, it 
is still not always immediately obvious what the current window is.  The 
cursor/powerline changes are not enough to make it obvious 100% of the 
time (at least, not without having to think about it -- and the point is 
I *don't* want to have to think about it).



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GTK interface modification
  2018-08-15  6:34   ` DJ Stauffer
@ 2018-08-15  8:07     ` martin rudalics
  2018-08-15 13:45       ` DJ Stauffer
  0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics @ 2018-08-15  8:07 UTC (permalink / raw)
  To: DJ Stauffer, emacs-devel

 >  > And finally you have to actually redraw the border when a window gets
 >  > (de-)selected, the appropriate moments given by the mode-line code.
 >
 > ^ Is this also in xdisp.c, or is that code elsewhere?

The call where the "real selected window" is known is in xdisp.c's
display_mode_lines as

       /* Select mode line face based on the real selected window.  */
       display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
			 NILP (window_mode_line_format)
			 ? BVAR (current_buffer, mode_line_format)
			 : window_mode_line_format);

and you probably want to set

     w->must_be_updated_p = true;

as well.  The routine actually changing the appearance of W's border
will then have to check whether W has the selected appearance already
set.  If not, you have to redraw W's border and that of the previously
selected window of W's frame accordingly.

I'm not sure where to actually draw the border on glass though.  You
can look at where window dividers are drawn but these are merely
statically bound to windows and do not depend on whether a window is
actually selected.  You will have to play around then.

martin



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: GTK interface modification
  2018-08-15  8:07     ` martin rudalics
@ 2018-08-15 13:45       ` DJ Stauffer
  0 siblings, 0 replies; 7+ messages in thread
From: DJ Stauffer @ 2018-08-15 13:45 UTC (permalink / raw)
  To: emacs-devel

On 08/15/2018 03:07 AM, martin rudalics wrote:
> > > And finally you have to actually redraw the border when a window gets
> >  > (de-)selected, the appropriate moments given by the mode-line code.
> >
> > ^ Is this also in xdisp.c, or is that code elsewhere?
>
> The call where the "real selected window" is known is in xdisp.c's
> display_mode_lines as
>
>       /* Select mode line face based on the real selected window. */
>       display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, 
> w),
>              NILP (window_mode_line_format)
>              ? BVAR (current_buffer, mode_line_format)
>              : window_mode_line_format);
>
> and you probably want to set
>
>     w->must_be_updated_p = true;
>
> as well.  The routine actually changing the appearance of W's border
> will then have to check whether W has the selected appearance already
> set.  If not, you have to redraw W's border and that of the previously
> selected window of W's frame accordingly.
>
> I'm not sure where to actually draw the border on glass though. You
> can look at where window dividers are drawn but these are merely
> statically bound to windows and do not depend on whether a window is
> actually selected.  You will have to play around then.
>
> martin

OK, thanks again!

DJ



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-15 13:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-13 23:14 GTK interface modification DJ Stauffer
2018-08-14  8:09 ` martin rudalics
2018-08-15  6:34   ` DJ Stauffer
2018-08-15  8:07     ` martin rudalics
2018-08-15 13:45       ` DJ Stauffer
2018-08-14  8:17 ` Yuri Khan
2018-08-15  6:35   ` DJ Stauffer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).