Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions bin/shutter
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,33 @@ sub STARTUP {

if ($x11_supported) {
$wnck_screen = Wnck::Screen::get_default();
$wnck_screen->force_update if $wnck_screen;
}

if ($wnck_screen) {
$wnck_screen->signal_connect('window-manager-changed' => sub {
$st->{_full}->set_menu(fct_ret_workspace_menu(FALSE));
});

$wnck_screen->signal_connect('viewports-changed' => sub {
$st->{_full}->set_menu(fct_ret_workspace_menu(FALSE));
});

$wnck_screen->signal_connect('workspace-created' => sub {
$st->{_full}->set_menu(fct_ret_workspace_menu(FALSE));
});

$wnck_screen->signal_connect('workspace-destroyed' => sub {
$st->{_full}->set_menu(fct_ret_workspace_menu(FALSE));
});

$wnck_screen->signal_connect('active-workspace-changed' => sub {
$st->{_full}->set_menu(fct_ret_workspace_menu(FALSE));
});

$wnck_screen->signal_connect('window-stacking-changed' => sub {
$st->{_window}->set_menu(fct_ret_window_menu());
fct_update_tray_menu(@_);
});
}

#TRAY ICON AND MENU
Expand Down Expand Up @@ -968,10 +994,8 @@ sub STARTUP {
$st->{_window}->set_menu(fct_ret_window_menu());

#and attach signal handlers
$st->{_full}->signal_connect('show-menu' => sub { $st->{_full}->set_menu(fct_ret_workspace_menu(FALSE)) });
$st->{_window}->signal_connect('clicked' => \&evt_take_screenshot, 'window');

$st->{_window}->signal_connect('show-menu' => sub { $st->{_window}->set_menu(fct_ret_window_menu()) });
#$st->{_section}->signal_connect('clicked' => \&evt_take_screenshot, 'section');
$st->{_menu}->signal_connect('clicked' => \&evt_take_screenshot, 'menu');
$st->{_tooltip}->signal_connect('clicked' => \&evt_take_screenshot, 'tooltip');
Expand Down Expand Up @@ -2904,14 +2928,6 @@ sub STARTUP {
if ($cmdname && $folder_to_save) {
evt_take_screenshot('global_keybinding', $cmdname, $folder_to_save, $extra);
}

#keep list of windows up-to-date (tray)
Glib::Idle->add(
sub {
$wnck_screen->signal_connect('window-stacking-changed' => sub { fct_update_tray_menu(@_); });
return FALSE;
}) if $wnck_screen;

}

#events
Expand Down Expand Up @@ -8442,7 +8458,6 @@ sub STARTUP {
$current_monitor_active = Gtk3::CheckMenuItem->new_with_label($d->get("Limit to current monitor"));
return $menu_wrksp;
}
$wnck_screen->force_update();

#we determine the wm name but on older
#version of libwnck (or the bindings)
Expand All @@ -8455,6 +8470,8 @@ sub STARTUP {
my $wm_name;
if ($wnck_screen->can('get_window_manager_name')) {
$wm_name = $wnck_screen->get_window_manager_name;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

$wm_name is defined here. Are we sure that the proposed patch triggers the issue? It looks like a new issue to me, originally the whole $wnck_screen was undefined, now it just fails to get the window manager's name. Maybe we can catch it and set $wm_name to something like "not-compiz", if $wnck_screen->get_window_manager_name returns undefined?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So, basically, $wnck_screen->can('get_window_manager_name') returns true, but $wnck_screen->get_window_manager_name is empty...

} else {
$wm_name = "unknown";
}

my $active_workspace = $wnck_screen->get_active_workspace;
Expand Down Expand Up @@ -8607,7 +8624,7 @@ sub STARTUP {
# Check if we can retrieve the list of stacked windows first, otherwise we will run into a crash, see issue 659

unless ($wnck_screen->get_windows_stacked) {
print "ERROR: The window list could not be retrieved and has been disabled, see https://github.com/shutter-project/shutter/issues/659";
$menu_windows->show_all;
return $menu_windows;
}

Expand Down
Loading