aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--COPYING2
-rw-r--r--DEPENDENCIES1
-rw-r--r--Makefile15
-rw-r--r--TODO1
-rwxr-xr-xconfigure21
-rw-r--r--dist/archlinux/stable/PKGBUILD4
-rwxr-xr-xinfo/behead2
-rw-r--r--info/libgamma.texinfo6
-rwxr-xr-xinfo/texise2
-rwxr-xr-xsrc/extract/cut2
-rwxr-xr-xsrc/extract/libgamma-error-extract2
-rwxr-xr-xsrc/extract/libgamma-method-extract2
-rw-r--r--src/lib/edid.c2
-rw-r--r--src/lib/edid.h2
-rw-r--r--src/lib/fake-quartz-cg.c2
-rw-r--r--src/lib/fake-quartz-cg.h2
-rw-r--r--src/lib/fake-w32-gdi.c2
-rw-r--r--src/lib/fake-w32-gdi.h2
-rw-r--r--src/lib/gamma-dummy.c.gpp2
-rw-r--r--src/lib/gamma-dummy.h2
-rw-r--r--src/lib/gamma-helper.c2
-rw-r--r--src/lib/gamma-helper.h2
-rw-r--r--src/lib/gamma-linux-drm.c2
-rw-r--r--src/lib/gamma-linux-drm.h2
-rw-r--r--src/lib/gamma-quartz-cg.c2
-rw-r--r--src/lib/gamma-quartz-cg.h2
-rw-r--r--src/lib/gamma-w32-gdi.c2
-rw-r--r--src/lib/gamma-w32-gdi.h2
-rw-r--r--src/lib/gamma-wayland.c850
-rw-r--r--src/lib/gamma-wayland.h163
-rw-r--r--src/lib/gamma-x-randr.c2
-rw-r--r--src/lib/gamma-x-randr.h2
-rw-r--r--src/lib/gamma-x-vidmode.c2
-rw-r--r--src/lib/gamma-x-vidmode.h2
-rw-r--r--src/lib/libgamma-error.c.gpp2
-rw-r--r--src/lib/libgamma-error.h10
-rw-r--r--src/lib/libgamma-facade.c.gpp46
-rw-r--r--src/lib/libgamma-facade.h2
-rw-r--r--src/lib/libgamma-method.c2
-rw-r--r--src/lib/libgamma-method.h11
-rw-r--r--src/lib/libgamma.h2
-rw-r--r--src/lib/wayland-gamma-control-protocol.xml105
-rw-r--r--src/test/crtcinfo.c2
-rw-r--r--src/test/crtcinfo.h2
-rw-r--r--src/test/errors.c2
-rw-r--r--src/test/errors.h2
-rw-r--r--src/test/methods.c3
-rw-r--r--src/test/methods.h2
-rw-r--r--src/test/ramps.c2
-rw-r--r--src/test/ramps.h2
-rw-r--r--src/test/test.c2
-rw-r--r--src/test/test.h2
-rw-r--r--src/test/update-warnings.h6
-rw-r--r--src/test/user.c2
-rw-r--r--src/test/user.h2
56 files changed, 1265 insertions, 62 deletions
diff --git a/.gitignore b/.gitignore
index 270192c..eb0fdcf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,7 +14,10 @@ obj/
*.o
/config.mk
/src/lib/libgamma-config.h
+/src/lib/wayland-*-protocol.c
+/src/lib/wayland-*-protocol.h
*.info
+*.info-*
*.pdf
*.dvi
*.ps
diff --git a/COPYING b/COPYING
index 95957f4..6d1557e 100644
--- a/COPYING
+++ b/COPYING
@@ -1,5 +1,5 @@
libgamma -- Display server abstraction layer for gamma ramp adjustments
-Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/DEPENDENCIES b/DEPENDENCIES
index 132ff2d..9833139 100644
--- a/DEPENDENCIES
+++ b/DEPENDENCIES
@@ -5,6 +5,7 @@ RUNTIME DEPENDENCIES:
libx11 Optional: for the X VidMode adjustment method
libxxf86vm Optional: for the X VidMode adjustment method
libdrm Optional: for the Linux DRM adjustment method
+ wayland Optional: for the Wayland/Orbital adjustment method
Optional dependencies are mandatory when they have been selected at
compile-time and are not utilisable if not selected at compile-time.
diff --git a/Makefile b/Makefile
index f558047..f5e8f13 100644
--- a/Makefile
+++ b/Makefile
@@ -158,6 +158,17 @@ bin/libgamma.$(SO):
mkdir -p $(shell dirname $@)
ln -sf libgamma.$(SO).$(LIB_VERSION) $@
+obj/lib/wayland-%-protocol.c: src/lib/wayland-%-protocol.xml # XML, yuck!
+ mkdir -p $(shell dirname $@)
+ $(WAYLAND_SCANNER) code < $< > $@
+
+src/lib/wayland-%-client-protocol.h: src/lib/wayland-%-protocol.xml # XML, yuck!
+ $(WAYLAND_SCANNER) client-header < $< > $@
+
+obj/lib/gamma-wayland.o: src/lib/gamma-wayland.c src/lib/*.h src/lib/wayland-gamma-control-client-protocol.h
+ mkdir -p $(shell dirname $@)
+ $(CC) $(LIB_FLAGS) $(LIBS_C) $(PIC) -s -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
+
obj/lib/%.o: src/lib/%.c src/lib/*.h
mkdir -p $(shell dirname $@)
$(CC) $(LIB_FLAGS) $(LIBS_C) $(PIC) -s -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
@@ -305,9 +316,9 @@ uninstall:
.PHONY: clean
clean:
- -rm -rf obj bin libgamma.{info,pdf,ps,dvi}
+ -rm -rf obj bin libgamma.info libgamma.info-* libgamma.pdf libgamma.ps libgamma.dvi
.PHONY: distclean
distclean: clean
- -rm -f .config.mk src/lib/libgamma-config.h
+ -rm -f .config.mk src/lib/libgamma-config.h src/lib/wayland-*-protocol.c src/lib/wayland-*-protocol.h
diff --git a/TODO b/TODO
index fbee3cf..46ae275 100644
--- a/TODO
+++ b/TODO
@@ -7,7 +7,6 @@ Unsupported display servers:
GNU Hurd TTY Does it have gamma ramp support?
The BSD TTY:s Do they have gamma ramp support?
Haiku Haiku does not have gamma ramp support
- Wayland I do not think Wayland have gamma ramp support
Mir I do not think Mir have gamma ramp support
diff --git a/configure b/configure
index b662f13..cfd22a1 100755
--- a/configure
+++ b/configure
@@ -10,6 +10,7 @@ have_debug='No, enable with --debug'
have_dummy='No, enable with --enable-dummy'
have_randr='No, enable with --enable-randr'
have_vidmode='No, enable with --enable-vidmode'
+have_wayland='No, enable with --enable-wayland'
have_drm='No, enable with --enable-drm'
have_w32gdi='No, enable with --enable-w32gdi[=fake]'
have_quartz='No, enable with --enable-quartz[=fake]'
@@ -18,6 +19,7 @@ enable_debug=0
enable_dummy=0
enable_randr=0
enable_vidmode=0
+enable_wayland=0
enable_drm=0
enable_w32gdi=0
enable_quartz=0
@@ -31,15 +33,17 @@ for arg in "$@"; do
case "${arg}" in
(--linux=developer|--developer) enable_debug=1
enable_dummy=1
- enable_vidmode=1
enable_randr=1
+ enable_vidmode=1
+ enable_wayland=1
enable_drm=1
fake_w32gdi=1
fake_quartz=1
os=gnu
;;
- (--linux) enable_vidmode=1
- enable_randr=1
+ (--linux) enable_randr=1
+ enable_vidmode=1
+ enable_wayland=1
enable_drm=1
os=gnu
;;
@@ -73,6 +77,7 @@ for arg in "$@"; do
(--enable-dummy) enable_dummy=1 ;;
(--enable-randr) enable_randr=1 ;;
(--enable-vidmode) enable_vidmode=1 ;;
+ (--enable-wayland) enable_wayland=1 ;;
(--enable-drm) enable_drm=1 ;;
(--enable-w32gdi) enable_w32gdi=1 ;;
(--enable-quartz) enable_quartz=1 ;;
@@ -131,6 +136,15 @@ if [ ${enable_vidmode} = 1 ]; then
echo '#define HAVE_LIBGAMMA_METHOD_X_VIDMODE' >&4
have_vidmode='Yes'
fi
+if [ ${enable_wayland} = 1 ]; then
+ echo 'LIBOBJ += gamma-wayland wayland-gamma-control-protocol' >&3
+ echo 'DEFINITIONS += -DHAVE_LIBGAMMA_METHOD_WAYLAND' >&3
+ echo 'LIBS_LD += $$(pkg-config --libs wayland-client)' >&3
+ echo 'LIBS_C += $$(pkg-config --cflags wayland-client)' >&3
+ echo 'WAYLAND_SCANNER = $(shell pkg-config --variable=wayland_scanner wayland-scanner)' >&3
+ echo '#define HAVE_LIBGAMMA_METHOD_WAYLAND' >&4
+ have_wayland='Yes'
+fi
if [ ${enable_drm} = 1 ]; then
echo 'LIBOBJ += gamma-linux-drm' >&3
echo 'DEFINITIONS += -DHAVE_LIBGAMMA_METHOD_LINUX_DRM' >&3
@@ -203,6 +217,7 @@ echo " Debug mode: ${have_debug}"
echo " Dummy method: ${have_dummy}"
echo " X.org via RandR: ${have_randr}"
echo " X.org via VidMode: ${have_vidmode}"
+echo " Wayland/Orbital: ${have_wayland}"
echo " Linux DRM: ${have_drm}"
echo " Windows GDI: ${have_w32gdi}"
echo " Quartz via CoreGraphics: ${have_quartz}"
diff --git a/dist/archlinux/stable/PKGBUILD b/dist/archlinux/stable/PKGBUILD
index 49f331f..320025c 100644
--- a/dist/archlinux/stable/PKGBUILD
+++ b/dist/archlinux/stable/PKGBUILD
@@ -7,8 +7,8 @@ pkgdesc="Display server abstraction layer for gamma ramps"
arch=(i686 x86_64)
url="https://github.com/maandree/libgamma"
license=('GPL3' 'custom:GFDL1.3')
-depends=(glibc libxcb libx11 libxxf86vm libdrm)
-makedepends=(glibc libxcb libx11 libxxf86vm libdrm sh make grep sed coreutils gcc general-preprocessor python3 texinfo bash pkg-config)
+depends=(libxcb libx11 libxxf86vm libdrm wayland)
+makedepends=(libxcb libx11 libxxf86vm libdrm wayland general-preprocessor python3)
install=libgamma.install
source=($url/archive/$pkgver.tar.gz)
sha256sums=(a29ddbd96eff868d5c61e793642813a6a4f6cfe358654227502bb91e95cb75db)
diff --git a/info/behead b/info/behead
index 647a236..581bd51 100755
--- a/info/behead
+++ b/info/behead
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# libgamma -- Display server abstraction layer for gamma ramp adjustments
-# Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+# Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/info/libgamma.texinfo b/info/libgamma.texinfo
index 68f0389..b10159a 100644
--- a/info/libgamma.texinfo
+++ b/info/libgamma.texinfo
@@ -17,7 +17,7 @@
@copying
-Copyright @copyright{} 2014 Mattias Andr@'ee
+Copyright @copyright{} 2014, 2015 Mattias Andr@'ee
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -209,6 +209,10 @@ Enables the X VidMode extension adjustment method.
@itemx --linux
Enables the Direct Rendering Manager adjustment method.
+@item --enable-wayland
+@itemx --linux
+Enables the Wayland/Orbital adjustment method.
+
@item --enable-w32gdi
@itemx --windows
Enables the Windows GDI adjustment method.
diff --git a/info/texise b/info/texise
index 64c8b86..d965f64 100755
--- a/info/texise
+++ b/info/texise
@@ -2,7 +2,7 @@
# -*- mode: python, encoding: utf-8 -*-
# libgamma -- Display server abstraction layer for gamma ramp adjustments
-# Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+# Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/extract/cut b/src/extract/cut
index 7399b7f..a47e1d2 100755
--- a/src/extract/cut
+++ b/src/extract/cut
@@ -2,7 +2,7 @@
# -*- mode: python, encoding: utf-8 -*-
# libgamma -- Display server abstraction layer for gamma ramp adjustments
-# Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+# Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/extract/libgamma-error-extract b/src/extract/libgamma-error-extract
index e237fb8..86c8bb6 100755
--- a/src/extract/libgamma-error-extract
+++ b/src/extract/libgamma-error-extract
@@ -2,7 +2,7 @@
# -*- mode: python, encoding: utf-8 -*-
# libgamma -- Display server abstraction layer for gamma ramp adjustments
-# Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+# Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/extract/libgamma-method-extract b/src/extract/libgamma-method-extract
index 77c3a03..1448b96 100755
--- a/src/extract/libgamma-method-extract
+++ b/src/extract/libgamma-method-extract
@@ -2,7 +2,7 @@
# -*- mode: python, encoding: utf-8 -*-
# libgamma -- Display server abstraction layer for gamma ramp adjustments
-# Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+# Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
diff --git a/src/lib/edid.c b/src/lib/edid.c
index d8f52b6..2a9f3f9 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/edid.h b/src/lib/edid.h
index c58125f..f065a98 100644
--- a/src/lib/edid.h
+++ b/src/lib/edid.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/fake-quartz-cg.c b/src/lib/fake-quartz-cg.c
index 39fe161..e7cbbc9 100644
--- a/src/lib/fake-quartz-cg.c
+++ b/src/lib/fake-quartz-cg.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/fake-quartz-cg.h b/src/lib/fake-quartz-cg.h
index b3d8c83..a77ccc6 100644
--- a/src/lib/fake-quartz-cg.h
+++ b/src/lib/fake-quartz-cg.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/fake-w32-gdi.c b/src/lib/fake-w32-gdi.c
index 8fb1ab7..1489073 100644
--- a/src/lib/fake-w32-gdi.c
+++ b/src/lib/fake-w32-gdi.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/fake-w32-gdi.h b/src/lib/fake-w32-gdi.h
index c777fa6..9462afe 100644
--- a/src/lib/fake-w32-gdi.h
+++ b/src/lib/fake-w32-gdi.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-dummy.c.gpp b/src/lib/gamma-dummy.c.gpp
index 2c89b45..24e9d41 100644
--- a/src/lib/gamma-dummy.c.gpp
+++ b/src/lib/gamma-dummy.c.gpp
@@ -1,7 +1,7 @@
/* -*- c -*- */
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-dummy.h b/src/lib/gamma-dummy.h
index 65a9ca6..3bce1cb 100644
--- a/src/lib/gamma-dummy.h
+++ b/src/lib/gamma-dummy.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-helper.c b/src/lib/gamma-helper.c
index 31ba3fc..3aafbb3 100644
--- a/src/lib/gamma-helper.c
+++ b/src/lib/gamma-helper.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-helper.h b/src/lib/gamma-helper.h
index a15bf6b..9ccc183 100644
--- a/src/lib/gamma-helper.h
+++ b/src/lib/gamma-helper.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-linux-drm.c b/src/lib/gamma-linux-drm.c
index 0e3c152..b785c9f 100644
--- a/src/lib/gamma-linux-drm.c
+++ b/src/lib/gamma-linux-drm.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-linux-drm.h b/src/lib/gamma-linux-drm.h
index defd17a..0c2ec9f 100644
--- a/src/lib/gamma-linux-drm.h
+++ b/src/lib/gamma-linux-drm.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-quartz-cg.c b/src/lib/gamma-quartz-cg.c
index d509ce8..585d868 100644
--- a/src/lib/gamma-quartz-cg.c
+++ b/src/lib/gamma-quartz-cg.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-quartz-cg.h b/src/lib/gamma-quartz-cg.h
index 6270324..c344967 100644
--- a/src/lib/gamma-quartz-cg.h
+++ b/src/lib/gamma-quartz-cg.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-w32-gdi.c b/src/lib/gamma-w32-gdi.c
index 7a55b1b..1dcf169 100644
--- a/src/lib/gamma-w32-gdi.c
+++ b/src/lib/gamma-w32-gdi.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-w32-gdi.h b/src/lib/gamma-w32-gdi.h
index b4d8494..89f6bc9 100644
--- a/src/lib/gamma-w32-gdi.h
+++ b/src/lib/gamma-w32-gdi.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-wayland.c b/src/lib/gamma-wayland.c
new file mode 100644
index 0000000..ceeacd5
--- /dev/null
+++ b/src/lib/gamma-wayland.c
@@ -0,0 +1,850 @@
+/**
+ * libgamma -- Display server abstraction layer for gamma ramp adjustments
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library 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.
+ *
+ * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef HAVE_LIBGAMMA_METHOD_WAYLAND
+# error Compiling gamma-wayland.c without HAVE_LIBGAMMA_METHOD_WAYLAND
+#endif
+
+#include "gamma-wayland.h"
+#ifdef __GCC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wcast-qual"
+#endif
+#include "wayland-gamma-control-client-protocol.h"
+#ifdef __GCC__
+# pragma GCC diagnostic pop
+#endif
+
+#include "libgamma-error.h"
+
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#ifdef DEBUG
+# include <stdio.h>
+#endif
+
+#include <wayland-client.h>
+
+
+
+/**
+ * This function is called when the display server
+ * announces global resources.
+ *
+ * @param site_state The site state
+ * @param registry The event handler
+ * @param id The ID of the resource
+ * @param interface The name of the resource's type
+ * @param version The version of the resource's type
+ */
+static void registry_global_handler(void* site_state, struct wl_registry* registry, uint32_t id,
+ const char* interface, uint32_t version);
+
+/**
+ * This function is called when the display server
+ * announces that global resources have been removed.
+ *
+ * @param site_state The site state
+ * @param registry The event handler
+ * @param id The ID of the resource
+ */
+static void registry_global_remover(void* site_state, struct wl_registry* registry, uint32_t id);
+
+/**
+ * This function is invoked when the display
+ * server tells us the size of a gamma ramp.
+ *
+ * @param crtc_data The protocol-specific data for the CRTC
+ * @param control The gamma ramp controll for the CRTC
+ * @param size The number of stops in the gamma ramps of the CRTC
+ */
+static void gamma_control_gamma_size(void* crtc_data, struct gamma_control* control, uint32_t size);
+
+/**
+ * This function is invoked when the display server
+ * tells us that a request has been completed.
+ *
+ * @param crtc_data The protocol-specific data for the CRTC
+ * @param callback The callback
+ * @param request_data Request-specific callback data
+ */
+static void display_synced(void* crtc_data, struct wl_callback* callback, uint32_t request_data);
+
+/**
+ * This function is called when the display server
+ * tells us about an output's geometry.
+ *
+ * @param crtc_data The protocol-specific data for the CRTC
+ * @param output The output
+ * @param x The left position, within the global compositor space, of the output
+ * @param y The top position, within the global compositor space, of the output
+ * @param physical_width Width in millimeters of the monitor's viewport
+ * @param physical_height Weight in millimeters of the monitor's viewport
+ * @param subpixel_ The monitor's subpixel-orientation
+ * @param make Textual description of the monitor's manufacturer
+ * @param model Textual description of the monitor's model
+ * @param transform Output flipping and rotation
+ */
+static void geometry(void* crtc_data, struct wl_output* output, int32_t x, int32_t y,
+ int32_t physical_width, int32_t physical_height, int32_t subpixel_,
+ const char* make, const char* model, int32_t transform);
+
+
+
+/**
+ * Data structure for CRTC data.
+ */
+typedef struct libgamma_wayland_crtc_data
+{
+ /**
+ * Wayland-representation of the output.
+ */
+ struct wl_output* output;
+
+ /**
+ * Display synchronisation callback.
+ */
+ struct wl_callback* display_sync;
+
+ /**
+ * Gamma controller for the output.
+ */
+ struct gamma_control* gamma_control;
+
+ /**
+ * The size of the gamma ramps.
+ */
+ uint32_t gamma_size;
+
+ /**
+ * Whether `gamma_size` has been set.
+ */
+ int gamma_size_announced;
+
+ /**
+ * Whether gamma may be supported.
+ */
+ int gamma_maybe_supported;
+
+ /**
+ * ID of the CRTC.
+ */
+ uint32_t global_id;
+
+ /**
+ * Whether the CRTC has been removed.
+ */
+ int removed;
+
+ /**
+ * Whether the CRTC have an geometry listener assigned.
+ */
+ int have_geometry_listener;
+
+ /**
+ * The output's geometry.
+ */
+ libgamma_crtc_information_t geometry;
+
+} libgamma_wayland_crtc_data_t;
+
+
+/**
+ * Data structure for site data.
+ */
+typedef struct libgamma_wayland_site_data
+{
+ /**
+ * Connection to the display.
+ */
+ struct wl_display* display;
+
+ /**
+ * Event handlers for the display.
+ */
+ struct wl_registry* registry;
+
+ /**
+ * Gamma controller for the display.
+ */
+ struct gamma_control_manager* gamma_control_manager;
+
+ /**
+ * The number of CRTC:s that are available under this
+ * partition. Note that the CRTC:s are not necessarily
+ * online.
+ */
+ size_t crtcs_available;
+
+ /**
+ * The number of CRTC:s that are available under this
+ * partition. Note that the CRTC:s are not necessarily
+ * online.
+ */
+ size_t crtcs_allocated;
+
+ /**
+ * CRTC information fields.
+ */
+ libgamma_wayland_crtc_data_t** crtcs;
+
+ /**
+ * Error set from `registry_global_handler`.
+ */
+ int async_errno;
+
+ /**
+ * Whether gamma may be supported.
+ */
+ int gamma_maybe_supported;
+
+} libgamma_wayland_site_data_t;
+
+
+/**
+ * Event handlers for the display.
+ */
+static const struct wl_registry_listener registry_listener =
+ {
+ registry_global_handler,
+ registry_global_remover,
+ };
+
+/**
+ * Gamma event handlers for CRTC:s.
+ */
+static const struct gamma_control_listener gamma_control_listener =
+ {
+ gamma_control_gamma_size,
+ };
+
+/**
+ * Output event handlers.
+ */
+static const struct wl_output_listener output_listener =
+ {
+ geometry,
+ NULL,
+ NULL,
+ NULL,
+ };
+
+static const struct wl_callback_listener display_sync_listener =
+ {
+ display_synced,
+ };
+
+
+
+/**
+ * Return the capabilities of the adjustment method.
+ *
+ * @param this The data structure to fill with the method's capabilities.
+ */
+void libgamma_wayland_method_capabilities(libgamma_method_capabilities_t* restrict this)
+{
+ char* display = getenv("WAYLAND_DISPLAY");
+ this->crtc_information = LIBGAMMA_CRTC_INFO_GAMMA_SIZE
+ | LIBGAMMA_CRTC_INFO_GAMMA_DEPTH
+ | LIBGAMMA_CRTC_INFO_GAMMA_SUPPORT
+ | LIBGAMMA_CRTC_INFO_MACRO_VIEWPORT
+ | LIBGAMMA_CRTC_INFO_SUBPIXEL_ORDER;
+ /* Wayland supports multiple sites and CRTC:s, but not paritions. */
+ this->default_site_known = (display && *display) ? 1 : 0;
+ this->multiple_sites = 1;
+ this->multiple_partitions = 0;
+ this->multiple_crtcs = 1;
+ this->partitions_are_graphics_cards = 0;
+ /* Wayland/Orbital has per-CRTC restore capabilities. */
+ this->site_restore = 0;
+ this->partition_restore = 0;
+ this->crtc_restore = 1;
+ /* Gamma ramp sizes are identical but not fixed. */
+ this->identical_gamma_sizes = 1;
+ this->fixed_gamma_size = 0;
+ /* Gamma ramp depths are fixed. */
+ this->fixed_gamma_depth = 1;
+ /* Wayland/Orbital is a real non-faked adjustment method. */
+ this->real = 1;
+ this->fake = 0;
+}
+
+
+/**
+ * This function is called when the display server
+ * announces global resources.
+ *
+ * @param site_state The site state
+ * @param registry The event handler
+ * @param id The ID of the resource
+ * @param interface The name of the resource's type
+ * @param version The version of the resource's type
+ */
+static void registry_global_handler(void* site_state, struct wl_registry* registry, uint32_t id,
+ const char* interface, uint32_t version)
+{
+ libgamma_site_state_t* site = site_state;
+ libgamma_wayland_site_data_t* data = site->data;
+ libgamma_wayland_crtc_data_t** crtcs = data->crtcs;
+ libgamma_wayland_crtc_data_t* crtc;
+ size_t new_allocation, i;
+
+ (void) version;
+
+ /* Stop if an earlier call failed. */
+ if (data->async_errno)
+ return;
+
+ if (!strcmp(interface, "gamma_control_manager"))
+ {
+ data->gamma_control_manager = wl_registry_bind(registry, id, &gamma_control_manager_interface, 1);
+ if (data->gamma_control_manager == NULL)
+ data->async_errno = errno;
+ }
+ else if (!strcmp(interface, "wl_output"))
+ {
+ /* Check that ID is not used. */
+ for (i = 0; i < data->crtcs_available; i++)
+ if (crtcs[i] && (crtcs[i]->global_id == id))
+ return;
+
+ /* Reallocate CRTC resource array. */
+ if (data->crtcs_available == data->crtcs_allocated)
+ {
+ new_allocation = data->crtcs_allocated ? (data->crtcs_allocated << 1) : 1;
+ crtcs = realloc(crtcs, new_allocation * sizeof(libgamma_wayland_crtc_data_t*));
+ if (crtcs == NULL)
+ {
+ data->async_errno = errno;
+ return;
+ }
+ data->crtcs = crtcs;
+ data->crtcs_allocated = new_allocation;
+ }
+
+ /* Allocate CRTC resource. */
+ crtc = calloc(1, sizeof(libgamma_wayland_crtc_data_t));
+ crtcs[data->crtcs_available] = crtc;
+ if (crtc == NULL)
+ {
+ data->async_errno = errno;
+ return;
+ }
+
+ /* Set CRTC data. */
+ crtc->global_id = id;
+ crtc->output = wl_registry_bind(registry, id, &wl_output_interface, 1);
+ crtc->removed = 0;
+
+ /* Increase CRTC cound and check for overflow. */
+ if (data->crtcs_available++ == (size_t)~0)
+ {
+ free(crtc);
+ data->async_errno = LIBGAMMA_IMPOSSIBLE_AMOUNT;
+ return;
+ }
+ }
+}
+
+
+/**
+ * This function is called when the display server
+ * announces that global resources have been removed.
+ *
+ * @param site_state The site state
+ * @param registry The event handler
+ * @param id The ID of the resource
+ */
+static void registry_global_remover(void* site_state, struct wl_registry* registry, uint32_t id)
+{
+ libgamma_site_state_t* site = site_state;
+ libgamma_wayland_site_data_t* data = site->data;
+ libgamma_wayland_crtc_data_t* crtc;
+ size_t i;
+
+ (void) registry;
+
+ for (i = 0; i < data->crtcs_available; i++)
+ if ((crtc = data->crtcs[i]))
+ if (crtc->global_id == id)
+ {
+ crtc->removed = 1;
+ break;
+ }
+}
+
+
+/**
+ * Initialise an allocated site state.
+ *
+ * @param this The site state to initialise.
+ * @param site The site identifier, unless it is `NULL` it must a
+ * `free`:able. One the state is destroyed the library
+ * will attempt to free it. There you should not free
+ * it yourself, and it must not be a string constant
+ * or allocate on the stack. Note however that it will
+ * not be free:d if this function fails.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_site_initialise(libgamma_site_state_t* restrict this,
+ char* restrict site)
+{
+ libgamma_wayland_site_data_t* data;
+
+ /* Allocate adjustment method dependent data memory area.
+ We use `calloc` because we want `data`'s pointers to be `NULL` if not allocated at `fail`. */
+ if ((this->data = data = calloc(1, sizeof(libgamma_wayland_site_data_t))) == NULL)
+ return LIBGAMMA_ERRNO_SET;
+
+ /* Connect to the display server. */
+ data->display = wl_display_connect(site);
+ if (data->display == NULL)
+ return LIBGAMMA_OPEN_SITE_FAILED;
+ data->registry = wl_display_get_registry(data->display);
+ if (data->registry == NULL)
+ return LIBGAMMA_ERRNO_SET;
+ if (wl_registry_add_listener(data->registry, &registry_listener, this) < 0)
+ return LIBGAMMA_ERRNO_SET;
+
+ /* Synchronise with display. */
+ if (wl_display_roundtrip(data->display) < 0)
+ return LIBGAMMA_ERRNO_SET;
+
+ /* Check for errors. */
+ if (data->async_errno > 0)
+ return errno = data->async_errno, LIBGAMMA_ERRNO_SET;
+ if (data->async_errno < 0)
+ return data->async_errno;
+
+ /* Check that we have a gamma controller. */
+ if (data->gamma_control_manager)
+ data->gamma_maybe_supported = 1;
+
+ this->partitions_available = 1;
+ return 0;
+}
+
+
+/**
+ * Release all resources held by a site state.
+ *
+ * @param this The site state.
+ */
+void libgamma_wayland_site_destroy(libgamma_site_state_t* restrict this)
+{
+ libgamma_wayland_site_data_t* data = this->data;
+ libgamma_wayland_crtc_data_t* crtc;
+ if (data->gamma_control_manager != NULL)
+ gamma_control_manager_destroy(data->gamma_control_manager);
+ if (data->registry != NULL)
+ wl_registry_destroy(data->registry);
+ if (data->display != NULL)
+ wl_display_disconnect(data->display);
+ while (data->crtcs_available--)
+ {
+ crtc = data->crtcs[data->crtcs_available];
+ if (crtc->gamma_control != NULL)
+ gamma_control_destroy(crtc->gamma_control);
+ if (crtc->output != NULL)
+ wl_output_destroy(crtc->output);
+ if (crtc->display_sync != NULL)
+ wl_callback_destroy(crtc->display_sync);
+ free(crtc);
+ }
+ free(data->crtcs);
+ free(data);
+}
+
+
+/**
+ * Restore the gamma ramps all CRTC:s with a site to the system settings.
+ *
+ * @param this The site state.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_site_restore(libgamma_site_state_t* restrict this)
+{
+ (void) this;
+ return errno = ENOTSUP, LIBGAMMA_ERRNO_SET;
+}
+
+
+/**
+ * Initialise an allocated partition state.
+ *
+ * @param this The partition state to initialise.
+ * @param site The site state for the site that the partition belongs to.
+ * @param partition The the index of the partition within the site.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_partition_initialise(libgamma_partition_state_t* restrict this,
+ libgamma_site_state_t* restrict site, size_t partition)
+{
+ libgamma_wayland_site_data_t* data = site->data;
+
+ this->data = NULL;
+ this->crtcs_available = 0;
+
+ if (partition != 0)
+ return LIBGAMMA_NO_SUCH_PARTITION;
+
+ this->crtcs_available = data->crtcs_available;
+ return 0;
+}
+
+
+/**
+ * Release all resources held by a partition state.
+ *
+ * @param this The partition state.
+ */
+void libgamma_wayland_partition_destroy(libgamma_partition_state_t* restrict this)
+{
+ (void) this;
+}
+
+
+/**
+ * Restore the gamma ramps all CRTC:s with a partition to the system settings.
+ *
+ * @param this The partition state.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_partition_restore(libgamma_partition_state_t* restrict this)
+{
+ return libgamma_wayland_site_restore(this->site);
+}
+
+
+/**
+ * This function is invoked when the display
+ * server tells us the size of a gamma ramp.
+ *
+ * @param crtc_data The protocol-specific data for the CRTC
+ * @param control The gamma ramp controll for the CRTC
+ * @param size The number of stops in the gamma ramps of the CRTC
+ */
+static void gamma_control_gamma_size(void* crtc_data, struct gamma_control* control, uint32_t size)
+{
+ libgamma_wayland_crtc_data_t* data = crtc_data;
+ (void) control;
+ data->gamma_size = size;
+ data->gamma_size_announced = 1;
+}
+
+
+/**
+ * Initialise an allocated CRTC state.
+ *
+ * @param this The CRTC state to initialise.
+ * @param partition The partition state for the partition that the CRTC belongs to.
+ * @param crtc The the index of the CRTC within the site.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_initialise(libgamma_crtc_state_t* restrict this,
+ libgamma_partition_state_t* restrict partition, size_t crtc)
+{
+ libgamma_wayland_crtc_data_t* data;
+ libgamma_wayland_site_data_t* site = partition->site->data;
+
+ this->data = NULL;
+
+ if (crtc >= partition->crtcs_available)
+ return LIBGAMMA_NO_SUCH_CRTC;
+
+ data = site->crtcs[crtc];
+
+ if (site->gamma_maybe_supported == 0)
+ return this->data = data, 0;
+
+ data->gamma_control = gamma_control_manager_get_gamma_control(site->gamma_control_manager, data->output);
+ if (data->gamma_control)
+ {
+ data->gamma_maybe_supported = 1;
+ gamma_control_add_listener(data->gamma_control, &gamma_control_listener, data);
+ }
+ if (wl_display_roundtrip(site->display) < 0)
+ return LIBGAMMA_ERRNO_SET;
+ if (data->gamma_size_announced == 0)
+ data->gamma_maybe_supported = 0;
+ else if (data->gamma_size < 2)
+ return LIBGAMMA_SINGLETON_GAMMA_RAMP;
+
+ this->data = data;
+
+ return 0;
+}
+
+
+/**
+ * Release all resources held by a CRTC state.
+ *
+ * @param this The CRTC state.
+ */
+void libgamma_wayland_crtc_destroy(libgamma_crtc_state_t* restrict this)
+{
+ (void) this;
+}
+
+
+/**
+ * Restore the gamma ramps for a CRTC to the system settings for that CRTC.
+ *
+ * @param this The CRTC state.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_restore(libgamma_crtc_state_t* restrict this)
+{
+ libgamma_wayland_crtc_data_t* data = this->data;
+ libgamma_wayland_site_data_t* site = this->partition->site->data;
+ gamma_control_reset_gamma(data->gamma_control);
+ if (wl_display_flush(site->display) < 0)
+ return LIBGAMMA_ERRNO_SET;
+ return 0;
+}
+
+
+
+/**
+ * This function is called when the display server
+ * tells us about an output's geometry.
+ *
+ * @param crtc_data The protocol-specific data for the CRTC
+ * @param output The output
+ * @param x The left position, within the global compositor space, of the output
+ * @param y The top position, within the global compositor space, of the output
+ * @param physical_width Width in millimeters of the monitor's viewport
+ * @param physical_height Weight in millimeters of the monitor's viewport
+ * @param subpixel_ The monitor's subpixel-orientation
+ * @param make Textual description of the monitor's manufacturer
+ * @param model Textual description of the monitor's model
+ * @param transform Output flipping and rotation
+ */
+static void geometry(void* crtc_data, struct wl_output* output, int32_t x, int32_t y,
+ int32_t physical_width, int32_t physical_height, int32_t subpixel_,
+ const char* make, const char* model, int32_t transform)
+{
+ libgamma_wayland_crtc_data_t* data = crtc_data;
+ libgamma_crtc_information_t* info = &(data->geometry);
+ enum wl_output_subpixel subpixel = subpixel_;
+
+ (void) output;
+ (void) x;
+ (void) y;
+ (void) transform;
+ (void) make; /* TODO new field (fix after merge to master branch) */
+ (void) model; /* TODO new field (fix after merge to master branch) */
+
+ info->width_mm = (size_t)(physical_width < 0 ? 0 : physical_width);
+ info->height_mm = (size_t)(physical_height < 0 ? 0 : physical_height);
+ info->width_mm_error = 0;
+ info->height_mm_error = 0;
+
+ info->subpixel_order_error = 0;
+ switch (subpixel)
+ {
+#define O(ORDER) \
+ case WL_OUTPUT_SUBPIXEL_##ORDER: \
+ info->subpixel_order = LIBGAMMA_SUBPIXEL_ORDER_##ORDER; \
+ break
+ O(UNKNOWN);
+ O(NONE);
+ O(HORIZONTAL_RGB);
+ O(HORIZONTAL_BGR);
+ O(VERTICAL_RGB);
+ O(VERTICAL_BGR);
+#undef O
+ default:
+ info->subpixel_order_error = LIBGAMMA_SUBPIXEL_ORDER_NOT_RECOGNISED;
+ break;
+ }
+}
+
+
+/**
+ * Read information about a CRTC.
+ *
+ * @param this Instance of a data structure to fill with the information about the CRTC.
+ * @param crtc The state of the CRTC whose information should be read.
+ * @param fields OR:ed identifiers for the information about the CRTC that should be read.
+ * @return Zero on success, -1 on error. On error refer to the error reports in `this`..
+ */
+int libgamma_wayland_get_crtc_information(libgamma_crtc_information_t* restrict this,
+ libgamma_crtc_state_t* restrict crtc, int32_t fields)
+{
+#define _EE(FIELD, ERROR) ((fields & FIELD) ? ERROR : 0)
+#define _E(FIELD) _EE(FIELD, LIBGAMMA_CRTC_INFO_NOT_SUPPORTED)
+
+ libgamma_wayland_crtc_data_t* data = crtc->data;
+ libgamma_wayland_site_data_t* site = crtc->partition->site->data;
+ int e = 0;
+
+ /* Wipe all error indicators. */
+ memset(this, 0, sizeof(libgamma_crtc_information_t));
+
+
+ /* Get geometry. */
+ this->width_mm_error = _EE(LIBGAMMA_CRTC_INFO_WIDTH_MM, LIBGAMMA_OUTPUT_INFORMATION_QUERY_FAILED);
+ this->height_mm_error = _EE(LIBGAMMA_CRTC_INFO_HEIGHT_MM, LIBGAMMA_OUTPUT_INFORMATION_QUERY_FAILED);
+ this->subpixel_order_error = _EE(LIBGAMMA_CRTC_INFO_SUBPIXEL_ORDER, LIBGAMMA_OUTPUT_INFORMATION_QUERY_FAILED);
+ if (this->width_mm_error || this->height_mm_error || this->subpixel_order_error)
+ {
+ if (data->have_geometry_listener == 0)
+ {
+ data->have_geometry_listener = 1;
+ data->geometry = *this;
+ wl_output_add_listener(data->output, &output_listener, data);
+ wl_display_roundtrip(site->display);
+ }
+ *this = data->geometry;
+ e |= this->width_mm_error | this->height_mm_error | this->subpixel_order_error;
+ }
+
+
+ /* There is no support for EDID, or any other way to get the gamma. */
+ e |= this->edid_error = _E(LIBGAMMA_CRTC_INFO_EDID);
+ e |= this->width_mm_edid_error = _E(LIBGAMMA_CRTC_INFO_WIDTH_MM_EDID);
+ e |= this->height_mm_edid_error = _E(LIBGAMMA_CRTC_INFO_HEIGHT_MM_EDID);
+ e |= this->gamma_error = _E(LIBGAMMA_CRTC_INFO_GAMMA);
+
+ /* Store gamma size. */
+ this->red_gamma_size = (size_t)(data->gamma_size);
+ this->green_gamma_size = (size_t)(data->gamma_size);
+ this->blue_gamma_size = (size_t)(data->gamma_size);
+ e |= this->gamma_size_error = data->gamma_maybe_supported ? 0 :
+ _EE(LIBGAMMA_CRTC_INFO_GAMMA_SIZE, LIBGAMMA_GAMMA_RAMPS_NOT_SUPPORTED);
+
+ /* Store gamma depth and gamma support. */
+ this->gamma_depth = 16;
+ this->gamma_support = data->gamma_maybe_supported;
+
+ /* Store active. */
+ this->active = data->removed == 0;
+
+ /* There is no connector support. */
+ e |= this->connector_name_error = _E(LIBGAMMA_CRTC_INFO_CONNECTOR_NAME);
+ e |= this->connector_type_error = _E(LIBGAMMA_CRTC_INFO_CONNECTOR_TYPE);
+
+
+ /* There was a failure if and only if unsupport field was requested. */
+ return e ? -1 : 0;
+
+#undef _E
+#undef _EE
+}
+
+
+/**
+ * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version.
+ *
+ * @param this The CRTC state.
+ * @param ramps The gamma ramps to fill with the current values.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_get_gamma_ramps16(libgamma_crtc_state_t* restrict this,
+ libgamma_gamma_ramps16_t* restrict ramps)
+{
+ (void) this;
+ (void) ramps;
+ return errno = ENOTSUP, LIBGAMMA_ERRNO_SET;
+}
+
+
+/**
+ * This function is invoked when the display server
+ * tells us that a request has been completed.
+ *
+ * @param crtc_data The protocol-specific data for the CRTC
+ * @param callback The callback
+ * @param request_data Request-specific callback data
+ */
+static void display_synced(void* crtc_data, struct wl_callback* callback, uint32_t request_data)
+{
+ libgamma_wayland_crtc_data_t* crtc = crtc_data;
+
+ (void) request_data;
+
+ crtc->display_sync = NULL;
+ wl_callback_destroy(callback);
+}
+
+
+/**
+ * Set the gamma ramps for a CRTC, 16-bit gamma-depth version.
+ *
+ * @param this The CRTC state.
+ * @param ramps The gamma ramps to apply.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_set_gamma_ramps16(libgamma_crtc_state_t* restrict this,
+ libgamma_gamma_ramps16_t ramps)
+{
+ libgamma_wayland_site_data_t* site = this->partition->site->data;
+ libgamma_wayland_crtc_data_t* crtc = this->data;
+ struct wl_array red;
+ struct wl_array green;
+ struct wl_array blue;
+ int r = 0;
+
+ /* Verify that gamma can be set. */
+#ifdef DEBUG
+ if (crtc->gamma_maybe_supported == 0)
+ return LIBGAMMA_GAMMA_RAMPS_NOT_SUPPORTED;
+#endif
+ if (crtc->removed)
+ return 0;
+
+#ifdef DEBUG
+ /* Gamma ramp sizes are identical but not fixed. */
+ if ((ramps.red_size != ramps.green_size) ||
+ (ramps.red_size != ramps.blue_size))
+ return LIBGAMMA_MIXED_GAMMA_RAMP_SIZE;
+#endif
+
+ /* Translate gamma ramps to Wayland structure. */
+ red .size = red .alloc = ramps. red_size * sizeof(uint16_t);
+ green.size = green.alloc = ramps.green_size * sizeof(uint16_t);
+ blue .size = blue .alloc = ramps. blue_size * sizeof(uint16_t);
+ red .data = ramps.red;
+ green.data = ramps.green;
+ blue .data = ramps.blue;
+
+ /* Apply gamma ramps. */
+ gamma_control_set_gamma(crtc->gamma_control, &red, &green, &blue);
+ crtc->display_sync = wl_display_sync(site->display);
+ wl_callback_add_listener(crtc->display_sync, &display_sync_listener, crtc);
+ wl_display_flush(site->display);
+ while (crtc->display_sync && (r >= 0))
+ r = wl_display_dispatch(site->display);
+ if (r < 0)
+ return LIBGAMMA_GAMMA_RAMP_WRITE_FAILED;
+
+ /* TODO Check for errors. */
+
+ return 0;
+}
+
diff --git a/src/lib/gamma-wayland.h b/src/lib/gamma-wayland.h
new file mode 100644
index 0000000..3ae6ade
--- /dev/null
+++ b/src/lib/gamma-wayland.h
@@ -0,0 +1,163 @@
+/**
+ * libgamma -- Display server abstraction layer for gamma ramp adjustments
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+ *
+ * This library 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.
+ *
+ * This library 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 this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef LIBGAMMA_GAMMA_WAYLAND_H
+#define LIBGAMMA_GAMMA_WAYLAND_H
+
+#ifndef HAVE_LIBGAMMA_METHOD_WAYLAND
+# error Including gamma-wayland.h without HAVE_LIBGAMMA_METHOD_WAYLAND
+#endif
+
+
+#include "libgamma-method.h"
+
+
+/**
+ * Return the capabilities of the adjustment method.
+ *
+ * @param this The data structure to fill with the method's capabilities.
+ */
+void libgamma_wayland_method_capabilities(libgamma_method_capabilities_t* restrict this);
+
+/**
+ * Initialise an allocated site state.
+ *
+ * @param this The site state to initialise.
+ * @param site The site identifier, unless it is `NULL` it must a
+ * `free`:able. One the state is destroyed the library
+ * will attempt to free it. There you should not free
+ * it yourself, and it must not be a string constant
+ * or allocate on the stack. Note however that it will
+ * not be free:d if this function fails.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_site_initialise(libgamma_site_state_t* restrict this,
+ char* restrict site);
+
+/**
+ * Release all resources held by a site state.
+ *
+ * @param this The site state.
+ */
+void libgamma_wayland_site_destroy(libgamma_site_state_t* restrict this);
+
+/**
+ * Restore the gamma ramps all CRTC:s with a site to the system settings.
+ *
+ * @param this The site state.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_site_restore(libgamma_site_state_t* restrict this) __attribute__((const));
+
+
+/**
+ * Initialise an allocated partition state.
+ *
+ * @param this The partition state to initialise.
+ * @param site The site state for the site that the partition belongs to.
+ * @param partition The the index of the partition within the site.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_partition_initialise(libgamma_partition_state_t* restrict this,
+ libgamma_site_state_t* restrict site,
+ size_t partition) __attribute__((pure));
+
+/**
+ * Release all resources held by a partition state.
+ *
+ * @param this The partition state.
+ */
+void libgamma_wayland_partition_destroy(libgamma_partition_state_t* restrict this) __attribute__((const));
+
+/**
+ * Restore the gamma ramps all CRTC:s with a partition to the system settings.
+ *
+ * @param this The partition state.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_partition_restore(libgamma_partition_state_t* restrict this) __attribute__((const));
+
+
+/**
+ * Initialise an allocated CRTC state.
+ *
+ * @param this The CRTC state to initialise.
+ * @param partition The partition state for the partition that the CRTC belongs to.
+ * @param crtc The the index of the CRTC within the site.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_initialise(libgamma_crtc_state_t* restrict this,
+ libgamma_partition_state_t* restrict partition, size_t crtc);
+
+/**
+ * Release all resources held by a CRTC state.
+ *
+ * @param this The CRTC state.
+ */
+void libgamma_wayland_crtc_destroy(libgamma_crtc_state_t* restrict this) __attribute__((const));
+
+/**
+ * Restore the gamma ramps for a CRTC to the system settings for that CRTC.
+ *
+ * @param this The CRTC state.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_restore(libgamma_crtc_state_t* restrict this);
+
+
+/**
+ * Read information about a CRTC.
+ *
+ * @param this Instance of a data structure to fill with the information about the CRTC.
+ * @param crtc The state of the CRTC whose information should be read.
+ * @param fields OR:ed identifiers for the information about the CRTC that should be read.
+ * @return Zero on success, -1 on error. On error refer to the error reports in `this`.
+ */
+int libgamma_wayland_get_crtc_information(libgamma_crtc_information_t* restrict this,
+ libgamma_crtc_state_t* restrict crtc, int32_t fields);
+
+/**
+ * Get the current gamma ramps for a CRTC, 16-bit gamma-depth version.
+ *
+ * @param this The CRTC state.
+ * @param ramps The gamma ramps to fill with the current values.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_get_gamma_ramps16(libgamma_crtc_state_t* restrict this,
+ libgamma_gamma_ramps16_t* restrict ramps) __attribute__((const));
+
+/**
+ * Set the gamma ramps for a CRTC, 16-bit gamma-depth version.
+ *
+ * @param this The CRTC state.
+ * @param ramps The gamma ramps to apply.
+ * @return Zero on success, otherwise (negative) the value of an
+ * error identifier provided by this library.
+ */
+int libgamma_wayland_crtc_set_gamma_ramps16(libgamma_crtc_state_t* restrict this,
+ libgamma_gamma_ramps16_t ramps);
+
+
+#endif
+
diff --git a/src/lib/gamma-x-randr.c b/src/lib/gamma-x-randr.c
index b3115a6..af818f3 100644
--- a/src/lib/gamma-x-randr.c
+++ b/src/lib/gamma-x-randr.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-x-randr.h b/src/lib/gamma-x-randr.h
index 39afa5c..093fcd4 100644
--- a/src/lib/gamma-x-randr.h
+++ b/src/lib/gamma-x-randr.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-x-vidmode.c b/src/lib/gamma-x-vidmode.c
index 51c86e6..9651894 100644
--- a/src/lib/gamma-x-vidmode.c
+++ b/src/lib/gamma-x-vidmode.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/gamma-x-vidmode.h b/src/lib/gamma-x-vidmode.h
index 6f0c498..018cd72 100644
--- a/src/lib/gamma-x-vidmode.h
+++ b/src/lib/gamma-x-vidmode.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/libgamma-error.c.gpp b/src/lib/libgamma-error.c.gpp
index 3d124eb..8e3f9b4 100644
--- a/src/lib/libgamma-error.c.gpp
+++ b/src/lib/libgamma-error.c.gpp
@@ -1,7 +1,7 @@
/* -*- c -*- */
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/libgamma-error.h b/src/lib/libgamma-error.h
index d4dddbd..d0b9e61 100644
--- a/src/lib/libgamma-error.h
+++ b/src/lib/libgamma-error.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -333,6 +333,12 @@ extern const char* libgamma_group_name;
*/
#define LIBGAMMA_OUTPUT_INFORMATION_QUERY_FAILED (-46)
+/**
+ * Gamma ramps are not supported.
+ * (Only returned in debug mode.)
+ */
+#define LIBGAMMA_GAMMA_RAMPS_NOT_SUPPORTED (-47)
+
/**
@@ -341,7 +347,7 @@ extern const char* libgamma_group_name;
* number your program thinks it should be sould
* update your program for new errors.
*/
-#define LIBGAMMA_ERROR_MIN (-46)
+#define LIBGAMMA_ERROR_MIN (-47)
diff --git a/src/lib/libgamma-facade.c.gpp b/src/lib/libgamma-facade.c.gpp
index d1a215c..8d10c5d 100644
--- a/src/lib/libgamma-facade.c.gpp
+++ b/src/lib/libgamma-facade.c.gpp
@@ -1,7 +1,7 @@
/* -*- c -*- */
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -179,12 +179,46 @@ size_t libgamma_list_methods(int* restrict methods, size_t buf_size, int operati
(void) operation;
return 0;
#else
- size_t n = 0;
+ size_t n = 0, len;
+ int included[LIBGAMMA_METHOD_COUNT];
+ char* begin;
+ char* end;
+
+ memset(included, 0, LIBGAMMA_METHOD_COUNT * sizeof(int));
+ begin = getenv("PREFERRED_DISPLAY");
+ while (begin && *begin)
+ {
+ end = strchr(begin, ' ');
+ len = (size_t)(end - begin);
+ if (len == 0);
+#ifdef HAVE_LIBGAMMA_METHOD_WAYLAND
+ else if ((len == 7) && !strncmp(begin, "wayland", len)) /* 7 is strlen("wayland") */
+ {
+ if (libgamma_list_method_test(LIBGAMMA_METHOD_WAYLAND, operation) && (n++ < buf_size))
+ methods[n - 1] = LIBGAMMA_METHOD_WAYLAND, included[methods[n - 1]] = 1;
+ }
+#endif
+#if defined(HAVE_LIBGAMMA_METHOD_X_RANDR) || defined(HAVE_LIBGAMMA_METHOD_X_VIDMODE)
+ else if ((len == 3) && !strncmp(begin, "x11", len)) /* 3 is strlen("x11") */
+ {
+# ifdef HAVE_LIBGAMMA_METHOD_X_RANDR
+ if (libgamma_list_method_test(LIBGAMMA_METHOD_X_RANDR, operation) && (n++ < buf_size))
+ methods[n - 1] = LIBGAMMA_METHOD_X_RANDR, included[methods[n - 1]] = 1;
+# endif
+# ifdef HAVE_LIBGAMMA_METHOD_X_VIDMODE
+ if (libgamma_list_method_test(LIBGAMMA_METHOD_X_VIDMODE, operation) && (n++ < buf_size))
+ methods[n - 1] = LIBGAMMA_METHOD_X_VIDMODE, included[methods[n - 1]] = 1;
+# endif
+ }
+#endif
+ begin = end + 1;
+ }
$>for method in $(get-methods); do
#ifdef HAVE_LIBGAMMA_METHOD_${method}
- if (libgamma_list_method_test(LIBGAMMA_METHOD_${method}, operation) && (n++ < buf_size))
- methods[n - 1] = LIBGAMMA_METHOD_${method};
+ if (included[LIBGAMMA_METHOD_${method}] == 0)
+ if (libgamma_list_method_test(LIBGAMMA_METHOD_${method}, operation) && (n++ < buf_size))
+ methods[n - 1] = LIBGAMMA_METHOD_${method};
#endif
$>done
@@ -334,6 +368,10 @@ const char* libgamma_method_default_site_variable(int method)
case LIBGAMMA_METHOD_X_VIDMODE:
return "DISPLAY";
#endif
+#ifdef HAVE_LIBGAMMA_METHOD_WAYLAND
+ case LIBGAMMA_METHOD_WAYLAND:
+ return "WAYLAND_DISPLAY";
+#endif
default:
return NULL;
}
diff --git a/src/lib/libgamma-facade.h b/src/lib/libgamma-facade.h
index d2cc724..343114c 100644
--- a/src/lib/libgamma-facade.h
+++ b/src/lib/libgamma-facade.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/libgamma-method.c b/src/lib/libgamma-method.c
index 0fa76c3..40b4013 100644
--- a/src/lib/libgamma-method.c
+++ b/src/lib/libgamma-method.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/libgamma-method.h b/src/lib/libgamma-method.h
index 6e0cff1..76a8f40 100644
--- a/src/lib/libgamma-method.h
+++ b/src/lib/libgamma-method.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -85,13 +85,20 @@
*/
#define LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS 5
+/**
+ * The identifier for the adjustment method with
+ * uses the Orbital Wayland compositor's protocol
+ * for gamma ramp control.
+ */
+#define LIBGAMMA_METHOD_WAYLAND 6
+
/**
* The index of the last gamma method, neither it
* nor any index before it may actually be supported
* as it could have been disabled at compile-time.
*/
-#define LIBGAMMA_METHOD_MAX 5
+#define LIBGAMMA_METHOD_MAX 6
/**
* The number adjustment methods provided by this library.
diff --git a/src/lib/libgamma.h b/src/lib/libgamma.h
index 27aefe4..9bec47c 100644
--- a/src/lib/libgamma.h
+++ b/src/lib/libgamma.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/lib/wayland-gamma-control-protocol.xml b/src/lib/wayland-gamma-control-protocol.xml
new file mode 100644
index 0000000..291472d
--- /dev/null
+++ b/src/lib/wayland-gamma-control-protocol.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<protocol name="gamma_control">
+ <copyright>
+ libgamma -- Display server abstraction layer for gamma ramp adjustments
+ Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
+
+ This library 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.
+
+ This library 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 this library. If not, see &lt;http://www.gnu.org/licenses/&gt;.
+ </copyright>
+
+
+ <!--
+ - Gamma ramp controller for a display.
+ -->
+ <interface name="gamma_control_manager" version="1">
+ <!--
+ - Acquirer a gamma ramp controller for an output.
+ -
+ - @param :struct gamma_control_manager* The gamma ramp controller for the display.
+ - @param output:struct wl_output* The output.
+ - @return id:struct gamma_control* Gamma ramp controller for the output.
+ -->
+ <request name="get_gamma_control">
+ <arg name="id" type="new_id" interface="gamma_control"/>
+ <arg name="output" type="object" interface="wl_output"/>
+ </request>
+
+ <!--
+ - Release a gamma ramp controller for a display.
+ -
+ - @param :struct gamma_control_manager* The gamma ramp controller.
+ -->
+ <request name="destroy" type="destructor"/>
+ </interface>
+
+
+ <!--
+ - Gamma ramp controller for an output.
+ -->
+ <interface name="gamma_control" version="1">
+ <!--
+ - List of errors for `gamma_control` methods.
+ -->
+ <enum name="error">
+ <!--
+ - The gamma ramps do not have the same number of stops.
+ -->
+ <entry name="invalid_gamma" value="0"/>
+ </enum>
+
+ <!--
+ - Event that notifies the program about the number
+ - of stops in the gamma ramps.
+ -
+ - @param user_data:void* Data registered to be passsed to the
+ - function to identify the event registry.
+ - @param :struct gamma_control* The gamma ramp control of the output.
+ - @param size:uint32_t The number of stops in the gamma ramps.
+ -->
+ <event name="gamma_size">
+ <arg name="size" type="uint"/>
+ </event>
+
+ <!--
+ - Set the gamma ramps for an output.
+ -
+ - @param :struct gamma_control* The gamma ramp control of the output.
+ - @param red:struct wl_array*<uint16_t> The gamma ramp for the red channel.
+ - @param green:struct wl_array*<uint16_t> The gamma ramp for the green channel.
+ - @param blue:struct wl_array*<uint16_t> The gamma ramp for the blue channel.
+ -->
+ <request name="set_gamma">
+ <arg name="red" type="array"/>
+ <arg name="green" type="array"/>
+ <arg name="blue" type="array"/>
+ </request>
+
+ <!--
+ - Undo all modifications to an output's gamma ramps.
+ -
+ - @param :struct gamma_control* The gamma ramp control of the output.
+ -->
+ <request name="reset_gamma"/>
+
+ <!--
+ - Release a gamma ramp controller for an output.
+ -
+ - @param :struct gamma_control* The gamma ramp controller.
+ -->
+ <request name="destroy" type="destructor"/>
+ </interface>
+
+
+</protocol>
+
diff --git a/src/test/crtcinfo.c b/src/test/crtcinfo.c
index 502d82a..712ad04 100644
--- a/src/test/crtcinfo.c
+++ b/src/test/crtcinfo.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/crtcinfo.h b/src/test/crtcinfo.h
index 39f282e..3c22c0b 100644
--- a/src/test/crtcinfo.h
+++ b/src/test/crtcinfo.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/errors.c b/src/test/errors.c
index c1137ca..6496d21 100644
--- a/src/test/errors.c
+++ b/src/test/errors.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/errors.h b/src/test/errors.h
index e3140e2..616cdaa 100644
--- a/src/test/errors.h
+++ b/src/test/errors.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/methods.c b/src/test/methods.c
index 30dadc8..f3fa67b 100644
--- a/src/test/methods.c
+++ b/src/test/methods.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -35,6 +35,7 @@ const char* method_name(int method)
case LIBGAMMA_METHOD_LINUX_DRM: return "Linux DRM";
case LIBGAMMA_METHOD_W32_GDI: return "Windows GDI";
case LIBGAMMA_METHOD_QUARTZ_CORE_GRAPHICS: return "Quartz using CoreGraphics";
+ case LIBGAMMA_METHOD_WAYLAND: return "Wayland/Orbital";
default:
return "(unknown)";
}
diff --git a/src/test/methods.h b/src/test/methods.h
index fd7975a..2e13b8d 100644
--- a/src/test/methods.h
+++ b/src/test/methods.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/ramps.c b/src/test/ramps.c
index cea86b8..ee3aa7d 100644
--- a/src/test/ramps.c
+++ b/src/test/ramps.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/ramps.h b/src/test/ramps.h
index 5ea2844..c16bbc8 100644
--- a/src/test/ramps.h
+++ b/src/test/ramps.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/test.c b/src/test/test.c
index 07727ac..6a4820d 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/test.h b/src/test/test.h
index 97a2fb6..62cda4c 100644
--- a/src/test/test.h
+++ b/src/test/test.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/update-warnings.h b/src/test/update-warnings.h
index 36d8940..f1df65c 100644
--- a/src/test/update-warnings.h
+++ b/src/test/update-warnings.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -46,10 +46,10 @@
#ifdef __GCC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcpp"
-# if LIBGAMMA_ERROR_MIN < -46
+# if LIBGAMMA_ERROR_MIN < -47
# warning New error codes have been added to libgamma.
# endif
-# if LIBGAMMA_METHOD_COUNT > 6
+# if LIBGAMMA_METHOD_COUNT > 7
# warning New adjust methods has been added to libgamma
# endif
# if LIBGAMMA_CONNECTOR_TYPE_COUNT > 20
diff --git a/src/test/user.c b/src/test/user.c
index f2a1d50..4f2b6d5 100644
--- a/src/test/user.c
+++ b/src/test/user.c
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/src/test/user.h b/src/test/user.h
index ffce92f..e96142d 100644
--- a/src/test/user.h
+++ b/src/test/user.h
@@ -1,6 +1,6 @@
/**
* libgamma -- Display server abstraction layer for gamma ramp adjustments
- * Copyright (C) 2014 Mattias Andrée (maandree@member.fsf.org)
+ * Copyright (C) 2014, 2015 Mattias Andrée (maandree@member.fsf.org)
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by