(no subject)

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

(no subject)

Gtk+ - General mailing list
Hi, ALL,
This link https://developer.gnome.org/gtk3/stable/GtkToolbar.html#GtkToolbar-popup-context-menu
states that the parameter "button" can be "-1".

What is the scenario when this occurs, i.e. it should be the button
number that was clicked IIUC?

Thank you for clarification.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Gtk+ - General mailing list
Nevermind.
Didn't read the whole description.

Sorry for the noise.

Thank you.

On Wed, Feb 20, 2019 at 11:07 AM Igor Korot <[hidden email]> wrote:
>
> Hi, ALL,
> This link https://developer.gnome.org/gtk3/stable/GtkToolbar.html#GtkToolbar-popup-context-menu
> states that the parameter "button" can be "-1".
>
> What is the scenario when this occurs, i.e. it should be the button
> number that was clicked IIUC?
>
> Thank you for clarification.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Stefan Salewski-2
In reply to this post by Gtk+ - General mailing list
On Wed, 2019-02-20 at 11:07 -0600, Igor Korot via gtk-list wrote:

> Hi, ALL,
> This link https://developer.gnome.org/gtk3/stable/GtkToolbar.html#Gtk
> Toolbar-popup-context-menu
> states that the parameter "button" can be "-1".
>
> What is the scenario when this occurs, i.e. it should be the button
> number that was clicked IIUC?
>
> Thank you for clarification.
>

Please use a more meaningful Subject next time.

And you may consider reading the API docs you linked to more carefully:

https://developer.gnome.org/gtk3/stable/GtkToolbar.html#GtkToolbar-popup-context-menu

"Emitted when the user right-clicks the toolbar or uses the
keybinding to display a popup menu."

So it seems to be obviously that button = -1 is the case when a
keybinding is used to display a popup menu. (Because for this case
there is no button involved.)

When you continue reading the API docs, it is even more clear:

"The mouse button number is given by the button parameter. If the menu
was popped up using the keybaord, button is -1."
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Gtk+ - General mailing list
Hi, Stefan et al,

On Wed, Feb 20, 2019 at 11:33 AM Stefan Salewski <[hidden email]> wrote:

>
> On Wed, 2019-02-20 at 11:07 -0600, Igor Korot via gtk-list wrote:
> > Hi, ALL,
> > This link https://developer.gnome.org/gtk3/stable/GtkToolbar.html#Gtk
> > Toolbar-popup-context-menu
> > states that the parameter "button" can be "-1".
> >
> > What is the scenario when this occurs, i.e. it should be the button
> > number that was clicked IIUC?
> >
> > Thank you for clarification.
> >
>
> Please use a more meaningful Subject next time.
>
> And you may consider reading the API docs you linked to more carefully:
>
> https://developer.gnome.org/gtk3/stable/GtkToolbar.html#GtkToolbar-popup-context-menu
>
> "Emitted when the user right-clicks the toolbar or uses the
> keybinding to display a popup menu."

I know I am kind of switching the topic here, but...

Why do we even talking about button number, when the doc explicitly said
"right-click", which implies "right mouse button".

Or I am misunderstanding something?

Thank you.

>
> So it seems to be obviously that button = -1 is the case when a
> keybinding is used to display a popup menu. (Because for this case
> there is no button involved.)
>
> When you continue reading the API docs, it is even more clear:
>
> "The mouse button number is given by the button parameter. If the menu
> was popped up using the keybaord, button is -1."
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Stefan Salewski-2
On Wed, 2019-02-20 at 11:49 -0600, Igor Korot wrote:
> I know I am kind of switching the topic here, but...
>
> Why do we even talking about button number, when the doc explicitly
> said
> "right-click", which implies "right mouse button".

Yes, I noticed that contradiction myself when answering your question.

I would assume that "right mouse button" is what is generally used, but
other buttons may work also or may work in future, maybe in GTK7?
Should be not too hard to test.
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Paul Davis
In reply to this post by Gtk+ - General mailing list


On Wed, Feb 20, 2019 at 10:49 AM Igor Korot via gtk-list <[hidden email]> wrote:

Why do we even talking about button number, when the doc explicitly said
"right-click", which implies "right mouse button".

X Window (at the very least) allows buttons to be remapped. Button #1 is typically the left mouse button, but a user may remap them (eg. left-handed people with a strong preference for using the mouse in their left hand). "left" and "right" buttons normally have a semantic meaning (e.g. "the button normally used for clicking on things" vs "the button used for context menus etc.") and you cannot hard code these on X Window.  More precisely, if you do hard code them, you disenfranchise a set of users who remap their mouse buttons.


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Gtk+ - General mailing list
Hi, Paul,

On Wed, Feb 20, 2019 at 12:03 PM Paul Davis <[hidden email]> wrote:

>
>
>
> On Wed, Feb 20, 2019 at 10:49 AM Igor Korot via gtk-list <[hidden email]> wrote:
>>
>>
>> Why do we even talking about button number, when the doc explicitly said
>> "right-click", which implies "right mouse button".
>
>
> X Window (at the very least) allows buttons to be remapped. Button #1 is typically the left mouse button, but a user may remap them (eg. left-handed people with a strong preference for using the mouse in their left hand). "left" and "right" buttons normally have a semantic meaning (e.g. "the button normally used for clicking on things" vs "the button used for context menus etc.") and you cannot hard code these on X Window.  More precisely, if you do hard code them, you disenfranchise a set of users who remap their mouse buttons.

Are you saying that if I map the left mouse button to be the right one
and click on it, I will not get that signal?

As far as the user code is concerned, the button I press to get the
context menu shouldn't matter, because this a low-level signal.
All the user code should be aware is - did I click the action button
or context menu one. Why do I need to care which is which?

Could you give me a scenario?

Thank you.

>
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Gtk+ - General mailing list
On Wed, Feb 20, 2019 at 12:10 PM Igor Korot <[hidden email]> wrote:

>
> Hi, Paul,
>
> On Wed, Feb 20, 2019 at 12:03 PM Paul Davis <[hidden email]> wrote:
> >
> >
> >
> > On Wed, Feb 20, 2019 at 10:49 AM Igor Korot via gtk-list <[hidden email]> wrote:
> >>
> >>
> >> Why do we even talking about button number, when the doc explicitly said
> >> "right-click", which implies "right mouse button".
> >
> >
> > X Window (at the very least) allows buttons to be remapped. Button #1 is typically the left mouse button, but a user may remap them (eg. left-handed people with a strong preference for using the mouse in their left hand). "left" and "right" buttons normally have a semantic meaning (e.g. "the button normally used for clicking on things" vs "the button used for context menus etc.") and you cannot hard code these on X Window.  More precisely, if you do hard code them, you disenfranchise a set of users who remap their mouse buttons.
>
> Are you saying that if I map the left mouse button to be the right one
> and click on it, I will not get that signal?
>
> As far as the user code is concerned, the button I press to get the
> context menu shouldn't matter, because this a low-level signal.
> All the user code should be aware is - did I click the action button
> or context menu one. Why do I need to care which is which?

Moreover - why user should care where the signal comes from - mouse or
keyboard?
I just need a proper place to display the context menu and make sure
I can either dismiss it or get the proper action.

Am I missing something?

Thank you.

>
> Could you give me a scenario?
>
> Thank you.
>
> >
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Paul Davis
In reply to this post by Gtk+ - General mailing list


On Wed, Feb 20, 2019 at 11:10 AM Igor Korot <[hidden email]> wrote:
Hi, Paul,

On Wed, Feb 20, 2019 at 12:03 PM Paul Davis <[hidden email]> wrote:
>
>
>
> On Wed, Feb 20, 2019 at 10:49 AM Igor Korot via gtk-list <[hidden email]> wrote:
>>
>>
>> Why do we even talking about button number, when the doc explicitly said
>> "right-click", which implies "right mouse button".
>
>
> X Window (at the very least) allows buttons to be remapped. Button #1 is typically the left mouse button, but a user may remap them (eg. left-handed people with a strong preference for using the mouse in their left hand). "left" and "right" buttons normally have a semantic meaning (e.g. "the button normally used for clicking on things" vs "the button used for context menus etc.") and you cannot hard code these on X Window.  More precisely, if you do hard code them, you disenfranchise a set of users who remap their mouse buttons.

Are you saying that if I map the left mouse button to be the right one
and click on it, I will not get that signal?

As far as the user code is concerned, the button I press to get the
context menu shouldn't matter, because this a low-level signal.
All the user code should be aware is - did I click the action button
or context menu one. Why do I need to care which is which?

Could you give me a scenario?

hold the mouse in your right hand. put your index finger on the most naturally positioned button. press it.

by default, X Window will generate a mouse button event using button number one.

now put the mouse in your left hand, put that index finger on the most naturally positioned button, press it.

by default, X Window will generate a mouse button event using button number three.

programmers don't want to deal with this in their code, so they generally assume that button #1 is "left button" and button #3 is "right button".

but what they really mean is "button used for most button clicks" and "button used for context clicks"

a dedicated left-handed user may remap this so that their left index finger correctly generates button 1 - the button used for most clicks.

your code can assume that 1 => most clicks; 3 => context click

it cannot assume that 1 => left ; 3 => right



_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Gtk+ - General mailing list
Paul,

On Wed, Feb 20, 2019 at 12:30 PM Paul Davis <[hidden email]> wrote:

>
>
>
> On Wed, Feb 20, 2019 at 11:10 AM Igor Korot <[hidden email]> wrote:
>>
>> Hi, Paul,
>>
>> On Wed, Feb 20, 2019 at 12:03 PM Paul Davis <[hidden email]> wrote:
>> >
>> >
>> >
>> > On Wed, Feb 20, 2019 at 10:49 AM Igor Korot via gtk-list <[hidden email]> wrote:
>> >>
>> >>
>> >> Why do we even talking about button number, when the doc explicitly said
>> >> "right-click", which implies "right mouse button".
>> >
>> >
>> > X Window (at the very least) allows buttons to be remapped. Button #1 is typically the left mouse button, but a user may remap them (eg. left-handed people with a strong preference for using the mouse in their left hand). "left" and "right" buttons normally have a semantic meaning (e.g. "the button normally used for clicking on things" vs "the button used for context menus etc.") and you cannot hard code these on X Window.  More precisely, if you do hard code them, you disenfranchise a set of users who remap their mouse buttons.
>>
>> Are you saying that if I map the left mouse button to be the right one
>> and click on it, I will not get that signal?
>>
>> As far as the user code is concerned, the button I press to get the
>> context menu shouldn't matter, because this a low-level signal.
>> All the user code should be aware is - did I click the action button
>> or context menu one. Why do I need to care which is which?
>>
>> Could you give me a scenario?
>
>
> hold the mouse in your right hand. put your index finger on the most naturally positioned button. press it.
>
> by default, X Window will generate a mouse button event using button number one.
>
> now put the mouse in your left hand, put that index finger on the most naturally positioned button, press it.
>
> by default, X Window will generate a mouse button event using button number three.
>
> programmers don't want to deal with this in their code, so they generally assume that button #1 is "left button" and button #3 is "right button".
>
> but what they really mean is "button used for most button clicks" and "button used for context clicks"
>
> a dedicated left-handed user may remap this so that their left index finger correctly generates button 1 - the button used for most clicks.
>
> your code can assume that 1 => most clicks; 3 => context click
>
> it cannot assume that 1 => left ; 3 => right

This is all correct and I'm not arguing about that.

What I do argue is why the context-menu event should care what mouse
button click it comes from?

Let's say I'm using GTK and writing a software.
Why should I care which button click generated my CSM?
As long as I get the event/message/signal I should be happy and will
write a handler where I will
construct the menu and display it.
The user can click the AUX1 button for all I care. But if this button
is not mapped correctly by the system
to generate "right-button click", this event/signal will never arrive/fire.

Am I missing something?
What is the scenario where user code needs to know if the button
pressed was 1, 3 or it was
a keyboard altogether (-1)?

Thank you.

>
>
_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Paul Davis


On Wed, Feb 20, 2019 at 12:36 PM Igor Korot <[hidden email]> wrote:

This is all correct and I'm not arguing about that.

What I do argue is why the context-menu event should care what mouse
button click it comes from?

if the menu is shown on button press (not release) (and this is typical), then something has be a little clever about the next-arriving button release event.


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list
Reply | Threaded
Open this post in threaded view
|

Re:

Michael Gratton
In reply to this post by Gtk+ - General mailing list
*hijacks the thread further*

On Thu, 21 Feb, 2019 at 6:36 AM, Igor Korot via gtk-list
<[hidden email]> wrote:
> What I do argue is why the context-menu event should care what mouse
> button click it comes from?

Yah, it's a bit odd there isn't a high-level context-menu signal for
widgets. Given it's important for accessibility, that it can be invoked
from both keyboard and mouse, and is used in almost every non-trivial
application.

In any case, Igor you might find `gdk_event_triggers_context_menu()`
helpful?

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>


_______________________________________________
gtk-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-list