Skip to content
Snippets Groups Projects
Verified Commit 770a53cd authored by Andre Miranda's avatar Andre Miranda
Browse files

panel-plugin: Avoid selecting unsupported regions

parent eb163f18
No related branches found
No related tags found
1 merge request!52Preliminary Wayland support
Pipeline #26443 passed
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <libxfce4ui/libxfce4ui.h> #include <libxfce4ui/libxfce4ui.h>
#ifdef ENABLE_WAYLAND
#include <gdk/gdkwayland.h>
#endif
/* Internals */ /* Internals */
...@@ -198,6 +201,14 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd) ...@@ -198,6 +201,14 @@ screenshooter_read_rc_file (const gchar *file, ScreenshotData *sd)
sd->show_in_folder = show_in_folder; sd->show_in_folder = show_in_folder;
sd->custom_action_command = last_custom_action_command; sd->custom_action_command = last_custom_action_command;
/* Under Wayland force FULLSCREEN region */
#ifdef ENABLE_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
sd->region = FULLSCREEN;
}
#endif
/* Check if the screenshot directory read from the preferences is valid */ /* Check if the screenshot directory read from the preferences is valid */
if (G_UNLIKELY (!screenshooter_is_directory_writable (sd->screenshot_dir))) if (G_UNLIKELY (!screenshooter_is_directory_writable (sd->screenshot_dir)))
{ {
......
...@@ -35,6 +35,10 @@ t */ ...@@ -35,6 +35,10 @@ t */
#include "libscreenshooter.h" #include "libscreenshooter.h"
#ifdef ENABLE_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#define SCREENSHOT_ICON_NAME "org.xfce.screenshooter" #define SCREENSHOT_ICON_NAME "org.xfce.screenshooter"
/* Struct containing all panel plugin data */ /* Struct containing all panel plugin data */
...@@ -174,17 +178,39 @@ static gboolean cb_button_scrolled (GtkWidget *widget, ...@@ -174,17 +178,39 @@ static gboolean cb_button_scrolled (GtkWidget *widget,
{ {
case GDK_SCROLL_UP: case GDK_SCROLL_UP:
case GDK_SCROLL_RIGHT: case GDK_SCROLL_RIGHT:
#ifdef ENABLE_WAYLAND
if (!GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
pd->sd->region += 1;
if (pd->sd->region > SELECT)
pd->sd->region = FULLSCREEN;
}
#else
pd->sd->region += 1; pd->sd->region += 1;
if (pd->sd->region > SELECT) if (pd->sd->region > SELECT)
pd->sd->region = FULLSCREEN; pd->sd->region = FULLSCREEN;
#endif
set_panel_button_tooltip (pd); set_panel_button_tooltip (pd);
gtk_widget_trigger_tooltip_query (pd->button); gtk_widget_trigger_tooltip_query (pd->button);
return TRUE; return TRUE;
case GDK_SCROLL_DOWN: case GDK_SCROLL_DOWN:
case GDK_SCROLL_LEFT: case GDK_SCROLL_LEFT:
#ifdef ENABLE_WAYLAND
if (!GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
pd->sd->region -= 1;
if (pd->sd->region == REGION_0)
pd->sd->region = SELECT;
}
#else
pd->sd->region -= 1; pd->sd->region -= 1;
if (pd->sd->region == REGION_0) if (pd->sd->region == REGION_0)
pd->sd->region = SELECT; pd->sd->region = SELECT;
#endif
set_panel_button_tooltip (pd); set_panel_button_tooltip (pd);
gtk_widget_trigger_tooltip_query (pd->button); gtk_widget_trigger_tooltip_query (pd->button);
return TRUE; return TRUE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment