Skip to content

Migration of button-pressed and button-released to new GtkGesture API. - #15923

Closed
ghost wants to merge 2 commits into
masterfrom
unknown repository
Closed

Migration of button-pressed and button-released to new GtkGesture API.#15923
ghost wants to merge 2 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Dec 21, 2023

Copy link
Copy Markdown

Hello to everyone,

this pr will migrate the first button-pressed and button-release to the new GtkGesture API. Please test if everything is working as before. I do not find any problem but I also might have missed something.

I will wait with all further migration to this event context, until this pr has been reviewed. This is because I want to be sure, that the way I implemented it is your preferred way and I don't need to do things twice. :-)

Just to let all of you know: I am coming from the cpp perspective. This might break some things in code structure in the way I prefer to implement it.

Looking forward to your reply.
Thanks in advance

Greetings

@ghost ghost mentioned this pull request Dec 21, 2023
@TurboGit TurboGit added the gtk4 label Dec 21, 2023
@TurboGit TurboGit added this to the 4.8 milestone Dec 21, 2023
Comment thread src/dtgtk/thumbtable.c
G_CALLBACK(_event_button_press_primary), table);
g_signal_connect(G_OBJECT(table->gesture_button_primary), "released",
G_CALLBACK(_event_button_release_primary), table);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems likely that this sequence of four calls will be repeated over and over for each button-press handler. That suggests packaging them into a function called something like dtgtk_button_handler_new which would take as arguments the GtkWidget, the specification of which button, the press and release callbacks, and the user-data pointer. With that abstraction in place, the above code would read

table->gesture_button_primary = dtgtk_button_handler_new(table->widget, GDK_BUTTON_PRIMARY, _event_button_press_primary, _event_button_release_primary, table);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a message might be of general use. Do you (or anyone else) has a short hint where to place such a method? I don't have a general overview of the whole code structure for now.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/dtgtk/button.h seems the obvious place.

@TurboGit

Copy link
Copy Markdown
Member

@Christian-Kr : Please do not merge master into topic branches. I'd prefer a rebase when needed. TIA.

@TurboGit TurboGit modified the milestones: 4.8, 5.0 May 13, 2024
@ghost

ghost commented Jun 1, 2024

Copy link
Copy Markdown
Author

@Christian-Kr : Please do not merge master into topic branches. I'd prefer a rebase when needed. TIA.

@TurboGit : I have reset the merge commit and force-pushed the branch to remote. In future I will use rebase. I would also handle #15908 like that, if it is ok for you.

Greetings

@ghost

ghost commented Jun 1, 2024

Copy link
Copy Markdown
Author

Well, there was some additional conflict with rebase. I think I ruined it. Cause it was just a small change, I will close this pr and start with a fresh branch again.

Sry for that.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants