diff --git a/src/apprt/gtk/ClipboardConfirmationWindow.zig b/src/apprt/gtk/ClipboardConfirmationWindow.zig index d967fd06f..9260d1c7b 100644 --- a/src/apprt/gtk/ClipboardConfirmationWindow.zig +++ b/src/apprt/gtk/ClipboardConfirmationWindow.zig @@ -27,8 +27,8 @@ core_surface: *CoreSurface, pending_req: apprt.ClipboardRequest, text_view: *gtk.TextView, text_view_scroll: *gtk.ScrolledWindow, -reveal_button_widget: *gtk.Widget, -hide_button_widget: *gtk.Widget, +reveal_button: *gtk.Button, +hide_button: *gtk.Button, pub fn create( app: *App, @@ -101,8 +101,8 @@ fn init( .pending_req = request, .text_view = text_view, .text_view_scroll = text_view_scroll, - .reveal_button_widget = gobject.ext.cast(gtk.Widget, reveal_button).?, - .hide_button_widget = gobject.ext.cast(gtk.Widget, hide_button).?, + .reveal_button = reveal_button, + .hide_button = hide_button, }; const buffer = gtk.TextBuffer.new(null); @@ -111,10 +111,10 @@ fn init( text_view.setBuffer(buffer); if (is_secure_input) { - gobject.ext.as(gtk.Widget, text_view_scroll).setSensitive(@intFromBool(false)); - gobject.ext.as(gtk.Widget, self.text_view).addCssClass("blurred"); + text_view_scroll.as(gtk.Widget).setSensitive(@intFromBool(false)); + self.text_view.as(gtk.Widget).addCssClass("blurred"); - self.reveal_button_widget.setVisible(@intFromBool(true)); + self.reveal_button.as(gtk.Widget).setVisible(@intFromBool(true)); _ = gtk.Button.signals.clicked.connect( reveal_button, @@ -189,17 +189,17 @@ fn gtkResponse(_: *DialogType, response: [*:0]u8, self: *ClipboardConfirmation) } fn gtkRevealButtonClicked(_: *gtk.Button, self: *ClipboardConfirmation) callconv(.C) void { - gobject.ext.as(gtk.Widget, self.text_view_scroll).setSensitive(@intFromBool(true)); - gobject.ext.as(gtk.Widget, self.text_view).removeCssClass("blurred"); + self.text_view_scroll.as(gtk.Widget).setSensitive(@intFromBool(true)); + self.text_view.as(gtk.Widget).removeCssClass("blurred"); - self.hide_button_widget.setVisible(@intFromBool(true)); - self.reveal_button_widget.setVisible(@intFromBool(false)); + self.hide_button.as(gtk.Widget).setVisible(@intFromBool(true)); + self.reveal_button.as(gtk.Widget).setVisible(@intFromBool(false)); } fn gtkHideButtonClicked(_: *gtk.Button, self: *ClipboardConfirmation) callconv(.C) void { - gobject.ext.as(gtk.Widget, self.text_view_scroll).setSensitive(@intFromBool(false)); - gobject.ext.as(gtk.Widget, self.text_view).addCssClass("blurred"); + self.text_view_scroll.as(gtk.Widget).setSensitive(@intFromBool(false)); + self.text_view.as(gtk.Widget).addCssClass("blurred"); - self.hide_button_widget.setVisible(@intFromBool(false)); - self.reveal_button_widget.setVisible(@intFromBool(true)); + self.hide_button.as(gtk.Widget).setVisible(@intFromBool(false)); + self.reveal_button.as(gtk.Widget).setVisible(@intFromBool(true)); } diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 47b0867ba..cba436fec 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -1209,7 +1209,13 @@ fn gtkClipboardRead( error.UnauthorizedPaste, => { // Create a dialog and ask the user if they want to paste anyway. - ClipboardConfirmationWindow.create(self.app, str, &self.core_surface, req.state, self.is_secure_input) catch |window_err| { + ClipboardConfirmationWindow.create( + self.app, + str, + &self.core_surface, + req.state, + self.is_secure_input, + ) catch |window_err| { log.err("failed to create clipboard confirmation window err={}", .{window_err}); }; return; @@ -2224,7 +2230,13 @@ fn doPaste(self: *Surface, data: [:0]const u8) void { error.UnsafePaste, error.UnauthorizedPaste, => { - ClipboardConfirmationWindow.create(self.app, data, &self.core_surface, .paste, self.is_secure_input) catch |window_err| { + ClipboardConfirmationWindow.create( + self.app, + data, + &self.core_surface, + .paste, + self.is_secure_input, + ) catch |window_err| { log.err("failed to create clipboard confirmation window err={}", .{window_err}); }; }, diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp index eafa92e1b..c76b69884 100644 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp +++ b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.blp @@ -14,18 +14,58 @@ Adw.MessageDialog clipboard_confirmation_window { default-response: "cancel"; close-response: "cancel"; - extra-child: ScrolledWindow { - width-request: 500; - height-request: 250; + extra-child: Overlay { + styles [ + "osd" + ] - TextView text_view { - cursor-visible: false; - editable: false; - monospace: true; - top-margin: 8; - left-margin: 8; - bottom-margin: 8; - right-margin: 8; + ScrolledWindow text_view_scroll { + width-request: 500; + height-request: 250; + + TextView text_view { + cursor-visible: false; + editable: false; + monospace: true; + top-margin: 8; + left-margin: 8; + bottom-margin: 8; + right-margin: 8; + + styles [ + "clipboard-content-view" + ] + } + } + + [overlay] + Button reveal_button { + visible: false; + halign: end; + valign: start; + margin-end: 12; + margin-top: 12; + + Image { + icon-name: "view-reveal-symbolic"; + } + } + + [overlay] + Button hide_button { + visible: false; + halign: end; + valign: start; + margin-end: 12; + margin-top: 12; + + styles [ + "opaque" + ] + + Image { + icon-name: "view-conceal-symbolic"; + } } }; } diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui index 9c89835a0..82512e3a2 100644 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui +++ b/src/apprt/gtk/ui/1.2/ccw-osc-52-read.ui @@ -7,27 +7,68 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - Authorize Clipboard Access - An application is attempting to read from the clipboard. The current clipboard contents are shown below. + Authorize Clipboard Access + An application is attempting to read from the clipboard. The current clipboard contents are shown below. - Deny - Allow + Deny + Allow cancel cancel - - 500 - 250 + + - - false - false - true - 8 - 8 - 8 - 8 + + 500 + 250 + + + false + false + true + 8 + 8 + 8 + 8 + + + + + + + + false + 2 + 1 + 12 + 12 + + + view-reveal-symbolic + + + + + + + false + 2 + 1 + 12 + 12 + + + + view-conceal-symbolic + + diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp index ecd58929b..529a2fc52 100644 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp +++ b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.blp @@ -14,18 +14,58 @@ Adw.MessageDialog clipboard_confirmation_window { default-response: "cancel"; close-response: "cancel"; - extra-child: ScrolledWindow { - width-request: 500; - height-request: 250; + extra-child: Overlay { + styles [ + "osd" + ] - TextView text_view { - cursor-visible: false; - editable: false; - monospace: true; - top-margin: 8; - left-margin: 8; - bottom-margin: 8; - right-margin: 8; + ScrolledWindow text_view_scroll { + width-request: 500; + height-request: 250; + + TextView text_view { + cursor-visible: false; + editable: false; + monospace: true; + top-margin: 8; + left-margin: 8; + bottom-margin: 8; + right-margin: 8; + + styles [ + "clipboard-content-view" + ] + } + } + + [overlay] + Button reveal_button { + visible: false; + halign: end; + valign: start; + margin-end: 12; + margin-top: 12; + + Image { + icon-name: "view-reveal-symbolic"; + } + } + + [overlay] + Button hide_button { + visible: false; + halign: end; + valign: start; + margin-end: 12; + margin-top: 12; + + styles [ + "opaque" + ] + + Image { + icon-name: "view-conceal-symbolic"; + } } }; } diff --git a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui index a8904de0d..195fb1de1 100644 --- a/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui +++ b/src/apprt/gtk/ui/1.2/ccw-osc-52-write.ui @@ -7,27 +7,68 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - Authorize Clipboard Access - An application is attempting to write to the clipboard. The current clipboard contents are shown below. + Authorize Clipboard Access + An application is attempting to write to the clipboard. The current clipboard contents are shown below. - Deny - Allow + Deny + Allow cancel cancel - - 500 - 250 + + - - false - false - true - 8 - 8 - 8 - 8 + + 500 + 250 + + + false + false + true + 8 + 8 + 8 + 8 + + + + + + + + false + 2 + 1 + 12 + 12 + + + view-reveal-symbolic + + + + + + + false + 2 + 1 + 12 + 12 + + + + view-conceal-symbolic + + diff --git a/src/apprt/gtk/ui/1.2/ccw-paste.blp b/src/apprt/gtk/ui/1.2/ccw-paste.blp index 916860368..3ca12e966 100644 --- a/src/apprt/gtk/ui/1.2/ccw-paste.blp +++ b/src/apprt/gtk/ui/1.2/ccw-paste.blp @@ -14,18 +14,58 @@ Adw.MessageDialog clipboard_confirmation_window { default-response: "cancel"; close-response: "cancel"; - extra-child: ScrolledWindow { - width-request: 500; - height-request: 250; + extra-child: Overlay { + styles [ + "osd" + ] - TextView text_view { - cursor-visible: false; - editable: false; - monospace: true; - top-margin: 8; - left-margin: 8; - bottom-margin: 8; - right-margin: 8; + ScrolledWindow text_view_scroll { + width-request: 500; + height-request: 250; + + TextView text_view { + cursor-visible: false; + editable: false; + monospace: true; + top-margin: 8; + left-margin: 8; + bottom-margin: 8; + right-margin: 8; + + styles [ + "clipboard-content-view" + ] + } + } + + [overlay] + Button reveal_button { + visible: false; + halign: end; + valign: start; + margin-end: 12; + margin-top: 12; + + Image { + icon-name: "view-reveal-symbolic"; + } + } + + [overlay] + Button hide_button { + visible: false; + halign: end; + valign: start; + margin-end: 12; + margin-top: 12; + + styles [ + "opaque" + ] + + Image { + icon-name: "view-conceal-symbolic"; + } } }; } diff --git a/src/apprt/gtk/ui/1.2/ccw-paste.ui b/src/apprt/gtk/ui/1.2/ccw-paste.ui index 33e75b3e8..342c767e6 100644 --- a/src/apprt/gtk/ui/1.2/ccw-paste.ui +++ b/src/apprt/gtk/ui/1.2/ccw-paste.ui @@ -7,27 +7,68 @@ corresponding .blp file and regenerate this file with blueprint-compiler. - Warning: Potentially Unsafe Paste - Pasting this text into the terminal may be dangerous as it looks like some commands may be executed. + Warning: Potentially Unsafe Paste + Pasting this text into the terminal may be dangerous as it looks like some commands may be executed. - Cancel - Paste + Cancel + Paste cancel cancel - - 500 - 250 + + - - false - false - true - 8 - 8 - 8 - 8 + + 500 + 250 + + + false + false + true + 8 + 8 + 8 + 8 + + + + + + + + false + 2 + 1 + 12 + 12 + + + view-reveal-symbolic + + + + + + + false + 2 + 1 + 12 + 12 + + + + view-conceal-symbolic + + diff --git a/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp b/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp index 9f3b806a6..60fca5b00 100644 --- a/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp +++ b/src/apprt/gtk/ui/1.5/ccw-osc-52-read.blp @@ -15,6 +15,10 @@ Adw.AlertDialog clipboard_confirmation_window { close-response: "cancel"; extra-child: Overlay { + styles [ + "osd" + ] + ScrolledWindow text_view_scroll { width-request: 500; height-request: 250; @@ -42,10 +46,6 @@ Adw.AlertDialog clipboard_confirmation_window { margin-end: 12; margin-top: 12; - styles [ - "destructive-action", - ] - Image { icon-name: "view-reveal-symbolic"; } @@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window { margin-top: 12; styles [ - "suggested-action", + "opaque" ] Image { diff --git a/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp b/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp index a745de597..7ef17def0 100644 --- a/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp +++ b/src/apprt/gtk/ui/1.5/ccw-osc-52-write.blp @@ -15,6 +15,10 @@ Adw.AlertDialog clipboard_confirmation_window { close-response: "cancel"; extra-child: Overlay { + styles [ + "osd" + ] + ScrolledWindow text_view_scroll { width-request: 500; height-request: 250; @@ -42,10 +46,6 @@ Adw.AlertDialog clipboard_confirmation_window { margin-end: 12; margin-top: 12; - styles [ - "destructive-action", - ] - Image { icon-name: "view-reveal-symbolic"; } @@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window { margin-top: 12; styles [ - "suggested-action", + "opaque" ] Image { diff --git a/src/apprt/gtk/ui/1.5/ccw-paste.blp b/src/apprt/gtk/ui/1.5/ccw-paste.blp index 1066ecae7..57539fb44 100644 --- a/src/apprt/gtk/ui/1.5/ccw-paste.blp +++ b/src/apprt/gtk/ui/1.5/ccw-paste.blp @@ -15,6 +15,10 @@ Adw.AlertDialog clipboard_confirmation_window { close-response: "cancel"; extra-child: Overlay { + styles [ + "osd" + ] + ScrolledWindow text_view_scroll { width-request: 500; height-request: 250; @@ -42,10 +46,6 @@ Adw.AlertDialog clipboard_confirmation_window { margin-end: 12; margin-top: 12; - styles [ - "destructive-action", - ] - Image { icon-name: "view-reveal-symbolic"; } @@ -60,7 +60,7 @@ Adw.AlertDialog clipboard_confirmation_window { margin-top: 12; styles [ - "suggested-action", + "opaque" ] Image {