-
-
Notifications
You must be signed in to change notification settings - Fork 49
Reimplementation for Maurizio's gnome-screenshot hack #667
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
923d141
e9c5f90
2732b31
cacd363
fd9f56a
ba610e2
a38454c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| ################################################### | ||
| # | ||
| # Copyright (C) 2008-2013 Mario Kemper <mario.kemper@gmail.com> | ||
| # | ||
| # This file is part of Shutter. | ||
| # | ||
| # Shutter is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 3 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # Shutter is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with Shutter; if not, write to the Free Software | ||
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| # | ||
| ################################################### | ||
|
|
||
| #perl -x -S perltidy -l=0 -b "%f" | ||
|
|
||
| package Shutter::Screenshot::SelectorGnomeWayland; | ||
|
|
||
| #modules | ||
| #-------------------------------------- | ||
| use utf8; | ||
| use strict; | ||
| use warnings; | ||
|
|
||
| use Shutter::Screenshot::Main; | ||
| use Shutter::Screenshot::History; | ||
|
|
||
| use Data::Dumper; | ||
| our @ISA = qw(Shutter::Screenshot::Main); | ||
|
|
||
| #Glib | ||
| use Glib qw/TRUE FALSE/; | ||
|
|
||
| #-------------------------------------- | ||
|
|
||
| sub new { | ||
| my $class = shift; | ||
|
|
||
| #call constructor of super class (shutter_common, include_cursor, delay, notify_timeout) | ||
| my $self = $class->SUPER::new(shift, shift, shift, shift); | ||
|
|
||
| $self->{_hide_time} = shift; #a short timeout to give the server a chance to redraw the area that was obscured | ||
|
|
||
| $self->{_dpi_scale} = Gtk3::Window->new('toplevel')->get('scale-factor'); | ||
|
|
||
| bless $self, $class; | ||
| return $self; | ||
| } | ||
|
|
||
| sub select_gnome_wayland { | ||
| my $self = shift; | ||
|
|
||
| #return value | ||
| my $output = 5; | ||
|
|
||
| my $cmdcursor = undef; | ||
|
|
||
| if ($self->{_include_cursor}) { | ||
| $cmdcursor = "-p"; | ||
| } | ||
| else { | ||
| $cmdcursor = ""; | ||
| } | ||
|
|
||
| my $fn = "/tmp/shutter-gnome-screenshot-tmp.png"; | ||
|
|
||
| system("gnome-screenshot", "-a", "-f", $fn, "-d", $self->{_delay}, $cmdcursor); | ||
|
|
||
|
|
||
|
|
||
| my $image = Gtk3::Image->new(); | ||
| $image->set_from_file($fn); | ||
| $output = $image->get_pixbuf(); | ||
|
|
||
| my $d = $self->{_sc}->get_gettext; | ||
|
|
||
| return $output; | ||
| } | ||
|
|
||
|
|
||
| sub redo_capture { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't actually redo any capture, will it?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, this is just a remainder from the SelectorAdvance.pm module which I took as a base. I have some ideas, how redo could be possible (make a full screen screenshot with gnome-screenshot, then choose the proper area, but this would require to somehow get the information, what the proper area is, as now gnome-screenshot is responsible for doing the selection) but nothing working yet. |
||
| my $self = shift; | ||
| my $output = 3; | ||
| if (defined $self->{_history}) { | ||
| ($output) = $self->get_pixbuf_from_drawable($self->{_history}->get_last_capture); | ||
| } | ||
| return $output; | ||
| } | ||
|
|
||
| sub get_history { | ||
| my $self = shift; | ||
| return $self->{_history}; | ||
| } | ||
|
|
||
| sub get_error_text { | ||
| my $self = shift; | ||
| return $self->{_error_text}; | ||
| } | ||
|
|
||
| sub get_action_name { | ||
| my $self = shift; | ||
| return $self->{_action_name}; | ||
| } | ||
|
|
||
| sub quit { | ||
| my $self = shift; | ||
|
|
||
| $self->ungrab_pointer_and_keyboard(FALSE, FALSE, TRUE); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did it grab them?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another unnecessary remainder. |
||
| $self->clean; | ||
| } | ||
|
|
||
| sub clean { | ||
| my $self = shift; | ||
|
|
||
| $self->{_selector}->signal_handler_disconnect($self->{_selector_handler}); | ||
| $self->{_view}->signal_handler_disconnect($self->{_view_zoom_handler}); | ||
| $self->{_view}->signal_handler_disconnect($self->{_view_button_handler}); | ||
| $self->{_view}->signal_handler_disconnect($self->{_view_event_handler}); | ||
| $self->{_select_window}->signal_handler_disconnect($self->{_key_handler}); | ||
| $self->{_select_window}->destroy; | ||
| $self->{_zoom_window}->destroy; | ||
| $self->{_prop_window}->destroy; | ||
| } | ||
|
|
||
| 1; | ||
Uh oh!
There was an error while loading. Please reload this page.