After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 157025 - XSetting for left-hand scroll
XSetting for left-hand scroll
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
2.8.x
Other All
: Normal enhancement
: ---
Assigned To: Christian Neumair
gtk-bugs
: 320618 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-10-28 12:26 UTC by encompass
Modified: 2011-02-04 16:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
captures calls to gtk_scrolled_window_new and sets policy to LHS scrollbars (1.07 KB, text/x-csrc)
2004-12-30 13:33 UTC, Jon Dowland
  Details
to build the wrapper and test program (565 bytes, text/plain)
2004-12-30 13:36 UTC, Jon Dowland
  Details
a test program demonstrating gtk_scrolled_window_new (2.44 KB, text/x-csrc)
2004-12-30 13:37 UTC, Jon Dowland
  Details
patch to change window_placement into a style property (6.94 KB, patch)
2005-04-10 21:18 UTC, Jon Dowland
none Details | Review
patch for gtk 2.6.5 (7.02 KB, patch)
2005-04-10 21:31 UTC, Jon Dowland
none Details | Review
sets window_placement to -1 (invalid); wraps all internal calls; checks style property on initial read (6.47 KB, patch)
2005-04-25 21:12 UTC, Jon Dowland
none Details | Review
use a GtkSetting instead of style property (7.19 KB, patch)
2005-05-09 21:03 UTC, Jon Dowland
none Details | Review
proof-of-concept that my patch here potentially breaks things (688 bytes, text/x-csrc)
2005-05-29 16:59 UTC, Jon Dowland
  Details
the GObject setting is preserved; GtkSetting in addition (6.69 KB, patch)
2005-05-29 17:16 UTC, Jon Dowland
needs-work Details | Review
Proposed (untested) patch (13.28 KB, patch)
2005-09-09 21:35 UTC, Christian Neumair
none Details | Review
Proposed (untested) patch #2 (14.62 KB, patch)
2005-09-09 21:57 UTC, Christian Neumair
needs-work Details | Review
screenshot (13.30 KB, image/png)
2006-03-14 20:28 UTC, Matthias Clasen
  Details
Proposed (tested) patch #3 (16.20 KB, patch)
2006-03-20 14:07 UTC, Christian Neumair
none Details | Review

Description encompass 2004-11-01 12:19:32 UTC
Distribution: Fedora Core release 2 (Tettnang)
Package: gtk+
Severity: enhancement
Version: GNOME2.6. unspecified
Gnome-Distributor: Red Hat, Inc
Synopsis: LEFT HANDED SCROLLING
Bugzilla-Product: gtk+
Bugzilla-Component: general
Bugzilla-Version: unspecified
Description:
Please describe your feature request:
I would like to request a left handed scroll bar feature for left handed
people on tablet PC's.

With my tablet PC I find it had to scrool down a page with my natural
left hand and see the text I am trying to view.  To give me the option
would be a great feature to add to the GTK tools to give GNU/Linux the
edge on the market again windows standardizations.




------- Bug moved to this database by unknown@bugzilla.gnome.org 2004-11-01 07:19 -------


Unknown platform unknown. Setting to default platform "Other".
Unknown milestone "unknown" in product "general".
   Setting to default milestone for this product, '---'
The original reporter of this bug does not have
   an account here. Reassigning to the person who moved
   it here, unknown@bugzilla.gnome.org.
   Previous reporter was encompass@tds.net.
Setting to default status "UNCONFIRMED".
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.

Comment 1 Jon Dowland 2004-11-04 15:31:36 UTC
Hello - I would like to ping this bug as I would like the same functionality. 
 
To reiterate: The gnome-terminal (like the konsole) has an option to put 
scrollbars on the LHS rather than the RHS. 
 
This is very useful for left-handed people, especially using input devices that 
resemble a pen, and particularly those with touch screens / tablet PCs, where 
scrolling on the RHS actually means you have to obscure the window. 
 
I would like to see the generic functionality for LHS/RHS scrollbars lifted 
from gnome-terminal (i.e. app-specific) and put into the general GTK toolkit 
(so its environment-specific), possibly with an entry in the accessibility 
section of the control centre. Then we could have all apps with LHS scrollbars 
w/o the authors having to write it in explicitly :) 
Comment 2 Federico Mena Quintero 2004-11-18 18:15:53 UTC
GtkScrolledWindow has a "window_placement" property, but unfortunately it is not
a style property.  If it were a style property, you could set it in your .gtkrc-2.0.

It would be easy to write a patch to add a style property for that.  Would you
like to give it a try?
Comment 3 Jon Dowland 2004-11-30 20:17:18 UTC
Absolutely!
Comment 4 Jon Dowland 2004-12-30 13:33:28 UTC
Created attachment 35299 [details]
captures calls to gtk_scrolled_window_new and sets policy to LHS scrollbars
Comment 5 Jon Dowland 2004-12-30 13:34:30 UTC
Hi - not sure what progress you are making on this. I've had a stab at  
wrapping that call via LD_PRELOAD as an intermediate step. Someone may find  
this interesting!  
  
Hope you all had a good festive season. 
Comment 6 Jon Dowland 2004-12-30 13:36:33 UTC
Created attachment 35300 [details]
to build the wrapper and test program
Comment 7 Jon Dowland 2004-12-30 13:37:55 UTC
Created attachment 35301 [details]
a test program demonstrating gtk_scrolled_window_new
Comment 8 Jon Dowland 2005-04-10 21:18:07 UTC
Created attachment 45112 [details] [review]
patch to change window_placement into a style property
Comment 9 Jon Dowland 2005-04-10 21:25:33 UTC
Hi - the patch I've just attached applies to gtk+-2.6.2 (just testing 2.6.5
now). In brief, it changes window_placement from a gobject property into a gtk
style property, adds an accessor function and uses it in place of reading the
value directly (based on the method used by the existing style property
scrollbar_spacing). There is still some tidying up to do.

I'd *REALLY* appreciate some feedback on the following points:

a) changing the property from gobject to gtk/style: what would this potentially
break, how can I check to see things do?
b) via a find/grep combination it appears that nothing reads the property
directly from outside of gtkscrolledwindow.c, but if that was a 'valid' thing to
do in the past, it would break things now (in the same way reading
scrollbar_spacing directly could)

Still to do: remove some unnecessary commented out code, check initial value of
the property, change the new accessor function so it doesn't call an rc function
on each access (again in the fashion of scrollbar_spacing).
Comment 10 Jon Dowland 2005-04-10 21:31:33 UTC
Created attachment 45113 [details] [review]
patch for gtk 2.6.5
Comment 11 Jon Dowland 2005-04-25 21:12:26 UTC
Created attachment 45673 [details] [review]
sets window_placement to -1 (invalid); wraps all internal calls; checks style property on initial read

Hello. I've realised the other style property is a class var, not an instance
var, and that has changed the approach a little. I've used a similar '-1 is
invalid' thing which many people may not like - however with an enum -1 is
definitely invalid so it's safer than a straight integer. I've set the wrapper
static so nobody else uses it.

The get_style_property is now only called once rather than once per
window_placement access so this patch should be more efficient than the last.

Was busy these past two weeks hence slow speed getting this out :) please
comment.
Comment 12 Jon Dowland 2005-05-09 21:03:29 UTC
Created attachment 46258 [details] [review]
use a GtkSetting instead of style property

Owen Taylor recommended on IRC that it should be a GtkSetting. This patch is
for 2.6.7. Comments please! :)
Comment 13 Jon Dowland 2005-05-29 16:57:11 UTC
I chatted with Federico on IRC on 10th May about this and there was two things
that came up: 

1) removing the gobject property to implement the style property might break
programs that already use the former
2) there was some thought that this could be a useful xsetting

I've written a test program verifying the former. As for the xsetting, I am
looking into bringing this up on the xdg list (there are similar bugs filed
against kde, mozilla, etc.)
Comment 14 Jon Dowland 2005-05-29 16:59:17 UTC
Created attachment 47003 [details]
proof-of-concept that my patch here potentially breaks things

$ gcc `pkg-config --libs --cflags gtk+-2.0` lhs-gobject.c
$ ./a.out 
the property thinks it's called: window-placement
$ LD_PRELOAD=<patched gtk>/gtk/.libs/libgtk-x11-2.0.so ./a.out
there is no window_placement property
Comment 15 Jon Dowland 2005-05-29 17:16:30 UTC
Created attachment 47004 [details] [review]
the GObject setting is preserved; GtkSetting in addition

Here I don't remove the GObject setting, just add the GtkSetting as well. Now
that test-case program works:

$ ./a.out 
the property thinks it's called: window-placement
$ LD_PRELOAD=gtk+-2.6.7/gtk/.libs/libgtk-x11-2.0.so ./a.out 
the property thinks it's called: window-placement

(P.S. I wonder if the Nokia 770 will mean more left-handed people being
interested in a patch like this? I'm certainly tempted to buy one :-) )
Comment 16 Jon Dowland 2005-06-18 23:34:51 UTC
Hello. Rather embarrassing, but I've just tried these patches against 2.6.8 and
everything since the first one to initialise the class var to -1 is broken (i.e.
the property is fixed at '3', which corresponds to bottom-right placement). I
believe this must have always been the case, and I have not noticed it since
I've only been paying attention to the orientation of the vertical scroll bars.
Work continues!
Comment 17 Christian Neumair 2005-09-08 20:56:56 UTC
Jon: Thanks for your efforts.
On the -1 issue: I think you should check for inequality of the XSetting and the
"window-placement" object property, and if that's the case return the XSetting.
Thus, the g_param_spec_enum'ed property will never have an invalid value.

Also, you should namespace the XSetting to "gtk-scrolled-window-placement" and
change the nick/blob to
"Scrolled Window Placement"/"Where the contents of scrolled windows are located
with respect to the scrollbars"

It would be absolutely amazing for left-handed people if you could pick up work
on this patch again :).
Comment 18 Christian Neumair 2005-09-09 09:23:28 UTC
> On the -1 issue: I think you should check for inequality of the XSetting and the
> "window-placement" object property, and if that's the case return the XSetting.
> Thus, the g_param_spec_enum'ed property will never have an invalid value.

Unfortunately, this doesn't work properly.

We can't distinguish whether a g_object_set is called for the default value, or
whether it was overridden. (g_object_new (GTK_TYPE_SCROLLED_WINDOW,
"window-placemnt", ... )). While we could set an internal
override_window_placement flag, which would be set if the setter is called with
a value different from the default XSetting value, we still can't react properly
to XSetting changes, because we can never know whether the last g_object_set was
done by the default or with custom code. If we provide a feature (overriding
default XSetting) which doesn't work all the time, we could have left it out in
the first place.

I'd rather deprecate gtk_scrolled_window_get_placement and
gtk_scrolled_window_set_placement and just make the scrolled window obey the
global XSetting. If we insist on being able to modify this on an individual
widget basis, we should IMHO provide a style property.

Owen: Why exactly do you prefer an XSetting over a style property?
Comment 19 Owen Taylor 2005-09-09 14:56:08 UTC
It make no sense to me that these is an attribute of the theme. The
elements that come into play here are:

 - User-interface flipping for right-to-left languages
 - User preference
 - Possibly the application

An XSETTING is generally the right way to do User preferences. Style properties
cannot be set conveniently except by the theme, and asking users to switch
the entire appearance of their desktop to get the scrollbar in a different
place is silly.
Comment 20 Christian Neumair 2005-09-09 15:20:32 UTC
Owen: Do you think that it makes sense to just ignore the application's request
(deprecating set_placement/get_placement, that is, and ignoring the value of
"window-placement") and always use the XSETTING? I can't think of any reason why
this behavior should be inconsistent among multiple scrolled windows on screen,
except if they're run in different contexts (RTL vs. LTR)?
Comment 21 Christian Neumair 2005-09-09 19:31:49 UTC
I'm accepting this bug. I hope this is OK with you, Jon.
Comment 22 Owen Taylor 2005-09-09 21:13:19 UTC
if you move bugs away from gtk-bugs@gtk.org, please add that as the QA Contact.
(We don't usually pay attention to the assignee, but if it's helpful to you
feel free to do it. As long as you add the QA Contact.)
Comment 23 Christian Neumair 2005-09-09 21:35:18 UTC
Created attachment 52030 [details] [review]
Proposed (untested) patch

The attached patch contains an XSETTING implementation. The window's settings
are only obeyed if its "window-placement-set" property is TRUE. I've copied the
screen_changed handler from GtkButton (btw. excellent code :D).
Comment 24 Christian Neumair 2005-09-09 21:57:05 UTC
Created attachment 52031 [details] [review]
Proposed (untested) patch #2

This one actually compiles.
Comment 25 Christian Neumair 2005-10-29 10:08:17 UTC
Ping.
Comment 26 Federico Mena Quintero 2005-11-01 02:40:23 UTC
I haven't tested the patch in comment #24, but it looks more or less sane.

1. Are there apps (in the GNOME CVS) that explicitly set the placement?

2. Would they break if your patch by default doesn't obey that placement unless
they get modified to use the placement-set property?

3. What if you make the default be "obey the XSETTING unless the app has set the
placement explicitly"?
Comment 27 Christian Neumair 2005-11-01 12:27:37 UTC
> 1. Are there apps (in the GNOME CVS) that explicitly set the placement?

[1] just lists gturing. The rest seem to be bindings.

> 2. Would they break if your patch by default doesn't obey that placement
> unless they get modified to use the placement-set property?

According to [2], gturing just displays a canvas in a scrolled window. I don't
know what you mean by break.

> "obey the XSETTING unless the app has set the placement explicitly"

That's exactly what the patch does, see gtk_scrolled_window_set_placement_set.
Obviously, I should replace the call with a g_object_set_property, so that a
change notification can take place.

[1] http://tinyurl.com/bdpez
[2] http://cvs.gnome.org/viewcvs/gturing/src/graph_editor.c?annotate=1.4
Comment 28 Christian Neumair 2005-11-01 12:32:57 UTC
It turns out that my implementation of gtk_scrolled_window_set_placement_set
already emits "window-placement-set". I wonder whether it is emitted twice when
gtk_scrolled_window_set_placement_set is invoked from
gtk_scrolled_window_set_property.
Comment 29 Federico Mena Quintero 2005-11-01 17:32:18 UTC
Oh!  If it's just GTuring, don't worry about it :)

You are getting two emissions because GObject automatically emits the
"notify:foo" when you change an object property through g_object_set(). 
Normally you need to split your internal setters into this:

static void
setter_internal (GtkFoo *foo, int value, gboolean notify)
{
  foo->frob = value;
  if (notify)
     g_object_notify (foo, "frob");
}

void
gtk_foo_set_frob (GtkFoo *foo, int value)
{
   setter_internal (foo, value, TRUE);
}

static void
gtk_foo_set_prop (GObject *object, guint prop_id, const GValue *value,
GParamSpec *pspec)
{
   switch (prop_id) {
      case PROP_FOO:
         setter_internal (object, g_value_get_int (value), FALSE);
         break;
   }
}
Comment 30 Matthias Clasen 2006-03-10 06:39:35 UTC
Patch looks good. 
Have you tested it, Christian ?

At some point, we should probably look into consolidating the various
run-over-the-widget-hierarchy-on-screen-change instances into a callback
mechanism that iterates only once over the tree...

Comment 31 Matthias Clasen 2006-03-10 06:41:22 UTC
*** Bug 320618 has been marked as a duplicate of this bug. ***
Comment 32 Matthias Clasen 2006-03-14 20:27:45 UTC
Patch needs some more work. 
I'll attach a screenshot of testgtk after setting

gtk-scrolled-window-placement = top-right

Comment 33 Matthias Clasen 2006-03-14 20:28:58 UTC
Created attachment 61247 [details]
screenshot
Comment 34 Christian Neumair 2006-03-20 14:07:24 UTC
Created attachment 61617 [details] [review]
Proposed (tested) patch #3

It was as simple as replacing more occurences of scrolled_window->window_placement  by priv->real_window_placement. Seems to work like a charm with all sizing and text direction combinations.
Comment 35 Matthias Clasen 2006-03-20 19:18:54 UTC
2006-03-20  Matthias Clasen  <mclasen@redhat.com>

        * gtk/gtk.symbols:
        * gtk/gtkscrolledwindow.h:
        * gtk/gtkscrolledwindow.c: Add a window-placement-set property
        and a gtk-scrolled-window-placement setting.  (#157025, Christian
        Neumair)

Comment 36 Ian Dalton 2006-09-22 18:11:09 UTC
This bug is marked as fixed; how can I implement it?  Say I want all my GTK apps to put the scrollbar on the left; is there something I can enter in ~/.gtkrc-2.0?
Comment 37 Christian Neumair 2006-09-22 19:12:05 UTC
gtk-scrolled-window-placement = top-right