unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* resize windows horizontally with the mouse
@ 2014-01-30  3:32 Michael Heerdegen
  2014-01-30  3:36 ` Yuri Khan
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Michael Heerdegen @ 2014-01-30  3:32 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 252 bytes --]

Hi,

it's a common nuisance that you cannot horizontally resize windows in
Emacs, at least here under the toolkits in X.  It's really really
missing...

So I thought we could use the fringe for that.  Implementation seems to
be quite straightforward:


[-- Attachment #2: drag-fringe.el --]
[-- Type: application/emacs-lisp, Size: 606 bytes --]

[-- Attachment #3: Type: text/plain, Size: 72 bytes --]


I wonder if I can find friends for this proposal.


Regards,

Michael.

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

* Re: resize windows horizontally with the mouse
  2014-01-30  3:32 resize windows horizontally with the mouse Michael Heerdegen
@ 2014-01-30  3:36 ` Yuri Khan
  2014-01-30  3:55   ` Michael Heerdegen
  2014-01-30  5:27   ` Darren Hoo
  2014-01-30  7:08 ` martin rudalics
  2014-01-30  8:47 ` Andreas Schwab
  2 siblings, 2 replies; 18+ messages in thread
From: Yuri Khan @ 2014-01-30  3:36 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Emacs developers

On Thu, Jan 30, 2014 at 10:32 AM, Michael Heerdegen
<michael_heerdegen@web.de> wrote:

> it's a common nuisance that you cannot horizontally resize windows in
> Emacs, at least here under the toolkits in X.  It's really really
> missing...

You can. It’s just that the grab handle is not the whole splitter but
only a small part where the mode lines meet.



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

* Re: resize windows horizontally with the mouse
  2014-01-30  3:36 ` Yuri Khan
@ 2014-01-30  3:55   ` Michael Heerdegen
  2014-01-30  5:27   ` Darren Hoo
  1 sibling, 0 replies; 18+ messages in thread
From: Michael Heerdegen @ 2014-01-30  3:55 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emacs developers

Yuri Khan <yuri.v.khan@gmail.com> writes:

> You can. It’s just that the grab handle is not the whole splitter but
> only a small part where the mode lines meet.

Oh, I didn't know that, thanks.  But it's really hard to "find" and hard
to "click" on.

Michael.



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

* Re: resize windows horizontally with the mouse
  2014-01-30  3:36 ` Yuri Khan
  2014-01-30  3:55   ` Michael Heerdegen
@ 2014-01-30  5:27   ` Darren Hoo
  2014-01-30  6:34     ` Yuri Khan
  1 sibling, 1 reply; 18+ messages in thread
From: Darren Hoo @ 2014-01-30  5:27 UTC (permalink / raw)
  To: emacs-devel

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Thu, Jan 30, 2014 at 10:32 AM, Michael Heerdegen
> <michael_heerdegen@web.de> wrote:
>
>> it's a common nuisance that you cannot horizontally resize windows in
>> Emacs, at least here under the toolkits in X.  It's really really
>> missing...
>
> You can. It’s just that the grab handle is not the whole splitter but
> only a small part where the mode lines meet.

So this is an intention. I thought it was a bug in the NS port. Usually
I just turn off scroll bar to bring the the whole splitter back.

BTW, has anyone met with sluggish redisplay of buffer text when resizing
windows horizontally?




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

* Re: resize windows horizontally with the mouse
  2014-01-30  5:27   ` Darren Hoo
@ 2014-01-30  6:34     ` Yuri Khan
  2014-01-30  7:09       ` martin rudalics
  0 siblings, 1 reply; 18+ messages in thread
From: Yuri Khan @ 2014-01-30  6:34 UTC (permalink / raw)
  To: Darren Hoo; +Cc: Emacs developers

On Thu, Jan 30, 2014 at 12:27 PM, Darren Hoo <darren.hoo@gmail.com> wrote:

> So this is an intention.

I’m not sure about that. There is a visible two- or three-pixel stripe
between the scroll bar and the fringe of the adjacent pane. If the
intention is to not allow resizing when scroll bars are displayed,
this gap should be eliminated. Alternatively, scrolling could be
allowed even in this case.

> I thought it was a bug in the NS port. Usually
> I just turn off scroll bar to bring the the whole splitter back.

Indeed, hiding scroll bars allows me to drag the whole splitter, in
X/GTK+. But pixel-hunting for the grab handle in the mode lines is
faster.

> BTW, has anyone met with sluggish redisplay of buffer text when resizing
> windows horizontally?

No, but the fringes and scroll bars flicker a lot while dragging.



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

* Re: resize windows horizontally with the mouse
  2014-01-30  3:32 resize windows horizontally with the mouse Michael Heerdegen
  2014-01-30  3:36 ` Yuri Khan
@ 2014-01-30  7:08 ` martin rudalics
  2014-01-30  8:47 ` Andreas Schwab
  2 siblings, 0 replies; 18+ messages in thread
From: martin rudalics @ 2014-01-30  7:08 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

 > it's a common nuisance that you cannot horizontally resize windows in
 > Emacs, at least here under the toolkits in X.  It's really really
 > missing...

With emacs -Q evaluate

(set-frame-parameter (selected-frame) 'right-divider-width 4)

and do C-x 3.

martin



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

* Re: resize windows horizontally with the mouse
  2014-01-30  6:34     ` Yuri Khan
@ 2014-01-30  7:09       ` martin rudalics
  2014-01-30  7:20         ` Yuri Khan
  0 siblings, 1 reply; 18+ messages in thread
From: martin rudalics @ 2014-01-30  7:09 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Emacs developers, Darren Hoo

 > I’m not sure about that. There is a visible two- or three-pixel stripe
 > between the scroll bar and the fringe of the adjacent pane. If the
 > intention is to not allow resizing when scroll bars are displayed,
 > this gap should be eliminated. Alternatively, scrolling could be
 > allowed even in this case.

Which toolkit?

 >> I thought it was a bug in the NS port. Usually
 >> I just turn off scroll bar to bring the the whole splitter back.
 >
 > Indeed, hiding scroll bars allows me to drag the whole splitter, in
 > X/GTK+. But pixel-hunting for the grab handle in the mode lines is
 > faster.
 >
 >> BTW, has anyone met with sluggish redisplay of buffer text when resizing
 >> windows horizontally?
 >
 > No, but the fringes and scroll bars flicker a lot while dragging.

Can you try to find out _when_ this started?

Thanks, martin




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

* Re: resize windows horizontally with the mouse
  2014-01-30  7:09       ` martin rudalics
@ 2014-01-30  7:20         ` Yuri Khan
  2014-01-30  7:53           ` martin rudalics
  0 siblings, 1 reply; 18+ messages in thread
From: Yuri Khan @ 2014-01-30  7:20 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs developers, Darren Hoo

On Thu, Jan 30, 2014 at 2:09 PM, martin rudalics <rudalics@gmx.at> wrote:
>> I’m not sure about that. There is a visible two- or three-pixel stripe
>> between the scroll bar and the fringe of the adjacent pane. If the
>> intention is to not allow resizing when scroll bars are displayed,
>> this gap should be eliminated. Alternatively, scrolling could be
>> allowed even in this case.
>
> Which toolkit?

GTK+3.

>>> BTW, has anyone met with sluggish redisplay of buffer text when resizing
>>> windows horizontally?
>>
>> No, but the fringes and scroll bars flicker a lot while dragging.
>
> Can you try to find out _when_ this started?

Can and will.



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

* Re: resize windows horizontally with the mouse
  2014-01-30  7:20         ` Yuri Khan
@ 2014-01-30  7:53           ` martin rudalics
  2014-01-30  9:45             ` Jan D.
  0 siblings, 1 reply; 18+ messages in thread
From: martin rudalics @ 2014-01-30  7:53 UTC (permalink / raw)
  To: Yuri Khan; +Cc: Darren Hoo, Emacs developers

 > GTK+3.

I see.  What does

(frame-parameter nil 'scroll-bar-width)

give?  Can you try to trace the following function in gtkutil.c

static void
update_theme_scrollbar_width (void)
{
#ifdef HAVE_GTK3
   GtkAdjustment *vadj;
#else
   GtkObject *vadj;
#endif
   GtkWidget *wscroll;
   int w = 0, b = 0;

   vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1);
   wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj));
   g_object_ref_sink (G_OBJECT (wscroll));
   gtk_widget_style_get (wscroll, "slider-width", &w, "trough-border", &b, NULL);
   gtk_widget_destroy (wscroll);
   g_object_unref (G_OBJECT (wscroll));
   w += 2*b;
   if (w < 16) w = 16;
   scroll_bar_width_for_theme = w;
}

and look what values w and b are set to?  IIRC the rounding to 16 is
responsible for a similar gap on my GTK+3 Emacs.

 > Can and will.

Fine.

Thanks, martin



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

* Re: resize windows horizontally with the mouse
  2014-01-30  3:32 resize windows horizontally with the mouse Michael Heerdegen
  2014-01-30  3:36 ` Yuri Khan
  2014-01-30  7:08 ` martin rudalics
@ 2014-01-30  8:47 ` Andreas Schwab
  2 siblings, 0 replies; 18+ messages in thread
From: Andreas Schwab @ 2014-01-30  8:47 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

Michael Heerdegen <michael_heerdegen@web.de> writes:

> it's a common nuisance that you cannot horizontally resize windows in
> Emacs, at least here under the toolkits in X.  It's really really
> missing...

The handle is the modeline part below the scrollbar.  The mouse shape
will guide you, and there is a tooltip saying "drag-mouse-1: resize".

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



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

* Re: resize windows horizontally with the mouse
  2014-01-30  7:53           ` martin rudalics
@ 2014-01-30  9:45             ` Jan D.
  2014-01-30 13:47               ` martin rudalics
  0 siblings, 1 reply; 18+ messages in thread
From: Jan D. @ 2014-01-30  9:45 UTC (permalink / raw)
  To: martin rudalics; +Cc: Darren Hoo, Emacs developers, Yuri Khan

Hello.

The rounding to 16 is because Gtk at some point hardcoded the width to 16.
Maybe this is fixed in Gtk+ 3?

      Jan D. 

> 30 jan 2014 kl. 08:53 skrev martin rudalics <rudalics@gmx.at>:
> 
> > GTK+3.
> 
> I see.  What does
> 
> (frame-parameter nil 'scroll-bar-width)
> 
> give?  Can you try to trace the following function in gtkutil.c
> 
> static void
> update_theme_scrollbar_width (void)
> {
> #ifdef HAVE_GTK3
>  GtkAdjustment *vadj;
> #else
>  GtkObject *vadj;
> #endif
>  GtkWidget *wscroll;
>  int w = 0, b = 0;
> 
>  vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1);
>  wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj));
>  g_object_ref_sink (G_OBJECT (wscroll));
>  gtk_widget_style_get (wscroll, "slider-width", &w, "trough-border", &b, NULL);
>  gtk_widget_destroy (wscroll);
>  g_object_unref (G_OBJECT (wscroll));
>  w += 2*b;
>  if (w < 16) w = 16;
>  scroll_bar_width_for_theme = w;
> }
> 
> and look what values w and b are set to?  IIRC the rounding to 16 is
> responsible for a similar gap on my GTK+3 Emacs.
> 
> > Can and will.
> 
> Fine.
> 
> Thanks, martin



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

* Re: resize windows horizontally with the mouse
  2014-01-30  9:45             ` Jan D.
@ 2014-01-30 13:47               ` martin rudalics
  2014-01-30 14:19                 ` Jan Djärv
  0 siblings, 1 reply; 18+ messages in thread
From: martin rudalics @ 2014-01-30 13:47 UTC (permalink / raw)
  To: Jan D.; +Cc: Yuri Khan, Emacs developers, Darren Hoo

 > The rounding to 16 is because Gtk at some point hardcoded the width to 16.
 > Maybe this is fixed in Gtk+ 3?

I have set GtkRange-slider-width to 12 so I see a 4 pixel wide empty area.
And the default should be 14 IIUC.

martin



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

* Re: resize windows horizontally with the mouse
  2014-01-30 13:47               ` martin rudalics
@ 2014-01-30 14:19                 ` Jan Djärv
  2014-01-30 14:37                   ` martin rudalics
  0 siblings, 1 reply; 18+ messages in thread
From: Jan Djärv @ 2014-01-30 14:19 UTC (permalink / raw)
  To: martin rudalics; +Cc: Emacs developers, Darren Hoo, Yuri Khan

Hi.

> 30 jan 2014 kl. 14:47 skrev martin rudalics <rudalics@gmx.at>:
> 
> > The rounding to 16 is because Gtk at some point hardcoded the width to 16.
> > Maybe this is fixed in Gtk+ 3?
> 
> I have set GtkRange-slider-width to 12 so I see a 4 pixel wide empty area.

In some themes the scroll bar handle is a bitmap of fixed width. Those do  not obey GtkRange-slider-width if too small.  I guess you don't have that kind of theme. 

> And the default should be 14 IIUC.
> 

Why?

     Jan D.


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

* Re: resize windows horizontally with the mouse
  2014-01-30 14:19                 ` Jan Djärv
@ 2014-01-30 14:37                   ` martin rudalics
  2014-01-30 15:46                     ` Jan D.
  0 siblings, 1 reply; 18+ messages in thread
From: martin rudalics @ 2014-01-30 14:37 UTC (permalink / raw)
  To: Jan Djärv; +Cc: Yuri Khan, Darren Hoo, Emacs developers

 > In some themes the scroll bar handle is a bitmap of fixed width. Those do  not obey GtkRange-slider-width if too small.  I guess you don't have that kind of theme.

I suppose not.  Is there any harm when they don't?

 >> And the default should be 14 IIUC.
 >>
 >
 > Why?

Because that's what I found everywhere but I'm obviously a complete
idiot in this department.  I looked, for example, here:

http://www.gtk.org/api/2.6/gtk/GtkRange.html

https://developer.gnome.org/gtk3/stable/GtkRange.html#GtkRange--s-slider-width

http://gtk.php.net/manual/en/html/gtk/gtk.gtkrange.property.slider-width.html

martin



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

* Re: resize windows horizontally with the mouse
  2014-01-30 14:37                   ` martin rudalics
@ 2014-01-30 15:46                     ` Jan D.
  2014-01-30 18:45                       ` martin rudalics
  0 siblings, 1 reply; 18+ messages in thread
From: Jan D. @ 2014-01-30 15:46 UTC (permalink / raw)
  To: martin rudalics; +Cc: Yuri Khan, Darren Hoo, Emacs developers

Hi.

> 30 jan 2014 kl. 15:37 skrev martin rudalics <rudalics@gmx.at>:
> 
> > In some themes the scroll bar handle is a bitmap of fixed width. Those do  not obey GtkRange-slider-width if too small.  I guess you don't have that kind of theme.
> 
> I suppose not.  Is there any harm when they don't?

Yes. We resize the GtkFixed where the text-part and scrollbar resides in Emacs. The layout widgets can not handle the layout of Emacs (i.e. text with scrollbar, modeline without scrollbar, minibuffer with scrollbar). If the scrollbar is 16 pixels wide no matter what, and Emacs thinks it. is 12, the sizing will be wrong.

> 
> >> And the default should be 14 IIUC.
> >>
> >
> > Why?
> 
> Because that's what I found everywhere but I'm obviously a complete
> idiot in this department.  I looked, for example, here:
> 
> http://www.gtk.org/api/2.6/gtk/GtkRange.html
> 
> https://developer.gnome.org/gtk3/stable/GtkRange.html#GtkRange--s-slider-width
> 
> http://gtk.php.net/manual/en/html/gtk/gtk.gtkrange.property.slider-width.html

You have to add 2 x trough-border, i.e 2 x 1.

      Jan D.


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

* Re: resize windows horizontally with the mouse
  2014-01-30 15:46                     ` Jan D.
@ 2014-01-30 18:45                       ` martin rudalics
  2014-01-31  9:52                         ` Jan D.
  0 siblings, 1 reply; 18+ messages in thread
From: martin rudalics @ 2014-01-30 18:45 UTC (permalink / raw)
  To: Jan D.; +Cc: Yuri Khan, Darren Hoo, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 824 bytes --]

 > Yes. We resize the GtkFixed where the text-part and scrollbar resides in Emacs. The layout widgets can not handle the layout of Emacs (i.e. text with scrollbar, modeline without scrollbar, minibuffer with scrollbar). If the scrollbar is 16 pixels wide no matter what, and Emacs thinks it. is 12, the sizing will be wrong.

I see.  But here I have to explicitly set the scroll-bar-width frame
parameter to make sure that no extra space is drawn.  Maybe we should
document this somewhere.

 > You have to add 2 x trough-border, i.e 2 x 1.

Aha.  So is it the trough-border that doesn't get always cleared
correctly when deleting/resizing windows or is it some extra space
between trough-border and the surrounding objects?

I attach a screenshot where you can see the effect with the scrollbar in
the upper window.

martin

[-- Attachment #2: GTK-scrollbars.png --]
[-- Type: image/png, Size: 54837 bytes --]

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

* Re: resize windows horizontally with the mouse
  2014-01-30 18:45                       ` martin rudalics
@ 2014-01-31  9:52                         ` Jan D.
  2014-01-31 10:44                           ` martin rudalics
  0 siblings, 1 reply; 18+ messages in thread
From: Jan D. @ 2014-01-31  9:52 UTC (permalink / raw)
  To: martin rudalics; +Cc: Darren Hoo, Emacs developers, Yuri Khan

Hello.

martin rudalics skrev 2014-01-30 19:45:
>  > Yes. We resize the GtkFixed where the text-part and scrollbar resides
> in Emacs. The layout widgets can not handle the layout of Emacs (i.e.
> text with scrollbar, modeline without scrollbar, minibuffer with
> scrollbar). If the scrollbar is 16 pixels wide no matter what, and Emacs
> thinks it. is 12, the sizing will be wrong.
>
> I see.  But here I have to explicitly set the scroll-bar-width frame
> parameter to make sure that no extra space is drawn.  Maybe we should
> document this somewhere.
>
>  > You have to add 2 x trough-border, i.e 2 x 1.
>
> Aha.  So is it the trough-border that doesn't get always cleared
> correctly when deleting/resizing windows or is it some extra space
> between trough-border and the surrounding objects?

I think it is the trough-border.  What do you do to make this happen?
Is it dependent on your 12 pixel setting?

	Jan D.


>
> I attach a screenshot where you can see the effect with the scrollbar in
> the upper window.
>
> martin




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

* Re: resize windows horizontally with the mouse
  2014-01-31  9:52                         ` Jan D.
@ 2014-01-31 10:44                           ` martin rudalics
  0 siblings, 0 replies; 18+ messages in thread
From: martin rudalics @ 2014-01-31 10:44 UTC (permalink / raw)
  To: Jan D.; +Cc: Yuri Khan, Emacs developers, Darren Hoo

 > I think it is the trough-border.  What do you do to make this happen?

In emacs -Q

(let* ((w2 (split-window))
        (w3 (split-window w2)))
   (balance-windows)
   (sit-for 3)
   (delete-window w3)
   (balance-windows))

Normal window deletion doesn't show it, probably because the new
scrollbars are drawn over the old ones.

 > Is it dependent on your 12 pixel setting?

I think so.  When I change the `scroll-bar-width' frame parameter to 14
it doesn't happen.  IIRC I once tried to fix it by clearing the area
somewhere in xg_remove_scroll_bar but it didn't help much.

martin



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

end of thread, other threads:[~2014-01-31 10:44 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30  3:32 resize windows horizontally with the mouse Michael Heerdegen
2014-01-30  3:36 ` Yuri Khan
2014-01-30  3:55   ` Michael Heerdegen
2014-01-30  5:27   ` Darren Hoo
2014-01-30  6:34     ` Yuri Khan
2014-01-30  7:09       ` martin rudalics
2014-01-30  7:20         ` Yuri Khan
2014-01-30  7:53           ` martin rudalics
2014-01-30  9:45             ` Jan D.
2014-01-30 13:47               ` martin rudalics
2014-01-30 14:19                 ` Jan Djärv
2014-01-30 14:37                   ` martin rudalics
2014-01-30 15:46                     ` Jan D.
2014-01-30 18:45                       ` martin rudalics
2014-01-31  9:52                         ` Jan D.
2014-01-31 10:44                           ` martin rudalics
2014-01-30  7:08 ` martin rudalics
2014-01-30  8:47 ` Andreas Schwab

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).