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 107776 - Use gtk dnd threshold value for snap tolerance
Use gtk dnd threshold value for snap tolerance
Status: RESOLVED FIXED
Product: gnome-panel
Classification: Other
Component: panel
2.3.x
Other All
: Normal minor
: ---
Assigned To: Panel Maintainers
Panel Maintainers
new-toplevel-todo
Depends on:
Blocks:
 
 
Reported: 2003-03-06 23:28 UTC by Luis Villa
Modified: 2015-03-24 13:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (7.59 KB, patch)
2003-12-01 13:33 UTC, Vincent Untz
needs-work Details | Review

Description Luis Villa 2003-03-06 23:28:17 UTC
So, it's pretty slick that the panel knows about 'center' and 'corner' but
particularly in the center case the snap/stick-i-ness is pretty small- I
didn't notice it was there the first time I was showing off the new panel
to someone. It was only when I went to file the 'it should have gravity'
bug that I noticed it actually did have it. Maybe just a few more pixels? I
have no idea what the UI/a11y people have to say about this, though.
Comment 1 Mark McLoughlin 2003-03-06 23:36:12 UTC
Yeah, its pretty arbitrary:

#define SNAP_TOLERANCE 20

so that's twenty pixels on each side of the center mark. Maybe we
should just double it for snapping to the center.
Comment 2 Luis Villa 2003-03-07 02:17:16 UTC
Sounds like it would work for me. I can maybe just poke at the #define
and experiment a bit.
Comment 3 Calum Benson 2003-03-25 18:32:44 UTC
My guess is that this value should be the same as the amount you need
to drag a maximized window to "shake it loose": see bug #93586.

Of course, right now that feature hasn't been incorporated and its
value is currently hard-coded too :)  So you probably want to
co-ordinate with Havoc on this.
Comment 4 Vincent Untz 2003-11-19 22:12:13 UTC
Havoc fixed this in metacity by using the gtk-dnd-drag-threshold
setting (it is multiplied by 6). We can do this too, but it won't be
'shared' with metacity: if it get changed there, we won't know it...
Comment 5 Calum Benson 2003-12-01 12:41:33 UTC
I guess it's not particularly important the value is identical to that
in metacity, to be honest.  Just as long as they're both some sensible
function of the dnd threshold, so that somebody with mobility problems
sees an improvement if they have to bump up the value.
Comment 6 Vincent Untz 2003-12-01 13:33:26 UTC
Created attachment 21980 [details] [review]
Proposed patch
Comment 7 Vincent Untz 2003-12-01 13:35:41 UTC
With this patch, we now use gtk-dnd-drag-threshold to determine the
snap tolerance. I just did like in metacity and use a factor of 6 (6 *
gtk-dnd-drag-threshold), but maybe we should use a lower factor...
Comment 8 Mark McLoughlin 2003-12-01 15:49:54 UTC
Hmm, I'd prefer to just calculate the snap_tolerance and stick it in
toplevel->priv so we don't need to keep getting it from the
GtkSettings buts its a bit of a pain in the arse 'cause you'd need to:

  1) Connect to "notify::gtk-dnd-drag-threshold" on the GtkSettings 
  2) Update for the new GtkSettings when we move to another screen.

Also, you can't do this until the toplevel has had its screen set.

Couple of other nits:

  + Don't use a magic number for the default threshold. Do:

      #define DEFAULT_DND_THRESHOLD 8

  + DRAG_THRESHOLD_TO_SNAP_TOLERANCE_FACTOR is a little long :-)
    Perhaps SNAP_TOLERANCE_FACTOR ?

  + Its common practice to do:

    g_object_get (G_OBJECT (settings),
                  "gtk-dnd-drag-threshold", &threshold,
                  NULL);

    Its a nice idiom because it puts the variable to hold the property
    beside the property name ... easy to read

Apart from that it looks fine - go ahead with whatever you think is
best.
Comment 9 Bryan W Clark 2003-12-21 19:46:30 UTC
Vincent, just checking in on this.  Has the patch been commited?

This looks good to me, I'd say go ahead if it hasn't already been done
and close this bug out.
Comment 10 Vincent Untz 2003-12-22 12:59:25 UTC
I did not have the time to update the patch and I won't be able to
work on it before January. But be sure I'll do it :-)
Comment 11 Mark McLoughlin 2004-02-13 18:17:44 UTC
Vincent: any update ?
Comment 12 Vincent Untz 2004-02-14 10:39:41 UTC
Still busy :/
I should have more time in a few days.
Comment 13 Kjartan Maraas 2004-05-18 15:58:06 UTC
Apparently still busy? :)
Comment 14 Vincent Untz 2004-12-21 08:27:06 UTC
I committed something that should help with the original bug. But this patch
should still be updated. I had forgottent about it.
Comment 15 Vincent Untz 2005-01-12 13:57:07 UTC
Sorry for the spam. Mass-marking some bugs to the 2.10.x milestone.
 Filter on "VINCENT WANTS THIS FOR 2.10" to ignore.
Comment 16 Vincent Untz 2005-01-12 21:38:12 UTC
2005-01-12  Vincent Untz  <vincent@vuntz.net>

         Use gtk dnd threshold value for snap tolerance
         Fix bug #107776.

        * panel-toplevel.c: (panel_toplevel_move_to): updated to use the
        snap_tolerance in the private structure
        (panel_toplevel_rotate_to_pointer): ditto
        (panel_toplevel_calc_floating): ditto
        (panel_toplevel_update_normal_position): ditto
        (panel_toplevel_update_auto_hide_position): ditto
        (panel_toplevel_drag_threshold_changed): new, update the
        snap_tolerance when gtk-dnd-drag-threshold has been changed
        (panel_toplevel_update_gtk_settings): new, update the GtkSettings we
        watch and disconnect from the previous one
        (panel_toplevel_screen_changed): call
        panel_toplevel_update_gtk_settings()
        (panel_toplevel_finalize): disconnect the handler for
        gtk-dnd-drag-threshold changes
        (panel_toplevel_instance_init): initialize the new fields and the
        GtkSettings we watch