Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • apps/xfce4-screenshooter
  • andreldm/xfce4-screenshooter
  • bobby285271/xfce4-screenshooter
  • samuelsmash/xfce4-screenshooter
  • triallax/xfce4-screenshooter
  • mbarriolinares/xfce4-screenshooter
  • Monsterovich/xfce4-screenshooter
7 results
Show changes
Commits on Source (399)
Showing
with 2498 additions and 1780 deletions
# Autotools files generated into srcdir
/ABOUT-NLS
/INSTALL
*.tar.bz2
*.tar.gz
......@@ -12,11 +13,18 @@ Makefile.in
/configure~
/depcomp
/install-sh
/intltool-*.in
/install-sh~
/ltmain.sh
/missing
/po/Makefile.in.in
/configure.ac
/po/Makevars.template
/po/Rules-quot
/po/boldquot.sed
/po/en@boldquot.header
/po/en@quot.header
/po/insert-header.sin
/po/quot.sed
/po/remove-potcdate.sin
/m4/
/mkinstalldirs
......@@ -32,16 +40,22 @@ Makefile
/libtool
/panel-plugin/.dirstamp
/panel-plugin/screenshooter.desktop
/po/.intltool-merge-cache*
/po/POTFILES
/po/*.gmo
/po/stamp-it
/po/remove-potcdate.sed
/po/stamp-po
/po/xfce4-screenshooter.pot
/src/.dirstamp
*.o
/src/xfce4-screenshooter
/src/xfce4-screenshooter.desktop*
/src/xfce4-screenshooter.desktop
/stamp-h1
src/xfce4-screenshooter.appdata.xml
/protocols/.dirstamp
# UI header files generated using xdt-csource
lib/*_ui.h
# Code generated using wayland-scanner
/protocols/*.c
/protocols/*.h
[submodule "protocols/wlr-protocols"]
path = protocols/wlr-protocols
url = https://gitlab.freedesktop.org/wlroots/wlr-protocols.git
......@@ -5,6 +5,11 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
SUBDIRS = po
BUILT_SOURCES =
EXTRA_DIST =
DISTCLEANFILES =
noinst_LTLIBRARIES =
bin_PROGRAMS = src/xfce4-screenshooter
distclean-local:
......@@ -19,14 +24,50 @@ dist-bz2: dist
distcheck-bz2: distcheck
zcat $(PACKAGE)-$(VERSION).tar.gz | bzip2 --best -c > $(PACKAGE)-$(VERSION).tar.bz2
# Convienence library for the application and the panel plugin
noinst_LTLIBRARIES = lib/libscreenshooter.la
# Wayland protocols
if ENABLE_WAYLAND
noinst_LTLIBRARIES += \
protocols/libprotocols.la
protocols_libprotocols_built_sources = \
protocols/wlr-screencopy-unstable-v1.c \
protocols/wlr-screencopy-unstable-v1-client.h
nodist_protocols_libprotocols_la_SOURCES = \
protocols/wlr-screencopy-unstable-v1.c
protocols_libprotocols_la_CFLAGS = \
$(WAYLAND_CLIENT_CFLAGS) \
$(PLATFORM_CFLAGS)
protocols_libprotocols_la_LDFLAGS = \
-no-undefined \
$(PLATFORM_LDFLAGS)
protocols_libprotocols_la_LIBADD = \
$(WAYLAND_CLIENT_LIBS)
protocols/%.c: $(WLR_PROTOCOLS_PKGDATADIR)/unstable/%.xml
$(AM_V_GEN) wayland-scanner private-code $< $@
protocols/%-client.h: $(WLR_PROTOCOLS_PKGDATADIR)/unstable/%.xml
$(AM_V_GEN) wayland-scanner client-header $< $@
BUILT_SOURCES += \
$(protocols_libprotocols_built_sources)
DISTCLEANFILES += \
$(protocols_libprotocols_built_sources)
endif
EXTRA_DIST += \
protocols/wlr-protocols/unstable/wlr-screencopy-unstable-v1.xml
# Imgur upload custom action script
scriptdir = $(libexecdir)/xfce4/screenshooter/scripts
script_DATA = imgur-upload.sh
# Convienence library for the application and the panel plugin
noinst_LTLIBRARIES += lib/libscreenshooter.la
lib_libscreenshooter_la_SOURCES = \
lib_libscreenshooter_la_SOURCES = \
$(lib_libscreenshooter_built_sources) \
lib/libscreenshooter.h \
lib/screenshooter-actions.c lib/screenshooter-actions.h \
......@@ -35,12 +76,18 @@ lib_libscreenshooter_la_SOURCES = \
lib/screenshooter-format.c lib/screenshooter-format.h \
lib/screenshooter-dialogs.c lib/screenshooter-dialogs.h \
lib/screenshooter-global.h \
lib/screenshooter-job.c lib/screenshooter-job.h \
lib/screenshooter-job-callbacks.c lib/screenshooter-job-callbacks.h \
lib/screenshooter-simple-job.c lib/screenshooter-simple-job.h \
lib/screenshooter-utils.c lib/screenshooter-utils.h \
lib/screenshooter-imgur.c lib/screenshooter-imgur.h \
lib/screenshooter-imgur-dialog.c lib/screenshooter-imgur-dialog.h
lib/screenshooter-utils.c lib/screenshooter-utils.h
if ENABLE_X11
lib_libscreenshooter_la_SOURCES += \
lib/screenshooter-capture-x11.c lib/screenshooter-capture-x11.h \
lib/screenshooter-utils-x11.c lib/screenshooter-utils-x11.h
endif
if ENABLE_WAYLAND
lib_libscreenshooter_la_SOURCES += \
lib/screenshooter-capture-wayland.c lib/screenshooter-capture-wayland.h
endif
lib_libscreenshooter_la_CFLAGS = \
-I$(top_srcdir) \
......@@ -52,14 +99,11 @@ lib_libscreenshooter_la_CFLAGS = \
@GLIB_CFLAGS@ \
@LIBXFCE4UTIL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \
@LIBXML_CFLAGS@ \
@SOUP2_CFLAGS@ \
@SOUP3_CFLAGS@ \
@LIBX11_CFLAGS@ \
@WAYLAND_CLIENT_CFLAGS@ \
@XFIXES_CFLAGS@ \
@XFCONF_CFLAGS@ \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
-DPACKAGE_SCRIPTS_DIR=\"$(scriptdir)\"
-DPACKAGE_LOCALE_DIR=\"$(localedir)\"
lib_libscreenshooter_la_LIBADD = \
-lm \
......@@ -70,21 +114,22 @@ lib_libscreenshooter_la_LIBADD = \
@LIBXFCE4UTIL_LIBS@ \
@LIBXFCE4UI_LIBS@ \
@GLIB_LIBS@ \
@SOUP2_LIBS@ \
@SOUP3_LIBS@ \
@LIBXML_LIBS@ \
@LIBXEXT_LIBS@ \
@LIBX11_LIBS@ \
@LIBX11_LDFLAGS@ \
@WAYLAND_CLIENT_LIBS@ \
@XFCONF_LIBS@ \
@XFIXES_LIBS@
if ENABLE_WAYLAND
lib_libscreenshooter_la_LIBADD += \
$(top_builddir)/protocols/libprotocols.la
endif
lib_libscreenshooter_built_sources = \
lib/screenshooter-marshal.c lib/screenshooter-marshal.h \
lib/screenshooter-imgur-dialog_ui.h
lib/screenshooter-marshal.c lib/screenshooter-marshal.h
#Autogenerated sources for the library
BUILT_SOURCES = $(lib_libscreenshooter_built_sources)
BUILT_SOURCES += $(lib_libscreenshooter_built_sources)
lib/screenshooter-marshal.h: lib/stamp-screenshooter-marshal.h
@true
......@@ -102,9 +147,6 @@ lib/screenshooter-marshal.c: lib/screenshooter-marshal.list Makefile
&& glib-genmarshal --prefix=_screenshooter_marshal --body $(top_srcdir)/lib/screenshooter-marshal.list >>$@ \
)
lib/screenshooter-imgur-dialog_ui.h: lib/screenshooter-imgur-dialog.ui
$(AM_V_GEN) xdt-csource --static --strip-comments --strip-content --name=screenshooter_imgur_dialog_ui $< >$@
# Main application
src_xfce4_screenshooter_CFLAGS = \
-I$(top_srcdir)/lib/ \
......@@ -117,12 +159,8 @@ src_xfce4_screenshooter_CFLAGS = \
@LIBXFCE4UTIL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \
@GTHREAD_CFLAGS@ \
@SOUP2_CFLAGS@ \
@SOUP3_CFLAGS@ \
@LIBXML_CFLAGS@ \
@LIBX11_CFLAGS@ \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
-DPACKAGE_SCRIPTS_DIR=\"$(scriptdir)\"
-DPACKAGE_LOCALE_DIR=\"$(localedir)\"
src_xfce4_screenshooter_LDFLAGS = \
@EXO_LIBS@ \
......@@ -131,11 +169,7 @@ src_xfce4_screenshooter_LDFLAGS = \
@GDKX11_LIBS@ \
@GLIB_LIBS@ \
@GTHREAD_LIBS@ \
@SOUP2_LIBS@ \
@SOUP3_LIBS@ \
@LIBXML_LIBS@ \
@LIBX11_LIBS@ \
@LIBX11_LDFLAGS@ \
@LIBXFCE4UTIL_LIBS@ \
@LIBXFCE4UI_LIBS@
......@@ -143,6 +177,12 @@ src_xfce4_screenshooter_LDADD = lib/libscreenshooter.la
src_xfce4_screenshooter_SOURCES = src/main.c
if ENABLE_WAYLAND
src_xfce4_screenshooter_CFLAGS += \
-I$(top_srcdir)/protocols/ \
-I$(top_builddir)/protocols
endif
# Manual file for the application
if HAVE_HELP2MAN
xfce4-screenshooter.1: src/xfce4-screenshooter
......@@ -151,17 +191,11 @@ endif
# Desktop file for the application
app_desktopdir = $(datadir)/applications
app_desktop_in_in_files = src/xfce4-screenshooter.desktop.in.in
app_desktop_in_files = $(app_desktop_in_in_files:.desktop.in.in=.desktop.in)
app_desktop_in_files = src/xfce4-screenshooter.desktop.in
app_desktop_DATA = $(app_desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
src/xfce4-screenshooter.desktop.in: src/xfce4-screenshooter.desktop.in.in
$(AM_V_GEN) ( \
$(MKDIR_P) $(dir $@); \
sed -e "s^@PLUGIN_PATH@^$(libexecdir)/applications^" \
$< > $@ \
)
src/xfce4-screenshooter.desktop: src/xfce4-screenshooter.desktop.in
$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
# Panel plugin
plugindir = $(libdir)/xfce4/panel/plugins
......@@ -169,7 +203,6 @@ plugin_LTLIBRARIES = panel-plugin/libscreenshooterplugin.la
panel_plugin_libscreenshooterplugin_la_CFLAGS = \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
-DPACKAGE_SCRIPTS_DIR=\"$(scriptdir)\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/ \
-I$(top_builddir)/lib/ \
......@@ -177,10 +210,7 @@ panel_plugin_libscreenshooterplugin_la_CFLAGS = \
@LIBXFCE4PANEL_CFLAGS@ \
@LIBXFCE4UI_CFLAGS@ \
@GTHREAD_CFLAGS@ \
@LIBXML_CFLAGS@ \
@LIBX11_CFLAGS@ \
@SOUP2_CFLAGS@ \
@SOUP3_CFLAGS@
@LIBX11_CFLAGS@
panel_plugin_libscreenshooterplugin_la_LDFLAGS = \
-avoid-version \
......@@ -193,11 +223,7 @@ panel_plugin_libscreenshooterplugin_la_LIBADD = \
@EXO_LIBS@ \
@LIBXFCE4PANEL_LIBS@ \
@GTHREAD_LIBS@ \
@SOUP2_LIBS@ \
@SOUP3_LIBS@ \
@LIBXML_LIBS@ \
@LIBX11_LIBS@ \
@LIBX11_LDFLAGS@ \
@LIBXFCE4UI_LIBS@ \
lib/libscreenshooter.la
......@@ -208,14 +234,17 @@ panel_plugin_libscreenshooterplugin_la_SOURCES = \
panel_desktopdir = $(datadir)/xfce4/panel/plugins
panel_desktop_in_files = panel-plugin/screenshooter.desktop.in
panel_desktop_DATA = $(panel_desktop_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
panel-plugin/screenshooter.desktop: panel-plugin/screenshooter.desktop.in
$(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
# appdata file for the application
@INTLTOOL_XML_RULE@
appdatadir = $(datadir)/metainfo
appdata_DATA = $(appdata_in_files:.xml.in=.xml)
appdata_in_files = src/xfce4-screenshooter.appdata.xml.in
src/xfce4-screenshooter.appdata.xml: src/xfce4-screenshooter.appdata.xml.in
$(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
# App icons
......@@ -257,7 +286,6 @@ install-data-hook:
echo "***"; \
fi
.PHONY: ChangeLog
ChangeLog: Makefile
......@@ -268,14 +296,18 @@ ChangeLog: Makefile
dist-hook: ChangeLog
# Extra dist and distclean rules
EXTRA_DIST = \
README.md \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
EXTRA_DIST += \
lib/screenshooter-marshal.list \
lib/screenshooter-imgur-dialog.ui \
$(app_desktop_in_in_files) \
meson.build \
meson_options.txt \
icons/meson.build \
lib/meson.build \
panel-plugin/meson.build \
po/meson.build \
protocols/meson.build \
src/meson.build \
xfce-revision.h.in \
$(app_desktop_in_files) \
$(panel_desktop_in_files) \
$(16icons_DATA) \
$(24icons_DATA) \
......@@ -283,23 +315,16 @@ EXTRA_DIST = \
$(48icons_DATA) \
$(128icons_DATA) \
$(scalicons_DATA) \
$(appdata_in_files) \
$(script_DATA)
$(appdata_in_files)
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
DISTCLEANFILES += \
stamp-screenshooter-marshal.h \
$(lib_libscreenshooter_built_sources) \
lib/stamp-screenshooter-marshal.h \
$(app_desktop_DATA) $(app_desktop_in_files) \
$(app_desktop_DATA) \
$(panel_desktop_DATA) \
$(appdata_DATA) \
xfce4-screenshooter.1 \
po/.intltool-merge-cache.lock
xfce4-screenshooter.1
# Man pages
dist_man_MANS = xfce4-screenshooter.1
script_SCRIPTS = $(script_DATA)
1.11.1 (2024-07-30)
======
- Drop unnecessary libxml dependency
- Translation Updates:
Czech, Serbian
1.11.0 (2024-07-25)
======
- Drop built-in support for imgur
- Drop jobs-related code
- Drop libsoup dependency
- Use XDG_DATA_HOME in imgur-upload.sh
- Make sure screenshot is copied to clipboard before closing (!56)
- Add more tests
- build: clang: Silence -Wcast-align
- Translation Updates:
Albanian, Basque, Belarusian, Bulgarian, Catalan, Chinese (China),
Chinese (Taiwan), Croatian, Czech, Danish, Dutch, English (United
Kingdom), Estonian, Finnish, French, Galician, German, Greek, Hebrew,
Hungarian, Indonesian, Italian, Japanese, Korean, Lithuanian, Malay,
Norwegian Bokmål, Occitan (post 1500), Persian (Iran), Polish,
Portuguese, Portuguese (Brazil), Russian, Serbian, Slovak, Slovenian,
Spanish, Swedish, Thai, Turkish, Ukrainian
1.10.6 (2024-05-28)
======
- build: Switch from intltool to gettext
- Preliminary Wayland support
- Translation Updates:
Albanian, Arabic, Armenian (Armenia), Basque, Belarusian, Bulgarian,
Catalan, Chinese (China), Chinese (Taiwan), Croatian, Czech, Danish,
Dutch, Eastern Armenian, English (Australia), English (United
Kingdom), Estonian, Finnish, French, Galician, Georgian, German,
Greek, Hebrew, Hungarian, Icelandic, Indonesian, Interlingue,
Italian, Japanese, Korean, Lithuanian, Malay, Norwegian Bokmål,
Occitan (post 1500), Persian (Iran), Polish, Portuguese, Portuguese
(Brazil), Russian, Serbian, Slovak, Slovenian, Spanish, Swedish,
Thai, Turkish, Ukrainian
1.10.5 (2024-02-04)
======
- Add imgur support as custom action (!51)
......
......@@ -6,8 +6,8 @@ Xfce4-screenshooter allows you to capture the entire screen, the active
window or a selected region. You can set the delay that elapses
before the screenshot is taken and the action that will be done with
the screenshot: save it to a file, copy it to the clipboard, open
it using another application, host it on imgur.com (a free online image
hosting service) or use your creativity with custom action scripts.
it using another application or use your creativity with custom actions
scripts.
----
......
......@@ -5,8 +5,6 @@
#
# Written for Xfce by Benedikt Meurer <benny@xfce.org>.
export XDT_AUTOGEN_REQUIRED_VERSION="4.14.0"
(type xdt-autogen) >/dev/null 2>&1 || {
cat >&2 <<EOF
autogen.sh: You don't seem to have the Xfce development tools installed on
......@@ -17,4 +15,4 @@ EOF
exit 1
}
xdt-autogen $@
XDT_AUTOGEN_REQUIRED_VERSION="4.17.0" xdt-autogen $@
......@@ -3,15 +3,11 @@ dnl
dnl xfce4-screenshooter
dnl
m4_define([xfce4_screenshooter_version_major], [1])
m4_define([xfce4_screenshooter_version_minor], [10])
m4_define([xfce4_screenshooter_version_micro], [5])
m4_define([xfce4_screenshooter_version_nano], []) dnl leave this empty to have no nano version
m4_define([xfce4_screenshooter_version_build], [@REVISION@])
m4_define([xfce4_screenshooter_version_tag], [])
m4_define([xfce4_screenshooter_version], [xfce4_screenshooter_version_major().xfce4_screenshooter_version_minor().xfce4_screenshooter_version_micro()ifelse(xfce4_screenshooter_version_nano(), [], [], [.xfce4_screenshooter_version_nano()])ifelse(xfce4_screenshooter_version_tag(), [git], [xfce4_screenshooter_version_tag()-xfce4_screenshooter_version_build()], [xfce4_screenshooter_version_tag()])])
AC_INIT([xfce4-screenshooter], [xfce4_screenshooter_version], [https://gitlab.xfce.org/apps/xfce4-screenshooter], [xfce4-screenshooter])
XDT_VERSION_INIT([1.11.1], [git])
AC_INIT([xfce4-screenshooter], [xdt_version], [https://gitlab.xfce.org/apps/xfce4-screenshooter], [xfce4-screenshooter])
AC_PREREQ([2.69])
AC_REVISION([xdt_version_build])
AC_CONFIG_MACRO_DIRS([m4])
dnl ***************************
dnl *** Initialize automake ***
......@@ -28,7 +24,6 @@ AC_PROG_CC()
AC_PROG_CC_C_O()
AC_PROG_LD()
AC_PROG_INSTALL()
IT_PROG_INTLTOOL([0.35.0])
AM_PROG_CC_C_O()
dnl **************************
......@@ -45,37 +40,70 @@ AC_HEADER_STDC
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.16.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.16.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.16.0])
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.18.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.18.0])
XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.18.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.42.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.24.0])
XDT_CHECK_PACKAGE([GDK], [gdk-3.0], [3.24.0])
XDT_CHECK_PACKAGE([GDKX11], [gdk-x11-3.0], [3.24.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.66.0])
XDT_CHECK_PACKAGE([LIBXML], [libxml-2.0], [2.4.0])
XDT_CHECK_PACKAGE([EXO], [exo-2], [0.12.0])
XDT_CHECK_PACKAGE([LIBXEXT], [xext], [1.0.0])
XDT_CHECK_PACKAGE([PANGO], [pango], [1.44.0])
XDT_CHECK_PACKAGE([XINPUT2], [xi], [1.7.8])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.16.0])
XDT_CHECK_OPTIONAL_PACKAGE([XFIXES], [xfixes], [4.0.0], [xfixes], [XFIXES extension support])
XDT_CHECK_LIBX11()
dnl *************************
dnl *** Check for libsoup ***
dnl *************************
XDT_CHECK_OPTIONAL_PACKAGE([SOUP3], [libsoup-3.0], [3.0.0])
if test "x$SOUP3_FOUND" = "x"; then
echo "libsoup 3 not found, try libsoup 2 as fallback"
XDT_CHECK_PACKAGE([SOUP2], [libsoup-2.4], [2.26.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.18.0])
dnl ***********************************
dnl *** Check for optional packages ***
dnl ***********************************
XDT_CHECK_OPTIONAL_FEATURE([X11],
[x11],
[
XDT_FEATURE_DEPENDENCY([LIBX11], [x11], [1.6.7])
XDT_FEATURE_DEPENDENCY([GDKX11], [gdk-x11-3.0], [3.24.0])
XDT_FEATURE_DEPENDENCY([XINPUT2], [xi], [1.7.8])
XDT_FEATURE_DEPENDENCY([LIBXEXT], [xext], [1.0.0])
XDT_FEATURE_DEPENDENCY([XFIXES], [xfixes], [4.0.0])
],
[the X11 windowing system])
XDT_CHECK_OPTIONAL_FEATURE([WAYLAND],
[wayland],
[
XDT_FEATURE_DEPENDENCY([GDK_WAYLAND], [gdk-wayland-3.0], [3.24.0])
XDT_FEATURE_DEPENDENCY([WAYLAND_SCANNER], [wayland-scanner], [1.15.0])
XDT_FEATURE_DEPENDENCY([WAYLAND_CLIENT], [wayland-client], [1.15.0])
],
[the Wayland windowing system])
if test x"$ENABLE_X11" != x"yes" -a x"$ENABLE_WAYLAND" != x"yes"; then
AC_MSG_ERROR([Either both X11 and Wayland support was disabled, or required dependencies are missing. One of the two must be enabled.])
fi
if test x"$ENABLE_X11" != x"yes"; then
dnl Do not check for optional X11 packages if X11 is disabled
enable_libxtst=no
fi
XDT_CHECK_OPTIONAL_PACKAGE([LIBXTST], [xtst], [libxtst_min_version], [libxtst], [Libxtst support])
if test x"$ENABLE_WAYLAND" = x"yes"; then
WLR_PROTOCOLS_PKGDATADIR=`$PKG_CONFIG --variable=pkgdatadir wlr-protocols 2>/dev/null || true`
if test x"$WLR_PROTOCOLS_PKGDATADIR" = x""; then
WLR_PROTOCOLS_PKGDATADIR="$ac_abs_confdir/protocols/wlr-protocols"
if test "$(echo "$WLR_PROTOCOLS_PKGDATADIR/"*)" = "$WLR_PROTOCOLS_PKGDATADIR/*"; then
AC_MSG_ERROR([$WLR_PROTOCOLS_PKGDATADIR seems empty, did you clone the wlr-protocols submodule?])
fi
fi
AC_MSG_CHECKING([for wlr-protocols])
AC_MSG_RESULT([$WLR_PROTOCOLS_PKGDATADIR])
AC_SUBST([WLR_PROTOCOLS_PKGDATADIR])
fi
dnl ******************************
dnl *** Check for i18n support ***
dnl ******************************
XDT_I18N([@LINGUAS@])
GETTEXT_PACKAGE="$PACKAGE"
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain])
AC_SUBST([GETTEXT_PACKAGE])
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.8])
dnl **************************
dnl *** Check for help2man ***
......@@ -88,7 +116,7 @@ AM_CONDITIONAL([HAVE_HELP2MAN], false)
fi
dnl Check for debugging support
XDT_FEATURE_DEBUG()
XDT_FEATURE_DEBUG([xdt_debug_default])
AC_OUTPUT([
Makefile
......@@ -105,6 +133,7 @@ echo ""
echo " * XFIXES support: $XFIXES_FOUND"
echo " * Debugging support: $enable_debug"
echo " * Libsoup version: $SOUP2_VERSION$SOUP3_VERSION"
echo " * X11 Support: ${ENABLE_X11:-no}"
echo " * Wayland Support: ${ENABLE_WAYLAND:-no}"
echo ""
sizes = [16, 24, 32, 48, 128]
foreach size : sizes
install_data(
'@0@x@0@'.format(size) / 'org.xfce.screenshooter.png',
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / '@0@x@0@'.format(size) / 'apps',
)
endforeach
install_data(
'scalable' / 'org.xfce.screenshooter.svg',
install_dir: get_option('prefix') / get_option('datadir') / 'icons' / 'hicolor' / 'scalable' / 'apps',
)
#!/bin/sh
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
# AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# -----------------------------------------------------------------------------
# This is a reference custom action to upload screenshots to Imgur™.
# Users are encouraged to make their own copies to cover their needs
# such as authenticated upload or use different hosting services.
# Watch for sensitive content, the uploaded image will be publicly
# available and there is no guarantee it can be certainly deleted.
# Xfce is NOT affiliated with nor this script is approved by Imgur™.
# If you use this script you must agree with Imgur™ Terms of Service
# available at https://imgur.com/tos
# -----------------------------------------------------------------------------
URL='https://api.imgur.com/3/image'
SCREENSHOT_PATH=$1
CLIENT_ID=$2
if [ -z "$SCREENSHOT_PATH" ] || [ -z "$CLIENT_ID" ]; then
zenity --error --text="Arguments are missing"
exit 1
fi
#RESPONSE='{"data":{"id":"q9a8Oh4","title":null,"description":null,"datetime":1690124891,"type":"image\/png","animated":false,"width":217,"height":186,"size":593,"views":0,"bandwidth":0,"vote":null,"favorite":false,"nsfw":null,"section":null,"account_url":null,"account_id":0,"is_ad":false,"in_most_viral":false,"has_sound":false,"tags":[],"ad_type":0,"ad_url":"","edited":"0","in_gallery":false,"deletehash":"b0AjSDJjSU4iyhE","name":"","link":"https:\/\/i.imgur.com\/q9a8Oh4.png"},"success":true,"status":200}'
#RESPONSE='{"data":{"error":{"code":1003,"message":"File type invalid (1)","type":"ImgurException","exception":[]},"request":"\/3\/image","method":"POST"},"success":false,"status":400}'
RESPONSE=$(curl --silent --location "$URL" --header "Authorization: Client-ID $CLIENT_ID" --form "image=@$SCREENSHOT_PATH")
STATUS=$(echo "$RESPONSE" | jq -r .status)
if [ -z "$STATUS" ] || [ $STATUS -ne 200 ]; then
ERROR=$(echo "$RESPONSE" | jq -r .data.error.message)
zenity --error --text="Failed to upload screenshot:\n$ERROR"
exit 1
fi
LINK="https://imgur.com/$(echo "$RESPONSE" | jq -r .data.id).png"
DELETE="https://imgur.com/delete/$(echo "$RESPONSE" | jq -r .data.deletehash)"
LOG_DIRECTORY="$HOME/.local/share/xfce4"
LOG="$LOG_DIRECTORY/xfce4-screenshooter-imgur.log"
# Add link to clipboard
echo "$LINK" | xclip -selection c
# Add links to log
mkdir -p "$LOG_DIRECTORY"
echo "---
$(date '+%x %X')
Link: $LINK
Delete: $DELETE" >> "$LOG"
# Show dialog with links
zenity --info --title="Screenshot uploaded" --text="Link: <a href='$LINK'>$LINK</a>
Delete: <a href='$DELETE'>$DELETE</a>
Link copied to clipboard. Links stored in:
$LOG"
libscreenshooter_sources = [
'libscreenshooter.h',
'screenshooter-actions.c',
'screenshooter-actions.h',
'screenshooter-capture.c',
'screenshooter-capture.h',
'screenshooter-custom-actions.c',
'screenshooter-custom-actions.h',
'screenshooter-format.c',
'screenshooter-format.h',
'screenshooter-dialogs.c',
'screenshooter-dialogs.h',
'screenshooter-global.h',
'screenshooter-utils.c',
'screenshooter-utils.h',
]
libscreenshooter_sources += gnome.genmarshal(
'screenshooter-marshal',
sources: 'screenshooter-marshal.list',
prefix: '_screenshooter_marshal',
internal: true,
install_header: false,
)
if enable_x11
libscreenshooter_sources += [
'screenshooter-capture-x11.c',
'screenshooter-capture-x11.h',
'screenshooter-utils-x11.c',
'screenshooter-utils-x11.h',
]
endif
if enable_wayland
libscreenshooter_sources += wayland_protocols_generated_sources
libscreenshooter_sources += [
'screenshooter-capture-wayland.c',
'screenshooter-capture-wayland.h',
]
endif
libscreenshooter = static_library(
'libscreenshooter',
libscreenshooter_sources,
include_directories: [
include_directories('..'),
],
dependencies: [
glib,
gtk,
exo,
libxfce4ui,
libxfce4util,
xfconf,
x11_deps,
wayland_deps,
xfixes,
],
install: false,
)
......@@ -23,7 +23,6 @@
#include "screenshooter-capture.h"
#include "screenshooter-global.h"
#include "screenshooter-dialogs.h"
#include "screenshooter-imgur.h"
#include "screenshooter-format.h"
......@@ -150,18 +149,6 @@ action_idle (gpointer user_data)
{
screenshooter_open_screenshot (save_location, sd->app, sd->app_info);
}
else if (sd->action & UPLOAD_IMGUR)
{
gboolean upload_successful = screenshooter_upload_to_imgur (save_location, sd->title);
/* If upload failed, regardless of whether it was chosen by GUI or CLI, and
* the action was not selected via CLI, show the actions dialog again.*/
if (!upload_successful && !sd->action_specified)
{
g_free (save_location);
return TRUE;
}
}
else if (sd->action & CUSTOM_ACTION)
{
screenshooter_custom_action_execute (save_location, sd->custom_action_name, sd->custom_action_command);
......
/* $Id$
*
* Copyright © 2024 André Miranda <andreldm@xfce.org>
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program 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 Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "screenshooter-capture-wayland.h"
#include <sys/mman.h>
#include <gdk/gdkwayland.h>
#include <protocols/wlr-screencopy-unstable-v1-client.h>
#include <libxfce4util/libxfce4util.h>
#include "screenshooter-global.h"
#include "screenshooter-utils.h"
/* Internals */
typedef struct {
struct wl_display *display;
struct wl_registry *registry;
struct wl_compositor *compositor;
struct wl_shm *shm;
struct zwlr_screencopy_manager_v1 *screencopy_manager;
}
ClientData;
typedef struct {
ClientData *client_data;
GdkMonitor *monitor;
struct zwlr_screencopy_frame_v1 *frame;
struct wl_buffer *buffer;
struct wl_shm_pool *pool;
unsigned char *shm_data;
int width;
int height;
int stride;
int size;
uint32_t format;
gboolean capture_done;
gboolean capture_failed;
}
OutputData;
static void handle_global (void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version);
static void handle_global_remove (void *data, struct wl_registry *reg, uint32_t name);
static void handle_frame_ready (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec);
static void handle_frame_failed (void *data, struct zwlr_screencopy_frame_v1 *frame);
static void handle_frame_flags (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t flags);
static void handle_frame_buffer (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t fmt, uint32_t w, uint32_t h, uint32_t str);
static void screenshooter_free_client_data (ClientData *client_data);
static void screenshooter_free_output_data (gpointer data);
static gboolean screenshooter_initialize_client_data (ClientData *client_data);
static GdkPixbuf *screenshooter_compose_screenshot (GList *outputs);
void
screenshooter_free_client_data (ClientData *client_data)
{
if (client_data->compositor != NULL)
wl_compositor_destroy (client_data->compositor);
if (client_data->shm != NULL)
wl_shm_destroy (client_data->shm);
if (client_data->screencopy_manager != NULL)
zwlr_screencopy_manager_v1_destroy (client_data->screencopy_manager);
wl_registry_destroy (client_data->registry);
/* do not destroy client_data->display because it is owned by gdk */
}
void
screenshooter_free_output_data (gpointer data)
{
OutputData *output = data;
if (output->shm_data != NULL)
munmap (output->shm_data, output->size);
if (output->buffer != NULL)
wl_buffer_destroy (output->buffer);
if (output->frame != NULL)
zwlr_screencopy_frame_v1_destroy (output->frame);
g_free (output);
}
/* global registry functions */
static void
handle_global (void *data, struct wl_registry *wl_registry, uint32_t name, const char *interface, uint32_t version)
{
ClientData *client_data = data;
if (g_strcmp0 (interface, wl_compositor_interface.name) == 0)
client_data->compositor = wl_registry_bind (wl_registry, name, &wl_compositor_interface, 1);
else if (g_strcmp0 (interface, wl_shm_interface.name) == 0)
client_data->shm = wl_registry_bind (wl_registry, name, &wl_shm_interface, 1);
else if (g_strcmp0 (interface, zwlr_screencopy_manager_v1_interface.name) == 0)
client_data->screencopy_manager = wl_registry_bind (wl_registry, name, &zwlr_screencopy_manager_v1_interface, 1);
}
static void
handle_global_remove (void *data, struct wl_registry *reg, uint32_t name)
{
/* do nothing */
}
const struct wl_registry_listener registry_listener = {
.global = handle_global,
.global_remove = handle_global_remove
};
/* screencopy frame functions */
static void
handle_frame_ready (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t tv_sec_hi, uint32_t tv_sec_lo, uint32_t tv_nsec)
{
OutputData *output = data;
TRACE ("buffer copy ready");
output->capture_done = TRUE;
}
static void
handle_frame_failed (void *data, struct zwlr_screencopy_frame_v1 *frame)
{
OutputData *output = data;
screenshooter_error (_("Failed to capture screencopy frame"));
output->capture_failed = TRUE;
}
static void
handle_frame_flags (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t flags)
{
TRACE ("buffer flags received");
}
static void
handle_frame_buffer (void *data, struct zwlr_screencopy_frame_v1 *frame, uint32_t format, uint32_t width, uint32_t height, uint32_t stride)
{
int fd;
char template[] = "/tmp/screenshooter-buffer-XXXXXX";
OutputData *output = data;
output->format = format;
output->width = width;
output->height = height;
output->stride = stride;
output->size = stride * height;
fd = mkstemp (template);
if (fd == -1)
{
screenshooter_error (_("Failed to create file descriptor"));
g_abort ();
}
ftruncate (fd, output->size);
unlink (template);
output->shm_data = mmap (NULL, output->size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (output->shm_data == MAP_FAILED)
{
screenshooter_error (_("Failed to map memory"));
close (fd);
g_abort ();
}
output->pool = wl_shm_create_pool (output->client_data->shm, fd, output->size);
output->buffer = wl_shm_pool_create_buffer (output->pool, 0, width, height, stride, format);
close (fd);
wl_shm_pool_destroy (output->pool);
zwlr_screencopy_frame_v1_copy (frame, output->buffer);
/* wait for flags and ready events */
}
const struct zwlr_screencopy_frame_v1_listener frame_listener = {
.ready = handle_frame_ready,
.failed = handle_frame_failed,
.flags = handle_frame_flags,
.buffer = handle_frame_buffer
};
/* Wayland client initialization */
gboolean
screenshooter_initialize_client_data (ClientData *client_data)
{
client_data->display = gdk_wayland_display_get_wl_display (gdk_display_get_default ());
client_data->registry = wl_display_get_registry (client_data->display);
wl_registry_add_listener (client_data->registry, &registry_listener, client_data);
wl_display_roundtrip (client_data->display);
if (client_data->compositor == NULL)
{
screenshooter_error (_("Required Wayland interfaces are missing"));
return FALSE;
}
if (client_data->shm == NULL)
{
screenshooter_error (_("Compositor is missing wl_shm"));
return FALSE;
}
if (client_data->screencopy_manager == NULL)
{
screenshooter_error (_("Compositor does not support wlr-screencopy-unstable-v1"));
return FALSE;
}
return TRUE;
}
/* Pixbuf manipulation functions */
static GdkPixbuf
*screenshooter_convert_buffer_to_pixbuf (OutputData *output)
{
guint8 *data = output->shm_data;
uint32_t format = output->format;
gboolean has_alpha = TRUE;
if (format == WL_SHM_FORMAT_ARGB8888 || format == WL_SHM_FORMAT_XRGB8888)
{
for (int y = 0; y < output->height; y++)
{
for (int x = 0; x < output->width; x++)
{
gint offset = y * output->stride + x * 4;
guint32 *px = (guint32 *)(gpointer)(data + offset);
guint8 blue = *px & 0xFF;
guint8 green = (*px >> 8) & 0xFF;
guint8 red = (*px >> 16) & 0xFF;
guint8 alpha = (*px >> 24) & 0xFF;
data[offset + 0] = red;
data[offset + 1] = green;
data[offset + 2] = blue;
data[offset + 3] = alpha;
}
}
}
else if (format == WL_SHM_FORMAT_ABGR8888 || format == WL_SHM_FORMAT_XBGR8888)
{
for (int y = 0; y < output->height; y++)
{
for (int x = 0; x < output->width; x++)
{
gint offset = y * output->stride + x * 4;
guint32 *px = (guint32 *)(gpointer)(data + offset);
guint8 red = *px & 0xFF;
guint8 green = (*px >> 8) & 0xFF;
guint8 blue = (*px >> 16) & 0xFF;
guint8 alpha = (*px >> 24) & 0xFF;
data[offset + 0] = red;
data[offset + 1] = green;
data[offset + 2] = blue;
data[offset + 3] = alpha;
}
}
}
else if (format == WL_SHM_FORMAT_BGR888)
{
has_alpha = FALSE;
for (int y = 0; y < output->height; y++)
{
for (int x = 0; x < output->width; x++)
{
gint offset = y * output->stride + x * 3;
guint8 *px = (guint8 *)(gpointer)(data + offset);
guint8 blue = px[2];
guint8 green = px[1];
guint8 red = px[0];
data[offset + 0] = red;
data[offset + 1] = green;
data[offset + 2] = blue;
}
}
}
else
{
screenshooter_error (_("Unsupported pixel format: 0x%x"), format);
return NULL;
}
return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB, has_alpha, 8, output->width, output->height, output->stride, NULL, NULL);
}
GdkPixbuf
*screenshooter_compose_screenshot (GList *outputs)
{
GdkRectangle geometry;
GdkPixbuf *dest = NULL;
int max_width = 0, max_height = 0;
/* find the maximum dimensions */
for (GList *iter = outputs; iter != NULL; iter = iter->next)
{
OutputData *output = (OutputData *) iter->data;
gdk_monitor_get_geometry (output->monitor, &geometry);
max_width = MAX (max_width, geometry.x + geometry.width);
max_height = MAX (max_height, geometry.y + geometry.height);
}
/* create a new destination pixbuf */
dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, max_width, max_height);
if (dest == NULL)
{
g_warning ("Failed to create destination pixbuf.");
return NULL;
}
/* fill with transparency */
gdk_pixbuf_fill (dest, 0x00000000);
/* composite each screenshot onto the destination pixbuf */
for (GList *iter = outputs; iter != NULL; iter = iter->next)
{
OutputData *output = (OutputData *) iter->data;
GdkPixbuf *pixbuf = screenshooter_convert_buffer_to_pixbuf (output);
gdk_monitor_get_geometry (output->monitor, &geometry);
gdk_pixbuf_composite (pixbuf, dest,
geometry.x, geometry.y,
geometry.width, geometry.height,
geometry.x, geometry.y,
1.0, 1.0,
GDK_INTERP_BILINEAR,
255);
g_object_unref (pixbuf);
}
return dest;
}
/* Public */
GdkPixbuf
*screenshooter_capture_screenshot_wayland (gint region,
gint delay,
gboolean show_mouse,
gboolean show_border)
{
int n_monitors;
gboolean failure = FALSE;
GList *outputs = NULL;
ClientData client_data = {};
GdkPixbuf *screenshot = NULL;
if (region != FULLSCREEN)
{
screenshooter_error (_("The selected mode is not supported in Wayland"));
return NULL;
}
/* only fullscreen is supported for now */
TRACE ("Get the screenshot of the entire screen");
/* initializate the wayland client */
if (!screenshooter_initialize_client_data (&client_data))
{
screenshooter_free_client_data (&client_data);
return NULL;
}
/* collect outputs (monitors) */
n_monitors = gdk_display_get_n_monitors (gdk_display_get_default ());
for (int i = 0; i < n_monitors; i++)
{
GdkMonitor *monitor = gdk_display_get_monitor (gdk_display_get_default (), i);
struct wl_output *wl_output = gdk_wayland_monitor_get_wl_output (monitor);
if (wl_output == NULL)
{
g_warning ("No output available for monitor %d", i);
continue;
}
OutputData *output = g_new0 (OutputData, 1);
outputs = g_list_append (outputs, output);
output->monitor = monitor;
output->client_data = &client_data;
output->frame = zwlr_screencopy_manager_v1_capture_output (client_data.screencopy_manager, show_mouse, wl_output);
zwlr_screencopy_frame_v1_add_listener (output->frame, &frame_listener, output);
}
/* wait for the capture of all outputs */
while (TRUE)
{
gboolean done = TRUE;
for (GList *elem = outputs; elem; elem = elem->next)
{
OutputData *output = elem->data;
if (!output->capture_done && !output->capture_failed)
done = FALSE;
if (output->capture_failed)
failure = TRUE;
}
if (done)
break;
wl_display_dispatch (client_data.display);
}
/* check the result */
if (failure)
screenshooter_error (_("Failed to capture"));
else
screenshot = screenshooter_compose_screenshot (outputs);
screenshooter_free_client_data (&client_data);
g_list_free_full (outputs, screenshooter_free_output_data);
return screenshot;
}
/* $Id$
*
* Copyright © 2009 Sebastian Waisbrot <seppo0010@gmail.com>
* Copyright © 2024 André Miranda <andreldm@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -15,23 +15,23 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* */
*/
#ifndef __HAVE_IMGUR_H__
#define __HAVE_IMGUR_H__
#ifndef __HAVE_CAPTURE_WAYLAND_H__
#define __HAVE_CAPTURE_WAYLAND_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <glib.h>
#include <glib/gstdio.h>
#include <gdk/gdk.h>
#include "screenshooter-utils.h"
#include "screenshooter-simple-job.h"
gboolean screenshooter_upload_to_imgur (const gchar *image_path,
const gchar *title);
const gchar* screenshooter_imgur_client_id (void);
GdkPixbuf
*screenshooter_capture_screenshot_wayland (gint region,
gint delay,
gboolean show_mouse,
gboolean show_border);
#endif
This diff is collapsed.
/* $Id$
*
* Copyright 2008-2009 Jérôme Guelfucci <jeromeg@xfce.org>
* Copyright © 2008-2009 Jérôme Guelfucci <jeromeg@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -17,48 +17,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __HAVE_JOB_CB_H__
#define __HAVE_JOB_CB_H__
#ifndef __HAVE_CAPTURE_X11_H__
#define __HAVE_CAPTURE_X11_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "screenshooter-utils.h"
#include "screenshooter-simple-job.h"
typedef enum
{
USER,
PASSWORD,
TITLE,
COMMENT,
} AskInformation;
#include <gdk/gdk.h>
#define DIALOG_RESPONSE_ERROR 1
GtkWidget *
create_spinner_dialog (const gchar *title,
GtkWidget **label);
void
cb_error (ExoJob *job,
GError *error,
GtkWidget *dialog);
void
cb_finished (ExoJob *job,
GtkWidget *dialog);
void
cb_update_info (ExoJob *job,
gchar *message,
GtkWidget *label);
void
cb_image_uploaded (ScreenshooterJob *job,
gchar *upload_name,
gchar *delete_hash,
gchar **last_user);
void
cb_ask_for_information (ScreenshooterJob *job,
GtkListStore *liststore,
const gchar *message,
gpointer unused);
GdkPixbuf
*screenshooter_capture_screenshot_x11 (gint region,
gint delay,
gboolean show_mouse,
gboolean show_border);
#endif
This diff is collapsed.
/* $Id$
*
* Copyright © 2008-2009 Jérôme Guelfucci <jeromeg@xfce.org>
* Copyright © 2024 André Miranda <andreldm@xfce.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -24,19 +24,7 @@
#include <config.h>
#endif
#include "screenshooter-global.h"
#ifdef HAVE_XFIXES
#include <X11/extensions/Xfixes.h>
#endif
#include <X11/extensions/shape.h>
#include <X11/extensions/XInput2.h>
#include <gdk/gdkkeysyms.h>
#include <gdk/gdkx.h>
#include <glib.h>
#include <unistd.h>
#include <libxfce4util/libxfce4util.h>
#include <gdk/gdk.h>
......
......@@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* */
#include "screenshooter-imgur.h"
#include "screenshooter-custom-actions.h"
#include <xfconf/xfconf.h>
......@@ -136,10 +135,10 @@ screenshooter_custom_action_load (GtkListStore *list_store)
{
gint32 max_id;
gint32 id;
gboolean imgur_custom_action_added;
XfconfChannel *channel;
GtkTreeIter iter;
GError *error = NULL;
gboolean imgur_found = FALSE;
if (!xfconf_init (&error))
{
......@@ -164,8 +163,16 @@ screenshooter_custom_action_load (GtkListStore *list_store)
name = xfconf_channel_get_string (channel, name_address, "");
command = xfconf_channel_get_string (channel, command_address, "");
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (GTK_LIST_STORE (list_store), &iter, CUSTOM_ACTION_NAME, name, CUSTOM_ACTION_COMMAND, command, -1);
/* Do not load action if that's the removed imgur upload script */
if (g_strrstr (command, "imgur-upload.sh") != NULL)
{
imgur_found = TRUE;
}
else
{
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (GTK_LIST_STORE (list_store), &iter, CUSTOM_ACTION_NAME, name, CUSTOM_ACTION_COMMAND, command, -1);
}
g_free (name);
g_free (command);
......@@ -173,18 +180,10 @@ screenshooter_custom_action_load (GtkListStore *list_store)
g_free (command_address);
}
imgur_custom_action_added = xfconf_channel_get_bool (channel, "/imgur-custom-action-added", FALSE);
if (G_UNLIKELY (!imgur_custom_action_added))
{
xfconf_channel_set_bool (channel, "/imgur-custom-action-added", TRUE);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (GTK_LIST_STORE (list_store), &iter,
CUSTOM_ACTION_NAME, _("Host on Imgur™"),
CUSTOM_ACTION_COMMAND, PACKAGE_SCRIPTS_DIR "/imgur-upload.sh %f %imgur_client_id", -1);
screenshooter_custom_action_save (GTK_TREE_MODEL (list_store));
}
/* TODO remove after a few releases */
xfconf_channel_reset_property (channel, "/imgur-custom-action-added", FALSE);
if (imgur_found)
screenshooter_custom_action_save (GTK_TREE_MODEL (list_store));
xfconf_shutdown ();
}
......@@ -220,15 +219,6 @@ screenshooter_custom_action_execute (gchar *save_location,
g_free (save_location_quoted);
g_strfreev (split);
/**
* Replace %imgur_client_id placeholder
* UNDOCUMENTED: CAN BE REMOVED IN ANY RELEASE!!!
**/
split = g_strsplit (formatted_command, "\%imgur_client_id", -1);
g_free (formatted_command);
formatted_command = g_strjoinv (screenshooter_imgur_client_id (), split);
g_strfreev (split);
expanded_command = xfce_expand_variables (formatted_command, NULL);
envp = screenshooter_parse_envp (&expanded_command);
......
......@@ -24,6 +24,10 @@
#include <exo/exo.h>
#ifdef ENABLE_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#define ICON_SIZE 16
#define THUMB_X_SIZE 200
#define THUMB_Y_SIZE 125
......@@ -61,9 +65,6 @@ static void
cb_clipboard_toggled (GtkToggleButton *tb,
ScreenshotData *sd);
static void
cb_imgur_toggled (GtkToggleButton *tb,
ScreenshotData *sd);
static void
cb_delay_spinner_changed (GtkWidget *spinner,
ScreenshotData *sd);
static void
......@@ -77,8 +78,9 @@ populate_liststore (GtkListStore *liststore);
static void
set_default_item (GtkWidget *combobox,
ScreenshotData *sd);
static GdkPixbuf
*screenshot_get_thumbnail (GdkPixbuf *screenshot);
static cairo_surface_t
*screenshot_get_thumbnail (GdkPixbuf *screenshot,
gint scale_factor);
static void
cb_progress_upload (goffset current_num_bytes,
goffset total_num_bytes,
......@@ -235,28 +237,6 @@ static void cb_clipboard_toggled (GtkToggleButton *tb, ScreenshotData *sd)
static void cb_imgur_toggled (GtkToggleButton *tb, ScreenshotData *sd)
{
if (gtk_toggle_button_get_active (tb))
sd->action = UPLOAD_IMGUR;
}
static void cb_imgur_warning_change_cursor (GtkWidget *widget, GdkCursor *cursor)
{
gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
}
static void cb_imgur_warning_clicked (GtkWidget *popover)
{
gtk_widget_set_visible (popover, TRUE);
}
/* Set the delay according to the spinner */
static void cb_delay_spinner_changed (GtkWidget *spinner, ScreenshotData *sd)
{
......@@ -393,7 +373,7 @@ static void set_default_item (GtkWidget *combobox, ScreenshotData *sd)
gtk_tree_model_get (model, &iter, 2, &command, -1);
gtk_tree_model_get (model, &iter, 3, &app_info, -1);
if (g_str_equal (command, sd->app))
if (g_strcmp0 (command, sd->app) == 0)
{
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combobox),
&iter);
......@@ -494,9 +474,11 @@ static void custom_action_load_last_used (GtkWidget *combobox, ScreenshotData *s
static GdkPixbuf
*screenshot_get_thumbnail (GdkPixbuf *screenshot)
static cairo_surface_t
*screenshot_get_thumbnail (GdkPixbuf *screenshot, gint scale_factor)
{
cairo_surface_t *surface;
GdkPixbuf *scaled_screenshot;
gint w = gdk_pixbuf_get_width (screenshot);
gint h = gdk_pixbuf_get_height (screenshot);
gint width = THUMB_X_SIZE;
......@@ -507,7 +489,11 @@ static GdkPixbuf
else
width = height * w / h;
return gdk_pixbuf_scale_simple (screenshot, width, height, GDK_INTERP_BILINEAR);
scaled_screenshot = gdk_pixbuf_scale_simple (screenshot, width * scale_factor, height * scale_factor, GDK_INTERP_BILINEAR);
surface = gdk_cairo_surface_create_from_pixbuf (scaled_screenshot, scale_factor, NULL);
g_free (scaled_screenshot);
return surface;
}
......@@ -696,8 +682,8 @@ save_screenshot_to_remote_location (GdkPixbuf *screenshot, GFile *save_file)
static void
preview_drag_begin (GtkWidget *widget, GdkDragContext *context, gpointer data)
{
GdkPixbuf *pixbuf = data;
gtk_drag_source_set_icon_pixbuf (widget, pixbuf);
cairo_surface_t *surface = data;
gtk_drag_set_icon_surface (context, surface);
}
static void
......@@ -970,22 +956,29 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (fullscreen_button),
_("Active window"));
gtk_box_pack_start (GTK_BOX (box), active_window_button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_window_button),
(sd->region == ACTIVE_WINDOW));
gtk_widget_set_tooltip_text (active_window_button,
_("Take a screenshot of the active window"));
g_signal_connect (G_OBJECT (active_window_button), "toggled",
G_CALLBACK (cb_active_window_toggled), sd);
g_signal_connect (G_OBJECT (active_window_button), "activate",
G_CALLBACK (cb_radiobutton_activate), dlg);
#ifdef ENABLE_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
gtk_widget_set_sensitive (active_window_button, FALSE);
gtk_widget_set_tooltip_text (active_window_button, _("Not supported in Wayland"));
}
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_window_button), (sd->region == ACTIVE_WINDOW));
#else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (active_window_button), (sd->region == ACTIVE_WINDOW));
#endif
/* Rectangle */
rectangle_button =
gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (fullscreen_button),
_("Select a region"));
gtk_box_pack_start (GTK_BOX (box), rectangle_button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rectangle_button),
(sd->region == SELECT));
gtk_widget_set_tooltip_text (rectangle_button,
_("Select a region to be captured by clicking a point of "
"the screen without releasing the mouse button, "
......@@ -996,6 +989,17 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
G_CALLBACK (cb_rectangle_toggled), sd);
g_signal_connect (G_OBJECT (rectangle_button), "activate",
G_CALLBACK (cb_radiobutton_activate), dlg);
#ifdef ENABLE_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
gtk_widget_set_sensitive (rectangle_button, FALSE);
gtk_widget_set_tooltip_text (rectangle_button, _("Not supported in Wayland"));
}
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rectangle_button), (sd->region == SELECT));
#else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rectangle_button), (sd->region == SELECT));
#endif
/* Create options label */
label = gtk_label_new ("");
......@@ -1045,6 +1049,13 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
G_CALLBACK (cb_toggle_set_insensi), checkbox);
g_signal_connect (G_OBJECT (rectangle_button), "toggled",
G_CALLBACK (cb_toggle_set_insensi), checkbox);
#ifdef ENABLE_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ()))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), FALSE);
gtk_widget_set_sensitive (checkbox, FALSE);
}
#endif
/* Create the main box for the delay stuff */
main_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
......@@ -1110,7 +1121,7 @@ GtkWidget *screenshooter_region_dialog_new (ScreenshotData *sd, gboolean plugin)
GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
{
GtkWidget *dlg, *grid, *box, *evbox, *label, *radio, *checkbox, *popover;
GtkWidget *dlg, *grid, *box, *evbox, *label, *radio, *checkbox;
GtkWidget *actions_grid;
GtkTreeIter iter;
......@@ -1119,8 +1130,7 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
GtkCellRenderer *renderer, *renderer_pixbuf;
GtkWidget *preview;
GdkPixbuf *thumbnail;
GdkCursor *cursor;
cairo_surface_t *thumbnail;
dlg = xfce_titled_dialog_new_with_mixed_buttons (_("Screenshot"),
NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
......@@ -1297,59 +1307,6 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
/* Run the callback functions to grey/ungrey the correct widgets */
cb_toggle_set_sensi (GTK_TOGGLE_BUTTON (radio), combobox);
/* Upload to imgur radio button */
if (sd->enable_imgur_upload)
{
GtkWidget *image;
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_grid_attach (GTK_GRID (actions_grid), box, 0, 5, 2, 1);
radio =
gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio),
_("Host on Imgur™"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radio),
(sd->action & UPLOAD_IMGUR));
gtk_widget_set_tooltip_text (radio,
_("Host the screenshot on Imgur™, a free online "
"image hosting service"));
g_signal_connect (G_OBJECT (radio), "toggled",
G_CALLBACK (cb_imgur_toggled), sd);
g_signal_connect (G_OBJECT (radio), "activate",
G_CALLBACK (cb_radiobutton_activate), dlg);
gtk_container_add (GTK_CONTAINER (box), radio);
/* Upload to imgur warning info */
image = gtk_image_new_from_icon_name ("dialog-warning-symbolic", GTK_ICON_SIZE_BUTTON);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
_("Watch for sensitive content, the uploaded image will be publicly\n"
"available and there is no guarantee it can be certainly deleted.\n"
"Xfce is NOT affiliated with nor this integration is approved by Imgur™.\n"
"If you use this feature you must agree with Imgur™ "
"<a href=\"https://imgur.com/tos\">Terms of Service</a>."));
popover = gtk_popover_new (image);
gtk_container_add (GTK_CONTAINER (popover), label);
gtk_container_set_border_width (GTK_CONTAINER (popover), 6);
gtk_widget_show (label);
evbox = gtk_event_box_new ();
g_signal_connect_swapped (G_OBJECT (evbox), "button-press-event",
G_CALLBACK (cb_imgur_warning_clicked), popover);
gtk_container_add (GTK_CONTAINER (box), evbox);
gtk_container_add (GTK_CONTAINER (evbox), image);
cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_HAND2);
g_signal_connect (evbox, "realize",
G_CALLBACK (cb_imgur_warning_change_cursor), cursor);
g_object_unref (cursor);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), _("<a href='https://gitlab.xfce.org/apps/xfce4-screenshooter/-/issues/115'>Deprecated!</a>"));
gtk_container_add (GTK_CONTAINER (box), label);
}
/* Preview box */
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (box), 0);
......@@ -1365,10 +1322,10 @@ GtkWidget *screenshooter_actions_dialog_new (ScreenshotData *sd)
gtk_box_pack_start (GTK_BOX (box), label, FALSE, FALSE, 0);
/* The preview image */
thumbnail = screenshot_get_thumbnail (sd->screenshot);
thumbnail = screenshot_get_thumbnail (sd->screenshot, gtk_widget_get_scale_factor (dlg));
evbox = gtk_event_box_new ();
preview = gtk_image_new_from_pixbuf (thumbnail);
g_object_unref (thumbnail);
preview = gtk_image_new_from_surface (thumbnail);
cairo_surface_destroy (thumbnail);
gtk_container_add (GTK_CONTAINER (evbox), preview);
gtk_box_pack_start (GTK_BOX (box), evbox, FALSE, FALSE, 0);
......@@ -1552,7 +1509,8 @@ static GtkWidget
gtk_container_set_border_width (GTK_CONTAINER (grid), 0);
image = gtk_image_new_from_icon_name ("dialog-information", GTK_ICON_SIZE_DND);
label = gtk_label_new (_("You can configure custom actions that will be available to handle screenshots after they are captured."));
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), _("You can configure custom actions that will be available to handle screenshots after they are captured. You can find more examples in the <a href=\"https://docs.xfce.org/apps/xfce4-screenshooter/custom-actions#examples\">documentation</a>."));
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_label_set_max_width_chars (GTK_LABEL (label), 30);
gtk_widget_set_hexpand (label, TRUE);
......
......@@ -28,10 +28,6 @@
#include "screenshooter-global.h"
#include "screenshooter-actions.h"
#ifdef HAVE_GIO
#include <gio/gio.h>
#endif
#include <gtk/gtk.h>
#include <libxfce4util/libxfce4util.h>
#include <libxfce4ui/libxfce4ui.h>
......