Skip to content

Commit

Permalink
Allow focus for selectable labels, closes #10
Browse files Browse the repository at this point in the history
  • Loading branch information
AlienCowEatCake committed Feb 3, 2024
1 parent 02c317e commit 7f54027
Showing 1 changed file with 105 additions and 0 deletions.
105 changes: 105 additions & 0 deletions patches_sylpheed/0020-Allow-focus-for-selectable-labels-on-macOS.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
From 6f66378f75b6192ce439bcb583195bcc37779d00 Mon Sep 17 00:00:00 2001
From: Peter Zhigalov <[email protected]>
Date: Sun, 4 Feb 2024 02:38:19 +0700
Subject: [PATCH 20/20] Allow focus for selectable labels on macOS

---
src/alertpanel.c | 2 ++
src/headerview.c | 2 ++
src/setup.c | 8 ++++++++
src/sslmanager.c | 2 ++
4 files changed, 14 insertions(+)

diff --git a/src/alertpanel.c b/src/alertpanel.c
index 723125e..e23d045 100644
--- a/src/alertpanel.c
+++ b/src/alertpanel.c
@@ -299,7 +299,9 @@ static void alertpanel_create(const gchar *title,
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+#endif
#ifdef G_OS_WIN32
{
GtkStyle *style;
diff --git a/src/headerview.c b/src/headerview.c
index 984e8bc..bc7993c 100644
--- a/src/headerview.c
+++ b/src/headerview.c
@@ -120,11 +120,13 @@ HeaderView *headerview_create(void)
gtk_label_set_selectable(GTK_LABEL(ng_body_label), TRUE);
gtk_label_set_selectable(GTK_LABEL(subject_body_label), TRUE);

+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(from_body_label, GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS(to_body_label, GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS(cc_body_label, GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS(ng_body_label, GTK_CAN_FOCUS);
GTK_WIDGET_UNSET_FLAGS(subject_body_label, GTK_CAN_FOCUS);
+#endif

gtk_widget_add_events(from_body_label, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
gtk_widget_add_events(to_body_label, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK);
diff --git a/src/setup.c b/src/setup.c
index c2f4feb..810e575 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -171,7 +171,9 @@ void setup_mailbox(void)
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+#endif
MODIFY_LABEL_STYLE();

vbox = gtk_vbox_new(FALSE, 8);
@@ -194,7 +196,9 @@ void setup_mailbox(void)
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_MIDDLE);
#endif
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+#endif
MODIFY_LABEL_STYLE();

g_free(fullpath);
@@ -223,7 +227,9 @@ void setup_mailbox(void)
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+#endif
MODIFY_LABEL_STYLE();

if (prefs_common.comply_gnome_hig) {
@@ -790,7 +796,9 @@ PrefsAccount *setup_account(void)
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+#endif
MODIFY_LABEL_STYLE();

vbox = gtk_vbox_new(FALSE, 8);
diff --git a/src/sslmanager.c b/src/sslmanager.c
index a633710..b8117e9 100644
--- a/src/sslmanager.c
+++ b/src/sslmanager.c
@@ -169,7 +169,9 @@ gint ssl_manager_verify_cert(SockInfo *sockinfo, const gchar *hostname,
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_selectable(GTK_LABEL(label), TRUE);
+#ifndef __APPLE__
GTK_WIDGET_UNSET_FLAGS(label, GTK_CAN_FOCUS);
+#endif
#ifdef G_OS_WIN32
{
GtkStyle *style;
--
2.39.3 (Apple Git-145)

0 comments on commit 7f54027

Please sign in to comment.