| author | Aaron Plattner <aplattner@nvidia.com> | 2012-05-02 15:06:02 (GMT) |
|---|---|---|
| committer | Aaron Plattner <aplattner@nvidia.com> | 2012-05-02 15:06:02 (GMT) |
| commit | c3e638087673f0f4b7a751685a97b7830a8d9a18 (patch) (side-by-side diff) | |
| tree | dfc366ef00d9df26f09931e959fbeb100931ccc4 | |
| parent | 6c04ca8c874a7407154520f8e78698b6e27206e7 (diff) | |
| download | nvidia-settings-302.07.zip nvidia-settings-302.07.tar.gz | |
302.07302.07
126 files changed, 5130 insertions, 14007 deletions
@@ -2,7 +2,7 @@ # nvidia-settings: A tool for configuring the NVIDIA X driver on Unix # and Linux systems. # -# Copyright (C) 2008 NVIDIA Corporation. +# Copyright (C) 2008-2012 NVIDIA Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, @@ -17,201 +17,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses>. # +.PHONY: all clean clobber install -############################################################################## -# include common variables and functions -############################################################################## +all clean clobber install: + @$(MAKE) -C src $@ + @$(MAKE) -C samples $@ + @$(MAKE) -C doc $@ -include utils.mk - - -############################################################################## -# The calling Makefile may export any of the following variables; we -# assign default values if they are not exported by the caller -############################################################################## - -ifndef X_LDFLAGS - ifeq ($(TARGET_OS)-$(TARGET_ARCH),Linux-x86_64) - X_LDFLAGS = -L/usr/X11R6/lib64 - else - X_LDFLAGS = -L/usr/X11R6/lib - endif -endif - -X_CFLAGS ?= - -GL_INCLUDE_PATH ?= /usr/include - -PKG_CONFIG ?= pkg-config - -ifndef GTK_CFLAGS - GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0) -endif - -ifndef GTK_LDFLAGS - GTK_LDFLAGS := $(shell $(PKG_CONFIG) --libs gtk+-2.0) -endif - - -############################################################################## -# The XF86Config-parser, libXNVCtrl, and common-utils directories may -# be in one of two places: either elsewhere in the driver source tree -# when building nvidia-settings as part of the NVIDIA driver build (in -# which case, XNVCTRL_DIR, XNVCTRL_ARCHIVE, XCONFIG_PARSER_DIR and -# COMMON_UTILS_DIR should be defined by the calling makefile), or -# directly in the source directory when building from the -# nvidia-settings source tarball (in which case, the below conditional -# assignments should be used) -############################################################################## - -XNVCTRL_DIR ?= src/libXNVCtrl -XNVCTRL_ARCHIVE ?= $(XNVCTRL_DIR)/libXNVCtrl.a -XCONFIG_PARSER_DIR ?= src/XF86Config-parser -COMMON_UTILS_DIR ?= src/common-utils - -############################################################################## -# assign variables -############################################################################## - -NVIDIA_SETTINGS = $(OUTPUTDIR)/nvidia-settings - -NVIDIA_SETTINGS_PROGRAM_NAME = "nvidia-settings" - -NVIDIA_SETTINGS_VERSION := $(NVIDIA_VERSION) - -CFLAGS += $(X_CFLAGS) - -ifeq ($(TARGET_OS),SunOS) - LDFLAGS += -Wl,-rpath=/usr/X11R6/lib -endif - -LDFLAGS += $(X_LDFLAGS) - -# Some older Linux distributions do not have the dynamic library -# libXxf86vm.so, though some newer Linux distributions do not have the -# static library libXxf86vm.a. Statically link against libXxf86vm -# when building nvidia-settings within the NVIDIA driver build, but -# dynamically link against libXxf86vm in the public builds. -ifdef NV_LINK_LIBXXF86VM_STATICALLY - LDFLAGS += -Wl,-Bstatic -lXxf86vm -Wl,-Bdynamic -else - LDFLAGS += -lXxf86vm -endif - -LDFLAGS += -lX11 -lXext -lm -LDFLAGS += $(GTK_LDFLAGS) -LDFLAGS += $(LIBDL_LDFLAGS) - -MANPAGE_GZIP ?= 1 - -MANPAGE_gzipped = $(OUTPUTDIR)/nvidia-settings.1.gz -MANPAGE_not_gzipped = $(OUTPUTDIR)/nvidia-settings.1 -ifeq ($(MANPAGE_GZIP),1) - MANPAGE = $(MANPAGE_gzipped) -else - MANPAGE = $(MANPAGE_not_gzipped) -endif -GEN_MANPAGE_OPTS = $(OUTPUTDIR)/gen-manpage-opts -OPTIONS_1_INC = $(OUTPUTDIR)/options.1.inc - -# Include all the source lists; dist-files.mk will define SRC -include dist-files.mk - -include $(XCONFIG_PARSER_DIR)/src.mk -SRC += $(addprefix $(XCONFIG_PARSER_DIR)/,$(XCONFIG_PARSER_SRC)) - -include $(COMMON_UTILS_DIR)/src.mk -SRC += $(addprefix $(COMMON_UTILS_DIR)/,$(COMMON_UTILS_SRC)) - -SRC += $(STAMP_C) - -OBJS = $(call BUILD_OBJECT_LIST,$(SRC)) - -CFLAGS += -I src -CFLAGS += -I src/image_data -CFLAGS += -I $(XNVCTRL_DIR) -CFLAGS += -I $(XCONFIG_PARSER_DIR)/.. -CFLAGS += -I src/libXNVCtrlAttributes -CFLAGS += -I src/xpm_data -CFLAGS += -I src/gtk+-2.x -CFLAGS += -I $(COMMON_UTILS_DIR) -CFLAGS += -I $(OUTPUTDIR) -CFLAGS += -DPROGRAM_NAME=\"nvidia-setttings\" - -$(call BUILD_OBJECT_LIST,$(GTK_SRC)): CFLAGS += $(GTK_CFLAGS) - - -############################################################################## -# build rules -############################################################################## - -.PNONY: all install NVIDIA_SETTINGS_install MANPAGE_install clean clobber - -all: $(NVIDIA_SETTINGS) $(MANPAGE) - -install: NVIDIA_SETTINGS_install MANPAGE_install - -NVIDIA_SETTINGS_install: $(NVIDIA_SETTINGS) - $(MKDIR) $(bindir) - $(INSTALL) $(INSTALL_BIN_ARGS) $< $(bindir)/$(notdir $<) - -MANPAGE_install: $(MANPAGE) - $(MKDIR) $(mandir) - $(INSTALL) $(INSTALL_BIN_ARGS) $< $(mandir)/$(notdir $<) - -$(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_ARCHIVE) - $(call quiet_cmd,LINK) -o $@ $(OBJS) $(XNVCTRL_ARCHIVE) \ - $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) - $(call quiet_cmd,STRIP_CMD) $@ - -# define the rule to build each object file -$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,CC,$(src)))) - -# define the rule to generate $(STAMP_C) -$(eval $(call DEFINE_STAMP_C_RULE, $(OBJS),$(NVIDIA_SETTINGS_PROGRAM_NAME))) - -clean clobber: - rm -rf $(NVIDIA_SETTINGS) $(MANPAGE) *~ $(STAMP_C) \ - $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d \ - $(GEN_MANPAGE_OPTS) $(OPTIONS_1_INC) - - -############################################################################## -# Documentation -############################################################################## - -AUTO_TEXT = ".\\\" WARNING: THIS FILE IS AUTO-GENERATED! Edit $< instead." - -doc: $(MANPAGE) - -GEN_MANPAGE_OPTS_SRC = src/gen-manpage-opts.c - -BUILD_MANPAGE_OBJECT_LIST = \ - $(patsubst %.o,%.manpage.o,$(call BUILD_OBJECT_LIST,$(1))) - -GEN_MANPAGE_OPTS_OBJS = \ - $(call BUILD_MANPAGE_OBJECT_LIST,$(GEN_MANPAGE_OPTS_SRC)) - -$(GEN_MANPAGE_OPTS): $(GEN_MANPAGE_OPTS_OBJS) - $(call quiet_cmd,HOST_LINK) $(GEN_MANPAGE_OPTS_OBJS) -o $@ \ - $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_BIN_LDFLAGS) - -# define a rule to build each GEN_MANPAGE_OPTS object file -$(foreach src,$(GEN_MANPAGE_OPTS_SRC),\ - $(eval $(call DEFINE_OBJECT_RULE_WITH_OBJECT_NAME,HOST_CC,$(src),\ - $(call BUILD_MANPAGE_OBJECT_LIST,$(src))))) - -$(OPTIONS_1_INC): $(GEN_MANPAGE_OPTS) - @./$< > $@ - -$(MANPAGE_not_gzipped): doc/nvidia-settings.1.m4 $(OPTIONS_1_INC) - $(call quiet_cmd,M4) \ - -D__HEADER__=$(AUTO_TEXT) \ - -D__BUILD_OS__=$(TARGET_OS) \ - -D__VERSION__=$(NVIDIA_VERSION) \ - -D__DATE__="`$(DATE) +%F`" \ - -I $(OUTPUTDIR) \ - $< > $@ - -$(MANPAGE_gzipped): $(MANPAGE_not_gzipped) - $(GZIP_CMD) -9f < $< > $@ diff --git a/dist-files.mk b/dist-files.mk deleted file mode 100644 index 80dcdb0..0000000 --- a/dist-files.mk +++ b/dev/null @@ -1,60 +0,0 @@ -# -# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix -# and Linux systems. -# -# Copyright (C) 2008 NVIDIA Corporation. -# -# This program is free software; you can redistribute it and/or modify it -# under the terms and conditions of the GNU General Public License, -# version 2, as published by the Free Software Foundation. -# -# 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 General Public License for -# more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses>. -# - -############################################################################## -# define the list of files that should be distributed in the -# nvidia-settings tarball; this is used by the NVIDIA driver build -# when packaging the tarball, and by the nvidia-settings makefile when -# building nvidia-settings. -# -# Defines SRC, EXTRA_DIST, and DIST_FILES -############################################################################## - -SRC := -EXTRA_DIST := COPYING dist-files.mk - -include src/src.mk -SRC += $(addprefix src/,$(SRC_SRC)) -EXTRA_DIST += $(addprefix src/,$(SRC_EXTRA_DIST)) - -include src/image_data/src.mk -SRC += $(addprefix src/image_data/,$(IMAGE_DATA_SRC)) -EXTRA_DIST += $(addprefix src/image_data/,$(IMAGE_DATA_EXTRA_DIST)) - -include src/libXNVCtrlAttributes/src.mk -SRC += $(addprefix src/libXNVCtrlAttributes/,$(LIB_XNVCTRL_ATTRIBUTES_SRC)) -EXTRA_DIST += $(addprefix src/libXNVCtrlAttributes/,$(LIB_XNVCTRL_ATTRIBUTES_EXTRA_DIST)) - -include src/xpm_data/src.mk -SRC += $(addprefix src/xpm_data/,$(LIB_XPM_DATA_SRC)) -EXTRA_DIST += $(addprefix src/xpm_data/,$(LIB_XPM_DATA_EXTRA_DIST)) - -include src/gtk+-2.x/src.mk -SRC += $(addprefix src/gtk+-2.x/,$(GTK_SRC)) -EXTRA_DIST += $(addprefix src/gtk+-2.x/,$(GTK_EXTRA_DIST)) - -include doc/src.mk -SRC += $(addprefix doc/,$(DOC_SRC)) -EXTRA_DIST += $(addprefix doc/,$(DOC_EXTRA_DIST)) - -include samples/src.mk -SRC += $(addprefix samples/,$(SAMPLES_SRC)) -EXTRA_DIST += $(addprefix samples/,$(SAMPLES_EXTRA_DIST)) - -DIST_FILES := $(SRC) $(EXTRA_DIST) diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..40f1472 --- a/dev/null +++ b/doc/Makefile @@ -0,0 +1,115 @@ +# +# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix +# and Linux systems. +# +# Copyright (C) 2008-2012 NVIDIA Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses>. +# + + +############################################################################## +# include common variables and functions +############################################################################## + +UTILS_MK_DIR ?= .. + +include $(UTILS_MK_DIR)/utils.mk + + +############################################################################## +# The common-utils directory may be in one of two places: either +# elsewhere in the driver source tree when building nvidia-settings as +# part of the NVIDIA driver build (in which case, COMMON_UTILS_DIR +# should be defined by the calling makefile), or directly in the +# source directory when building from the nvidia-settings source +# tarball (in which case, the below conditional assignments should be +# used) +############################################################################## + +COMMON_UTILS_DIR ?= ../src/common-utils + + +############################################################################## +# assign variables +############################################################################## + +MANPAGE_GZIP ?= 1 + +MANPAGE_gzipped = $(OUTPUTDIR)/nvidia-settings.1.gz +MANPAGE_not_gzipped = $(OUTPUTDIR)/nvidia-settings.1 +ifeq ($(MANPAGE_GZIP),1) + MANPAGE = $(MANPAGE_gzipped) +else + MANPAGE = $(MANPAGE_not_gzipped) +endif +GEN_MANPAGE_OPTS = $(OUTPUTDIR)/gen-manpage-opts +OPTIONS_1_INC = $(OUTPUTDIR)/options.1.inc + +CFLAGS += -I $(COMMON_UTILS_DIR) +CFLAGS += -I ../src/libXNVCtrlAttributes + + +############################################################################## +# build rules +############################################################################## + +.PNONY: all install MANPAGE_install clean clobber + +all: $(MANPAGE) + +install: MANPAGE_install + +MANPAGE_install: $(MANPAGE) + $(MKDIR) $(MANDIR) + $(INSTALL) $(INSTALL_BIN_ARGS) $< $(MANDIR)/$(notdir $<) + +clean clobber: + rm -rf $(MANPAGE) *~ $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d \ + $(GEN_MANPAGE_OPTS) $(OPTIONS_1_INC) + + +############################################################################## +# Documentation +############################################################################## + +AUTO_TEXT = ".\\\" WARNING: THIS FILE IS AUTO-GENERATED! Edit $< instead." + +doc: $(MANPAGE) + +GEN_MANPAGE_OPTS_SRC = ../src/gen-manpage-opts.c +GEN_MANPAGE_OPTS_SRC += $(COMMON_UTILS_DIR)/gen-manpage-opts-helper.c + +GEN_MANPAGE_OPTS_OBJS = $(call BUILD_OBJECT_LIST,$(GEN_MANPAGE_OPTS_SRC)) + +$(foreach src, $(GEN_MANPAGE_OPTS_SRC), \ + $(eval $(call DEFINE_OBJECT_RULE,HOST_CC,$(src)))) + +$(GEN_MANPAGE_OPTS): $(GEN_MANPAGE_OPTS_OBJS) + $(call quiet_cmd,HOST_LINK) \ + $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_BIN_LDFLAGS) $^ -o $@ + +$(OPTIONS_1_INC): $(GEN_MANPAGE_OPTS) + @./$< > $@ + +$(MANPAGE_not_gzipped): nvidia-settings.1.m4 $(OPTIONS_1_INC) $(VERSION_MK) + $(call quiet_cmd,M4) \ + -D__HEADER__=$(AUTO_TEXT) \ + -D__BUILD_OS__=$(TARGET_OS) \ + -D__VERSION__=$(NVIDIA_VERSION) \ + -D__DATE__="`$(DATE) +%F`" \ + -I $(OUTPUTDIR) \ + $< > $@ + +$(MANPAGE_gzipped): $(MANPAGE_not_gzipped) + $(GZIP_CMD) -9f < $< > $@ diff --git a/doc/nvidia-settings.png b/doc/nvidia-settings.png Binary files differindex b506d99..82acce4 100644 --- a/doc/nvidia-settings.png +++ b/doc/nvidia-settings.png @@ -10,3 +10,5 @@ DOC_EXTRA_DIST += nvidia-settings.1.m4 DOC_EXTRA_DIST += nvidia-settings.desktop DOC_EXTRA_DIST += nvidia-settings.png DOC_EXTRA_DIST += src.mk + +DOC_DIST_FILES := $(DOC_SRC) $(DOC_EXTRA_DIST)
\ No newline at end of file diff --git a/doc/version.mk b/doc/version.mk new file mode 100644 index 0000000..c29a7ba --- a/dev/null +++ b/doc/version.mk @@ -0,0 +1 @@ +NVIDIA_VERSION = 302.07 diff --git a/samples/Makefile b/samples/Makefile index 35be348..8fc8e4b 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -55,7 +55,7 @@ CFLAGS += -I $(LIBXNVCTRL_DIR) LDFLAGS += $(X_LDFLAGS) LDFLAGS += -L $(LIBXNVCTRL_DIR) -LDFLAGS += -lXNVCtrl -lXext -lX11 +LIBS += -lXNVCtrl -lXext -lX11 ############################################################################## @@ -76,7 +76,7 @@ SAMPLE_SOURCES += nv-control-3dvisionpro.c # build rules ############################################################################## -.PHONY: all clean clobber +.PHONY: all clean clobber install # define the rule to build each object file $(foreach src, $(SAMPLE_SOURCES), $(eval $(call DEFINE_OBJECT_RULE,CC,$(src)))) @@ -84,7 +84,7 @@ $(foreach src, $(SAMPLE_SOURCES), $(eval $(call DEFINE_OBJECT_RULE,CC,$(src)))) # define the rule to link each sample app from its corresponding object file define link_sample_from_object $$(OUTPUTDIR)/$(1:.c=): $$(call BUILD_OBJECT_LIST,$(1)) - $$(call quiet_cmd,LINK) $$(CFLAGS) -o $$@ $$< $$(LDFLAGS) $$(BIN_LDFLAGS) + $$(call quiet_cmd,LINK) $$(CFLAGS) $$(LDFLAGS) $$(BIN_LDFLAGS) -o $$@ $$< $$(LIBS) all:: $$(OUTPUTDIR)/$(1:.c=) SAMPLES += $$(OUTPUTDIR)/$(1:.c=) endef @@ -93,3 +93,7 @@ $(foreach sample,$(SAMPLE_SOURCES),$(eval $(call link_sample_from_object,$(sampl clean clobber: rm -rf *~ $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d $(SAMPLES) + +install: + @# don't install samples, this is just to satisfy the top-level + @# recursion rule diff --git a/samples/nv-control-dpy.c b/samples/nv-control-dpy.c index 28fc7e3..b15c0ed 100644 --- a/samples/nv-control-dpy.c +++ b/samples/nv-control-dpy.c @@ -53,6 +53,28 @@ static char *find_modeline(char *modeString, char *pModeLines, +static void print_display_name(Display *dpy, int target_id, int attr, + char *name) +{ + Bool ret; + char *str; + + ret = XNVCTRLQueryTargetStringAttribute(dpy, + NV_CTRL_TARGET_TYPE_DISPLAY, + target_id, 0, + attr, + &str); + if (!ret) { + printf(" %18s : N/A\n", name); + return; + } + + printf(" %18s : %s\n", name, str); + XFree(str); +} + + + int main(int argc, char *argv[]) { @@ -363,8 +385,48 @@ int main(int argc, char *argv[]) XFree(str); } - - + + + /* + * query the MetaModes for the X screen, using + * NV_CTRL_BINARY_DATA_METAMODES_VERSION_2. + */ + + else if (strcmp(argv[1], "--print-metamodes-version2") == 0) { + + /* get list of metamodes */ + + ret = XNVCTRLQueryBinaryData(dpy, screen, 0, // n/a + NV_CTRL_BINARY_DATA_METAMODES_VERSION_2, + (void *) &str, &len); + + if (!ret) { + fprintf(stderr, "Failed to query MetaModes.\n\n"); + return 1; + } + + /* + * the returned data is in the form: + * + * "MetaMode 1\0MetaMode 2\0MetaMode 3\0Last MetaMode\0\0" + * + * so walk from one "\0" to the next to print each MetaMode. + */ + + printf("MetaModes:\n"); + + start = str; + for (j = 0; j < len; j++) { + if (str[j] == '\0') { + printf(" %s\n", start); + start = &str[j+1]; + } + } + + XFree(str); + } + + /* * query the currently in use MetaMode. Note that an alternative * way to accomplish this is to use XRandR to query the current @@ -387,8 +449,32 @@ int main(int argc, char *argv[]) XFree(str); } - - + + + /* + * query the currently in use MetaMode. Note that an alternative + * way to accomplish this is to use XRandR to query the current + * mode's refresh rate, and then match the refresh rate to the id + * reported in the returned NV_CTRL_BINARY_DATA_METAMODES_VERSION_2 data. + */ + + else if (strcmp(argv[1], "--print-current-metamode-version2") == 0) { + + ret = XNVCTRLQueryStringAttribute(dpy, screen, mask, + NV_CTRL_STRING_CURRENT_METAMODE_VERSION_2, + &str); + + if (!ret) { + fprintf(stderr, "Failed to query the current MetaMode.\n\n"); + return 1; + } + + printf("current metamode: \"%s\"\n\n", str); + + XFree(str); + } + + /* * add the given MetaMode to X screen's list of MetaModes, using * NV_CTRL_STRING_OPERATION_ADD_METAMODE; example MetaMode string: @@ -1163,7 +1249,54 @@ int main(int argc, char *argv[]) printf("The id of the new MetaMode is %d; use xrandr to " "switch to it.\n\n", id); } - + + + /* Display all names each display device goes by + */ + else if (strcmp(argv[1], "--print-display-names") == 0) { + unsigned int *pData; + int len, i; + + printf("Display Device Information:\n"); + + ret = XNVCTRLQueryTargetBinaryData(dpy, + NV_CTRL_TARGET_TYPE_GPU, + 0, + 0, + NV_CTRL_BINARY_DATA_DISPLAY_TARGETS, + (unsigned char **) &pData, + &len); + if (!ret) { + fprintf(stderr, "Failed to query number of display devices.\n\n"); + return 1; + } + + printf(" number of display devices: %d\n", pData[0]); + + for (i = 1; i <= pData[0]; i++) { + + printf("\n Display Device: %d\n", pData[i]); + + print_display_name(dpy, pData[i], + NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME, + "Type Basename"); + print_display_name(dpy, pData[i], + NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID, + "Type ID"); + print_display_name(dpy, pData[i], + NV_CTRL_STRING_DISPLAY_NAME_DP_GUID, + "DP GUID"); + print_display_name(dpy, pData[i], + NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH, + "EDID HASH"); + print_display_name(dpy, pData[i], + NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX, + "Target Index"); + print_display_name(dpy, pData[i], + NV_CTRL_STRING_DISPLAY_NAME_RANDR, + "RANDR"); + } + } /* * print help information @@ -1204,6 +1337,9 @@ int main(int argc, char *argv[]) printf(" --print-metamodes: print the current MetaModes for the " "X screen\n\n"); + printf(" --print-metamodes-version2: print the current MetaModes for " + "the X screen with extended information\n\n"); + printf(" --add-metamode [metamode]: add the specified " "MetaMode to the X screen's list of MetaModes.\n\n"); @@ -1212,7 +1348,10 @@ int main(int argc, char *argv[]) printf(" --print-current-metamode: print the current MetaMode.\n\n"); - + printf(" --print-current-metamode-version2: print the current " + "MetaMode with extended information.\n\n"); + + printf(" Misc options:\n\n"); printf(" --get-valid-freq-ranges: query the valid frequency " @@ -1246,6 +1385,9 @@ int main(int argc, char *argv[]) printf(" --dynamic-twinview: demonstrates the process of " "dynamically transitioning into TwinView.\n\n"); + + printf(" --print-display-names: print all the names associated with " + "each display device on the server\n\n"); } return 0; diff --git a/samples/nv-control-dvc.c b/samples/nv-control-dvc.c index dde9c0e..e8243bc 100644 --- a/samples/nv-control-dvc.c +++ b/samples/nv-control-dvc.c @@ -52,7 +52,7 @@ * to the display device mask. */ -char *display_device_name(int mask) +static char *display_device_name(int mask) { switch (mask) { case (1 << 0): return "CRT-0"; break; diff --git a/samples/nv-control-events.c b/samples/nv-control-events.c index 4b9e402..3364203 100644 --- a/samples/nv-control-events.c +++ b/samples/nv-control-events.c @@ -30,6 +30,7 @@ #include <stdlib.h> #include <string.h> #include <ctype.h> +#include <unistd.h> #include <X11/Xlib.h> @@ -37,30 +38,117 @@ #include "NVCtrl.h" #include "NVCtrlLib.h" +#define EVENT_TYPE_START TARGET_ATTRIBUTE_CHANGED_EVENT +#define EVENT_TYPE_END TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT + + static const char *attr2str(int n); static const char *target2str(int n); +static const char *targetTypeAndId2Str(int targetType, int targetId); + +struct target_info { + int type; + int count; +}; + +static void print_usage(char **argv) +{ + printf("Usage:\n"); + printf("%s [-d <dpy>] [-a] [-c] [-b] [-s]\n", argv[0]); + printf("\n"); + printf("-d <dpy>: X server display to connect to\n"); + printf("-a: Listen for attribute availability events\n"); + printf("-c: Listen for attribute changed events\n"); + printf("-b: Listen for binary attribute changed events\n"); + printf("-s: Listen for string attribute changed events\n"); + printf("\n"); + printf("By default (i.e., if none of -a, -c, -b, or -s are requested),\n" + "all event types are enabled.\n"); +} -int main(void) +int main(int argc, char **argv) { Display *dpy; Bool ret; int event_base, error_base; - int num_screens, num_gpus, num_framelocks, num_vcs, i; - int num_gvis, num_coolers, num_thermal_sensors; - int num_3d_vision_pro_transceivers; - int sources; - XEvent event; - XNVCtrlAttributeChangedEvent *nvevent; - XNVCtrlAttributeChangedEventTarget *nveventtarget; + int i, j, k; + int sources = 0; + struct target_info info[] = { + { .type = NV_CTRL_TARGET_TYPE_X_SCREEN }, + { .type = NV_CTRL_TARGET_TYPE_GPU }, + { .type = NV_CTRL_TARGET_TYPE_FRAMELOCK }, + { .type = NV_CTRL_TARGET_TYPE_VCSC }, + { .type = NV_CTRL_TARGET_TYPE_GVI }, + { .type = NV_CTRL_TARGET_TYPE_COOLER }, + { .type = NV_CTRL_TARGET_TYPE_THERMAL_SENSOR }, + { .type = NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER }, + }; + static const int num_target_types = sizeof(info) / sizeof(*info); + + int c; + char *dpy_name = NULL; + Bool anythingEnabled; + +#define EVENT_TYPE_ENTRY(_x) [_x] = { False, #_x } + + struct { + Bool enabled; + char *description; + } eventTypes[] = { + EVENT_TYPE_ENTRY(TARGET_ATTRIBUTE_CHANGED_EVENT), + EVENT_TYPE_ENTRY(TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT), + EVENT_TYPE_ENTRY(TARGET_STRING_ATTRIBUTE_CHANGED_EVENT), + EVENT_TYPE_ENTRY(TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT), + }; + + while ((c = getopt(argc, argv, "d:acbsh")) >= 0) { + switch (c) { + case 'd': + dpy_name = optarg; + break; + case 'a': + eventTypes[TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT].enabled = True; + break; + case 'c': + eventTypes[TARGET_ATTRIBUTE_CHANGED_EVENT].enabled = True; + break; + case 'b': + eventTypes[TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT].enabled = True; + break; + case 's': + eventTypes[TARGET_STRING_ATTRIBUTE_CHANGED_EVENT].enabled = True; + break; + case '?': + fprintf(stderr, "%s: Unknown argument '%c'\n", argv[0], optopt); + /* fallthrough */ + case 'h': + print_usage(argv); + return 1; + } + } + + anythingEnabled = False; + for (i = EVENT_TYPE_START; i <= EVENT_TYPE_END; i++) { + if (eventTypes[i].enabled) { + anythingEnabled = True; + break; + } + } + + if (!anythingEnabled) { + for (i = EVENT_TYPE_START; i <= EVENT_TYPE_END; i++) { + eventTypes[i].enabled = True; + } + } /* * Open a display connection, and make sure the NV-CONTROL X * extension is present on the screen we want to use. */ - - dpy = XOpenDisplay(NULL); + + dpy = XOpenDisplay(dpy_name); if (!dpy) { - fprintf(stderr, "Cannot open display '%s'.\n", XDisplayName(NULL)); + fprintf(stderr, "Cannot open display '%s'.\n", XDisplayName(dpy_name)); return 1; } @@ -71,305 +159,97 @@ int main(void) ret = XNVCTRLQueryExtension(dpy, &event_base, &error_base); if (ret != True) { fprintf(stderr, "The NV-CONTROL X extension does not exist on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Query number of X Screens */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, - &num_screens); - if (ret != True) { - fprintf(stderr, "Failed to query the number of X Screens on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Query number of GPUs */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_GPU, - &num_gpus); - if (ret != True) { - fprintf(stderr, "Failed to query the number of GPUs on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Query number of Frame Lock (G-Sync) devices */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_FRAMELOCK, - &num_framelocks); - if (ret != True) { - fprintf(stderr, "Failed to query the number of G-Sync devices on " - "'%s'.\n", - XDisplayName(NULL)); + XDisplayName(dpy_name)); return 1; } - /* Query number of VCS (Visual Computing System) devices */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_VCSC, - &num_vcs); - if (ret != True) { - fprintf(stderr, "Failed to query the number of Visual Computing " - "System devices on '%s'.\n", - XDisplayName(NULL)); - return 1; - } + /* Query target counts */ + for (i = 0; i < num_target_types; i++) { - /* Query number of GVI (Graphics Video Input) devices */ + struct target_info *tinfo = &info[i]; - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_GVI, - &num_gvis); - if (ret != True) { - fprintf(stderr, "Failed to query the number of Graphics Video " - "Input devices on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Query number of Cooler devices */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_COOLER, - &num_coolers); - if (ret != True) { - fprintf(stderr, "Failed to query the number of Cooler devices " - "on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Query number of Thermal Sensor devices */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, - &num_thermal_sensors); - if (ret != True) { - fprintf(stderr, "Failed to query the number of Thermal Sensor " - "devices on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* Query number of 3d Vision Pro Transceivers */ - - ret = XNVCTRLQueryTargetCount(dpy, NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER, - &num_3d_vision_pro_transceivers); - if (ret != True) { - fprintf(stderr, "Failed to query the number of 3D Vision Pro " - "Transceiver devices on '%s'.\n", - XDisplayName(NULL)); - return 1; - } - - /* - * register to receive NV-CONTROL events: whenever any NV-CONTROL - * attribute is changed by an NV-CONTROL client, any other client - * can receive notification of the change. - */ - - sources = 0; - - /* - * - Register to receive ATTRIBUTE_CHANGE_EVENT events. These events - * are specific to attributes set on X Screens. - */ - - printf("Registering to receive ATTRIBUTE_CHANGED_EVENT events...\n"); - fflush(stdout); - - for (i = 0; i < num_screens; i++ ) { - - /* Only register to receive events if this screen is controlled by - * the NVIDIA driver. - */ - if (!XNVCTRLIsNvScreen(dpy, i)) { - printf("- The NV-CONTROL X not available on X screen " - "%d of '%s'.\n", i, XDisplayName(NULL)); - continue; - } - - ret = XNVCtrlSelectNotify(dpy, i, ATTRIBUTE_CHANGED_EVENT, True); + ret = XNVCTRLQueryTargetCount(dpy, tinfo->type, &tinfo->count); if (ret != True) { - printf("- Unable to register to receive NV-CONTROL events on '%s'." - "\n", XDisplayName(NULL)); - continue; + fprintf(stderr, "Failed to query %s target count on '%s'.\n", + target2str(tinfo->type), XDisplayName(dpy_name)); + return 1; } - - printf("+ Listening to ATTRIBUTE_CHANGE_EVENTs on X screen %d.\n", i); - sources++; } - printf("\n"); - /* - * - Register to receive TARGET_ATTRIBUTE_CHANGED_EVENT events. These - * events are specific to attributes set on various devices and - * structures controlled by the NVIDIA driver. Some possible targets - * include X Screens, GPUs, and Frame Lock boards. - */ - - printf("Registering to receive TARGET_ATTRIBUTE_CHANGED_EVENT " - "events...\n"); + printf("Registering to receive events...\n"); fflush(stdout); - /* Register to receive on all X Screen targets */ - - for (i = 0; i < num_screens; i++ ) { - - /* Only register to receive events if this screen is controlled by - * the NVIDIA driver. - */ - if (!XNVCTRLIsNvScreen(dpy, i)) { - printf("- The NV-CONTROL X not available on X screen " - "%d of '%s'.\n", i, XDisplayName(NULL)); - continue; - } - - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_X_SCREEN, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for X screen %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on X screen " - "%d.\n", i); - sources++; - } + /* Register to receive events on all targets */ - /* Register to receive on all GPU targets */ + for (i = 0; i < num_target_types; i++) { + struct target_info *tinfo = &info[i]; - for (i = 0; i < num_gpus; i++ ) { + for (j = 0; j < tinfo->count; j++) { - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_GPU, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for GPU %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on GPU " - "%d.\n", i); - sources++; - } - - /* Register to receive on all Frame Lock (G-Sync) targets */ - - for (i = 0; i < num_framelocks; i++ ) { - - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_FRAMELOCK, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for Frame Lock %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on Frame Lock " - "%d.\n", i); - sources++; - } - - /* Register to receive on all VCS targets */ - - for (i = 0; i < num_vcs; i++ ) { - - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_VCSC, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for VCS %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on VCS " - "%d.\n", i); - sources++; - } - - /* Register to receive on all GVI targets */ - - for (i = 0; i < num_gvis; i++ ) { - - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_GVI, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for GVI %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on GVI " - "%d.\n", i); - sources++; - } - - /* Register to receive on all Cooler targets */ - - for (i = 0; i < num_coolers; i++ ) { - - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_COOLER, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for Cooler %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on Cooler " - "%d.\n", i); - sources++; - } - - /* Register to receive on all Thermal Sensor targets */ - - for (i = 0; i < num_thermal_sensors; i++ ) { + for (k = EVENT_TYPE_START; k <= EVENT_TYPE_END; k++) { + if (!eventTypes[k].enabled) { + continue; + } - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_THERMAL_SENSOR, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for Thermal Sensor %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; - } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on Thermal " - "Sensor %d.\n", i); - sources++; - } + if ((k == TARGET_ATTRIBUTE_CHANGED_EVENT) && + (tinfo->type == NV_CTRL_TARGET_TYPE_X_SCREEN)) { + + /* + * Only register to receive events if this screen is + * controlled by the NVIDIA driver. + */ + if (!XNVCTRLIsNvScreen(dpy, j)) { + printf("- The NV-CONTROL X not available on X screen " + "%d of '%s'.\n", i, XDisplayName(dpy_name)); + continue; + } + + /* + * - Register to receive ATTRIBUTE_CHANGE_EVENT events. + * These events are specific to attributes set on X + * Screens. + */ + + + ret = XNVCtrlSelectNotify(dpy, j, ATTRIBUTE_CHANGED_EVENT, + True); + if (ret != True) { + printf("- Unable to register to receive NV-CONTROL" + "events on '%s'.\n", XDisplayName(dpy_name)); + continue; + } + + printf("+ Listening on X screen %d for " + "ATTRIBUTE_CHANGED_EVENTs.\n", j); + sources++; + } - /* Register to receive on all 3D Vision Pro Transceiver targets */ + /* + * - Register to receive TARGET_ATTRIBUTE_CHANGED_EVENT events. + * These events are specific to attributes set on various + * devices and structures controlled by the NVIDIA driver. + * Some possible targets include X Screens, GPUs, and Frame + * Lock boards. + */ + + ret = XNVCtrlSelectTargetNotify(dpy, + tinfo->type, /* target type */ + j, /* target ID */ + k, /* eventType */ + True); + if (ret != True) { + printf("- Unable to register on %s %d for %ss.\n", + target2str(tinfo->type), j, + eventTypes[k].description); + continue; + } - for (i = 0; i < num_3d_vision_pro_transceivers; i++ ) { + printf("+ Listening on %s %d for %ss.\n", + target2str(tinfo->type), j, eventTypes[k].description); - ret = XNVCtrlSelectTargetNotify(dpy, NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER, - i, TARGET_ATTRIBUTE_CHANGED_EVENT, - True); - if (ret != True) { - printf("- Unable to register to receive NV-CONTROL " - "target events for 3D Vision Pro Transceiver %d on '%s'.\n", - i, XDisplayName(NULL)); - continue; + sources++; + } } - - printf("+ Listening to TARGET_ATTRIBUTE_CHANGE_EVENTs on 3d Vision " - "Pro Transceiver %d.\n", i); - sources++; } /* @@ -386,31 +266,25 @@ int main(void) */ while (True) { - char target_str[256]; + XEvent event; + const char *target_str; /* block for the next event */ XNextEvent(dpy, &event); - /* if this is not one of our events, then bail out of this iteration */ - - if ((event.type != (event_base + ATTRIBUTE_CHANGED_EVENT)) && - (event.type != (event_base + TARGET_ATTRIBUTE_CHANGED_EVENT))) - continue; - /* Handle ATTRIBUTE_CHANGED_EVENTS */ if (event.type == (event_base + ATTRIBUTE_CHANGED_EVENT)) { /* cast the X event as an XNVCtrlAttributeChangedEvent */ - - nvevent = (XNVCtrlAttributeChangedEvent *) &event; - - /* print out the event information */ - snprintf(target_str, 256, "%s-%-3d", - target2str(NV_CTRL_TARGET_TYPE_X_SCREEN), - nvevent->screen); + XNVCtrlAttributeChangedEvent *nvevent = + (XNVCtrlAttributeChangedEvent *) &event; + + target_str = targetTypeAndId2Str(NV_CTRL_TARGET_TYPE_X_SCREEN, + nvevent->screen); - printf("ATTRIBUTE_CHANGED_EVENTS: Target: %15s " + /* print out the event information */ + printf("ATTRIBUTE_CHANGED_EVENTS: Target: %15s " "Display Mask: 0x%08x " "Attribute: (%3d) %-32s Value: %d (0x%08x)\n", target_str, @@ -424,16 +298,16 @@ int main(void) /* Handle TARGET_ATTRIBUTE_CHANGED_EVENTS */ } else if (event.type == (event_base + TARGET_ATTRIBUTE_CHANGED_EVENT)) { + /* cast the X event as an XNVCtrlAttributeChangedEventTarget */ - - nveventtarget = (XNVCtrlAttributeChangedEventTarget *) &event; - - /* print out the event information */ - snprintf(target_str, 256, "%s-%-3d", - target2str(nveventtarget->target_type), - nveventtarget->target_id); + XNVCtrlAttributeChangedEventTarget *nveventtarget = + (XNVCtrlAttributeChangedEventTarget *) &event; - printf("TARGET_ATTRIBUTE_CHANGED_EVENTS: Target: %15s " + target_str = targetTypeAndId2Str(nveventtarget->target_type, + nveventtarget->target_id); + + /* print out the event information */ + printf("TARGET_ATTRIBUTE_CHANGED_EVENT: Target: %15s " "Display Mask: 0x%08x " "Attribute: (%3d) %-32s Value: %d (0x%08x)\n", target_str, @@ -443,6 +317,66 @@ int main(void) nveventtarget->value, nveventtarget->value ); + + /* Handle TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENTS */ + } else if (event.type == + (event_base + TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT)) { + + /* cast the X event as an XNVCtrlAttributeChangedEventTargetAvailability */ + XNVCtrlAttributeChangedEventTargetAvailability *nveventavail = + (XNVCtrlAttributeChangedEventTargetAvailability *) &event; + + target_str = targetTypeAndId2Str(nveventavail->target_type, + nveventavail->target_id); + + /* print out the event information */ + printf("TARGET_ATTRIBUTE_AVAILABILITY_CHANGED_EVENT: Target: %15s " + "Display Mask: 0x%08x " + "Attribute: (%3d) %-32s Available: %s\n", + target_str, + nveventavail->display_mask, + nveventavail->attribute, + attr2str(nveventavail->attribute), + nveventavail->availability ? "Yes" : "No" + ); + } else if (event.type == + (event_base + TARGET_STRING_ATTRIBUTE_CHANGED_EVENT)) { + + XNVCtrlStringAttributeChangedEventTarget *nveventstring = + (XNVCtrlStringAttributeChangedEventTarget*) &event; + + target_str = targetTypeAndId2Str(nveventstring->target_type, + nveventstring->target_id); + + /* print out the event information */ + printf("TARGET_STRING_ATTRIBUTE_CHANGED_EVENT: Target: %15s " + "Display Mask: 0x%08x " + "Attribute: %3d\n", + target_str, + nveventstring->display_mask, + nveventstring->attribute + ); + + } else if (event.type == + (event_base + TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT)) { + + XNVCtrlBinaryAttributeChangedEventTarget *nveventbinary = + (XNVCtrlBinaryAttributeChangedEventTarget *) &event; + + target_str = targetTypeAndId2Str(nveventbinary->target_type, + nveventbinary->target_id); + + /* print out the event information */ + printf("TARGET_BINARY_ATTRIBUTE_CHANGED_EVENT: Target: %15s " + "Display Mask: 0x%08x " + "Attribute: %3d\n", + target_str, + nveventbinary->display_mask, + nveventbinary->attribute + ); + + } else { + printf("ERROR: unrecognized event type %d\n", event.type); } } @@ -481,6 +415,15 @@ static const char *target2str(int n) } } +static const char *targetTypeAndId2Str(int targetType, int targetId) +{ + static char tmp[256]; + + snprintf(tmp, sizeof(tmp), "%s-%-3d", target2str(targetType), targetId); + + return tmp; +} + // Used to convert the NV-CONTROL #defines to human readable text. #define MAKE_ENTRY(ATTRIBUTE) { ATTRIBUTE, #ATTRIBUTE, NULL } @@ -590,7 +533,6 @@ static AttrEntry attr_table[] = { MAKE_ENTRY(NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT), MAKE_ENTRY(NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT), MAKE_ENTRY(NV_CTRL_GVO_DATA_FORMAT), - MAKE_ENTRY(NV_CTRL_GVO_DISPLAY_X_SCREEN), MAKE_ENTRY(NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED), MAKE_ENTRY(NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE), MAKE_ENTRY(NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED), @@ -603,8 +545,6 @@ static AttrEntry attr_table[] = { MAKE_ENTRY(NV_CTRL_GVIO_VIDEO_FORMAT_WIDTH), MAKE_ENTRY(NV_CTRL_GVIO_VIDEO_FORMAT_HEIGHT), MAKE_ENTRY(NV_CTRL_GVIO_VIDEO_FORMAT_REFRESH_RATE), - MAKE_ENTRY(NV_CTRL_GVO_X_SCREEN_PAN_X), - MAKE_ENTRY(NV_CTRL_GVO_X_SCREEN_PAN_Y), MAKE_ENTRY(NV_CTRL_GPU_OVERCLOCKING_STATE), MAKE_ENTRY(NV_CTRL_GPU_2D_CLOCK_FREQS), MAKE_ENTRY(NV_CTRL_GPU_3D_CLOCK_FREQS), diff --git a/samples/nv-control-gvi.c b/samples/nv-control-gvi.c index 6e0a4de..c5a0d91 100644 --- a/samples/nv-control-gvi.c +++ b/samples/nv-control-gvi.c @@ -46,24 +46,10 @@ case (FMT): \ /* - * Decode SDI input value returned. - */ -char *SyncTypeName(int value) -{ - switch (value) { - ADD_NVCTRL_CASE(NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_HD); - ADD_NVCTRL_CASE(NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_SD); - ADD_NVCTRL_CASE(NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED_NONE); - default: - return "Invalid Value"; - } -} - -/* * Decode provided signal format. */ -char *VideoFormatName(int value) +static char *VideoFormatName(int value) { switch(value) { ADD_NVCTRL_CASE(NV_CTRL_GVIO_VIDEO_FORMAT_NONE); @@ -136,7 +122,7 @@ char *VideoFormatName(int value) } } -const char *SamplingName(int value) +static const char *SamplingName(int value) { switch (value) { default: @@ -150,7 +136,7 @@ const char *SamplingName(int value) } } -const char *BPCName(int value) +static const char *BPCName(int value) { switch (value) { ADD_NVCTRL_CASE(NV_CTRL_GVI_BITS_PER_COMPONENT_UNKNOWN); @@ -349,9 +335,10 @@ static void do_query(Display *dpy, int use_gvi) printf(" - Jack %d\n", jack); for (channel = 0; channel < max_channels_per_jack; channel++) { + unsigned int link_definition = ((channel & 0xFFFF)<<16); + printf(" - Channel %d\n", channel); - unsigned int link_definition = ((channel & 0xFFFF)<<16); link_definition |= (jack & 0xFFFF); ret = XNVCTRLQueryTargetAttribute(dpy, @@ -571,13 +558,13 @@ static void do_query(Display *dpy, int use_gvi) -unsigned int firstbit (unsigned int mask) +static unsigned int firstbit (unsigned int mask) { return mask ^ ((mask - 1) & mask); } // List the configuration space of the GVI device. -void do_listconfig(Display *dpy, int gvi) +static void do_listconfig(Display *dpy, int gvi) { NVCTRLAttributeValidValuesRec values; @@ -770,7 +757,7 @@ void do_listconfig(Display *dpy, int gvi) -void do_configure(Display *dpy, int use_gvi, char *pIn) +static void do_configure(Display *dpy, int use_gvi, char *pIn) { Bool ret; char *pOut = NULL; diff --git a/samples/nv-control-info.c b/samples/nv-control-info.c index c86e736..777a3a7 100644 --- a/samples/nv-control-info.c +++ b/samples/nv-control-info.c @@ -142,7 +142,6 @@ static AttrEntry attr_int_table[] = { MAKE_ENTRY(NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT), MAKE_ENTRY(NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT), MAKE_ENTRY(NV_CTRL_GVO_DATA_FORMAT), - MAKE_ENTRY(NV_CTRL_GVO_DISPLAY_X_SCREEN), MAKE_ENTRY(NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED), MAKE_ENTRY(NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE), MAKE_ENTRY(NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED), @@ -155,8 +154,6 @@ static AttrEntry attr_int_table[] = { MAKE_ENTRY(NV_CTRL_GVIO_VIDEO_FORMAT_WIDTH), MAKE_ENTRY(NV_CTRL_GVIO_VIDEO_FORMAT_HEIGHT), MAKE_ENTRY(NV_CTRL_GVIO_VIDEO_FORMAT_REFRESH_RATE), - MAKE_ENTRY(NV_CTRL_GVO_X_SCREEN_PAN_X), - MAKE_ENTRY(NV_CTRL_GVO_X_SCREEN_PAN_Y), MAKE_ENTRY(NV_CTRL_GPU_OVERCLOCKING_STATE), MAKE_ENTRY(NV_CTRL_GPU_2D_CLOCK_FREQS), MAKE_ENTRY(NV_CTRL_GPU_3D_CLOCK_FREQS), @@ -372,13 +369,20 @@ static AttrEntry attr_str_table[] = { MAKE_ENTRY(NV_CTRL_STRING_3D_VISION_PRO_GLASSES_FIRMWARE_DATE_A), MAKE_ENTRY(NV_CTRL_STRING_3D_VISION_PRO_GLASSES_ADDRESS), MAKE_ENTRY(NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME), + MAKE_ENTRY(NV_CTRL_STRING_CURRENT_METAMODE_VERSION_2), + MAKE_ENTRY(NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME), + MAKE_ENTRY(NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID), + MAKE_ENTRY(NV_CTRL_STRING_DISPLAY_NAME_DP_GUID), + MAKE_ENTRY(NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH), + MAKE_ENTRY(NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX), + MAKE_ENTRY(NV_CTRL_STRING_DISPLAY_NAME_RANDR), { -1, NULL, NULL } }; static AttrEntry attr_bin_table[] = { MAKE_ENTRY(NV_CTRL_BINARY_DATA_EDID), MAKE_ENTRY(NV_CTRL_BINARY_DATA_MODELINES), - MAKE_ENTRY(NV_CTRL_BINARY_DATA_METAMODES), + MAKE_ENTRY(NV_CTRL_BINARY_DATA_METAMODES_VERSION_1), MAKE_ENTRY(NV_CTRL_BINARY_DATA_XSCREENS_USING_GPU), MAKE_ENTRY(NV_CTRL_BINARY_DATA_GPUS_USED_BY_XSCREEN), MAKE_ENTRY(NV_CTRL_BINARY_DATA_GPUS_USING_FRAMELOCK), @@ -390,6 +394,9 @@ static AttrEntry attr_bin_table[] = { MAKE_ENTRY(NV_CTRL_BINARY_DATA_GPUS_USED_BY_LOGICAL_XSCREEN), MAKE_ENTRY(NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU), MAKE_ENTRY(NV_CTRL_BINARY_DATA_GLASSES_PAIRED_TO_3D_VISION_PRO_TRANSCEIVER), + MAKE_ENTRY(NV_CTRL_BINARY_DATA_DISPLAY_TARGETS), + MAKE_ENTRY(NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU), + MAKE_ENTRY(NV_CTRL_BINARY_DATA_METAMODES_VERSION_2), { -1, NULL, NULL } }; @@ -404,7 +411,7 @@ static AttrEntry attr_strop_table[] = { }; -void print_perms(NVCTRLAttributePermissionsRec *perms) +static void print_perms(NVCTRLAttributePermissionsRec *perms) { printf("%c", (perms->permissions & ATTRIBUTE_TYPE_READ) ? 'R' : '_'); printf("%c", (perms->permissions & ATTRIBUTE_TYPE_WRITE) ? 'W' : '_'); @@ -426,7 +433,7 @@ void print_perms(NVCTRLAttributePermissionsRec *perms) case (FMT): \ return #FMT; -const char *GetAttrTypeName(value) +static const char *GetAttrTypeName(int value) { switch (value) { ADD_NVCTRL_CASE(ATTRIBUTE_TYPE_UNKNOWN); diff --git a/samples/nv-control-targets.c b/samples/nv-control-targets.c index 0f402db..f9236cc 100644 --- a/samples/nv-control-targets.c +++ b/samples/nv-control-targets.c @@ -46,7 +46,7 @@ * to the display device mask. */ -char *display_device_name(int mask) +static char *display_device_name(int mask) { switch (mask) { case (1 << 0): return "CRT-0"; break; diff --git a/samples/src.mk b/samples/src.mk index 8ae3d84..8bc8558 100644 --- a/samples/src.mk +++ b/samples/src.mk @@ -15,3 +15,5 @@ SAMPLES_EXTRA_DIST += nv-control-targets.c SAMPLES_EXTRA_DIST += nv-control-framelock.c SAMPLES_EXTRA_DIST += nv-control-screen.h SAMPLES_EXTRA_DIST += src.mk + +SAMPLES_DIST_FILES := $(SAMPLES_SRC) $(SAMPLES_EXTRA_DIST)
\ No newline at end of file diff --git a/samples/version.mk b/samples/version.mk new file mode 100644 index 0000000..c29a7ba --- a/dev/null +++ b/samples/version.mk @@ -0,0 +1 @@ +NVIDIA_VERSION = 302.07 diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..c7e79b3 --- a/dev/null +++ b/src/Makefile @@ -0,0 +1,174 @@ +# +# nvidia-settings: A tool for configuring the NVIDIA X driver on Unix +# and Linux systems. +# +# Copyright (C) 2008-2012 NVIDIA Corporation. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# 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 General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses>. +# + + +############################################################################## +# include common variables and functions +############################################################################## + +UTILS_MK_DIR ?= .. + +include $(UTILS_MK_DIR)/utils.mk + + +############################################################################## +# The calling Makefile may export any of the following variables; we +# assign default values if they are not exported by the caller +############################################################################## + +ifndef X_LDFLAGS + ifeq ($(TARGET_OS)-$(TARGET_ARCH),Linux-x86_64) + X_LDFLAGS = -L/usr/X11R6/lib64 + else + X_LDFLAGS = -L/usr/X11R6/lib + endif +endif + +X_CFLAGS ?= + +GL_INCLUDE_PATH ?= /usr/include + +PKG_CONFIG ?= pkg-config + +ifndef GTK_CFLAGS + GTK_CFLAGS := $(shell $(PKG_CONFIG) --cflags gtk+-2.0) +endif + +ifndef GTK_LDFLAGS + GTK_LDFLAGS := $(shell $(PKG_CONFIG) --libs gtk+-2.0) +endif + + +############################################################################## +# The XF86Config-parser, libXNVCtrl, and common-utils directories may +# be in one of two places: either elsewhere in the driver source tree +# when building nvidia-settings as part of the NVIDIA driver build (in +# which case, XNVCTRL_DIR, XNVCTRL_ARCHIVE, XCONFIG_PARSER_DIR and +# COMMON_UTILS_DIR should be defined by the calling makefile), or +# directly in the source directory when building from the +# nvidia-settings source tarball (in which case, the below conditional +# assignments should be used) +############################################################################## + +XNVCTRL_DIR ?= libXNVCtrl +XNVCTRL_ARCHIVE ?= $(XNVCTRL_DIR)/libXNVCtrl.a +XCONFIG_PARSER_DIR ?= XF86Config-parser +COMMON_UTILS_DIR ?= common-utils + +############################################################################## +# assign variables +############################################################################## + +NVIDIA_SETTINGS = $(OUTPUTDIR)/nvidia-settings + +NVIDIA_SETTINGS_PROGRAM_NAME = "nvidia-settings" + +NVIDIA_SETTINGS_VERSION := $(NVIDIA_VERSION) + +CFLAGS += $(X_CFLAGS) + +ifeq ($(TARGET_OS),SunOS) + LDFLAGS += -Wl,-rpath=/usr/X11R6/lib +endif + +LDFLAGS += $(X_LDFLAGS) + +# Some older Linux distributions do not have the dynamic library +# libXxf86vm.so, though some newer Linux distributions do not have the +# static library libXxf86vm.a. Statically link against libXxf86vm +# when building nvidia-settings within the NVIDIA driver build, but +# dynamically link against libXxf86vm in the public builds. +ifdef NV_LINK_LIBXXF86VM_STATICALLY + LIBS += -Wl,-Bstatic -lXxf86vm -Wl,-Bdynamic +else + LIBS += -lXxf86vm +endif + +# Preferably, we would use pkg-config's "--libs-only-l" and +# "--libs-only-L" options to get separate GTK_LDFLAGS and GTK_LIBS, +# appending them to LDFLAGS and LIBS, respectively. However, the +# pkg-config(1) man page cautions: +# +# [...] Note that the union of "--libs-only-l" and +# "--libs-only-L" may be smaller than "--libs", due to flags such +# as -rdynamic. +# +# So append all of GTK_LDFLAGS to LIBS, so that LIBS can go after +# $(OBJECTS) on the link commandline, causing libraries for linking to +# be named after the objects that depend on those libraries (needed +# for "--as-needed" linker behavior). +LIBS += -lX11 -lXext -lm $(LIBDL_LIBS) $(GTK_LDFLAGS) + +# Include all the source lists; dist-files.mk will define NVIDIA_SETTINGS_SRC +include src.mk +SRC += $(NVIDIA_SETTINGS_SRC) + +include $(XCONFIG_PARSER_DIR)/src.mk +SRC += $(addprefix $(XCONFIG_PARSER_DIR)/,$(XCONFIG_PARSER_SRC)) + +include $(COMMON_UTILS_DIR)/src.mk +SRC += $(addprefix $(COMMON_UTILS_DIR)/,$(COMMON_UTILS_SRC)) + +SRC += $(STAMP_C) + +OBJS = $(call BUILD_OBJECT_LIST,$(SRC)) + +CFLAGS += -I . +CFLAGS += -I image_data +CFLAGS += -I $(XNVCTRL_DIR) +CFLAGS += -I $(XCONFIG_PARSER_DIR)/.. +CFLAGS += -I libXNVCtrlAttributes +CFLAGS += -I xpm_data +CFLAGS += -I gtk+-2.x +CFLAGS += -I $(COMMON_UTILS_DIR) +CFLAGS += -I $(OUTPUTDIR) +CFLAGS += -DPROGRAM_NAME=\"nvidia-setttings\" + +$(call BUILD_OBJECT_LIST,$(GTK_SRC)): CFLAGS += $(GTK_CFLAGS) + + +############################################################################## +# build rules +############################################################################## + +.PNONY: all install NVIDIA_SETTINGS_install clean clobber + +all: $(NVIDIA_SETTINGS) + +install: NVIDIA_SETTINGS_install + +NVIDIA_SETTINGS_install: $(NVIDIA_SETTINGS) + $(MKDIR) $(BINDIR) + $(INSTALL) $(INSTALL_BIN_ARGS) $< $(BINDIR)/$(notdir $<) + +$(NVIDIA_SETTINGS): $(OBJS) $(XNVCTRL_ARCHIVE) + $(call quiet_cmd,LINK) $(CFLAGS) $(LDFLAGS) $(BIN_LDFLAGS) -o $@ $(OBJS) \ + $(XNVCTRL_ARCHIVE) $(LIBS) + $(call quiet_cmd,STRIP_CMD) $@ + +# define the rule to build each object file +$(foreach src,$(SRC),$(eval $(call DEFINE_OBJECT_RULE,CC,$(src)))) + +# define the rule to generate $(STAMP_C) +$(eval $(call DEFINE_STAMP_C_RULE, $(OBJS),$(NVIDIA_SETTINGS_PROGRAM_NAME))) + +clean clobber: + rm -rf $(NVIDIA_SETTINGS) *~ $(STAMP_C) \ + $(OUTPUTDIR)/*.o $(OUTPUTDIR)/*.d + diff --git a/src/command-line.c b/src/command-line.c index f728157..605b57b 100644 --- a/src/command-line.c +++ b/src/command-line.c @@ -146,6 +146,12 @@ static void print_attribute_help(char *attr) } /* print_attribute_help() */ +static void print_help_helper(const char *name, const char *description) +{ + nv_msg(TAB, name); + nv_msg_preserve_whitespace(BIGTAB, description); + nv_msg(NULL, ""); +} /* * print_help() - loop through the __options[] table, and print the @@ -154,66 +160,14 @@ static void print_attribute_help(char *attr) void print_help(void) { - int i, j, len; - char *msg, *tmp, scratch[64]; - const NVGetoptOption *o; - print_version(); nv_msg(NULL, ""); nv_msg(NULL, "nvidia-settings [options]"); nv_msg(NULL, ""); - - for (i = 0; __options[i].name; i++) { - o = &__options[i]; - if (isalpha(o->val)) { - sprintf(scratch, "%c", o->val); - msg = nvstrcat("-", scratch, ", --", o->name, NULL); - } else { - msg = nvstrcat("--", o->name, NULL); - } - if (o->flags & NVGETOPT_HAS_ARGUMENT) { - len = strlen(o->name); - for (j = 0; j < len; j++) scratch[j] = toupper(o->name[j]); - scratch[len] = '\0'; - tmp = nvstrcat(msg, "=[", scratch, "]", NULL); - free(msg); - msg = tmp; - } - nv_msg(TAB, msg); - free(msg); - if (o->description) { - char *buf = NULL, *pbuf = NULL, *s = NULL; - - buf = calloc(1, 1 + strlen(o->description)); - if (!buf) { - /* XXX There should be better message than this */ - nv_error_msg("Not enough memory\n"); - return; - } - pbuf = buf; - - for (s = o->description; s && *s; s++) { - switch (*s) { - case '<': - case '>': - case '^': - break; - default: - *pbuf = *s; - pbuf++; - break; - } - } - *pbuf = '\0'; - nv_msg_preserve_whitespace(BIGTAB, buf); - free(buf); - } - - nv_msg(NULL, ""); - } -} /* print_help() */ + nvgetopt_print_help(__options, 0, print_help_helper); +} /* diff --git a/src/command-line.h b/src/command-line.h index 52335a5..700ed2a 100644 --- a/src/command-line.h +++ b/src/command-line.h @@ -20,8 +20,6 @@ #ifndef __COMMAND_LINE_H__ #define __COMMAND_LINE_H__ -#include <NvCtrlAttributes.h> - #define DEFAULT_RC_FILE "~/.nvidia-settings-rc" #define CONFIG_FILE_OPTION 1 diff --git a/src/common-utils/common-utils.c b/src/common-utils/common-utils.c index 701bb07..98b92fe 100644 --- a/src/common-utils/common-utils.c +++ b/src/common-utils/common-utils.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 NVIDIA Corporation + * Copyright (C) 2010-2012 NVIDIA Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -150,6 +150,35 @@ char *nvstrdup(const char *s) /* + * nvstrndup() - implementation of strndup() that checks return values; if + * an error occurs, an error is printed to stderr and exit is called + * -- this function will only return on success. + */ + +char *nvstrndup(const char *s, size_t n) +{ + char *m; + + if (!s) return NULL; + + m = malloc(n + 1); + + if (!m) { + fprintf(stderr, "%s: memory allocation failure during malloc (%s)! \n", + PROGRAM_NAME, strerror(errno)); + exit(1); + } + + strncpy (m, s, n); + m[n] = '\0'; + + return m; + +} /* nvstrndup() */ + + + +/* * nvstrtolower() - convert the given string to lowercase. */ @@ -250,3 +279,310 @@ char *tilde_expansion(const char *str) return ret; } /* tilde_expansion() */ + + +/****************************************************************************/ +/* TextRows helper functions */ +/****************************************************************************/ + +/* + * nv_format_text_rows() - this function breaks the given string str + * into some number of rows, where each row is not longer than the + * specified width. + * + * If prefix is non-NULL, the first line is prepended with the prefix, + * and subsequent lines are indented to line up with the prefix. + * + * If word_boundary is TRUE, then attempt to only break lines on + * boundaries between words. + */ + +TextRows *nv_format_text_rows(const char *prefix, + const char *str, + int width, int word_boundary) +{ + int len, prefix_len, z, w, i; + char *line, *buf, *local_prefix, *a, *b, *c; + TextRows *t; + + /* initialize the TextRows structure */ + + t = (TextRows *) malloc(sizeof(TextRows)); + + if (!t) return NULL; + + t->t = NULL; + t->n = 0; + t->m = 0; + + if (!str) return t; + + buf = strdup(str); + + if (!buf) return t; + + z = strlen(buf); /* length of entire string */ + a = buf; /* pointer to the start of the string */ + + /* initialize the prefix fields */ + + if (prefix) { + prefix_len = strlen(prefix); + local_prefix = strdup(prefix); + } else { + prefix_len = 0; + local_prefix = NULL; + } + + /* adjust the max width for any prefix */ + + w = width - prefix_len; + + do { + /* + * if the string will fit on one line, point b to the end of the + * string + */ + + if (z < w) b = a + z; + + /* + * if the string won't fit on one line, move b to where the + * end of the line should be, and then move b back until we + * find a space; if we don't find a space before we back b all + * the way up to a, just assign b to where the line should end. + */ + + else { + b = a + w; + + if (word_boundary) { + while ((b >= a) && (!isspace(*b))) b--; + if (b <= a) b = a + w; + } + } + + /* look for any newline inbetween a and b, and move b to it */ + + for (c = a; c < b; c++) if (*c == '\n') { b = c; break; } + + /* + * copy the string that starts at a and ends at b, prepending + * with a prefix, if present + */ + + len = b-a; + len += prefix_len; + line = (char *) malloc(len+1); + if (local_prefix) strncpy(line, local_prefix, prefix_len); + strncpy(line + prefix_len, a, len - prefix_len); + line[len] = '\0'; + + /* append the new line to the array of text rows */ + + t->t = (char **) realloc(t->t, sizeof(char *) * (t->n + 1)); + t->t[t->n] = line; + t->n++; + + if (t->m < len) t->m = len; + + /* + * adjust the length of the string and move the pointer to the + * beginning of the new line + */ + + z -= (b - a + 1); + a = b + 1; + + /* move to the first non whitespace character (excluding newlines) */ + + if (word_boundary && isspace(*b)) { + while ((z) && (isspace(*a)) && (*a != '\n')) a++, z--; + } else { + if (!isspace(*b)) z++, a--; + } + + if (local_prefix) { + for (i = 0; i < prefix_len; i++) local_prefix[i] = ' '; + } + + } while (z > 0); + + if (local_prefix) free(local_prefix); + free(buf); + + return t; +} + + +/* + * nv_text_rows_append() - append the given msg to the existing TextRows + */ + +void nv_text_rows_append(TextRows *t, const char *msg) +{ + int len; + + t->t = realloc(t->t, sizeof(char *) * (t->n + 1)); + + if (msg) { + t->t[t->n] = strdup(msg); + len = strlen(msg); + if (t->m < len) t->m = len; + } else { + t->t[t->n] = NULL; + } + + t->n++; +} + +/* + * nv_concat_text_rows() - concatenate two text rows, storing the + * result in t0 + */ + +#define NV_MAX(x,y) ((x) > (y) ? (x) : (y)) + +void nv_concat_text_rows(TextRows *t0, TextRows *t1) +{ + int n, i; + + n = t0->n + t1->n; + + t0->t = realloc(t0->t, sizeof(char *) * n); + + for (i = 0; i < t1->n; i++) { + t0->t[i + t0->n] = strdup(t1->t[i]); + } + + t0->m = NV_MAX(t0->m, t1->m); + t0->n = n; + +} /* nv_concat_text_rows() */ + + +/* + * nv_free_text_rows() - free the TextRows data structure allocated by + * nv_format_text_rows() + */ + +void nv_free_text_rows(TextRows *t) +{ + int i; + + if (!t) return; + for (i = 0; i < t->n; i++) free(t->t[i]); + if (t->t) free(t->t); + free(t); + +} /* nv_free_text_rows() */ + + +/****************************************************************************/ +/* printing helper functions */ +/****************************************************************************/ + +#define DEFAULT_WIDTH 75 + +static unsigned short __terminal_width = 0; + +/* + * reset_current_terminal_width() - if new_val is zero, then use the + * TIOCGWINSZ ioctl to get the current width of the terminal, and + * assign it the value to __terminal_width. If the ioctl fails, use a + * hardcoded constant. If new_val is non-zero, then use new_val. + */ + +void reset_current_terminal_width(unsigned short new_val) +{ + struct winsize ws; + + if (new_val) { + __terminal_width = new_val; + return; + } + + if (ioctl(STDERR_FILENO, TIOCGWINSZ, &ws) == -1 || ws.ws_col == 0) { + __terminal_width = DEFAULT_WIDTH; + } else { + __terminal_width = ws.ws_col - 1; + } +} + +/* + * Call silence_fmt(1) to turn fmtout(), fmtoutp() and format() into noops. + */ +static int __silent = 0; + +void silence_fmt(int val) +{ + __silent = val; +} + + +static void vformat(FILE *stream, const int wb, + const char *prefix, const char *buf) +{ + int i; + TextRows *t; + + if (!__terminal_width) reset_current_terminal_width(0); + + t = nv_format_text_rows(prefix, buf, __terminal_width, wb); + + for (i = 0; i < t->n; i++) fprintf(stream, "%s\n", t->t[i]); + + nv_free_text_rows(t); +} + + +#define NV_VFORMAT(stream, wb, prefix, fmt) \ +do { \ + char *buf; \ + NV_VSNPRINTF(buf, fmt); \ + vformat(stream, wb, prefix, buf); \ + free (buf); \ +} while(0) + + +void fmtout(const char *fmt, ...) +{ + if (__silent > 0) { + return; + } + NV_VFORMAT(stdout, TRUE, NULL, fmt); +} + + +void fmtoutp(const char *prefix, const char *fmt, ...) +{ + if (__silent > 0) { + return; + } + NV_VFORMAT(stdout, TRUE, prefix, fmt); +} + + +void fmterr(const char *fmt, ...) +{ + vformat(stderr, 0, NULL, ""); + NV_VFORMAT(stderr, TRUE, "ERROR: ", fmt); + vformat(stderr, 0, NULL, ""); +} + + +void fmtwarn(const char *fmt, ...) +{ + vformat(stderr, 0, NULL, ""); + NV_VFORMAT(stderr, TRUE, "WARNING: ", fmt); + vformat(stderr, 0, NULL, ""); +} + + +void fmt(FILE *stream, const char *prefix, const char *fmt, ...) +{ + if (__silent > 0) { + return; + } + NV_VFORMAT(stream, TRUE, prefix, fmt); +} diff --git a/src/common-utils/common-utils.h b/src/common-utils/common-utils.h index 04d5f3b..e0d9314 100644 --- a/src/common-utils/common-utils.h +++ b/src/common-utils/common-utils.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 NVIDIA Corporation + * Copyright (C) 2010-2012 NVIDIA Corporation * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -17,6 +17,9 @@ #ifndef __COMMON_UTILS_H__ #define __COMMON_UTILS_H__ +#include <stdio.h> +#include <stdarg.h> + #if !defined(TRUE) #define TRUE 1 #endif @@ -25,13 +28,86 @@ #define FALSE 0 #endif +#define ARRAY_LEN(_arr) (sizeof(_arr) / sizeof(_arr[0])) + +#define TAB " " +#define BIGTAB " " + +typedef struct { + char **t; /* the text rows */ + int n; /* number of rows */ + int m; /* maximum row length */ +} TextRows; + void *nvalloc(size_t size); char *nvstrcat(const char *str, ...); void *nvrealloc(void *ptr, size_t size); char *nvstrdup(const char *s); +char *nvstrndup(const char *s, size_t n); char *nvstrtolower(char *s); void nvfree(void *s); char *tilde_expansion(const char *str); +TextRows *nv_format_text_rows(const char *prefix, + const char *str, + int width, int word_boundary); +void nv_text_rows_append(TextRows *t, const char *msg); +void nv_concat_text_rows(TextRows *t0, TextRows *t1); +void nv_free_text_rows(TextRows *t); + +void reset_current_terminal_width(unsigned short new_val); + +void silence_fmt(int val); +void fmtout(const char *fmt, ...); +void fmtoutp(const char *prefix, const char *fmt, ...); +void fmterr(const char *fmt, ...); +void fmtwarn(const char *fmt, ...); +void fmt(FILE *stream, const char *prefix, const char *fmt, ...); + +/* + * NV_VSNPRINTF(): macro that assigns buf using vsnprintf(). This is + * correct for differing semantics of the vsnprintf() return value: + * + * -1 when the buffer is not long enough (glibc < 2.1) + * + * or + * + * the length the string would have been if the buffer had been large + * enough (glibc >= 2.1) + * + * This macro allocates memory for buf; the caller should free it when + * done. + */ + +#define NV_FMT_BUF_LEN 256 + +#define NV_VSNPRINTF(buf, fmt) \ +do { \ + if (!fmt) { \ + (buf) = NULL; \ + } else { \ + va_list ap; \ + int len, current_len = NV_FMT_BUF_LEN; \ + \ + (buf) = malloc(current_len); \ + \ + while (1) { \ + va_start(ap, fmt); \ + len = vsnprintf((buf), current_len, (fmt), ap); \ + va_end(ap); \ + \ + if ((len > -1) && (len < current_len)) { \ + break; \ + } else if (len > -1) { \ + current_len = len + 1; \ + } else { \ + current_len += NV_FMT_BUF_LEN; \ + } \ + free(buf); \ + (buf) = malloc(current_len); \ + } \ + } \ +} while (0) + #endif /* __COMMON_UTILS_H__ */ diff --git a/src/common-utils/gen-manpage-opts-helper.c b/src/common-utils/gen-manpage-opts-helper.c new file mode 100644 index 0000000..d2abb1c --- a/dev/null +++ b/src/common-utils/gen-manpage-opts-helper.c @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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 program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +#include "nvgetopt.h" +#include "gen-manpage-opts-helper.h" + +static void print_option(const NVGetoptOption *o) +{ + char scratch[64], *s; + int j, len; + + int italics, bold, omitWhiteSpace; + + /* if we are going to need the argument, process it now */ + if (o->flags & NVGETOPT_HAS_ARGUMENT) { + if (o->arg_name) { + strcpy(scratch, o->arg_name); + } else { + len = strlen(o->name); + for (j = 0; j < len; j++) scratch[j] = toupper(o->name[j]); + scratch[len] = '\0'; + } + } + + printf(".TP\n.BI \""); + /* Print the name of the option */ + /* XXX We should backslashify the '-' characters in o->name. */ + + if (isalpha(o->val)) { + /* '\-c' */ + printf("\\-%c", o->val); + + if (o->flags & NVGETOPT_HAS_ARGUMENT) { + /* ' " "ARG" "' */ + printf(" \" \"%s\" \"", scratch); + } + /* ', ' */ + printf(", "); + } + + /* '\-\-name' */ + printf("\\-\\-%s", o->name); + + /* '=" "ARG' */ + if (o->flags & NVGETOPT_HAS_ARGUMENT) { + printf("=\" \"%s", scratch); + + /* '" "' */ + if ((o->flags & NVGETOPT_IS_BOOLEAN) || + (o->flags & NVGETOPT_ALLOW_DISABLE)) { + printf("\" \""); + } + } + + /* ', \-\-no\-name' */ + if (((o->flags & NVGETOPT_IS_BOOLEAN) && + !(o->flags & NVGETOPT_HAS_ARGUMENT)) || + (o->flags & NVGETOPT_ALLOW_DISABLE)) { + printf(", \\-\\-no\\-%s", o->name); + } + + printf("\"\n"); + + /* Print the option description */ + /* XXX Each sentence should be on its own line! */ + + /* + * Print the option description: write each character one at a + * time (ugh) so that we can special-case a few characters: + * + * '&' : toggles italics on and off + * '^' : toggles bold on and off + * '-' : is backslashified: "\-" + * + * Whitespace is omited when italics or bold is on + */ + + italics = 0; + bold = 0; + omitWhiteSpace = 0; + + for (s = o->description; s && *s; s++) { + + switch (*s) { + case '&': + if (italics) { + printf("\n"); + } else { + printf("\n.I "); + } + omitWhiteSpace = italics; + italics = !italics; + break; + case '^': + if (bold) { + printf("\n"); + } else { + printf("\n.B "); + } + omitWhiteSpace = bold; + bold = !bold; + break; + case '-': + printf("\\-"); + omitWhiteSpace = 0; + break; + case ' ': + if (!omitWhiteSpace) { + printf(" "); + } + break; + default: + printf("%c", *s); + omitWhiteSpace = 0; + break; + } + } + + printf("\n"); +} + +void gen_manpage_opts_helper(const NVGetoptOption *options) +{ + int i; + int has_advanced_options = 0; + + /* Print the "simple" options; i.e. the ones you get with --help. */ + printf(".SH OPTIONS\n"); + for (i = 0; options[i].name; i++) { + const NVGetoptOption *o = &options[i]; + + if (!o->description) { + continue; + } + + if (!(o->flags & NVGETOPT_HELP_ALWAYS)) { + has_advanced_options = 1; + continue; + } + + print_option(o); + } + + if (has_advanced_options) { + /* + * If any exist, print the advanced options; i.e., the ones + * you get with --advanced-help + */ + printf(".SH \"ADVANCED OPTIONS\"\n"); + for (i = 0; options[i].name; i++) { + const NVGetoptOption *o = &options[i]; + + if (!o->description) { + continue; + } + + if (o->flags & NVGETOPT_HELP_ALWAYS) { + continue; + } + + print_option(o); + } + } +} diff --git a/src/common-utils/gen-manpage-opts-helper.h b/src/common-utils/gen-manpage-opts-helper.h new file mode 100644 index 0000000..b09852e --- a/dev/null +++ b/src/common-utils/gen-manpage-opts-helper.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope 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 program. If not, see <http://www.gnu.org/licenses/>. + */ + +#if !defined(__GEN_MANPAGE_OPTS_HELPER_H__) +#define __GEN_MANPAGE_OPTS_HELPER_H__ + +#include "nvgetopt.h" + +void gen_manpage_opts_helper(const NVGetoptOption *options); + +#endif /* __GEN_MANPAGE_OPTS_HELPER_H__ */ diff --git a/src/common-utils/nvgetopt.c b/src/common-utils/nvgetopt.c index a89dcac..f04cef3 100644 --- a/src/common-utils/nvgetopt.c +++ b/src/common-utils/nvgetopt.c @@ -21,8 +21,10 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include <ctype.h> #include "nvgetopt.h" +#include "common-utils.h" int nvgetopt(int argc, @@ -309,3 +311,126 @@ int nvgetopt(int argc, return ret; } /* nvgetopt() */ + + +/* + * cook_description() - the description string may contain text within + * special characters which are interpreted by the manpage generator. + * We want to omit those characters here. + */ + +static char *cook_description(const char *description) +{ + const char *src; + char *s, *dst; + + if (!description) { + return NULL; + } + + s = strdup(description); + + if (!s) { + return NULL; + } + + for (src = description, dst = s; *src; src++) { + if ((*src == '&') || (*src == '^')) { + continue; + } + *dst = *src; + dst++; + } + + *dst = '\0'; + + return s; +} + + +void nvgetopt_print_help(const NVGetoptOption *options, + unsigned int include_mask, + nvgetopt_print_help_callback_ptr callback) +{ + const NVGetoptOption *o; + int i; + + for (i = 0; options[i].name; i++) { + + char *msg = NULL, *arg = NULL, *description = NULL; + + o = &options[i]; + + /* Skip options with no help text */ + if (!o->description) { + continue; + } + + /* skip options who don't have all the bits of include_mask */ + if ((o->flags & include_mask) != include_mask) { + continue; + } + + /* if we are going to need the argument, process it now */ + arg = NULL; + if (o->flags & NVGETOPT_HAS_ARGUMENT) { + if (o->arg_name) { + arg = strdup(o->arg_name); + } else { + char *tmp; + arg = strdup(o->name); + for (tmp = arg; tmp && *tmp; tmp++) { + *tmp = toupper(*tmp); + } + } + } + + msg = NULL; + + /* + * create the long version of the option, possibly with an + * argument; e.g., "--foo" or "--foo=BAR" + */ + if (arg) { + msg = nvstrcat("--", o->name, "=", arg, NULL); + } else { + msg = nvstrcat("--", o->name, NULL); + } + + /* + * prepend the single character version of the option, + * possibly with an argument; e.g., "-f" or "-f BAR" + */ + if (isalpha(o->val)) { + char scratch[16]; + char *tmp; + snprintf(scratch, sizeof(scratch), "%c", o->val); + if (arg) { + tmp = nvstrcat("-", scratch, " ", arg, ", ", msg, NULL); + } else { + tmp = nvstrcat("-", scratch, ", ", msg, NULL); + } + free(msg); + msg = tmp; + } + + /* append the boolean version of the option; e.g., "--no-foo" */ + if (((o->flags & NVGETOPT_IS_BOOLEAN) && + !(o->flags & NVGETOPT_HAS_ARGUMENT)) || + (o->flags & NVGETOPT_ALLOW_DISABLE)) { + char *tmp = nvstrcat(msg, ", --no-", o->name, NULL); + free(msg); + msg = tmp; + } + + /* process the description text */ + description = cook_description(o->description); + + /* give the strings to the caller to format and print */ + callback(msg, description); + + free(msg); + free(arg); + free(description); + } +} diff --git a/src/common-utils/nvgetopt.h b/src/common-utils/nvgetopt.h index 127f40b..5847546 100644 --- a/src/common-utils/nvgetopt.h +++ b/src/common-utils/nvgetopt.h @@ -155,5 +155,29 @@ int nvgetopt(int argc, double *doubleval, int *disable_val); +/* + * nvgetopt_print_help() - print a help message for each option in the + * provided NVGetoptOption array. This is useful for a utility's + * "--help" output. + * + * Options will only be printed if they have every bit set that + * include_mask includes. + * + * For each option, the provided callback function wil be called with + * two strings: a name string that lists the option's name, and a + * description string for the option. The callback function is + * responsible for actually printing these strings. Examples: + * + * name = "-v, --version"; + * description = "Print usage information for the common commandline " + * "options and exit."; + */ + +typedef void nvgetopt_print_help_callback_ptr(const char *name, + const char *description); + +void nvgetopt_print_help(const NVGetoptOption *options, + unsigned int include_mask, + nvgetopt_print_help_callback_ptr callback); #endif /* __NVGETOPT_H__ */ diff --git a/src/common-utils/src.mk b/src/common-utils/src.mk index 14e4131..12ba143 100644 --- a/src/common-utils/src.mk +++ b/src/common-utils/src.mk @@ -7,3 +7,9 @@ COMMON_UTILS_EXTRA_DIST += nvgetopt.h COMMON_UTILS_EXTRA_DIST += common-utils.h COMMON_UTILS_EXTRA_DIST += src.mk +# gen-manpage-opts-helper.c is listed in EXTRA_DIST, rather than SRC, +# because it is not compiled into the utilities themselves, but used +# when building the utility's gen-manpage-opts +COMMON_UTILS_EXTRA_DIST += gen-manpage-opts-helper.c +COMMON_UTILS_EXTRA_DIST += gen-manpage-opts-helper.h + diff --git a/src/config-file.c b/src/config-file.c index 99c7059..5ea5c29 100644 --- a/src/config-file.c +++ b/src/config-file.c @@ -434,14 +434,14 @@ int nv_write_config_file(const char *filename, CtrlHandles *h, (p->display_device_mask); fprintf(stream, "%s%s%c%s[%s]=%d\n", p->display, target_str, - DISPLAY_NAME_SEPARATOR, tmp, tmp_d_str, p->val); + DISPLAY_NAME_SEPARATOR, tmp, tmp_d_str, p->val.i); free(tmp_d_str); } else { fprintf(stream, "%s%s%c%s=%d\n", p->display, target_str, - DISPLAY_NAME_SEPARATOR, tmp, p->val); + DISPLAY_NAME_SEPARATOR, tmp, p->val.i); } p = p->next; diff --git a/src/gen-manpage-opts.c b/src/gen-manpage-opts.c index 7f960ab..2d1f948 100644 --- a/src/gen-manpage-opts.c +++ b/src/gen-manpage-opts.c @@ -24,119 +24,10 @@ #include "nvgetopt.h" #include "option-table.h" +#include "gen-manpage-opts-helper.h" -#define NV_FMT_BUF_LEN 512 - -/* - * Prints the option help in a form that is suitable to include in the manpage. - */ - -static void print_option(const NVGetoptOption *o) -{ - int omitWhiteSpace; - - /* if we are going to need the argument, process it now */ - - printf(".TP\n.BI \""); - /* Print the name of the option */ - /* XXX We should backslashify the '-' characters in o->name. */ - - if (isalpha(o->val)) { - /* '\-c \-\-name' */ - printf("\\-%c, \\-\\-%s", o->val, o->name); - } else { - printf("\\-\\-%s", o->name); - } - - /* '=" "ARG' */ - if (o->flags & NVGETOPT_HAS_ARGUMENT) { - int len, j; - char tbuf[32]; - len = strlen(o->name); - for (j = 0; j < len; j++) - tbuf[j] = toupper(o->name[j]); - tbuf[len] = '\0'; - printf("=\" \"%s", tbuf); - } - - printf("\"\n"); - - /* Print the option description */ - /* XXX Each sentence should be on its own line! */ - - /* - * Print the option description: write each character one at a - * time (ugh) so that we can special-case a few characters: - * - * "^" --> "\n.I " - * "<" --> "\n.B " - * ">" --> "\n" - * - * '^' is used to mark the text as underlined till it is turned off with '>'. - * '<' is used to mark the text as bold till it is turned off with '>'. - * - * XXX Each sentence should be on its own line! - */ - - if (o->description) { - char *buf = NULL, *s = NULL, *pbuf = NULL; - - buf = calloc(1, NV_FMT_BUF_LEN + strlen(o->description)); - if (!buf) { - /* XXX There should be better message than this */ - printf("Not enough memory\n"); - return; - } - pbuf = buf; - - omitWhiteSpace = 0; - for (s = o->description; s && *s; s++) { - switch (*s) { - case '<': - sprintf(pbuf, "\n.B "); - pbuf = pbuf + 4; - omitWhiteSpace = 0; - break; - case '^': - sprintf(pbuf, "\n.I "); - pbuf = pbuf + 4; - omitWhiteSpace = 0; - break; - case '>': - *pbuf = '\n'; - pbuf++; - omitWhiteSpace = 1; - break; - case ' ': - if (!omitWhiteSpace) { - *pbuf = *s; - pbuf++; - } - break; - default: - *pbuf = *s; - pbuf++; - omitWhiteSpace = 0; - break; - } - } - printf("%s", buf); - free(buf); - } - - printf("\n"); -} - -int main(int argc, char* argv[]) +int main(void) { - int i; - const NVGetoptOption *o; - - printf(".SH OPTIONS\n"); - for (i = 0; __options[i].name; i++) { - o = &__options[i]; - print_option(o); - } - + gen_manpage_opts_helper(__options); return 0; } diff --git a/src/glxinfo.c b/src/glxinfo.c index a5b98c5..dfeffaf 100644 --- a/src/glxinfo.c +++ b/src/glxinfo.c @@ -25,6 +25,7 @@ #include "NvCtrlAttributes.h" #include "query-assign.h" /* CtrlHandles */ #include "msg.h" +#include "glxinfo.h" #include <GL/glx.h> /* GLX #defines */ diff --git a/src/gtk+-2.x/ctk3dvisionpro.c b/src/gtk+-2.x/ctk3dvisionpro.c index 2882099..383a9e5 100644 --- a/src/gtk+-2.x/ctk3dvisionpro.c +++ b/src/gtk+-2.x/ctk3dvisionpro.c @@ -197,6 +197,7 @@ GType ctk_3d_vision_pro_get_type(void) sizeof (Ctk3DVisionPro), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_3d_vision_pro_type = g_type_register_static(GTK_TYPE_VBOX, diff --git a/src/gtk+-2.x/ctkbanner.c b/src/gtk+-2.x/ctkbanner.c index d37f43a..1ee026a 100644 --- a/src/gtk+-2.x/ctkbanner.c +++ b/src/gtk+-2.x/ctkbanner.c @@ -49,7 +49,6 @@ #include "opengl_pixdata.h" #include "penguin_pixdata.h" #include "gvi_pixdata.h" -#include "rotation_pixdata.h" #include "sdi_pixdata.h" #include "sdi_shared_sync_bnc_pixdata.h" #include "slimm_pixdata.h" @@ -105,6 +104,7 @@ GType ctk_banner_get_type( sizeof (CtkBanner), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_banner_type = g_type_register_static(GTK_TYPE_DRAWING_AREA, @@ -365,7 +365,6 @@ static gboolean select_artwork(BannerArtworkType artwork, { BANNER_ARTWORK_HELP, FALSE, 16, &help_pixdata }, { BANNER_ARTWORK_OPENGL, FALSE, 16, &opengl_pixdata }, { BANNER_ARTWORK_PENGUIN, TRUE, 16, &penguin_pixdata }, - { BANNER_ARTWORK_ROTATION, FALSE, 16, &rotation_pixdata }, { BANNER_ARTWORK_SDI, FALSE, 16, &sdi_pixdata }, { BANNER_ARTWORK_SDI_SHARED_SYNC_BNC, FALSE, 16, &sdi_shared_sync_bnc_pixdata }, { BANNER_ARTWORK_SLIMM, FALSE, 16, &slimm_pixdata }, diff --git a/src/gtk+-2.x/ctkbanner.h b/src/gtk+-2.x/ctkbanner.h index 863ef43..256d4b0 100644 --- a/src/gtk+-2.x/ctkbanner.h +++ b/src/gtk+-2.x/ctkbanner.h @@ -60,7 +60,6 @@ typedef enum { BANNER_ARTWORK_HELP, BANNER_ARTWORK_OPENGL, BANNER_ARTWORK_PENGUIN, - BANNER_ARTWORK_ROTATION, BANNER_ARTWORK_SDI, BANNER_ARTWORK_SDI_SHARED_SYNC_BNC, BANNER_ARTWORK_SLIMM, diff --git a/src/gtk+-2.x/ctkclocks.c b/src/gtk+-2.x/ctkclocks.c index 876aece..76f5ad6 100644 --- a/src/gtk+-2.x/ctkclocks.c +++ b/src/gtk+-2.x/ctkclocks.c @@ -165,6 +165,7 @@ GType ctk_clocks_get_type(void) sizeof(CtkClocks), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_object_type = g_type_register_static diff --git a/src/gtk+-2.x/ctkcolorcontrols.c b/src/gtk+-2.x/ctkcolorcontrols.c index b5d7fad..cb1f22d 100644 --- a/src/gtk+-2.x/ctkcolorcontrols.c +++ b/src/gtk+-2.x/ctkcolorcontrols.c @@ -43,6 +43,8 @@ static gint map_nvctrl_value_to_table(CtkColorControls *ctk_color_controls, static gboolean update_color_space_menu_info(CtkColorControls *ctk_color_controls); +static void setup_reset_button(CtkColorControls *ctk_color_controls); + static void color_space_menu_changed(GtkOptionMenu *color_space_menu, gpointer user_data); static void color_range_menu_changed(GtkOptionMenu *color_range_menu, @@ -90,6 +92,7 @@ GType ctk_color_controls_get_type(void) sizeof (CtkColorControls), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_color_controls_type = @@ -105,7 +108,6 @@ GtkWidget* ctk_color_controls_new(NvCtrlAttributeHandle *handle, CtkConfig *ctk_config, CtkEvent *ctk_event, GtkWidget *reset_button, - unsigned int display_device_mask, char *name) { GObject *object; @@ -117,12 +119,12 @@ GtkWidget* ctk_color_controls_new(NvCtrlAttributeHandle *handle, gint i; /* check if color configuration is supported */ - ret1 = NvCtrlGetValidDisplayAttributeValues(handle, display_device_mask, - NV_CTRL_COLOR_SPACE, - &valid1); - ret2 = NvCtrlGetValidDisplayAttributeValues(handle, display_device_mask, - NV_CTRL_COLOR_RANGE, - &valid2); + ret1 = NvCtrlGetValidAttributeValues(handle, + NV_CTRL_COLOR_SPACE, + &valid1); + ret2 = NvCtrlGetValidAttributeValues(handle, + NV_CTRL_COLOR_RANGE, + &valid2); if ((ret1 != NvCtrlSuccess) || (ret2 != NvCtrlSuccess)) { return NULL; @@ -138,7 +140,6 @@ GtkWidget* ctk_color_controls_new(NvCtrlAttributeHandle *handle, ctk_color_controls->handle = handle; ctk_color_controls->ctk_config = ctk_config; ctk_color_controls->reset_button = reset_button; - ctk_color_controls->display_device_mask = display_device_mask; ctk_color_controls->name = strdup(name); /* build a table holding available color space */ @@ -150,7 +151,7 @@ GtkWidget* ctk_color_controls_new(NvCtrlAttributeHandle *handle, hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, FRAME_PADDING); - ctk_color_controls->color_controls_main = hbox; + ctk_color_controls->color_controls_box = hbox; frame = gtk_frame_new("Color Controls"); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); @@ -210,7 +211,6 @@ GtkWidget* ctk_color_controls_new(NvCtrlAttributeHandle *handle, gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 0); - ctk_color_controls->color_space_box = hbox; gtk_table_attach(GTK_TABLE(table), hbox, 1, 2, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); gtk_box_pack_start(GTK_BOX(hbox), @@ -270,6 +270,50 @@ GtkWidget* ctk_color_controls_new(NvCtrlAttributeHandle *handle, } /* ctk_color_controls_new() */ + +/* + * setup_reset_button() - enables the reset button if any of the current + * settings are not the default. + */ +static void setup_reset_button(CtkColorControls *ctk_color_controls) +{ + gint history; + gint val; + + if (!GTK_WIDGET_SENSITIVE(ctk_color_controls->color_controls_box)) { + /* Nothing is available, don't bother enabling the reset button yet. */ + return; + } + + /* The color space menu is always available */ + history = gtk_option_menu_get_history + (GTK_OPTION_MENU(ctk_color_controls->color_space_menu)); + val = ctk_color_controls->color_space_table[history]; + if (val != NV_CTRL_COLOR_SPACE_RGB) { + goto enable; + } + + /* Color range is dependent on the color space */ + if (GTK_WIDGET_SENSITIVE(ctk_color_controls->color_range_menu)) { + history = gtk_option_menu_get_history + (GTK_OPTION_MENU(ctk_color_controls->color_range_menu)); + val = ctk_color_controls->color_range_table[history]; + if (val != NV_CTRL_COLOR_RANGE_FULL) { + goto enable; + } + } + + /* Don't disable reset button here, since other settings that are not + * managed by the ctk_image_slider here may need it enabled + */ + return; + + enable: + gtk_widget_set_sensitive(ctk_color_controls->reset_button, TRUE); +} + + + /* * ctk_color_controls_setup() - Setup routine for color attributes. Used * in DFP setup stage as well as for updating the GUI when there is change in @@ -283,10 +327,12 @@ void ctk_color_controls_setup(CtkColorControls *ctk_color_controls) /* color space */ if (!update_color_space_menu_info(ctk_color_controls)) { - gtk_widget_set_sensitive(ctk_color_controls->color_controls_main, - FALSE); - gtk_widget_hide_all(ctk_color_controls->color_controls_main); + gtk_widget_set_sensitive(ctk_color_controls->color_controls_box, FALSE); + gtk_widget_hide_all(ctk_color_controls->color_controls_box); } + + setup_reset_button(ctk_color_controls); + } /* ctk_color_controls_setup() */ @@ -296,11 +342,9 @@ static gboolean update_color_space_menu_info(CtkColorControls *ctk_color_control /* color space */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_SPACE, - &color_space)) { - free(ctk_color_controls->color_space_table); + NvCtrlGetAttribute(ctk_color_controls->handle, + NV_CTRL_COLOR_SPACE, + &color_space)) { return FALSE; } @@ -322,9 +366,14 @@ static gboolean update_color_space_menu_info(CtkColorControls *ctk_color_control (gpointer) ctk_color_controls); /* dynamically regenerate color range dropdown */ - setup_color_range_dropdown(ctk_color_controls); + if (!setup_color_range_dropdown(ctk_color_controls)) { + gtk_widget_set_sensitive(ctk_color_controls->color_range_menu, FALSE); + } else { + gtk_widget_set_sensitive(ctk_color_controls->color_range_menu, TRUE); + } + + return TRUE; - return True; } /* update_color_space_menu_info() */ static @@ -370,10 +419,9 @@ static void color_range_menu_changed(GtkOptionMenu *color_range_menu, history = gtk_option_menu_get_history(color_range_menu); color_range = ctk_color_controls->color_range_table[history]; - NvCtrlSetDisplayAttribute(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_RANGE, - color_range); + NvCtrlSetAttribute(ctk_color_controls->handle, + NV_CTRL_COLOR_RANGE, + color_range); g_signal_handlers_block_by_func (G_OBJECT(ctk_color_controls->color_range_menu), @@ -406,10 +454,9 @@ static void color_space_menu_changed(GtkOptionMenu *color_space_menu, color_space = ctk_color_controls->color_space_table[history]; - NvCtrlSetDisplayAttribute(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_SPACE, - color_space); + NvCtrlSetAttribute(ctk_color_controls->handle, + NV_CTRL_COLOR_SPACE, + color_space); color_space = map_nvctrl_value_to_table(ctk_color_controls, color_space); @@ -444,15 +491,13 @@ void ctk_color_controls_reset(CtkColorControls *ctk_color_controls) return; } - NvCtrlSetDisplayAttribute(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_SPACE, - NV_CTRL_COLOR_SPACE_RGB); + NvCtrlSetAttribute(ctk_color_controls->handle, + NV_CTRL_COLOR_SPACE, + NV_CTRL_COLOR_SPACE_RGB); - NvCtrlSetDisplayAttribute(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_RANGE, - NV_CTRL_COLOR_RANGE_FULL); + NvCtrlSetAttribute(ctk_color_controls->handle, + NV_CTRL_COLOR_RANGE, + NV_CTRL_COLOR_RANGE_FULL); ctk_color_controls_setup(ctk_color_controls); } /* ctk_color_controls_reset() */ @@ -487,14 +532,8 @@ static void color_control_update_received(GtkObject *object, gpointer arg1, CtkColorControls *ctk_object = CTK_COLOR_CONTROLS(user_data); CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - /* if the event is not for this display device, return */ - - if (!(event_struct->display_mask & ctk_object->display_device_mask)) { - return; - } - ctk_color_controls_setup(ctk_object); - + /* update status bar message */ switch (event_struct->attribute) { case NV_CTRL_COLOR_RANGE: @@ -557,10 +596,9 @@ static gboolean setup_color_range_dropdown(CtkColorControls *ctk_color_controls) GtkWidget *menu, *menu_item; NVCTRLAttributeValidValuesRec valid; - ret = NvCtrlGetValidDisplayAttributeValues(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_RANGE, - &valid); + ret = NvCtrlGetValidAttributeValues(ctk_color_controls->handle, + NV_CTRL_COLOR_RANGE, + &valid); if (valid.type != ATTRIBUTE_TYPE_INT_BITS) { return FALSE; @@ -609,9 +647,9 @@ static gboolean setup_color_range_dropdown(CtkColorControls *ctk_color_controls) /* color range */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_color_controls->handle, - ctk_color_controls->display_device_mask, - NV_CTRL_COLOR_RANGE, &val)) { + NvCtrlGetAttribute(ctk_color_controls->handle, + NV_CTRL_COLOR_RANGE, + &val)) { val = NV_CTRL_COLOR_RANGE_FULL; } @@ -628,18 +666,16 @@ static gboolean setup_color_range_dropdown(CtkColorControls *ctk_color_controls) (GTK_OPTION_MENU(ctk_color_controls->color_range_menu), val); - /* If dropdown only has one item, disable it */ - if (ctk_color_controls->color_range_table_size > 1) { - gtk_widget_set_sensitive(ctk_color_controls->color_range_menu, True); - } else { - gtk_widget_set_sensitive(ctk_color_controls->color_range_menu, False); - } - g_signal_handlers_unblock_by_func (G_OBJECT(ctk_color_controls->color_range_menu), G_CALLBACK(color_range_menu_changed), (gpointer) ctk_color_controls); + /* If dropdown only has one item, disable it */ + if (ctk_color_controls->color_range_table_size <= 1) { + return FALSE; + } + return TRUE; } /* setup_color_range_dropdown() */ diff --git a/src/gtk+-2.x/ctkcolorcontrols.h b/src/gtk+-2.x/ctkcolorcontrols.h index 13b7dad..cdfd233 100644 --- a/src/gtk+-2.x/ctkcolorcontrols.h +++ b/src/gtk+-2.x/ctkcolorcontrols.h @@ -55,14 +55,11 @@ struct _CtkColorControls NvCtrlAttributeHandle *handle; CtkConfig *ctk_config; GtkWidget *reset_button; - GtkWidget *color_controls_main; - GtkWidget *color_space_box; + GtkWidget *color_controls_box; GtkWidget *color_range_menu; GtkWidget *color_space_menu; - GtkWidget *color_current_config; - gint display_device_mask; gint *color_space_table; gint color_space_table_size; gint *color_range_table; @@ -81,7 +78,6 @@ GType ctk_color_controls_get_type (void) G_GNUC_CONST; GtkWidget* ctk_color_controls_new (NvCtrlAttributeHandle *, CtkConfig *, CtkEvent *, GtkWidget *, - unsigned int display_device_mask, char *); void ctk_color_controls_reset (CtkColorControls*); diff --git a/src/gtk+-2.x/ctkcolorcorrection.c b/src/gtk+-2.x/ctkcolorcorrection.c index 9b0adeb..a283ddf 100644 --- a/src/gtk+-2.x/ctkcolorcorrection.c +++ b/src/gtk+-2.x/ctkcolorcorrection.c @@ -143,6 +143,7 @@ GType ctk_color_correction_get_type( sizeof (CtkColorCorrection), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_color_correction_type = @@ -903,42 +904,42 @@ static void apply_parsed_attribute_list( switch (p->attr & (ALL_VALUES | ALL_CHANNELS)) { case (CONTRAST_VALUE | RED_CHANNEL): set_color_state(ctk_color_correction, CONTRAST, - RED_CHANNEL, p->fval, TRUE); break; + RED_CHANNEL, p->val.f, TRUE); break; case (CONTRAST_VALUE | GREEN_CHANNEL): set_color_state(ctk_color_correction, CONTRAST, - GREEN_CHANNEL, p->fval, TRUE); break; + GREEN_CHANNEL, p->val.f, TRUE); break; case (CONTRAST_VALUE | BLUE_CHANNEL): set_color_state(ctk_color_correction, CONTRAST, - BLUE_CHANNEL, p->fval, TRUE); break; + BLUE_CHANNEL, p->val.f, TRUE); break; case (CONTRAST_VALUE | ALL_CHANNELS): set_color_state(ctk_color_correction, CONTRAST, - ALL_CHANNELS, p->fval, TRUE); break; + ALL_CHANNELS, p->val.f, TRUE); break; case (BRIGHTNESS_VALUE | RED_CHANNEL): set_color_state(ctk_color_correction, BRIGHTNESS, - RED_CHANNEL, p->fval, TRUE); break; + RED_CHANNEL, p->val.f, TRUE); break; case (BRIGHTNESS_VALUE | GREEN_CHANNEL): set_color_state(ctk_color_correction, BRIGHTNESS, - GREEN_CHANNEL, p->fval, TRUE); break; + GREEN_CHANNEL, p->val.f, TRUE); break; case (BRIGHTNESS_VALUE | BLUE_CHANNEL): set_color_state(ctk_color_correction, BRIGHTNESS, - BLUE_CHANNEL, p->fval, TRUE); break; + BLUE_CHANNEL, p->val.f, TRUE); break; case (BRIGHTNESS_VALUE | ALL_CHANNELS): set_color_state(ctk_color_correction, BRIGHTNESS, - ALL_CHANNELS, p->fval, TRUE); break; + ALL_CHANNELS, p->val.f, TRUE); break; case (GAMMA_VALUE | RED_CHANNEL): set_color_state(ctk_color_correction, GAMMA, - RED_CHANNEL, p->fval, TRUE); break; + RED_CHANNEL, p->val.f, TRUE); break; case (GAMMA_VALUE | GREEN_CHANNEL): set_color_state(ctk_color_correction, GAMMA, - GREEN_CHANNEL, p->fval, TRUE); break; + GREEN_CHANNEL, p->val.f, TRUE); break; case (GAMMA_VALUE | BLUE_CHANNEL): set_color_state(ctk_color_correction, GAMMA, - BLUE_CHANNEL, p->fval, TRUE); break; + BLUE_CHANNEL, p->val.f, TRUE); break; case (GAMMA_VALUE | ALL_CHANNELS): set_color_state(ctk_color_correction, GAMMA, - ALL_CHANNELS, p->fval, TRUE); break; + ALL_CHANNELS, p->val.f, TRUE); break; default: goto next_attribute; diff --git a/src/gtk+-2.x/ctkconfig.c b/src/gtk+-2.x/ctkconfig.c index 5375af4..caadc1f 100644 --- a/src/gtk+-2.x/ctkconfig.c +++ b/src/gtk+-2.x/ctkconfig.c @@ -102,6 +102,7 @@ GType ctk_config_get_type( sizeof (CtkConfig), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_config_type = g_type_register_static diff --git a/src/gtk+-2.x/ctkcursorshadow.c b/src/gtk+-2.x/ctkcursorshadow.c index 7b23dcf..92ea1fa 100644 --- a/src/gtk+-2.x/ctkcursorshadow.c +++ b/src/gtk+-2.x/ctkcursorshadow.c @@ -176,6 +176,7 @@ GType ctk_cursor_shadow_get_type(void) sizeof(CtkCursorShadow), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_cursor_shadow_type = g_type_register_static diff --git a/src/gtk+-2.x/ctkcurve.c b/src/gtk+-2.x/ctkcurve.c index 001aae1..709373f 100644 --- a/src/gtk+-2.x/ctkcurve.c +++ b/src/gtk+-2.x/ctkcurve.c @@ -68,6 +68,7 @@ GType ctk_curve_get_type( sizeof (CtkCurve), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_curve_type = g_type_register_static (GTK_TYPE_DRAWING_AREA, diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.c b/src/gtk+-2.x/ctkdisplayconfig-utils.c index 526c120..eed0604 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.c +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.c @@ -41,7 +41,7 @@ static void xconfig_update_buffer(GtkWidget *widget, gpointer user_data); - +static gchar *display_pick_config_name(nvDisplayPtr display, int be_generic); @@ -432,6 +432,36 @@ static nvModeLinePtr modeline_parse(nvDisplayPtr display, /*****************************************************************************/ +/** apply_mode_attribute_token() ************************************* + * + * Modifies the nvMode structure (pointed to by data) with + * information from the token-value pair given. Currently accepts + * stereo (mode) data. + * + * Unknown token and/or values are silently ignored. + * + **/ +static void apply_mode_attribute_token(char *token, char *value, void *data) +{ + nvModePtr mode = (nvModePtr)data; + + if (!mode || !token || !strlen(token)) { + return; + } + + /* stereo */ + if (!strcasecmp("stereo", token)) { + if (!strcasecmp("PassiveLeft", value)) { + mode->passive_stereo_eye = PASSIVE_STEREO_EYE_LEFT; + } else if (!strcasecmp("PassiveRight", value)) { + mode->passive_stereo_eye = PASSIVE_STEREO_EYE_RIGHT; + } + } + +} /* apply_mode_attribute_token() */ + + + /** mode_parse() ***************************************************** * * Converts a mode string (dpy specific part of a metamode) to a @@ -439,9 +469,10 @@ static nvModeLinePtr modeline_parse(nvDisplayPtr display, * * Mode strings have the following format: * - * "mode_name +X+Y @WxH" + * "mode_name +X+Y @WxH {token=value, ...}" * **/ + nvModePtr mode_parse(nvDisplayPtr display, const char *mode_str) { nvModePtr mode; @@ -484,7 +515,7 @@ nvModePtr mode_parse(nvDisplayPtr display, const char *mode_str) if (strcmp(mode_str, "NULL")) { nv_warning_msg("Mode name '%s' does not match any modelines for " "display device '%s' in modeline '%s'.", - mode_name, display->name, mode_str); + mode_name, display->logName, mode_str); } mode->dim[W] = display->modelines->data.hdisplay; mode->dim[H] = display->modelines->data.vdisplay; @@ -518,8 +549,29 @@ nvModePtr mode_parse(nvDisplayPtr display, const char *mode_str) &(mode->dim[X]), &(mode->dim[Y])); } + /* Read extra params */ + else if (*str == '{') { + const char *end; + char *tmp; + str++; + + end = strchr(str, '}'); + if (!end) goto fail; + + /* Dupe the string so we can parse it properly */ + tmp = nvstrndup(str, (size_t)(end-str)); + if (!tmp) goto fail; + + parse_token_value_pairs(tmp, apply_mode_attribute_token, mode); + free(tmp); + if (end && (*end == '}')) { + str = ++end; + } + } + /* Mode parse error - Ack! */ else { + nv_error_msg("Unknown mode token: %s", str); str = NULL; } @@ -567,46 +619,31 @@ static gchar *mode_get_str(nvModePtr mode, int be_generic) { gchar *mode_str; gchar *tmp; - + gchar *flags_str; + nvDisplayPtr display = mode->display; + nvScreenPtr screen; + nvGpuPtr gpu; /* Make sure the mode has everything it needs to be displayed */ - if (!mode || !mode->display || !mode->display->gpu || !mode->metamode) { + if (!mode || !mode->metamode || !display) { return NULL; } - /* Don't display dummy modes */ if (be_generic && mode->dummy && !mode->modeline) { return NULL; } + screen = display->screen; + gpu = display->gpu; + if (!screen || !gpu) { + return NULL; + } - /* Only one display, be very generic (no 'CRT:' in metamode) */ - if (be_generic && mode->display->gpu->num_displays == 1) { - mode_str = g_strdup(""); - - /* If there's more than one CRT/DFP/TV, we can't be generic. */ - } else { - int generic = be_generic; - - if ((mode->display->device_mask & 0x000000FF) && - (mode->display->device_mask != - (mode->display->gpu->connected_displays & 0x000000FF))) { - generic = 0; - } - if ((mode->display->device_mask & 0x0000FF00) && - (mode->display->device_mask != - (mode->display->gpu->connected_displays & 0x0000FF00))) { - generic = 0; - } - if ((mode->display->device_mask & 0x00FF0000) && - (mode->display->device_mask != - (mode->display->gpu->connected_displays & 0x00FF0000))) { - generic = 0; - } - - /* Get the display type */ - tmp = display_get_type_str(mode->display->device_mask, generic); + /* Pick a suitable display name qualifier */ + mode_str = display_pick_config_name(display, be_generic); + if (mode_str[0] != '\0') { + tmp = mode_str; mode_str = g_strconcat(tmp, ": ", NULL); g_free(tmp); } @@ -663,6 +700,42 @@ static gchar *mode_get_str(nvModePtr mode, int be_generic) mode_str = tmp; + /* Mode Flags */ + flags_str = NULL; + + /* Passive Stereo Eye */ + if (screen->stereo_supported && screen->stereo == 4) { + const char *eye; + + switch (mode->passive_stereo_eye) { + case PASSIVE_STEREO_EYE_LEFT: + eye = "PassiveLeft"; + break; + case PASSIVE_STEREO_EYE_RIGHT: + eye = "PassiveRight"; + break; + case 0: + default: + eye = NULL; + break; + } + + if (eye) { + tmp = g_strdup_printf("%s, stereo=%s", (flags_str ? flags_str : ""), eye); + g_free(flags_str); + flags_str = tmp; + } + } + + if (flags_str) { + tmp = g_strdup_printf("%s {%s}", + mode_str, + flags_str+2 // Skip the first comma and whitespace + ); + g_free(mode_str); + mode_str = tmp; + } + return mode_str; } /* mode_get_str() */ @@ -675,56 +748,67 @@ static gchar *mode_get_str(nvModePtr mode, int be_generic) /*****************************************************************************/ -/** display_get_type_str() ******************************************* +/** display_names_match() ******************************************** * - * Returns the type name of a display (CRT, CRT-1, DFP ..) - * - * If 'generic' is set to 1, then a generic version of the name is - * returned. + * Determines if two (display) names are the same. Returns FALSE if + * either name is NULL. * **/ -gchar *display_get_type_str(unsigned int device_mask, int be_generic) + +static Bool display_names_match(const char *name1, const char *name2) { - unsigned int bit = 0; - int num; - gchar *name = NULL; - gchar *type_name; + if (!name1 || !name2) { + return FALSE; + } + return (strcasecmp(name1, name2) == 0) ? TRUE : FALSE; +} - /* Get the generic type name of the display */ - if (device_mask & 0x000000FF) { - name = g_strdup("CRT"); - bit = (device_mask & 0x000000FF); - } else if (device_mask & 0x0000FF00) { - name = g_strdup("TV"); - bit = (device_mask & 0x0000FF00) >> 8; - } else if (device_mask & 0x00FF0000) { - name = g_strdup("DFP"); - bit = (device_mask & 0x00FF0000) >> 16; - } +/** display_pick_config_name() *************************************** + * + * Returns one of the display's names to be used for writing + * configuration. + * + * If 'generic' is TRUE, then the most generic name possible is + * returned. This depends on the current existence of other display + * devices, and the name returned here will not collide with the name + * of other display devices. + * + **/ +static gchar *display_pick_config_name(nvDisplayPtr display, int be_generic) +{ + nvDisplayPtr other; - if (be_generic || !name) { - return name; + /* Be specific */ + if (!be_generic) { + goto return_specific; } - /* Add the specific display number to the name */ - num = 0; - while (bit) { - num++; - bit >>= 1; - } - if (num) { - num--; + /* Only one display, so no need for a qualifier */ + if (display->gpu->num_displays == 1) { + return g_strdup(""); } - type_name = g_strdup_printf("%s-%d", name, num); - g_free(name); + /* Find the best generic name possible. If any display connected to the + * GPU has the same typeBaseName, then return the typeIdName instead + */ + for (other = display->gpu->displays; other; other = other->next_on_gpu) { + if (other == display) continue; + if (strcmp(other->typeBaseName, display->typeBaseName) == 0) { + goto return_specific; + } + } - return type_name; + /* No other display device on the GPU shares the same type basename, + * so we can use it + */ + return g_strdup(display->typeBaseName); -} /* display_get_type_str() */ + return_specific: + return g_strdup(display->typeIdName); +} @@ -896,9 +980,9 @@ Bool display_add_modelines_from_server(nvDisplayPtr display, gchar **err_str) */ broken_doublescan_modelines = 1; - ret = NvCtrlGetAttribute(display->gpu->handle, + ret = NvCtrlGetAttribute(display->handle, NV_CTRL_ATTR_NV_MAJOR_VERSION, &major); - ret1 = NvCtrlGetAttribute(display->gpu->handle, + ret1 = NvCtrlGetAttribute(display->handle, NV_CTRL_ATTR_NV_MINOR_VERSION, &minor); if ((ret == NvCtrlSuccess) && (ret1 == NvCtrlSuccess) && @@ -912,17 +996,14 @@ Bool display_add_modelines_from_server(nvDisplayPtr display, gchar **err_str) /* Get the validated modelines for the display */ - ret = NvCtrlGetBinaryAttribute(display->gpu->handle, - display->device_mask, + ret = NvCtrlGetBinaryAttribute(display->handle, 0, NV_CTRL_BINARY_DATA_MODELINES, (unsigned char **)&modeline_strs, &len); if (ret != NvCtrlSuccess) { *err_str = g_strdup_printf("Failed to query modelines of display " - "device 0x%08x '%s'\nconnected to " - "GPU-%d '%s'.", - display->device_mask, display->name, - NvCtrlGetTargetId(display->gpu->handle), - display->gpu->name); + "device %d '%s'.", + NvCtrlGetTargetId(display->handle), + display->logName); nv_error_msg(*err_str); goto fail; } @@ -936,12 +1017,9 @@ Bool display_add_modelines_from_server(nvDisplayPtr display, gchar **err_str) if (!modeline) { *err_str = g_strdup_printf("Failed to parse the following " "modeline of display device\n" - "0x%08x '%s' connected to GPU-%d " - "'%s':\n\n%s", - display->device_mask, - display->name, - NvCtrlGetTargetId(display->gpu->handle), - display->gpu->name, + "%d '%s' :\n\n%s", + NvCtrlGetTargetId(display->handle), + display->logName, str); nv_error_msg(*err_str); goto fail; @@ -1030,7 +1108,13 @@ static void display_free(nvDisplayPtr display) if (display) { display_remove_modes(display); display_remove_modelines(display); - XFree(display->name); + XFree(display->logName); + XFree(display->typeBaseName); + XFree(display->typeIdName); + XFree(display->dpGuidName); + XFree(display->edidHashName); + XFree(display->targetIdName); + XFree(display->randrName); free(display); } @@ -1040,15 +1124,62 @@ static void display_free(nvDisplayPtr display) /*****************************************************************************/ -/** METAMODE FUNCTIONS *******************************************************/ +/** SCREEN FUNCTIONS *********************************************************/ /*****************************************************************************/ +/** screen_find_named_display() ************************************** + * + * Finds a display named 'display_name' in the list of displays on the + * given screen, or NULL if no display matched 'display_name'. + * + **/ +static nvDisplayPtr screen_find_named_display(nvScreenPtr screen, + char *display_name) +{ + nvDisplayPtr display; + nvDisplayPtr possible_display = NULL; + + if (!display_name) { + return NULL; + } + + /* Look for exact matches */ + for (display = screen->displays; + display; + display = display->next_in_screen) { + + /* Look for an exact match */ + if (display_names_match(display->typeIdName, display_name)) { + return display; + } + if (display_names_match(display->dpGuidName, display_name)) { + return display; + } + if (display_names_match(display->targetIdName, display_name)) { + return display; + } + if (display_names_match(display->randrName, display_name)) { + return display; + } + + /* Allow matching to generic names, but only return these + * if no other name matched + */ + if (!possible_display) { + if (display_names_match(display->typeBaseName, display_name)) { + possible_display = display; + } + if (display_names_match(display->edidHashName, display_name)) { + possible_display = display; + } + } + } + + return possible_display; +} -/*****************************************************************************/ -/** SCREEN FUNCTIONS *********************************************************/ -/*****************************************************************************/ /** renumber_xscreens() ********************************************** @@ -1114,7 +1245,6 @@ void screen_link_display(nvScreenPtr screen, nvDisplayPtr display) } } } - screen->displays_mask |= display->device_mask; screen->num_displays++; } /* screen_link_display() */ @@ -1147,7 +1277,6 @@ void screen_unlink_display(nvDisplayPtr display) cur = cur->next_in_screen; } } - screen->displays_mask &= ~(display->device_mask); screen->num_displays--; display->screen = NULL; @@ -1347,30 +1476,30 @@ static Bool screen_add_metamode(nvScreenPtr screen, const char *metamode_str, mode_str_itr = strtok(NULL, ",")) { nvModePtr mode; - unsigned int device_mask; nvDisplayPtr display; + unsigned int display_id; const char *orig_mode_str = parse_skip_whitespace(mode_str_itr); const char *mode_str; - /* Parse the display device bitmask from the name */ - mode_str = parse_read_display_name(mode_str_itr, &device_mask); + /* Parse the display device (NV-CONTROL target) id from the name */ + mode_str = parse_read_display_id(mode_str_itr, &display_id); if (!mode_str) { nv_warning_msg("Failed to read a display device name on screen %d " - "(on GPU-%d)\nwhile parsing metamode:\n\n'%s'", + "while parsing metamode:\n\n'%s'", screen->scrnum, - NvCtrlGetTargetId(screen->gpu->handle), + orig_mode_str); continue; } - /* Match device bitmask to an existing display */ - display = gpu_get_display(screen->gpu, device_mask); + /* Match device id to an existing display */ + display = layout_get_display(screen->layout, display_id); if (!display) { - nv_warning_msg("Failed to find display device 0x%08x on screen %d " - "(on GPU-%d)\nwhile parsing metamode:\n\n'%s'", - device_mask, + nv_warning_msg("Failed to find display device %d on screen %d " + "while parsing metamode:\n\n'%s'", + display_id, screen->scrnum, - NvCtrlGetTargetId(screen->gpu->handle), + orig_mode_str); continue; } @@ -1378,10 +1507,10 @@ static Bool screen_add_metamode(nvScreenPtr screen, const char *metamode_str, /* Parse the mode */ mode = mode_parse(display, mode_str); if (!mode) { - nv_warning_msg("Failed to parse mode '%s'\non screen %d (on GPU-%d)" - "\nfrom metamode:\n\n'%s'", - mode_str, screen->scrnum, - NvCtrlGetTargetId(screen->gpu->handle), + nv_warning_msg("Failed to parse mode '%s'\non screen %d\n" + "from metamode:\n\n'%s'", + mode_str, + screen->scrnum, orig_mode_str); continue; } @@ -1512,7 +1641,7 @@ static Bool screen_check_metamodes(nvScreenPtr screen) * match the top left of the first non-dummy mode * **/ -void screen_assign_dummy_metamode_positions(nvScreenPtr screen) +static void screen_assign_dummy_metamode_positions(nvScreenPtr screen) { nvDisplayPtr display; nvModePtr ok_mode; @@ -1565,7 +1694,7 @@ static Bool screen_add_metamodes(nvScreenPtr screen, gchar **err_str) /* Get the list of metamodes for the screen */ ret = NvCtrlGetBinaryAttribute(screen->handle, 0, - NV_CTRL_BINARY_DATA_METAMODES, + NV_CTRL_BINARY_DATA_METAMODES_VERSION_2, (unsigned char **)&metamode_strs, &len); if (ret != NvCtrlSuccess) { @@ -1580,7 +1709,7 @@ static Bool screen_add_metamodes(nvScreenPtr screen, gchar **err_str) /* Get the current metamode for the screen */ ret = NvCtrlGetStringAttribute(screen->handle, - NV_CTRL_STRING_CURRENT_METAMODE, + NV_CTRL_STRING_CURRENT_METAMODE_VERSION_2, &cur_metamode_str); if (ret != NvCtrlSuccess) { *err_str = g_strdup_printf("Failed to query current metamode of\n" @@ -1700,26 +1829,6 @@ static void screen_free(nvScreenPtr screen) /*****************************************************************************/ -/** gpu_get_display() ************************************************ - * - * Returns the display with the matching device_mask or NULL if not - * found. - * - **/ -nvDisplayPtr gpu_get_display(nvGpuPtr gpu, unsigned int device_mask) -{ - nvDisplayPtr display; - - for (display = gpu->displays; display; display = display->next_on_gpu) { - if (display->device_mask == device_mask) return display; - } - - return NULL; - -} /* gpu_get_display() */ - - - /** gpu_remove_and_free_display() ************************************ * * Removes a display from the GPU and frees it. @@ -1756,7 +1865,6 @@ void gpu_remove_and_free_display(nvDisplayPtr display) } } } - gpu->connected_displays &= ~(display->device_mask); gpu->num_displays--; display_free(display); @@ -1777,7 +1885,6 @@ static void gpu_remove_displays(nvGpuPtr gpu) while (gpu->displays) { gpu_remove_and_free_display(gpu->displays); } - gpu->connected_displays = 0; } /* gpu_remove_displays() */ @@ -1808,7 +1915,6 @@ static void gpu_add_display(nvGpuPtr gpu, nvDisplayPtr display) } } } - gpu->connected_displays |= display->device_mask; gpu->num_displays++; } /* gpu_add_display() */ @@ -1857,17 +1963,74 @@ static Bool gpu_query_gvo_mode_info(nvGpuPtr gpu, int mode_id, int table_idx) } + +/** display_add_name_from_server() *********************************** + * + * Queries and adds the NV-CONTROL name to the display device. + * + **/ + +static const struct DisplayNameInfoRec { + int attr; + Bool canBeNull; + const char *nameDescription; + size_t offset; +} DisplayNamesTable[] = { + { NV_CTRL_STRING_DISPLAY_DEVICE_NAME, FALSE, "Log Name", + offsetof(nvDisplay, logName) }, + { NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME, FALSE, "Type Base Name", + offsetof(nvDisplay, typeBaseName) }, + { NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID, FALSE, "Type ID", + offsetof(nvDisplay, typeIdName) }, + { NV_CTRL_STRING_DISPLAY_NAME_DP_GUID, TRUE, "DP GUID Name", + offsetof(nvDisplay, dpGuidName) }, + { NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH, TRUE, "EDID Hash Name", + offsetof(nvDisplay, edidHashName) }, + { NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX, FALSE, "Target Index Name", + offsetof(nvDisplay, targetIdName) }, + { NV_CTRL_STRING_DISPLAY_NAME_RANDR, FALSE, "RandR Name", + offsetof(nvDisplay, randrName) }, +}; + +static Bool display_add_name_from_server(nvDisplayPtr display, + const struct DisplayNameInfoRec *displayNameInfo, + gchar **err_str) +{ + ReturnStatus ret; + char *str; + + ret = NvCtrlGetStringAttribute(display->handle, + displayNameInfo->attr, + &str); + if (ret == NvCtrlSuccess) { + *((char **)(((char *)display) + displayNameInfo->offset)) = str; + + } else if (!displayNameInfo->canBeNull) { + *err_str = g_strdup_printf("Failed to query name '%s' of display " + "device DPY-%d.", + displayNameInfo->nameDescription, + NvCtrlGetTargetId(display->handle)); + nv_error_msg(*err_str); + return FALSE; + } + + return TRUE; +} + + + /** gpu_add_display_from_server() ************************************ * - * Adds the display with the device mask given to the GPU structure. + * Adds the display with the device id given to the GPU structure. * **/ nvDisplayPtr gpu_add_display_from_server(nvGpuPtr gpu, - unsigned int device_mask, + unsigned int display_id, gchar **err_str) { ReturnStatus ret; nvDisplayPtr display; + int i; /* Create the display structure */ @@ -1875,34 +2038,40 @@ nvDisplayPtr gpu_add_display_from_server(nvGpuPtr gpu, if (!display) goto fail; - /* Init the display structure */ - display->device_mask = device_mask; + /* Make an NV-CONTROL handle to talk to the display */ + display->handle = + NvCtrlAttributeInit(NvCtrlGetDisplayPtr(gpu->handle), + NV_CTRL_TARGET_TYPE_DISPLAY, + display_id, + NV_CTRL_ATTRIBUTES_NV_CONTROL_SUBSYSTEM); + if (!display->handle) { + *err_str = g_strdup_printf("Failed to create NV-CONTROL handle for\n" + "display %d (on GPU-%d).", + display_id, + NvCtrlGetTargetId(gpu->handle)); + nv_error_msg(*err_str); + goto fail; + } /* Query the display information */ - ret = NvCtrlGetStringDisplayAttribute(gpu->handle, - device_mask, - NV_CTRL_STRING_DISPLAY_DEVICE_NAME, - &(display->name)); - if (ret != NvCtrlSuccess) { - *err_str = g_strdup_printf("Failed to query name of display device\n" - "0x%08x connected to GPU-%d '%s'.", - device_mask, NvCtrlGetTargetId(gpu->handle), - gpu->name); - nv_error_msg(*err_str); - goto fail; + for (i = 0; i < ARRAY_LEN(DisplayNamesTable); i++) { + if (!display_add_name_from_server(display, + DisplayNamesTable + i, err_str)) { + goto fail; + } } /* Query if this display is an SDI display */ - ret = NvCtrlGetDisplayAttribute(gpu->handle, device_mask, - NV_CTRL_IS_GVO_DISPLAY, - &(display->is_sdi)); + ret = NvCtrlGetAttribute(display->handle, + NV_CTRL_IS_GVO_DISPLAY, + &(display->is_sdi)); if (ret != NvCtrlSuccess) { nv_warning_msg("Failed to query if display device\n" - "0x%08x connected to GPU-%d '%s' is an\n" + "%d connected to GPU-%d '%s' is an\n" "SDI device.", - device_mask, NvCtrlGetTargetId(gpu->handle), + display_id, NvCtrlGetTargetId(gpu->handle), gpu->name); display->is_sdi = FALSE; } @@ -1995,9 +2164,9 @@ nvDisplayPtr gpu_add_display_from_server(nvGpuPtr gpu, /* Query the modelines for the display device */ if (!display_add_modelines_from_server(display, err_str)) { - nv_warning_msg("Failed to add modelines to display device 0x%08x " + nv_warning_msg("Failed to add modelines to display device %d " "'%s'\nconnected to GPU-%d '%s'.", - device_mask, display->name, + display_id, display->logName, NvCtrlGetTargetId(gpu->handle), gpu->name); goto fail; } @@ -2023,38 +2192,44 @@ nvDisplayPtr gpu_add_display_from_server(nvGpuPtr gpu, static Bool gpu_add_displays_from_server(nvGpuPtr gpu, gchar **err_str) { ReturnStatus ret; - unsigned int mask; + int *pData; + int len; + int i; /* Clean up the GPU list */ gpu_remove_displays(gpu); - - /* Get the list of connected displays */ - ret = NvCtrlGetAttribute(gpu->handle, NV_CTRL_CONNECTED_DISPLAYS, - (int *)&(gpu->connected_displays)); + /* Get list of displays connected to this GPU */ + ret = NvCtrlGetBinaryAttribute(gpu->handle, 0, + NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU, + (unsigned char **)(&pData), &len); if (ret != NvCtrlSuccess) { - *err_str = g_strdup_printf("Failed to query connected display " - "devices on GPU-%d '%s'.", - NvCtrlGetTargetId(gpu), gpu->name); + *err_str = g_strdup_printf("Failed to query list of displays \n" + "connected to GPU-%d '%s'.", + NvCtrlGetTargetId(gpu->handle), gpu->name); nv_error_msg(*err_str); goto fail; } - /* Add each connected display */ - for (mask = 1; mask; mask <<= 1) { + for (i = 0; i < pData[0]; i++) { + if (!gpu_add_display_from_server(gpu, pData[i+1], err_str)) { + nv_warning_msg("Failed to add display device %d to GPU-%d " + + + - if (!(mask & (gpu->connected_displays))) continue; - if (!gpu_add_display_from_server(gpu, mask, err_str)) { - nv_warning_msg("Failed to add display device 0x%08x to GPU-%d " "'%s'.", - mask, NvCtrlGetTargetId(gpu->handle), gpu->name); + pData[i+1], NvCtrlGetTargetId(gpu->handle), + gpu->name); + XFree(pData); goto fail; } } + XFree(pData); return TRUE; fail: @@ -2508,8 +2683,8 @@ static Bool layout_add_screen_from_server(nvLayoutPtr layout, NvCtrlAttributeInit(display, NV_CTRL_TARGET_TYPE_X_SCREEN, screen_id, - NV_CTRL_ATTRIBUTES_NV_CONTROL_SUBSYSTEM | - NV_CTRL_ATTRIBUTES_XRANDR_SUBSYSTEM); + NV_CTRL_ATTRIBUTES_NV_CONTROL_SUBSYSTEM); + if (!screen->handle) { *err_str = g_strdup_printf("Failed to create NV-CONTROL handle for\n" "screen %d.", @@ -2519,6 +2694,15 @@ static Bool layout_add_screen_from_server(nvLayoutPtr layout, } + /* Query the current stereo mode */ + ret = NvCtrlGetAttribute(screen->handle, NV_CTRL_STEREO, &val); + if (ret == NvCtrlSuccess) { + screen->stereo_supported = TRUE; + screen->stereo = val; + } else { + screen->stereo_supported = FALSE; + } + /* See if the screen supports dynamic twinview */ ret = NvCtrlGetAttribute(screen->handle, NV_CTRL_DYNAMIC_TWINVIEW, &val); if (ret != NvCtrlSuccess) { @@ -2595,20 +2779,27 @@ static Bool layout_add_screen_from_server(nvLayoutPtr layout, /* Query & parse the screen's primary display */ screen->primaryDisplay = NULL; - ret = NvCtrlGetStringDisplayAttribute - (screen->handle, - 0, - NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER, - &primary_str); - - if (ret == NvCtrlSuccess) { - unsigned int device_mask; - - /* Parse the device mask */ - parse_read_display_name(primary_str, &device_mask); + ret = NvCtrlGetStringAttribute(screen->handle, + NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER, + &primary_str); + + if (ret == NvCtrlSuccess && primary_str) { + char *str; + + /* The TwinView Xinerana Info Order string may be a comma-separated + * list of display device names, though we could add full support + * for ordering these, just keep track of a single display here. + */ + str = strchr(primary_str, ','); + if (!str) { + str = nvstrdup(primary_str); + } else { + str = nvstrndup(primary_str, str-primary_str); + } + XFree(primary_str); - /* Find the matching primary display */ - screen->primaryDisplay = gpu_get_display(screen->gpu, device_mask); + screen->primaryDisplay = screen_find_named_display(screen, str); + nvfree(str); } } @@ -2724,7 +2915,7 @@ nvLayoutPtr layout_load_from_server(NvCtrlAttributeHandle *handle, { nvLayoutPtr layout = NULL; ReturnStatus ret; - + int tmp; /* Allocate the layout structure */ layout = (nvLayoutPtr)calloc(1, sizeof(nvLayout)); @@ -2744,6 +2935,19 @@ nvLayoutPtr layout_load_from_server(NvCtrlAttributeHandle *handle, goto fail; } + /* does the driver know about NV_CTRL_CURRENT_METAMODE_ID? */ + ret = NvCtrlGetAttribute(handle, NV_CTRL_CURRENT_METAMODE_ID, &tmp); + if (ret != NvCtrlSuccess) { + char *displayName = NvCtrlGetDisplayName(handle); + *err_str = g_strdup_printf("The NVIDIA X driver on %s is not new\n" + "enough to support the nvidia-settings " + "Display Configuration page.", + displayName ? displayName : "this X server"); + free(displayName); + nv_warning_msg(*err_str); + goto fail; + } + if (!layout_add_gpus_from_server(layout, err_str)) { nv_warning_msg("Failed to add GPU(s) to layout for display " "configuration page."); @@ -2807,6 +3011,35 @@ nvScreenPtr layout_get_a_screen(nvLayoutPtr layout, nvGpuPtr preferred_gpu) +/** layout_get_display() ********************************************* + * + * Returns the display with the matching display id or NULL if not + * found. + * + **/ +nvDisplayPtr layout_get_display(const nvLayoutPtr layout, + const unsigned int display_id) +{ + nvGpuPtr gpu; + nvDisplayPtr display; + + for (gpu = layout->gpus; gpu; gpu = gpu->next_in_layout) { + for (display = gpu->displays; + display; + display = display->next_on_gpu) { + + if (NvCtrlGetTargetId(display->handle) == display_id) { + return display; + } + } + } + + return NULL; + +} /* layout_get_display() */ + + + /*****************************************************************************/ /** XCONFIG FUNCTIONS ********************************************************/ diff --git a/src/gtk+-2.x/ctkdisplayconfig-utils.h b/src/gtk+-2.x/ctkdisplayconfig-utils.h index a9cc38c..d2b663a 100644 --- a/src/gtk+-2.x/ctkdisplayconfig-utils.h +++ b/src/gtk+-2.x/ctkdisplayconfig-utils.h @@ -59,7 +59,6 @@ void modeline_free(nvModeLinePtr m); /* Display functions */ -gchar * display_get_type_str(unsigned int device_mask, int be_generic); int display_find_closest_mode_matching_modeline(nvDisplayPtr display, nvModeLinePtr modeline); Bool display_has_modeline(nvDisplayPtr display, nvModeLinePtr modeline); @@ -82,10 +81,9 @@ gchar * screen_get_metamode_str(nvScreenPtr screen, int metamode_idx, /* GPU functions */ -nvDisplayPtr gpu_get_display(nvGpuPtr gpu, unsigned int device_mask); void gpu_remove_and_free_display(nvDisplayPtr display); nvDisplayPtr gpu_add_display_from_server(nvGpuPtr gpu, - unsigned int device_mask, + unsigned int display_id, gchar **err_str); Bool gpu_add_screenless_modes_to_displays(nvGpuPtr gpu); @@ -98,6 +96,8 @@ void layout_add_screen(nvLayoutPtr layout, nvScreenPtr screen); nvLayoutPtr layout_load_from_server(NvCtrlAttributeHandle *handle, gchar **err_str); nvScreenPtr layout_get_a_screen(nvLayoutPtr layout, nvGpuPtr preferred_gpu); +nvDisplayPtr layout_get_display(const nvLayoutPtr layout, + const unsigned int display_id); void layout_remove_and_free_screen(nvScreenPtr screen); diff --git a/src/gtk+-2.x/ctkdisplayconfig.c b/src/gtk+-2.x/ctkdisplayconfig.c index 96fd5ff..26ca46e 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.c +++ b/src/gtk+-2.x/ctkdisplayconfig.c @@ -48,12 +48,19 @@ void layout_modified_callback(nvLayoutPtr layout, void *data); static void setup_layout_frame(CtkDisplayConfig *ctk_object); +static void setup_selected_item_dropdown(CtkDisplayConfig *ctk_object); + +static void selected_item_changed(GtkWidget *widget, gpointer user_data); + +static void update_selected_page(CtkDisplayConfig *ctk_object); + static void setup_display_page(CtkDisplayConfig *ctk_object); static void display_config_changed(GtkWidget *widget, gpointer user_data); static void display_resolution_changed(GtkWidget *widget, gpointer user_data); static void display_refresh_changed(GtkWidget *widget, gpointer user_data); -static void display_modelname_changed(GtkWidget *widget, gpointer user_data); + +static void display_stereo_changed(GtkWidget *widget, gpointer user_data); static void display_position_type_changed(GtkWidget *widget, gpointer user_data); static void display_position_offset_activate(GtkWidget *widget, gpointer user_data); @@ -71,6 +78,8 @@ static gboolean screen_virtual_size_focus_out(GtkWidget *widget, GdkEvent *event static void screen_depth_changed(GtkWidget *widget, gpointer user_data); +static void screen_stereo_changed(GtkWidget *widget, gpointer user_data); + static void screen_position_type_changed(GtkWidget *widget, gpointer user_data); static void screen_position_offset_activate(GtkWidget *widget, gpointer user_data); static void screen_position_relative_changed(GtkWidget *widget, gpointer user_data); @@ -157,12 +166,12 @@ static const char * __layout_xinerama_button_help = "this option will require restarting your X server. Note that when Xinerama " "is enabled, resolution changes will also require restarting your X server."; +static const char * __selected_item_help = +"The Selection drop-down allows you to pick which X screen or display device " +"to configure."; /* Display tooltips */ -static const char * __dpy_model_help = -"The Display drop-down allows you to select a desired display device."; - static const char * __dpy_configuration_mnu_help = "The Configure drop-down allows you to select the desired configuration " "for the currently selected display device."; @@ -176,6 +185,11 @@ static const char * __dpy_refresh_mnu_help = "for the currently selected display device. Note that the selected " "resolution may restrict the available refresh rates."; +static const char * __dpy_stereo_help = +"The Display Passive Stereo Eye drop-down allows you to select a desired " +"stereo eye the display should output when Passive Stereo (Mode 4) is " +"selected enabled."; + static const char * __dpy_position_type_help = "The Position Type drop-down allows you to set how the selected display " "device is placed within the X screen. This is only available when " @@ -213,6 +227,10 @@ static const char * __screen_depth_help = "The Depth drop-down allows setting of the color quality for the selected " "screen; changing this option will require restarting your X server."; +static const char * __screen_stereo_help = +"The Stereo Mode drop-down allows setting of the stereo mode for the selected " +"screen; changing this option will require restarting your X server."; + static const char * __screen_position_type_help = "The Position Type drop-down appears when two or more display devices are active. " "This allows you to set how the selected screen " @@ -386,11 +404,6 @@ static void register_layout_events(CtkDisplayConfig *ctk_object) (gpointer) ctk_object); g_signal_connect(G_OBJECT(screen->ctk_event), - CTK_EVENT_NAME(NV_CTRL_ASSOCIATED_DISPLAY_DEVICES), - G_CALLBACK(display_config_attribute_changed), - (gpointer) ctk_object); - - g_signal_connect(G_OBJECT(screen->ctk_event), CTK_EVENT_NAME(NV_CTRL_STRING_MOVE_METAMODE), G_CALLBACK(display_config_attribute_changed), (gpointer) ctk_object); @@ -497,33 +510,12 @@ static void consolidate_xinerama(CtkDisplayConfig *ctk_object, /** update_btn_apply() ************************************************** * - * Updates the apply button's sensitvity (if possible) + * Updates the apply button's sensitivity * **/ -void update_btn_apply(CtkDisplayConfig *ctk_object, Bool sensitive) +static void update_btn_apply(CtkDisplayConfig *ctk_object, Bool sensitive) { - Bool xrandr_available = FALSE; - nvLayoutPtr layout = ctk_object->layout; - nvScreenPtr screen; - - - if (sensitive) { - /* If none of the screens support XRandR, we can't apply */ - for (screen = layout->screens; - screen; - screen = screen->next_in_layout) { - if (NvCtrlGetXrandrEventBase(screen->handle) >= 0) { - xrandr_available = TRUE; - break; - } - } - - if (!xrandr_available && !ctk_object->primary_display_changed) { - sensitive = FALSE; - } - } - gtk_widget_set_sensitive(ctk_object->btn_apply, sensitive); } /* update_btn_apply() */ @@ -697,7 +689,7 @@ static int generate_xconf_metamode_str(CtkDisplayConfig *ctk_object, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, - msg); + "%s", msg); gtk_dialog_add_buttons(GTK_DIALOG(dlg), "Truncate MetaModes", @@ -874,6 +866,7 @@ GType ctk_display_config_get_type(void) sizeof(CtkDisplayConfig), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_display_config_type = g_type_register_static @@ -892,7 +885,7 @@ GType ctk_display_config_get_type(void) * **/ -GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) +static GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) { GtkWidget *dialog; GtkWidget *image; @@ -989,7 +982,7 @@ GtkWidget * create_validation_dialog(CtkDisplayConfig *ctk_object) * **/ -GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) +static GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) { GtkWidget *dialog; GtkWidget *image; @@ -1013,7 +1006,7 @@ GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) GTK_DIALOG_DESTROY_WITH_PARENT, NULL); ctk_object->dlg_validation_apply = dialog; - + /* Main horizontal box */ hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), @@ -1024,11 +1017,11 @@ GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) GTK_ICON_SIZE_DIALOG); gtk_misc_set_alignment(GTK_MISC(image), 0.0f, 0.0f); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 5); - + /* Main vertical box */ vbox = gtk_vbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - + /* Pack the main message */ str = g_strdup_printf("The current settings cannot be completely applied\n" "due to one or more of the following reasons:\n" @@ -1047,7 +1040,7 @@ GtkWidget * create_validation_apply_dialog(CtkDisplayConfig *ctk_object) g_free(str); gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.0f); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); - + /* Action Buttons */ gtk_dialog_add_button(GTK_DIALOG(dialog), "Apply What Is Possible", GTK_RESPONSE_ACCEPT); @@ -1129,6 +1122,24 @@ static void screen_size_changed(GdkScreen *screen, +/** update_gui() ***************************************************** + * + * Sync state of all widgets to reflect current configuration + * + **/ + +static void update_gui(CtkDisplayConfig *ctk_object) +{ + setup_display_page(ctk_object); + setup_screen_page(ctk_object); + setup_selected_item_dropdown(ctk_object); + update_selected_page(ctk_object); + setup_layout_frame(ctk_object); + +} /* update_gui() */ + + + /** ctk_display_config_new() ***************************************** * * Display Configuration widget creation. @@ -1143,14 +1154,17 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, GtkWidget *banner; GtkWidget *frame; - GtkWidget *notebook; GtkWidget *hbox; GtkWidget *vbox; GdkScreen *screen; GtkWidget *label; GtkWidget *eventbox; + GtkWidget *hseparator; GtkRequisition req; + GSList *labels = NULL; + GSList *slitem; + gint max_width; GtkWidget *menu; GtkWidget *menu_item; @@ -1286,12 +1300,12 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, (gpointer) ctk_object); - /* Display model name */ - ctk_object->mnu_display_model = gtk_option_menu_new(); - ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_model, - __dpy_model_help); - g_signal_connect(G_OBJECT(ctk_object->mnu_display_model), "changed", - G_CALLBACK(display_modelname_changed), + /* Selected display/X screen dropdown */ + ctk_object->mnu_selected_item = gtk_option_menu_new(); + ctk_config_set_tooltip(ctk_config, ctk_object->mnu_selected_item, + __selected_item_help); + g_signal_connect(G_OBJECT(ctk_object->mnu_selected_item), "changed", + G_CALLBACK(selected_item_changed), (gpointer) ctk_object); /* Display configuration (Disabled, TwinView, Separate X screen) */ @@ -1352,6 +1366,23 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, ctk_object->txt_display_modename = gtk_label_new(""); gtk_label_set_selectable(GTK_LABEL(ctk_object->txt_display_modename), TRUE); + /* Display passive stereo eye dropdown */ + ctk_object->mnu_display_stereo = gtk_option_menu_new(); + menu = gtk_menu_new(); + menu_item = gtk_menu_item_new_with_label("None"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Left"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Right"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + gtk_option_menu_set_menu + (GTK_OPTION_MENU(ctk_object->mnu_display_stereo), menu); + ctk_config_set_tooltip(ctk_config, ctk_object->mnu_display_stereo, + __dpy_stereo_help); + g_signal_connect(G_OBJECT(ctk_object->mnu_display_stereo), + "changed", G_CALLBACK(display_stereo_changed), + (gpointer) ctk_object); + /* Display Position Type (Absolute/Relative Menu) */ ctk_object->mnu_display_position_type = gtk_option_menu_new(); menu = gtk_menu_new(); @@ -1404,11 +1435,6 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, G_CALLBACK(display_panning_focus_out), (gpointer) ctk_object); - /* X screen number */ - ctk_object->txt_screen_num = gtk_label_new(""); - gtk_label_set_selectable(GTK_LABEL(ctk_object->txt_screen_num), TRUE); - gtk_misc_set_alignment(GTK_MISC(ctk_object->txt_screen_num), 0.0f, 0.5f); - /* X screen virtual size */ ctk_object->txt_screen_virtual_size = gtk_entry_new(); ctk_config_set_tooltip(ctk_config, ctk_object->txt_screen_virtual_size, @@ -1429,6 +1455,41 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, G_CALLBACK(screen_depth_changed), (gpointer) ctk_object); + /* Screen Stereo Mode */ + ctk_object->mnu_screen_stereo = gtk_option_menu_new(); + menu = gtk_menu_new(); + menu_item = gtk_menu_item_new_with_label("Disabled"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("DCC Glasses"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("BlueLine Glasses"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Onboard (DIN)"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Passive Eye Per Display"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Vertical Interlaced"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Color Interleaved"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Horizontal Interlaced"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Checkerboard 3D DLP"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("Inverse Checkerboard 3D DLP"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("NVIDIA 3D Vision"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + menu_item = gtk_menu_item_new_with_label("NVIDIA 3D Vision Pro"); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + gtk_option_menu_set_menu + (GTK_OPTION_MENU(ctk_object->mnu_screen_stereo), menu); + ctk_config_set_tooltip(ctk_config, ctk_object->mnu_screen_stereo, + __screen_stereo_help); + g_signal_connect(G_OBJECT(ctk_object->mnu_screen_stereo), + "changed", G_CALLBACK(screen_stereo_changed), + (gpointer) ctk_object); + /* Screen Position Type (Absolute/Relative Menu) */ ctk_object->mnu_screen_position_type = gtk_option_menu_new(); menu = gtk_menu_new(); @@ -1599,14 +1660,6 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, G_CALLBACK(save_clicked), (gpointer) ctk_object); - - - /**** - * - * Pack the widgets - * - ***/ - { /* Layout section */ frame = gtk_frame_new("Layout"); /* main panel */ @@ -1624,52 +1677,42 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, gtk_box_pack_start(GTK_BOX(vbox), ctk_object->chk_xinerama_enabled, FALSE, FALSE, 0); } - - /* Panel for the notebook sections */ - notebook = gtk_notebook_new(); - ctk_object->notebook = notebook; - gtk_box_pack_start(GTK_BOX(ctk_object), notebook, FALSE, FALSE, 0); + + /* Selection */ + label = gtk_label_new("Selection:"); + labels = g_slist_append(labels, label); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(ctk_object), hbox, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_selected_item, + TRUE, TRUE, 0); + { /* Display page */ - /* Generate the major vbox for the display section */ vbox = gtk_vbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(ctk_object), vbox, FALSE, FALSE, 0); ctk_object->display_page = vbox; - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); /* Display Configuration */ - hbox = gtk_hbox_new(FALSE, 5); - /* Pack widget into major vbox later. - * Create it here so we can get its size */ label = gtk_label_new("Configuration:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_size_request(label, &req); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_display_config, - TRUE, TRUE, 0); - ctk_object->box_display_config = hbox; + labels = g_slist_append(labels, label); - /* Display model name */ hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new("Model:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_display_model, + gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_display_config, TRUE, TRUE, 0); - - /* Pack the display configuration line */ - gtk_box_pack_start(GTK_BOX(vbox), ctk_object->box_display_config, - FALSE, TRUE, 0); + ctk_object->box_display_config = hbox; /* Display resolution and refresh dropdowns */ + label = gtk_label_new("Resolution:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); - label = gtk_label_new("Resolution:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_display_resolution, TRUE, TRUE, 0); @@ -1678,23 +1721,40 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, ctk_object->box_display_resolution = hbox; /* Modeline modename info */ + label = gtk_label_new("Mode Name:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Mode Name:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->txt_display_modename, FALSE, FALSE, 0); ctk_object->box_display_modename = hbox; - /* Display positioning */ - label = gtk_label_new("Position:"); + /* + * XXX Disabled until we have support for identifying and handling + * Stereo vs Composite incompatibility. + */ + #if 0 + /* Display passive stereo eye dropdown */ + label = gtk_label_new("Stereo Eye:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_display_stereo, + TRUE, TRUE, 0); + ctk_object->box_display_stereo = hbox; + #else + ctk_object->box_display_stereo = NULL; + #endif - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); + /* Display positioning */ + label = gtk_label_new("Position:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), @@ -1710,11 +1770,9 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, /* Display panning text entry */ label = gtk_label_new("Panning:"); - hbox = gtk_hbox_new(FALSE, 5); - - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->txt_display_panning, @@ -1732,9 +1790,6 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, g_signal_connect(G_OBJECT(ctk_object->chk_primary_display), "toggled", G_CALLBACK(screen_primary_display_toggled), (gpointer) ctk_object); - - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->chk_primary_display, TRUE, TRUE, 0); @@ -1745,53 +1800,60 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, gtk_widget_show_all(ctk_object->display_page); } /* Display sub-section */ - - { /* X screen page */ - /* Generate the major vbox for the display section */ + { /* X screen page */ vbox = gtk_vbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(ctk_object), vbox, FALSE, FALSE, 0); ctk_object->screen_page = vbox; - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - - /* X screen number */ - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - label = gtk_label_new("Screen Number:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_size_request(label, &req); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), ctk_object->txt_screen_num, - TRUE, TRUE, 0); /* X screen virtual size */ + label = gtk_label_new("Virtual Size:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Virtual Size:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->txt_screen_virtual_size, TRUE, TRUE, 0); ctk_object->box_screen_virtual_size = hbox; /* X screen depth dropdown */ + label = gtk_label_new("Color Depth:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("Color Depth:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_screen_depth, TRUE, TRUE, 0); ctk_object->box_screen_depth = hbox; - /* X screen positioning */ + /* + * XXX Disabled until we have support for identifying and handling + * Stereo vs Composite incompatibility. + */ + #if 0 + /* X screen stereo dropdown */ + label = gtk_label_new("Stereo Mode:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); + gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_screen_stereo, + TRUE, TRUE, 0); + ctk_object->box_screen_stereo = hbox; + #else + ctk_object->box_screen_stereo = NULL; + #endif + + /* X screen positioning */ label = gtk_label_new("Position:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); + labels = g_slist_append(labels, label); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->mnu_screen_position_type, @@ -1805,11 +1867,11 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, ctk_object->box_screen_position = hbox; /* X screen metamode drop down & buttons */ + label = gtk_label_new("MetaMode:"); + labels = g_slist_append(labels, label); + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - label = gtk_label_new("MetaMode:"); - gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); - gtk_widget_set_size_request(label, req.width, -1); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 5); gtk_box_pack_start(GTK_BOX(hbox), ctk_object->btn_screen_metamode, TRUE, TRUE, 0); @@ -1826,11 +1888,34 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, gtk_widget_show_all(ctk_object->screen_page); } /* X screen sub-section */ - - + + + /* Align all the configuration labels */ + max_width = 0; + for (slitem = labels; slitem; slitem = slitem->next) { + label = slitem->data; + gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); + gtk_widget_size_request(label, &req); + if (req.width > max_width) { + max_width = req.width; + } + } + for (slitem = labels; slitem; slitem = slitem->next) { + label = slitem->data; + gtk_widget_set_size_request(label, max_width, -1); + } + g_slist_free(labels); + + { /* Buttons */ hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(ctk_object), hbox, FALSE, FALSE, 0); + gtk_box_pack_end(GTK_BOX(ctk_object), hbox, FALSE, FALSE, 0); + + gtk_box_pack_end(GTK_BOX(hbox), ctk_object->btn_save, + FALSE, FALSE, 0); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_end(GTK_BOX(ctk_object), hbox, FALSE, FALSE, 0); gtk_box_pack_end(GTK_BOX(hbox), ctk_object->btn_reset, FALSE, FALSE, 0); @@ -1841,11 +1926,8 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, gtk_box_pack_end(GTK_BOX(hbox), ctk_object->btn_apply, FALSE, FALSE, 0); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(ctk_object), hbox, FALSE, FALSE, 0); - - gtk_box_pack_end(GTK_BOX(hbox), ctk_object->btn_save, - FALSE, FALSE, 0); + hseparator = gtk_hseparator_new(); + gtk_box_pack_end(GTK_BOX(ctk_object), hseparator, FALSE, TRUE, 5); } @@ -1884,11 +1966,7 @@ GtkWidget* ctk_display_config_new(NvCtrlAttributeHandle *handle, /* Show the GUI */ gtk_widget_show_all(GTK_WIDGET(ctk_object)); - - /* Setup the GUI */ - setup_layout_frame(ctk_object); - setup_display_page(ctk_object); - setup_screen_page(ctk_object); + update_gui(ctk_object); /* Register to receive updates when layout changed */ ctk_display_layout_register_callbacks(CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), @@ -1939,7 +2017,8 @@ GtkTextBuffer *ctk_display_config_create_help(GtkTextTagTable *table, ctk_help_heading(b, &i, "Enable Xinerama"); ctk_help_para(b, &i, "%s This setting is only available when multiple " "X screens are present.", __layout_xinerama_button_help); - + ctk_help_heading(b, &i, "Selection"); + ctk_help_para(b, &i, __selected_item_help); ctk_help_para(b, &i, ""); ctk_help_heading(b, &i, "Display Section"); @@ -1947,8 +2026,6 @@ GtkTextBuffer *ctk_display_config_create_help(GtkTextTagTable *table, "settings for the currently selected display device."); ctk_help_heading(b, &i, "Model"); ctk_help_para(b, &i, "The Model name is the name of the display device."); - ctk_help_heading(b, &i, "Select Display"); - ctk_help_para(b, &i, __dpy_model_help); ctk_help_heading(b, &i, "Resolution"); ctk_help_para(b, &i, __dpy_resolution_mnu_help); ctk_help_heading(b, &i, "Refresh"); @@ -2001,9 +2078,8 @@ GtkTextBuffer *ctk_display_config_create_help(GtkTextTagTable *table, ctk_help_para(b, &i, ""); ctk_help_heading(b, &i, "Buttons"); ctk_help_heading(b, &i, "Apply"); - ctk_help_para(b, &i, "%s Note that XRandR must be available to apply " - "settings. Also note that even when XRandR is available, " - "not all settings can be applied to an active X server; " + ctk_help_para(b, &i, "%s Note that not all settings can be applied to an " + "active X server; " "these require restarting the X server after saving the " "desired settings to the X configuration file. Examples " "of such settings include changing the position of any X " @@ -2075,6 +2151,194 @@ static void setup_layout_frame(CtkDisplayConfig *ctk_object) +/** update_selected_page() *********************************************** + * + * Makes sure the correct page (Display or X Screen) is selected based on + * the currently selected items. + * + **/ + +static void update_selected_page(CtkDisplayConfig *ctk_object) +{ + nvDisplayPtr display = ctk_display_layout_get_selected_display + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + nvScreenPtr screen = ctk_display_layout_get_selected_screen + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + + gtk_widget_hide(ctk_object->display_page); + gtk_widget_hide(ctk_object->screen_page); + if (display) { + gtk_widget_show(ctk_object->display_page); + } else if (screen) { + gtk_widget_show(ctk_object->screen_page); + } + +} /* update_selected_page() */ + + + +/** generate_selected_item_dropdown() ************************************ + * + * Drop down menu for selecting current display/X screen. + * + **/ + +static GtkWidget* generate_selected_item_dropdown(CtkDisplayConfig *ctk_object, + nvDisplayPtr cur_display, + nvScreenPtr cur_screen, + int *cur_idx) +{ + GtkWidget *menu; + GtkWidget *menu_item; + nvLayoutPtr layout = ctk_object->layout; + nvGpuPtr gpu; + nvDisplayPtr display; + nvScreenPtr screen; + int idx; + char *str; + char *tmp; + gboolean show_gpu_info; + + /* (Re)allocate the lookup table */ + + if (ctk_object->selected_item_table) { + free(ctk_object->selected_item_table); + } + + ctk_object->selected_item_table_len = layout->num_screens; + for (gpu = layout->gpus; gpu; gpu = gpu->next_in_layout) { + ctk_object->selected_item_table_len += gpu->num_displays; + } + + ctk_object->selected_item_table = + calloc(ctk_object->selected_item_table_len, + sizeof(SelectableItem)); + + if (!ctk_object->selected_item_table) { + ctk_object->selected_item_table_len = 0; + gtk_option_menu_remove_menu + (GTK_OPTION_MENU(ctk_object->mnu_selected_item)); + gtk_widget_set_sensitive(ctk_object->mnu_selected_item, False); + return NULL; + } + + /* Create the dropdown menu and fill the lookup table */ + + menu = gtk_menu_new(); + idx = 0; + show_gpu_info = ((layout->num_gpus > 1) || ctk_object->advanced_mode) ? True : False; + + /* Add X screens */ + for (screen = layout->screens; screen; screen = screen->next_in_layout) { + if (!cur_display && (cur_screen == screen)) { + *cur_idx = idx; + } + + str = g_strdup_printf("X screen %d", screen->scrnum); + if (show_gpu_info) { + tmp = str; + str = g_strdup_printf("%s (on GPU-%d)", tmp, + NvCtrlGetTargetId(screen->gpu->handle)); + g_free(tmp); + } + + menu_item = gtk_menu_item_new_with_label(str); + g_free(str); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + gtk_widget_show(menu_item); + + ctk_object->selected_item_table[idx].type = SELECTABLE_ITEM_SCREEN; + ctk_object->selected_item_table[idx].u.screen = screen; + idx++; + } + + /* Add displays */ + for (gpu = layout->gpus; gpu; gpu = gpu->next_in_layout) { + for (display = gpu->displays; + display; + display = display->next_on_gpu) { + if (cur_display == display) { + *cur_idx = idx; + } + str = g_strdup_printf("%s (%s", display->logName, + display->typeIdName); + if (show_gpu_info) { + tmp = str; + str = g_strdup_printf("%s on GPU-%d", tmp, + NvCtrlGetTargetId(gpu->handle)); + g_free(tmp); + } + tmp = str; + str = g_strdup_printf("%s)", tmp); + g_free(tmp); + + menu_item = gtk_menu_item_new_with_label(str); + g_free(str); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); + gtk_widget_show(menu_item); + + ctk_object->selected_item_table[idx].type = SELECTABLE_ITEM_DISPLAY; + ctk_object->selected_item_table[idx].u.display = display; + idx++; + } + } + + return menu; + +} /* generate_selected_item_dropdown() */ + + + +/** setup_selected_item_dropdown() ****************************** + * + * Setup display modelname dropdown menu. + * + **/ + +static void setup_selected_item_dropdown(CtkDisplayConfig *ctk_object) +{ + GtkWidget *menu; + nvDisplayPtr display = ctk_display_layout_get_selected_display + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + nvScreenPtr screen = ctk_display_layout_get_selected_screen + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + int cur_idx = 0; + + + if (!display && !screen) { + gtk_widget_set_sensitive(ctk_object->mnu_selected_item, False); + gtk_widget_hide(ctk_object->mnu_selected_item); + return; + } + + gtk_widget_set_sensitive(ctk_object->mnu_selected_item, True); + + menu = generate_selected_item_dropdown(ctk_object, display, screen, + &cur_idx); + if (!menu) { + gtk_widget_set_sensitive(ctk_object->mnu_selected_item, False); + return; + } + + /* Setup the menu and select the current model */ + g_signal_handlers_block_by_func + (G_OBJECT(ctk_object->mnu_selected_item), + G_CALLBACK(selected_item_changed), (gpointer) ctk_object); + + gtk_option_menu_set_menu + (GTK_OPTION_MENU(ctk_object->mnu_selected_item), menu); + + gtk_option_menu_set_history + (GTK_OPTION_MENU(ctk_object->mnu_selected_item), cur_idx); + + g_signal_handlers_unblock_by_func + (G_OBJECT(ctk_object->mnu_selected_item), + G_CALLBACK(selected_item_changed), (gpointer) ctk_object); + +} /* setup_selected_item_dropdown() */ + + + /** setup_display_modename() ***************************************** * * Updates the modeline modename of the selected display @@ -2588,120 +2852,62 @@ static void setup_display_resolution_dropdown(CtkDisplayConfig *ctk_object) -/** generate_display_modelname_dropdown() ******************************** +/** setup_display_stereo_dropdown() ********************************** * - * Generate display modelname dropdown menu. + * Configures the screen stereo mode dropdown to reflect the + * stereo mode for the currently selected screen. * **/ -static GtkWidget* generate_display_modelname_dropdown(CtkDisplayConfig *ctk_object, - int *cur_idx) +static void setup_display_stereo_dropdown(CtkDisplayConfig *ctk_object) { - GtkWidget *menu; - GtkWidget *menu_item; - nvLayoutPtr layout = ctk_object->layout; - nvGpuPtr gpu; - nvDisplayPtr display; - int display_count = 0; - nvDisplayPtr d = ctk_display_layout_get_selected_display + nvScreenPtr screen = ctk_display_layout_get_selected_screen (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); - - /* Create the display modelname lookup table for the dropdown */ - if (ctk_object->display_model_table) { - free(ctk_object->display_model_table); - } - ctk_object->display_model_table_len = 0; - for (gpu = layout->gpus; gpu; gpu = gpu->next_in_layout) { - display_count += gpu->num_displays; - } - - ctk_object->display_model_table = - calloc(display_count, sizeof(nvDisplayPtr)); - - if (!ctk_object->display_model_table) { - gtk_option_menu_remove_menu - (GTK_OPTION_MENU(ctk_object->mnu_display_model)); - gtk_widget_set_sensitive(ctk_object->mnu_display_model, False); - return NULL; - } - - /* Generate the popup menu */ - menu = gtk_menu_new(); - for (gpu = layout->gpus; gpu; gpu = gpu->next_in_layout) { - for (display = gpu->displays; - display; - display = display->next_on_gpu) { - - gchar *str, *type; - if (d == display) { - *cur_idx = ctk_object->display_model_table_len; - } - /* Setup the menu item text */ - type = display_get_type_str(display->device_mask, 0); - str = g_strdup_printf("%s (%s on GPU-%d)", - display->name, type, - NvCtrlGetTargetId(gpu->handle)); - menu_item = gtk_menu_item_new_with_label(str); - g_free(str); - g_free(type); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); - gtk_widget_show(menu_item); - ctk_object->display_model_table - [ctk_object->display_model_table_len++] = display; - } - } - - return menu; - -} /* generate_display_modelname_dropdown() */ - - - -/** setup_display_modelname_dropdown() ************************** - * - * Setup display modelname dropdown menu. - * - **/ - -static void setup_display_modelname_dropdown(CtkDisplayConfig *ctk_object) -{ - GtkWidget *menu; - int cur_idx = 0; /* Currently selected display */ nvDisplayPtr display = ctk_display_layout_get_selected_display (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + nvModePtr mode; + int idx; - /* If no display is selected or there is no screen, hide the frame */ - if (!display) { - gtk_widget_set_sensitive(ctk_object->mnu_display_model, False); - gtk_widget_hide(ctk_object->mnu_display_model); + if (!ctk_object->box_display_stereo) return; + + if (!display || !display->cur_mode || !screen || + !screen->stereo_supported || (screen->stereo != 4)) { + gtk_widget_hide(ctk_object->box_display_stereo); return; } - /* Enable display widgets and setup widget information */ - gtk_widget_set_sensitive(ctk_object->mnu_display_model, True); + mode = display->cur_mode; - menu = generate_display_modelname_dropdown(ctk_object, &cur_idx); - /* If menu not generated return */ - if (!menu) { - return; - } - /* Setup the menu and select the current model */ + /* Set the selected passive stereo eye */ g_signal_handlers_block_by_func - (G_OBJECT(ctk_object->mnu_display_model), - G_CALLBACK(display_modelname_changed), (gpointer) ctk_object); + (G_OBJECT(ctk_object->mnu_display_stereo), + G_CALLBACK(display_stereo_changed), (gpointer) ctk_object); - gtk_option_menu_set_menu - (GTK_OPTION_MENU(ctk_object->mnu_display_model), menu); + switch (mode->passive_stereo_eye) { + default: + /* Oops */ + case PASSIVE_STEREO_EYE_NONE: + idx = 0; + break; + case PASSIVE_STEREO_EYE_LEFT: + idx = 1; + break; + case PASSIVE_STEREO_EYE_RIGHT: + idx = 2; + break; + } gtk_option_menu_set_history - (GTK_OPTION_MENU(ctk_object->mnu_display_model), cur_idx); + (GTK_OPTION_MENU(ctk_object->mnu_display_stereo), idx); g_signal_handlers_unblock_by_func - (G_OBJECT(ctk_object->mnu_display_model), - G_CALLBACK(display_modelname_changed), (gpointer) ctk_object); + (G_OBJECT(ctk_object->mnu_display_stereo), + G_CALLBACK(display_stereo_changed), (gpointer) ctk_object); + + gtk_widget_show(ctk_object->box_display_stereo); -} /* setup_display_modelname_dropdown() */ +} /* setup_display_stereo_dropdown() */ @@ -2801,7 +3007,7 @@ static void setup_display_position_relative(CtkDisplayConfig *ctk_object) ctk_object->display_position_table[idx] = relative_to; - menu_item = gtk_menu_item_new_with_label(relative_to->name); + menu_item = gtk_menu_item_new_with_label(relative_to->logName); gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item); gtk_widget_show(menu_item); idx++; @@ -3031,7 +3237,7 @@ static void setup_display_panning(CtkDisplayConfig *ctk_object) /** setup_display_page() ******************************************** * * Sets up the display frame to reflect the currently selected - * display. + * display. * **/ @@ -3039,63 +3245,24 @@ static void setup_display_page(CtkDisplayConfig *ctk_object) { nvDisplayPtr display = ctk_display_layout_get_selected_display (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); - gint page_num; - GtkWidget *tab_label; - - page_num = gtk_notebook_page_num(GTK_NOTEBOOK(ctk_object->notebook), - ctk_object->display_page); - /* If no display is selected, remove the display page */ if (!display) { - gtk_widget_set_sensitive(ctk_object->display_page, False); - if (page_num >= 0) { - gtk_notebook_remove_page(GTK_NOTEBOOK(ctk_object->notebook), - page_num); - } return; } /* Enable display widgets and setup widget information */ gtk_widget_set_sensitive(ctk_object->display_page, True); - - - /* Setup the display modelname dropdown */ - setup_display_modelname_dropdown(ctk_object); - - /* Setup the seleted mode modename */ setup_display_config(ctk_object); - - - /* Setup the seleted mode modename */ setup_display_modename(ctk_object); - - - /* Setup display resolution menu */ setup_display_resolution_dropdown(ctk_object); - - - /* Setup position */ + setup_display_stereo_dropdown(ctk_object); setup_display_position(ctk_object); - - - /* Setup panning */ setup_display_panning(ctk_object); - - - /* Setup first display */ setup_primary_display(ctk_object); - - /* Make sure the page has been added to the notebook */ - if (page_num < 0) { - tab_label = gtk_label_new("Display"); - gtk_notebook_prepend_page(GTK_NOTEBOOK(ctk_object->notebook), - ctk_object->display_page, tab_label); - } - } /* setup_display_page() */ @@ -3263,6 +3430,45 @@ static void setup_screen_depth_dropdown(CtkDisplayConfig *ctk_object) +/** setup_screen_stereo_dropdown() *********************************** + * + * Configures the screen stereo mode dropdown to reflect the + * stereo mode for the currently selected screen. + * + **/ + +static void setup_screen_stereo_dropdown(CtkDisplayConfig *ctk_object) +{ + nvScreenPtr screen = ctk_display_layout_get_selected_screen + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + + if (!ctk_object->box_screen_stereo) return; + + /* Handle cases where the position type should be hidden */ + if (!screen || !screen->stereo_supported) { + gtk_widget_hide(ctk_object->box_screen_stereo); + return; + } + + /* Set the selected positioning type */ + g_signal_handlers_block_by_func + (G_OBJECT(ctk_object->mnu_screen_stereo), + G_CALLBACK(screen_stereo_changed), (gpointer) ctk_object); + + gtk_option_menu_set_history + (GTK_OPTION_MENU(ctk_object->mnu_screen_stereo), + screen->stereo); + + g_signal_handlers_unblock_by_func + (G_OBJECT(ctk_object->mnu_screen_stereo), + G_CALLBACK(screen_stereo_changed), (gpointer) ctk_object); + + gtk_widget_show(ctk_object->box_screen_stereo); + +} /* setup_screen_stereo_dropdown() */ + + + /** setup_screen_position_type() ************************************* * * Configures the screen position type dropdown to reflect the @@ -3536,23 +3742,9 @@ static void setup_screen_page(CtkDisplayConfig *ctk_object) { nvScreenPtr screen = ctk_display_layout_get_selected_screen (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); - gchar *tmp; - gint page_num; - GtkWidget *tab_label; - GParamSpec* param_spec = NULL; - - page_num = gtk_notebook_page_num(GTK_NOTEBOOK(ctk_object->notebook), - ctk_object->screen_page); - - /* If there is no display or no screen selected, remove the screen page */ if (!screen) { - gtk_widget_set_sensitive(ctk_object->screen_page, False); - if (page_num >= 0) { - gtk_notebook_remove_page(GTK_NOTEBOOK(ctk_object->notebook), - page_num); - } return; } @@ -3560,51 +3752,12 @@ static void setup_screen_page(CtkDisplayConfig *ctk_object) /* Enable display widgets and setup widget information */ gtk_widget_set_sensitive(ctk_object->screen_page, True); - - /* Setup the screen number */ - tmp = g_strdup_printf("%d", screen->scrnum); - - param_spec = g_object_class_find_property - (G_OBJECT_GET_CLASS(gtk_widget_get_settings(ctk_object->txt_screen_num)), - "gtk-label-select-on-focus"); - - if (param_spec) { - /* - * When running against versions of gtk that have the - * "gtk-label-select-on-focus" property, set the property to FALSE for - * the screen label so that it isn't auto-selected when switching tabs - */ - g_object_set(gtk_widget_get_settings(ctk_object->txt_screen_num), - "gtk-label-select-on-focus", FALSE, NULL); - } - - gtk_label_set_text(GTK_LABEL(ctk_object->txt_screen_num), tmp); - g_free(tmp); - - - /* Setup screen (virtual) size */ setup_screen_virtual_size(ctk_object); - - - /* Setup depth menu */ setup_screen_depth_dropdown(ctk_object); - - - /* Setup position */ + setup_screen_stereo_dropdown(ctk_object); setup_screen_position(ctk_object); - - - /* Setup metamode menu */ setup_screen_metamode(ctk_object); - - /* Make sure the page has been added to the notebook */ - if (page_num < 0) { - tab_label = gtk_label_new("X Screen"); - gtk_notebook_append_page(GTK_NOTEBOOK(ctk_object->notebook), - ctk_object->screen_page, tab_label); - } - } /* setup_screen_page() */ @@ -3669,7 +3822,7 @@ static gint validation_fix_crowded_metamodes(CtkDisplayConfig *ctk_object, nv_info_msg(TAB, "Setting display device '%s' as Off " "for MetaMode %d on Screen %d. (There are " "already %d active display devices for this " - "MetaMode.", display->name, i, screen->scrnum, + "MetaMode.", display->logName, i, screen->scrnum, screen->gpu->max_displays); } } @@ -3708,7 +3861,7 @@ static gint validation_fix_crowded_metamodes(CtkDisplayConfig *ctk_object, "%d on Screen %d. (Minimally, a Screen must have " "one MetaMode with at least one active display " "device.)", - first_mode->display->name, i, screen->scrnum); + first_mode->display->logName, i, screen->scrnum); } } } @@ -4039,12 +4192,11 @@ static int validate_layout(CtkDisplayConfig *ctk_object, int validation_type) case GTK_RESPONSE_APPLY: /* User wants to auto fix the warnings */ result = validation_auto_fix(ctk_object); - + /* Update the GUI to reflect any updates made by auto fix */ - setup_display_page(ctk_object); - setup_screen_page(ctk_object); + update_gui(ctk_object); return result; - + case GTK_RESPONSE_REJECT: default: /* User wants to heed the validation warnings */ @@ -4110,8 +4262,8 @@ static gboolean validate_apply(CtkDisplayConfig *ctk_object) /** layout_selected_callback() *************************************** * - * Called every time the user selects a new display from the layout - * image. + * Called every time the user selects a new display or screen from + * the layout image. * **/ @@ -4123,6 +4275,8 @@ void layout_selected_callback(nvLayoutPtr layout, void *data) /* Reconfigure GUI to display information about the selected screen. */ setup_display_page(ctk_object); setup_screen_page(ctk_object); + setup_selected_item_dropdown(ctk_object); + update_selected_page(ctk_object); get_cur_screen_pos(ctk_object); @@ -4170,14 +4324,47 @@ void layout_modified_callback(nvLayoutPtr layout, void *data) /* Widget signal handlers ********************************************/ +/** selected_item_changed() ********************************* + * + * Called when user selects a new display or X screen. + * + **/ +static void selected_item_changed(GtkWidget *widget, gpointer user_data) +{ + CtkDisplayConfig *ctk_object = CTK_DISPLAY_CONFIG(user_data); + gint idx; + SelectableItem *item; + + idx = gtk_option_menu_get_history(GTK_OPTION_MENU(widget)); + item = &(ctk_object->selected_item_table[idx]); + + switch (item->type) { + case SELECTABLE_ITEM_SCREEN: + ctk_display_layout_select_screen + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), item->u.screen); + break; + case SELECTABLE_ITEM_DISPLAY: + ctk_display_layout_select_display + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), item->u.display); + break; + } + + setup_display_page(ctk_object); + setup_screen_page(ctk_object); + update_selected_page(ctk_object); + +} /* selected_item_changed() */ + + + /** do_enable_display_for_xscreen() ********************************** * * Adds the display device to a separate X screen in the layout. * **/ -void do_enable_display_for_xscreen(CtkDisplayConfig *ctk_object, - nvDisplayPtr display) +static void do_enable_display_for_xscreen(CtkDisplayConfig *ctk_object, + nvDisplayPtr display) { nvLayoutPtr layout = ctk_object->layout; nvScreenPtr screen; @@ -4378,9 +4565,6 @@ static void do_enable_display_for_twinview(CtkDisplayConfig *ctk_object, nvScreenPtr screen; nvMetaModePtr metamode; nvModePtr mode; - guint new_mask; - char *msg; - GtkWidget *dlg, *parent; /* Make sure a screen exists */ @@ -4389,68 +4573,12 @@ static void do_enable_display_for_twinview(CtkDisplayConfig *ctk_object, if (!screen) return; - /* attempt to associate the display device with the screen */ - new_mask = screen->displays_mask | display->device_mask; - if (screen->handle) { - ReturnStatus ret; - - ret = NvCtrlSetDisplayAttributeWithReply - (screen->handle, 0, - NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, - new_mask); - - if (ret != NvCtrlSuccess) { - - msg = g_strdup_printf("Failed to associate display device " - "'%s' with X screen %d. TwinView cannot " - "be enabled with this combination of " - "display devices.", - display->name, screen->scrnum); - - parent = ctk_get_parent_window(GTK_WIDGET(ctk_object)); - - if (parent) { - dlg = gtk_message_dialog_new - (GTK_WINDOW(parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, - msg); - - gtk_dialog_run(GTK_DIALOG(dlg)); - gtk_widget_destroy(dlg); - - } else { - nv_error_msg(msg); - } - - g_free(msg); - - return; - - } else { - g_signal_handlers_block_by_func - (G_OBJECT(screen->ctk_event), - G_CALLBACK(display_config_attribute_changed), - (gpointer) ctk_object); - - /* Make sure other parts of nvidia-settings get updated */ - ctk_event_emit(screen->ctk_event, 0, - NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, new_mask); - - g_signal_handlers_unblock_by_func - (G_OBJECT(screen->ctk_event), - G_CALLBACK(display_config_attribute_changed), - (gpointer) ctk_object); - } - } - /* Delete implicit metamodes on all X Screens driven by the GPU */ prepare_gpu_for_twinview(ctk_object, gpu, screen); /* Fix up the display's metamode list */ display_remove_modes(display); - + for (metamode = screen->metamodes; metamode; metamode = metamode->next) { nvDisplayPtr other; @@ -4839,24 +4967,23 @@ static gboolean do_query_remove_display(CtkDisplayConfig *ctk_object, * **/ -void do_disable_display(CtkDisplayConfig *ctk_object, nvDisplayPtr display) +static void do_disable_display(CtkDisplayConfig *ctk_object, + nvDisplayPtr display) { nvGpuPtr gpu = display->gpu; gchar *str; - gchar *type = display_get_type_str(display->device_mask, 0); /* Setup the remove display dialog */ if (ctk_object->advanced_mode) { str = g_strdup_printf("Disable the display device %s (%s) " "on GPU-%d (%s)?", - display->name, type, + display->logName, display->typeIdName, NvCtrlGetTargetId(gpu->handle), gpu->name); } else { str = g_strdup_printf("Disable the display device %s (%s)?", - display->name, type); + display->logName, display->typeIdName); } - g_free(type); gtk_label_set_text (GTK_LABEL(ctk_object->txt_display_disable), str); @@ -4920,7 +5047,7 @@ static void display_config_changed(GtkWidget *widget, gpointer user_data) if (!display->modelines) { char *tokens; gchar *err_str = NULL; - NvCtrlStringOperation(display->gpu->handle, display->device_mask, + NvCtrlStringOperation(display->handle, 0, NV_CTRL_STRING_OPERATION_BUILD_MODEPOOL, "", &tokens); update = TRUE; @@ -4990,10 +5117,7 @@ static void display_config_changed(GtkWidget *widget, gpointer user_data) /* Final update */ ctk_display_layout_update(CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); - /* Update GUI */ - setup_layout_frame(ctk_object); - setup_display_page(ctk_object); - setup_screen_page(ctk_object); + update_gui(ctk_object); user_changed_attributes(ctk_object); } @@ -5126,28 +5250,42 @@ static void display_resolution_changed(GtkWidget *widget, gpointer user_data) -/** display_modelname_changed() ***************************** +/** display_stereo_changed() ***************************** * - * Called when user selectes a new display from display modelname dropdown. + * Called when user selectes a new passive stereo eye + * configuration. * **/ -static void display_modelname_changed(GtkWidget *widget, gpointer user_data) +static void display_stereo_changed(GtkWidget *widget, gpointer user_data) { CtkDisplayConfig *ctk_object = CTK_DISPLAY_CONFIG(user_data); nvDisplayPtr display; + nvModePtr mode; gint idx; - /* Get the modeline and display to set */ - idx = gtk_option_menu_get_history(GTK_OPTION_MENU(widget)); - display = ctk_object->display_model_table[idx]; - ctk_display_layout_select_display - (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), display); + /* Update the current mode on the selected display */ + display = ctk_display_layout_get_selected_display + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); - /* Reconfigure GUI to display information about the selected display. */ - setup_display_page(ctk_object); - setup_screen_page(ctk_object); + if (display && display->cur_mode) { + mode = display->cur_mode; -} /* display_modelname_changed() */ + idx = gtk_option_menu_get_history(GTK_OPTION_MENU(widget)); + switch (idx) { + case 1: + mode->passive_stereo_eye = PASSIVE_STEREO_EYE_LEFT; + break; + case 2: + mode->passive_stereo_eye = PASSIVE_STEREO_EYE_RIGHT; + break; + default: + case 0: + mode->passive_stereo_eye = PASSIVE_STEREO_EYE_NONE; + break; + } + } + +} /* display_stereo_changed() */ @@ -5466,6 +5604,36 @@ static void screen_depth_changed(GtkWidget *widget, gpointer user_data) +/** screen_stereo_changed() ****************************************** + * + * Called when user selects a new stereo mode for a screen. + * + **/ + +static void screen_stereo_changed(GtkWidget *widget, gpointer user_data) +{ + CtkDisplayConfig *ctk_object = CTK_DISPLAY_CONFIG(user_data); + gint idx = gtk_option_menu_get_history(GTK_OPTION_MENU(widget)); + nvScreenPtr screen = ctk_display_layout_get_selected_screen + (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout)); + + if (!screen) return; + + screen->stereo = idx; + + /* Can't apply screen stereo changes */ + ctk_object->apply_possible = FALSE; + + user_changed_attributes(ctk_object); + + + /* Changing this can modify how the display page looks */ + setup_display_page(ctk_object); + +} /* screen_stereo_changed() */ + + + /** screen_position_type_changed() *********************************** * * Called when user selects a new screen position method (relative/ @@ -5848,7 +6016,7 @@ static gboolean do_display_confirm_countdown(gpointer data) /** switch_to_current_metamode() ************************************* * - * Switches to the current screen metamode using XRandR + * Switches to the current screen metamode using NV_CTRL_CURRENT_METAMODE_ID * **/ @@ -5861,8 +6029,6 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, int new_width; int new_height; int new_rate; - int old_width; - int old_height; int old_rate; static SwitchModeCallbackInfo info; GtkWidget *dlg; @@ -5885,41 +6051,19 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, if (!parent) goto fail; - /* XRandR must be available to do mode switching */ - - if (NvCtrlGetXrandrEventBase(screen->handle) < 0) { - dlg = gtk_message_dialog_new - (GTK_WINDOW(parent), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_CLOSE, - "The XRandR X extension was not found. This extension must " - "be supported by the X server and enabled for display " - "configuration settings to be dynamically applicable."); - - gtk_dialog_run(GTK_DIALOG(dlg)); - gtk_widget_destroy(dlg); - - nv_warning_msg("XRandR X extension not enabled, " - "cannot apply settings!"); - goto fail; - } - - /* Get the current mode so we can fall back on that if the * mode switch fails, or the user does not confirm. */ - ret = NvCtrlXrandrGetScreenMode(screen->handle, &old_width, &old_height, - &old_rate); + ret = NvCtrlGetAttribute(screen->handle, NV_CTRL_CURRENT_METAMODE_ID, + (int *)&old_rate); if (ret != NvCtrlSuccess) { nv_warning_msg("Failed to get current (fallback) mode for " "display device!"); goto fail; } - nv_info_msg(TAB, "Current mode: %dx%d (id: %d)", - old_width, old_height, old_rate); + nv_info_msg(TAB, "Current mode (id: %d)", old_rate); /* Switch to the new mode */ @@ -5927,8 +6071,9 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, nv_info_msg(TAB, "Switching to mode: %dx%d (id: %d)...", new_width, new_height, new_rate); - ret = NvCtrlXrandrSetScreenMode(screen->handle, new_width, new_height, - new_rate); + ret = NvCtrlSetDisplayAttributeWithReply(screen->handle, 0, + NV_CTRL_CURRENT_METAMODE_ID, + new_rate); if (ret != NvCtrlSuccess) { nv_warning_msg("Failed to set MetaMode (%d) '%s' " @@ -5949,7 +6094,7 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, - msg); + "%s", msg); } else { msg = g_strdup_printf("Failed to set MetaMode (%d) '%s' " "(Mode %dx%d, id: %d) on X screen %d.", @@ -5961,7 +6106,7 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - msg); + "%s", msg); } result = gtk_dialog_run(GTK_DIALOG(dlg)); @@ -6025,11 +6170,11 @@ static Bool switch_to_current_metamode(CtkDisplayConfig *ctk_object, case GTK_RESPONSE_REJECT: default: /* Fall back to previous settings */ - nv_info_msg(TAB, "Switching back to mode: %dx%d (id: %d)...", - old_width, old_height, old_rate); + nv_info_msg(TAB, "Switching back to mode (id: %d)...", old_rate); - NvCtrlXrandrSetScreenMode(screen->handle, old_width, old_height, - old_rate); + ret = NvCtrlSetDisplayAttributeWithReply(screen->handle, 0, + NV_CTRL_CURRENT_METAMODE_ID, + old_rate); /* Good luck! */ goto fail; } @@ -6389,36 +6534,13 @@ static void apply_clicked(GtkWidget *widget, gpointer user_data) if (!update_screen_metamodes(ctk_object, screen)) { clear_apply = FALSE; - } else { - ReturnStatus ret; - - ret = NvCtrlSetDisplayAttributeWithReply - (screen->handle, 0, - NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, - screen->displays_mask); - - if (ret != NvCtrlSuccess) { - nv_error_msg("Failed to set screen %d's association mask " - "to: 0x%08x", - screen->scrnum, screen->displays_mask); - } else { - /* Make sure other parts of nvidia-settings get updated */ - ctk_event_emit(screen->ctk_event, 0, - NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, - screen->displays_mask); - } } if (screen->primaryDisplay && ctk_object->primary_display_changed) { - gchar *primary_str = - display_get_type_str(screen->primaryDisplay->device_mask, - 0); - ret = NvCtrlSetStringAttribute(screen->handle, NV_CTRL_STRING_TWINVIEW_XINERAMA_INFO_ORDER, - primary_str, NULL); - g_free(primary_str); - + screen->primaryDisplay->typeIdName, + NULL); if (ret != NvCtrlSuccess) { nv_error_msg("Failed to set primary display" "for screen %d (GPU:%s)", screen->scrnum, @@ -6567,28 +6689,26 @@ static Bool add_monitor_to_xconfig(nvDisplayPtr display, XConfigPtr config, /* Copy the model name string, stripping any '"' characters */ - len = strlen(display->name); + len = strlen(display->logName); monitor->modelname = malloc(len + 1); for (i = 0, j = 0; i < len; i++, j++) { - if (display->name[i] == '\"') { + if (display->logName[i] == '\"') { if (++i >= len) break; } - monitor->modelname[j] = display->name[i]; + monitor->modelname[j] = display->logName[i]; } monitor->modelname[j] = '\0'; /* Get the Horizontal Sync ranges from nv-control */ - ret = NvCtrlGetStringDisplayAttribute - (display->gpu->handle, - display->device_mask, - NV_CTRL_STRING_VALID_HORIZ_SYNC_RANGES, - &range_str); + ret = NvCtrlGetStringAttribute(display->handle, + NV_CTRL_STRING_VALID_HORIZ_SYNC_RANGES, + &range_str); if (ret != NvCtrlSuccess) { nv_error_msg("Unable to determine valid horizontal sync ranges " "for display device '%s' (GPU: %s)!", - display->name, display->gpu->name); + display->logName, display->gpu->name); goto fail; } @@ -6602,7 +6722,7 @@ static Bool add_monitor_to_xconfig(nvDisplayPtr display, XConfigPtr config, if (!parse_read_float_range(tmp, &min, &max)) { nv_error_msg("Unable to determine valid horizontal sync ranges " "for display device '%s' (GPU: %s)!", - display->name, display->gpu->name); + display->logName, display->gpu->name); goto fail; } @@ -6617,15 +6737,13 @@ static Bool add_monitor_to_xconfig(nvDisplayPtr display, XConfigPtr config, /* Get the Horizontal Sync ranges from nv-control */ - ret = NvCtrlGetStringDisplayAttribute - (display->gpu->handle, - display->device_mask, - NV_CTRL_STRING_VALID_VERT_REFRESH_RANGES, - &range_str); + ret = NvCtrlGetStringAttribute(display->handle, + NV_CTRL_STRING_VALID_VERT_REFRESH_RANGES, + &range_str); if (ret != NvCtrlSuccess) { nv_error_msg("Unable to determine valid vertical refresh ranges " "for display device '%s' (GPU: %s)!", - display->name, display->gpu->name); + display->logName, display->gpu->name); goto fail; } @@ -6639,7 +6757,7 @@ static Bool add_monitor_to_xconfig(nvDisplayPtr display, XConfigPtr config, if (!parse_read_float_range(tmp, &min, &max)) { nv_error_msg("Unable to determine valid vertical refresh ranges " "for display device '%s' (GPU: %s)!", - display->name, display->gpu->name); + display->logName, display->gpu->name); goto fail; } @@ -6838,7 +6956,7 @@ static int add_screen_to_xconfig(CtkDisplayConfig *ctk_object, /* Create the screen's only Monitor section from the first display */ if (!add_monitor_to_xconfig(display, config, screen->scrnum)) { nv_error_msg("Failed to add display device '%s' to screen %d!", - display->name, screen->scrnum); + display->logName, screen->scrnum); goto fail; } @@ -6856,40 +6974,42 @@ static int add_screen_to_xconfig(CtkDisplayConfig *ctk_object, add_modelines_to_monitor(display->conf_monitor, other->modes); } - /* Set the TwinView option */ - xconfigAddNewOption(&conf_screen->options, "TwinView", - ((screen->num_displays > 1) ? "1" : "0" )); + /* Set the Stereo option */ + { + char buf[32]; + snprintf(buf, 32, "%d", screen->stereo); + xconfigAddNewOption(&conf_screen->options, "Stereo", buf); + } /* Set the TwinviewXineramaInfoOrder option */ if (screen->primaryDisplay) { - gchar *primary_str = - display_get_type_str(screen->primaryDisplay->device_mask, 0); - - xconfigAddNewOption(&conf_screen->options, "TwinViewXineramaInfoOrder", - primary_str); - g_free(primary_str); + xconfigAddNewOption(&conf_screen->options, + "TwinViewXineramaInfoOrder", + screen->primaryDisplay->typeIdName); } /* Create the "metamode" option string. */ ret = generate_xconf_metamode_str(ctk_object, screen, &metamode_strs); if (ret != XCONFIG_GEN_OK) goto bail; - + /* If no user specified metamodes were found, add * whatever the currently selected metamode is */ if (!metamode_strs) { metamode_strs = screen_get_metamode_str(screen, - screen->cur_metamode_idx, 1); + screen->cur_metamode_idx, + 1); } - + if (metamode_strs) { - xconfigAddNewOption(&conf_screen->options, "metamodes", metamode_strs); + xconfigAddNewOption(&conf_screen->options, "metamodes", + metamode_strs); free(metamode_strs); } } - - + + /* Setup the display section */ conf_screen->defaultdepth = screen->depth; @@ -7318,7 +7438,7 @@ static void save_clicked(GtkWidget *widget, gpointer user_data) static void advanced_clicked(GtkWidget *widget, gpointer user_data) { CtkDisplayConfig *ctk_object = CTK_DISPLAY_CONFIG(user_data); - + /* Toggle advanced options for the display */ ctk_object->advanced_mode = !(ctk_object->advanced_mode); @@ -7337,10 +7457,8 @@ static void advanced_clicked(GtkWidget *widget, gpointer user_data) (CTK_DISPLAY_LAYOUT(ctk_object->obj_layout), 0); } - /* Update the GUI to show the right widgets */ - setup_display_page(ctk_object); - setup_screen_page(ctk_object); + update_gui(ctk_object); } /* advanced_clicked() */ @@ -7388,8 +7506,8 @@ static void probe_clicked(GtkWidget *widget, gpointer user_data) * button. * **/ -static gboolean layout_change_is_applyable(const nvLayout *old, - const nvLayout *new) +static gboolean layout_change_is_applyable(const nvLayoutPtr old, + const nvLayoutPtr new) { const nvGpu *gpu; @@ -7399,7 +7517,6 @@ static gboolean layout_change_is_applyable(const nvLayout *old, const nvDisplay *dpy; for (dpy = gpu->displays; dpy; dpy = dpy->next_on_gpu) { - const nvGpu *new_gpu; /* See if the display was active in the old layout. */ if (!dpy->cur_mode || !dpy->cur_mode->modeline) { @@ -7408,24 +7525,7 @@ static gboolean layout_change_is_applyable(const nvLayout *old, /* This display device had an active mode in the old layout. See if * it's still connected in the new layout. */ - - /* First, find the matching GPU */ - for (new_gpu = new->gpus; new_gpu; new_gpu = - new_gpu->next_in_layout) { - - if (strcmp(gpu->pci_bus_id, new_gpu->pci_bus_id) == 0) { - break; - } - } - - if (!new_gpu) { - /* We really should have found the new GPU! */ - return True; - } - - /* Then, see if the given dpy is connected. If it's not, then the - * Apply button should be enabled. */ - if (!(dpy->device_mask & new_gpu->connected_displays)) { + if (!layout_get_display(new, NvCtrlGetTargetId(dpy->handle))) { return True; } } @@ -7482,11 +7582,7 @@ static void reset_layout(CtkDisplayConfig *ctk_object) /* Make sure X screens have some kind of position */ assign_screen_positions(ctk_object); - - /* Setup the GUI */ - setup_layout_frame(ctk_object); - setup_display_page(ctk_object); - setup_screen_page(ctk_object); + update_gui(ctk_object); /* Get new position */ get_cur_screen_pos(ctk_object); diff --git a/src/gtk+-2.x/ctkdisplayconfig.h b/src/gtk+-2.x/ctkdisplayconfig.h index a5a2a4e..7e415e8 100644 --- a/src/gtk+-2.x/ctkdisplayconfig.h +++ b/src/gtk+-2.x/ctkdisplayconfig.h @@ -49,6 +49,20 @@ G_BEGIN_DECLS (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_DISPLAY_CONFIG, \ CtkDisplayConfigClass)) +typedef enum { + SELECTABLE_ITEM_SCREEN, + SELECTABLE_ITEM_DISPLAY +} SelectableItemType; + + +typedef struct SelectableItemRec { + SelectableItemType type; + union { + nvDisplayPtr display; + nvScreenPtr screen; + } u; +} SelectableItem; + typedef struct _CtkDisplayConfig { @@ -68,14 +82,15 @@ typedef struct _CtkDisplayConfig GtkWidget *chk_primary_display; gboolean primary_display_changed; + GtkWidget *mnu_selected_item; + SelectableItem *selected_item_table; + int selected_item_table_len; + GtkWidget *notebook; /* Tabbed notebook for display and X screen pages */ /* Display - Info */ GtkWidget *display_page; - GtkWidget *mnu_display_model; - nvDisplayPtr *display_model_table; /* Lookup table for display modelname */ - int display_model_table_len; GtkWidget *txt_display_gpu; GtkWidget *box_display_config; @@ -83,7 +98,7 @@ typedef struct _CtkDisplayConfig GtkWidget *mnu_display_config_disabled; GtkWidget *mnu_display_config_xscreen; GtkWidget *mnu_display_config_twinview; - + /* Display - Settings */ GtkWidget *box_display_resolution; GtkWidget *mnu_display_resolution; @@ -97,6 +112,9 @@ typedef struct _CtkDisplayConfig GtkWidget *box_display_modename; GtkWidget *txt_display_modename; + GtkWidget *box_display_stereo; + GtkWidget *mnu_display_stereo; + GtkWidget *box_display_position; GtkWidget *mnu_display_position_type; /* Absolute, Right of... */ GtkWidget *mnu_display_position_relative; /* List of available devices */ @@ -111,8 +129,6 @@ typedef struct _CtkDisplayConfig /* X Screen - Info */ GtkWidget *screen_page; - GtkWidget *txt_screen_num; - /* X Screen - Settings */ GtkWidget *box_screen_virtual_size; GtkWidget *txt_screen_virtual_size; @@ -120,6 +136,9 @@ typedef struct _CtkDisplayConfig GtkWidget *box_screen_depth; GtkWidget *mnu_screen_depth; + GtkWidget *box_screen_stereo; + GtkWidget *mnu_screen_stereo; + GtkWidget *box_screen_position; GtkWidget *mnu_screen_position_type; /* Absolute, Right of... */ GtkWidget *mnu_screen_position_relative; /* List of available devices */ @@ -178,7 +197,7 @@ typedef struct _CtkDisplayConfig gboolean advanced_mode; GtkWidget *btn_reset; - + int last_resolution_idx; } CtkDisplayConfig; diff --git a/src/gtk+-2.x/ctkdisplaydevice-crt.c b/src/gtk+-2.x/ctkdisplaydevice-crt.c index ad55b39..aa15ee9 100644 --- a/src/gtk+-2.x/ctkdisplaydevice-crt.c +++ b/src/gtk+-2.x/ctkdisplaydevice-crt.c @@ -65,6 +65,7 @@ GType ctk_display_device_crt_get_type(void) sizeof (CtkDisplayDeviceCrt), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_display_device_crt_type = g_type_register_static (GTK_TYPE_VBOX, @@ -105,7 +106,6 @@ static void ctk_display_device_crt_finalize( GtkWidget* ctk_display_device_crt_new(NvCtrlAttributeHandle *handle, CtkConfig *ctk_config, CtkEvent *ctk_event, - unsigned int display_device_mask, char *name) { GObject *object; @@ -124,7 +124,6 @@ GtkWidget* ctk_display_device_crt_new(NvCtrlAttributeHandle *handle, ctk_display_device_crt->handle = handle; ctk_display_device_crt->ctk_config = ctk_config; ctk_display_device_crt->ctk_event = ctk_event; - ctk_display_device_crt->display_device_mask = display_device_mask; ctk_display_device_crt->name = g_strdup(name); ctk_display_device_crt->txt_refresh_rate = gtk_label_new(""); gtk_box_set_spacing(GTK_BOX(object), 10); @@ -160,7 +159,7 @@ GtkWidget* ctk_display_device_crt_new(NvCtrlAttributeHandle *handle, ctk_display_device_crt->image_sliders = ctk_image_sliders_new(handle, ctk_config, ctk_event, ctk_display_device_crt->reset_button, - display_device_mask, name); + name); if (ctk_display_device_crt->image_sliders) { gtk_box_pack_start(GTK_BOX(object), ctk_display_device_crt->image_sliders, @@ -209,10 +208,17 @@ GtkWidget* ctk_display_device_crt_new(NvCtrlAttributeHandle *handle, } /* pack the EDID button */ + ctk_display_device_crt->edid = + ctk_edid_new(ctk_display_device_crt->handle, + ctk_display_device_crt->ctk_config, + ctk_display_device_crt->ctk_event, + ctk_display_device_crt->name); + hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0); - ctk_display_device_crt->edid_box = hbox; - + gtk_box_pack_start(GTK_BOX(hbox), ctk_display_device_crt->edid, + TRUE, TRUE, 0); + /* show the page */ gtk_widget_show_all(GTK_WIDGET(object)); @@ -220,8 +226,7 @@ GtkWidget* ctk_display_device_crt_new(NvCtrlAttributeHandle *handle, /* Update the GUI */ update_display_enabled_flag(ctk_display_device_crt->handle, - &ctk_display_device_crt->display_enabled, - ctk_display_device_crt->display_device_mask); + &ctk_display_device_crt->display_enabled); ctk_display_device_crt_setup(ctk_display_device_crt); @@ -262,10 +267,8 @@ GtkTextBuffer *ctk_display_device_crt_create_help(GtkTextTagTable *table, add_image_sliders_help (CTK_IMAGE_SLIDERS(ctk_display_device_crt->image_sliders), b, &i); - if (ctk_display_device_crt->edid) { - add_acquire_edid_help(b, &i); - } - + add_acquire_edid_help(b, &i); + td = gtk_tooltips_data_get(GTK_WIDGET(ctk_display_device_crt->reset_button)); ctk_help_reset_hardware_defaults (b, &i, td->tip_text); @@ -284,12 +287,15 @@ static void reset_button_clicked(GtkButton *button, gpointer user_data) { CtkDisplayDeviceCrt *ctk_display_device_crt = CTK_DISPLAY_DEVICE_CRT(user_data); - + + /* Disable the reset button here and allow the controls below to (re)enable + * it if need be,. + */ + gtk_widget_set_sensitive(ctk_display_device_crt->reset_button, FALSE); + ctk_image_sliders_reset (CTK_IMAGE_SLIDERS(ctk_display_device_crt->image_sliders)); - gtk_widget_set_sensitive(ctk_display_device_crt->reset_button, FALSE); - ctk_config_statusbar_message(ctk_display_device_crt->ctk_config, "Reset hardware defaults for %s.", ctk_display_device_crt->name); @@ -305,59 +311,35 @@ static void reset_button_clicked(GtkButton *button, gpointer user_data) static void ctk_display_device_crt_setup(CtkDisplayDeviceCrt *ctk_display_device_crt) { - /* Update CRT-specific settings */ - crt_info_setup(ctk_display_device_crt); - - /* Update the image sliders */ + /* Disable the reset button here and allow the controls below to (re)enable + * it if need be,. + */ + gtk_widget_set_sensitive(ctk_display_device_crt->reset_button, FALSE); - ctk_image_sliders_setup - (CTK_IMAGE_SLIDERS(ctk_display_device_crt->image_sliders)); + /* Update info */ - /* update acquire EDID button */ - - if (ctk_display_device_crt->edid) { - GList *list; - - list = gtk_container_get_children - (GTK_CONTAINER(ctk_display_device_crt->edid_box)); - if (list) { - gtk_container_remove - (GTK_CONTAINER(ctk_display_device_crt->edid_box), - (GtkWidget *)(list->data)); - g_list_free(list); - } - } + crt_info_setup(ctk_display_device_crt); - ctk_display_device_crt->edid = - ctk_edid_new(ctk_display_device_crt->handle, - ctk_display_device_crt->ctk_config, - ctk_display_device_crt->ctk_event, - ctk_display_device_crt->reset_button, - ctk_display_device_crt->display_device_mask, - ctk_display_device_crt->name); + ctk_edid_setup(CTK_EDID(ctk_display_device_crt->edid)); - if (ctk_display_device_crt->edid) { - gtk_box_pack_start(GTK_BOX(ctk_display_device_crt->edid_box), - ctk_display_device_crt->edid, TRUE, TRUE, 0); - } + /* Update controls */ + ctk_image_sliders_setup + (CTK_IMAGE_SLIDERS(ctk_display_device_crt->image_sliders)); - /* update the reset button */ +} /* ctk_display_device_crt_setup() */ - gtk_widget_set_sensitive(ctk_display_device_crt->reset_button, FALSE); -} /* ctk_display_device_crt_setup() */ static void crt_info_setup(CtkDisplayDeviceCrt *ctk_display_device_crt) { ReturnStatus ret; gint val; - + /* Refresh Rate */ - ret = NvCtrlGetDisplayAttribute(ctk_display_device_crt->handle, - ctk_display_device_crt->display_device_mask, - NV_CTRL_REFRESH_RATE, &val); + ret = NvCtrlGetAttribute(ctk_display_device_crt->handle, + NV_CTRL_REFRESH_RATE, &val); if (ret == NvCtrlSuccess) { char str[32]; float fvalue = ((float)(val)) / 100.0f; @@ -384,12 +366,7 @@ static void enabled_displays_received(GtkObject *object, gpointer arg1, /* Requery display information only if display disabled */ update_display_enabled_flag(ctk_object->handle, - &ctk_object->display_enabled, - ctk_object->display_device_mask); - - if (ctk_object->display_enabled) { - return; - } + &ctk_object->display_enabled); ctk_display_device_crt_setup(ctk_object); @@ -405,11 +382,6 @@ static void info_update_received(GtkObject *object, gpointer arg1, gpointer user_data) { CtkDisplayDeviceCrt *ctk_object = CTK_DISPLAY_DEVICE_CRT(user_data); - CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - - /* if the event is not for this display device, return */ - if (!(event_struct->display_mask & ctk_object->display_device_mask)) { - return; - } + crt_info_setup(ctk_object); } diff --git a/src/gtk+-2.x/ctkdisplaydevice-crt.h b/src/gtk+-2.x/ctkdisplaydevice-crt.h index 7c78d3c..e360343 100644 --- a/src/gtk+-2.x/ctkdisplaydevice-crt.h +++ b/src/gtk+-2.x/ctkdisplaydevice-crt.h @@ -59,11 +59,9 @@ struct _CtkDisplayDeviceCrt GtkWidget *image_sliders; GtkWidget *reset_button; GtkWidget *txt_refresh_rate; - - GtkWidget *edid_box; + GtkWidget *edid; - unsigned int display_device_mask; gboolean display_enabled; char *name; @@ -77,7 +75,7 @@ struct _CtkDisplayDeviceCrtClass GType ctk_display_device_crt_get_type (void) G_GNUC_CONST; GtkWidget* ctk_display_device_crt_new (NvCtrlAttributeHandle *, CtkConfig *, CtkEvent *, - unsigned int, char *); + char *); GtkTextBuffer *ctk_display_device_crt_create_help(GtkTextTagTable *, CtkDisplayDeviceCrt *); diff --git a/src/gtk+-2.x/ctkdisplaydevice-dfp.c b/src/gtk+-2.x/ctkdisplaydevice-dfp.c deleted file mode 100644 index cd20c87..0000000 --- a/src/gtk+-2.x/ctkdisplaydevice-dfp.c +++ b/dev/null @@ -1,1433 +0,0 @@ -/* - * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix - * and Linux systems. - * - * Copyright (C) 2004 NVIDIA Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses>. - */ - -#include <gtk/gtk.h> -#include <NvCtrlAttributes.h> - -#include "ctkbanner.h" - -#include "ctkdisplaydevice-dfp.h" - -#include "ctkditheringcontrols.h" -#include "ctkcolorcontrols.h" -#include "ctkimagesliders.h" -#include "ctkedid.h" -#include "ctkconfig.h" -#include "ctkhelp.h" -#include "ctkutils.h" -#include <stdio.h> - -static void ctk_display_device_dfp_class_init(CtkDisplayDeviceDfpClass *); -static void ctk_display_device_dfp_finalize(GObject *); - -static GtkWidget *make_scaling_radio_button(CtkDisplayDeviceDfp - *ctk_display_device_dfp, - GtkWidget *vbox, - GtkWidget *prev_radio, - char *label, - gint value); - -static void dfp_scaling_changed(GtkWidget *widget, gpointer user_data); - -static void reset_button_clicked(GtkButton *button, gpointer user_data); - -static void -dfp_scaling_update_buttons(CtkDisplayDeviceDfp *ctk_display_device_dfp, - gint value); - - -static void dfp_update_received(GtkObject *object, gpointer arg1, - gpointer user_data); - -static void dfp_info_setup(CtkDisplayDeviceDfp *ctk_display_device_dfp); - -static void dfp_scaling_setup(CtkDisplayDeviceDfp *ctk_display_device_dfp); - -static void ctk_display_device_dfp_setup(CtkDisplayDeviceDfp - *ctk_display_device_dfp); - -static void enabled_displays_received(GtkObject *object, gpointer arg1, - gpointer user_data); - -static void info_update_received(GtkObject *object, gpointer arg1, - gpointer user_data); - - -#define FRAME_PADDING 5 - -#define __SCALING (1<<0) - - -#define GET_SCALING_TARGET(V) ((V) >> 16) -#define GET_SCALING_METHOD(V) ((V) & 0xFFFF) -#define MAKE_SCALING_VALUE(T, M) (((T) << 16) | ((M) & 0xFFFF)) - - -static const char *__scaling_help = -"A flat panel usually has a single 'native' resolution. If you are " -"using a resolution that is smaller than the flat panel's native " -"resolution, then Flat Panel Scaling can adjust how the image is " -"displayed on the flat panel. This setting will only take effect when " -"GPU scaling is active, which occurs when the frontend and backend " -"resolutions of the current mode are different."; - -static const char *__info_help = -"This section describes basic informations about the " -"DVI connection to the digital flat panel."; - -static const char *__info_chip_location_help = -"Report whether the flat panel is driven by the on-chip controller " -"(internal), or a separate controller chip elsewhere on the graphics " -"board (external)."; - -static const char *__info_link_help = -"Report whether the specified display device is driven by a single " -"link or dual link DVI connection."; - -static const char *__info_signal_help = -"Report whether the flat panel is driven by an LVDS, TMDS, or " -"DisplayPort signal."; - -static const char * __native_res_help = -"The Native Resolution is the width and height in pixels that the flat " -"panel uses to display the image. All other resolutions must be scaled " -"to this resolution by the GPU and/or the DFP's built-in scaler."; - -static const char * __best_fit_res_help = -"The Best Fit Resolution is a resolution supported by the DFP that " -"closely matches the frontend resolution. The Best Fit Resolution " -"is used as the Backend Resolution when you want to let the DFP do " -"the scaling from the Frontend Resolution to the Native Resolution."; - -static const char * __frontend_res_help = -"The Frontend Resolution is the current resolution of the image in pixels."; - -static const char * __refresh_rate_help = -"The refresh rate displays the rate at which the screen is currently " -"refreshing the image."; - -static const char * __backend_res_help = -"The Backend Resolution is the resolution that the GPU is driving to " -"the DFP. If the Backend Resolution is different than the Frontend " -"Resolution, then the GPU will scale the image from the Frontend " -"Resolution to the Backend Resolution. If the Backend Resolution " -"is different than the Native Resolution, then the DFP will scale " -"the image from the Backend Resolution to the Native Resolution. " -"Backend Resolution is either the Native Resolution or the Best " -"Fit Resolution."; - -static const char * __force_gpu_scaling_help = -"When set, the driver will make the GPU scale the " -"frontend (current) mode to the flat panel's native " -"resolution. If disabled, the GPU will only scale (if " -"needed) to the best fitting resolution reported in the flat " -"panel's EDID; the flat panel will then scale the image to " -"its native resolution."; - -static const char *__gpu_scaling_help = -"Reports whether the GPU and/or DFP are actively scaling the current " -"resolution."; - -static const char *__gpu_scaling_stretched_help = -"The image will be expanded to fit the entire flat panel."; - -static const char *__gpu_scaling_centered_help = -"The image will only occupy the number of pixels " -"needed and be centered on the flat panel. Setting this " -"will disable image sharpening for the display device."; - -static const char *__gpu_scaling_ar_scaled_help = -"The image will be scaled (retaining the original " -"aspect ratio) to expand and fit as much of the entire " -"flat panel as possible."; - -GType ctk_display_device_dfp_get_type(void) -{ - static GType ctk_display_device_dfp_type = 0; - - if (!ctk_display_device_dfp_type) { - static const GTypeInfo ctk_display_device_dfp_info = { - sizeof (CtkDisplayDeviceDfpClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) ctk_display_device_dfp_class_init, - NULL, /* class_finalize, */ - NULL, /* class_data */ - sizeof (CtkDisplayDeviceDfp), - 0, /* n_preallocs */ - NULL, /* instance_init */ - }; - - ctk_display_device_dfp_type = g_type_register_static (GTK_TYPE_VBOX, - "CtkDisplayDeviceDfp", &ctk_display_device_dfp_info, 0); - } - - return ctk_display_device_dfp_type; -} - -static void ctk_display_device_dfp_class_init( - CtkDisplayDeviceDfpClass *ctk_display_device_dfp_class -) -{ - GObjectClass *gobject_class = (GObjectClass *)ctk_display_device_dfp_class; - gobject_class->finalize = ctk_display_device_dfp_finalize; -} - -static void ctk_display_device_dfp_finalize( - GObject *object -) -{ - CtkDisplayDeviceDfp *ctk_display_device_dfp = CTK_DISPLAY_DEVICE_DFP(object); - g_free(ctk_display_device_dfp->name); - g_signal_handlers_disconnect_matched(ctk_display_device_dfp->ctk_event, - G_SIGNAL_MATCH_DATA, - 0, - 0, - NULL, - NULL, - (gpointer) ctk_display_device_dfp); -} - - -/* - * ctk_display_device_dfp_new() - constructor for the DFP display - * device page. - */ - -GtkWidget* ctk_display_device_dfp_new(NvCtrlAttributeHandle *handle, - CtkConfig *ctk_config, - CtkEvent *ctk_event, - unsigned int display_device_mask, - char *name) -{ - GObject *object; - CtkDisplayDeviceDfp *ctk_display_device_dfp; - GtkWidget *banner; - GtkWidget *frame; - GtkWidget *hbox, *vbox, *tmpbox; - - GtkWidget *button; - GtkWidget *radio0; - GtkWidget *radio1; - GtkWidget *radio2; - GtkWidget *alignment; - GtkWidget *notebook; - GtkWidget *nbox; - GtkWidget *align; - - GtkWidget *table; - ReturnStatus ret1, ret2; - gint val_target, val_method; - - object = g_object_new(CTK_TYPE_DISPLAY_DEVICE_DFP, NULL); - if (!object) return NULL; - - ctk_display_device_dfp = CTK_DISPLAY_DEVICE_DFP(object); - ctk_display_device_dfp->handle = handle; - ctk_display_device_dfp->ctk_event = ctk_event; - ctk_display_device_dfp->ctk_config = ctk_config; - ctk_display_device_dfp->display_device_mask = display_device_mask; - ctk_display_device_dfp->name = g_strdup(name); - - /* cache the default scaling target & method values */ - ret1 = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_GPU_SCALING_DEFAULT_TARGET, - &val_target); - ret2 = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_GPU_SCALING_DEFAULT_METHOD, - &val_method); - - if (ret1 != NvCtrlSuccess || ret2 != NvCtrlSuccess || - val_target == NV_CTRL_GPU_SCALING_TARGET_INVALID || - val_method == NV_CTRL_GPU_SCALING_METHOD_INVALID) { - val_target = NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT; - val_method = NV_CTRL_GPU_SCALING_METHOD_STRETCHED; - } - - ctk_display_device_dfp->default_scaling_target = val_target; - ctk_display_device_dfp->default_scaling_method = val_method; - - gtk_box_set_spacing(GTK_BOX(object), 10); - - /* banner */ - - banner = ctk_banner_image_new(BANNER_ARTWORK_DFP); - gtk_box_pack_start(GTK_BOX(object), banner, FALSE, FALSE, 0); - - /* - * create the reset button (which we need while creating the - * controls in this page so that we can set the button's - * sensitivity), though we pack it at the bottom of the page - */ - - ctk_display_device_dfp->reset_button = - gtk_button_new_with_label("Reset DFP Hardware Defaults"); - - alignment = gtk_alignment_new(1, 1, 0, 0); - gtk_container_add(GTK_CONTAINER(alignment), - ctk_display_device_dfp->reset_button); - gtk_box_pack_end(GTK_BOX(object), alignment, TRUE, TRUE, 0); - - g_signal_connect(G_OBJECT(ctk_display_device_dfp->reset_button), - "clicked", G_CALLBACK(reset_button_clicked), - (gpointer) ctk_display_device_dfp); - - ctk_config_set_tooltip(ctk_config, ctk_display_device_dfp->reset_button, - ctk_help_create_reset_hardware_defaults_text("DFP", name)); - - /* Create tabbed notebook for widget */ - - notebook = gtk_notebook_new(); - gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); - align = gtk_alignment_new(0, 0, 1, 1); - gtk_container_add(GTK_CONTAINER(align), notebook); - gtk_box_pack_start(GTK_BOX(object), align, FALSE, FALSE, 0); - - /* Create first tab for dfp info */ - - nbox = gtk_vbox_new(FALSE, FRAME_PADDING); - gtk_container_set_border_width(GTK_CONTAINER(nbox), FRAME_PADDING); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nbox, gtk_label_new("Information")); - - /* create the hbox to store dfp info, scaling */ - - hbox = gtk_hbox_new(FALSE, FRAME_PADDING); - gtk_box_pack_start(GTK_BOX(nbox), hbox, FALSE, FALSE, FRAME_PADDING); - - /* DFP info */ - - frame = gtk_frame_new("Flat Panel Information"); - gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); - - /* - * insert a vbox between the frame and the widgets, so that the - * widgets don't expand to fill all of the space within the - * frame - */ - - tmpbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(tmpbox), FRAME_PADDING); - gtk_container_add(GTK_CONTAINER(frame), tmpbox); - - /* Make the txt widgets that will get updated */ - ctk_display_device_dfp->txt_chip_location = gtk_label_new(""); - ctk_display_device_dfp->txt_link = gtk_label_new(""); - ctk_display_device_dfp->txt_signal = gtk_label_new(""); - ctk_display_device_dfp->txt_native_resolution = gtk_label_new(""); - ctk_display_device_dfp->txt_best_fit_resolution = gtk_label_new(""); - ctk_display_device_dfp->txt_frontend_resolution = gtk_label_new(""); - ctk_display_device_dfp->txt_backend_resolution = gtk_label_new(""); - ctk_display_device_dfp->txt_refresh_rate = gtk_label_new(""); - - /* Add information widget lines */ - { - typedef struct { - GtkWidget *label; - GtkWidget *txt; - const gchar *tooltip; - } TextLineInfo; - - TextLineInfo lines[] = { - { - gtk_label_new("Chip location:"), - ctk_display_device_dfp->txt_chip_location, - __info_chip_location_help - }, - { - gtk_label_new("Connection link:"), - ctk_display_device_dfp->txt_link, - __info_link_help - }, - { - gtk_label_new("Signal:"), - ctk_display_device_dfp->txt_signal, - __info_signal_help - }, - { - gtk_label_new("Native Resolution:"), - ctk_display_device_dfp->txt_native_resolution, - __native_res_help, - }, - { - gtk_label_new("Best Fit Resolution:"), - ctk_display_device_dfp->txt_best_fit_resolution, - __best_fit_res_help, - }, - { - gtk_label_new("Frontend Resolution:"), - ctk_display_device_dfp->txt_frontend_resolution, - __frontend_res_help, - }, - { - gtk_label_new("Backend Resolution:"), - ctk_display_device_dfp->txt_backend_resolution, - __backend_res_help, - }, - { - gtk_label_new("Refresh Rate:"), - ctk_display_device_dfp->txt_refresh_rate, - __refresh_rate_help, - }, - { NULL, NULL, NULL } - }; - int i; - - GtkRequisition req; - int max_width; - - /* Compute max width of lables and setup text alignments */ - max_width = 0; - for (i = 0; lines[i].label; i++) { - gtk_misc_set_alignment(GTK_MISC(lines[i].label), 0.0f, 0.5f); - gtk_misc_set_alignment(GTK_MISC(lines[i].txt), 0.0f, 0.5f); - - gtk_widget_size_request(lines[i].label, &req); - if (max_width < req.width) { - max_width = req.width; - } - } - - /* Pack labels */ - for (i = 0; lines[i].label; i++) { - GtkWidget *tmphbox; - - /* Add separators */ - if (i == 3 || i == 5 || i == 7) { - GtkWidget *separator = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(tmpbox), separator, - FALSE, FALSE, 0); - } - - /* Set the label's width */ - gtk_widget_set_size_request(lines[i].label, max_width, -1); - - /* add the widgets for this line */ - tmphbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(tmphbox), lines[i].label, - FALSE, TRUE, 5); - gtk_box_pack_start(GTK_BOX(tmphbox), lines[i].txt, - FALSE, TRUE, 5); - - /* Include tooltips */ - if (lines[i].tooltip) { - ctk_config_set_tooltip(ctk_config, - lines[i].label, - lines[i].tooltip); - ctk_config_set_tooltip(ctk_config, - lines[i].txt, - lines[i].tooltip); - } - gtk_box_pack_start(GTK_BOX(tmpbox), tmphbox, FALSE, FALSE, 0); - } - } - - - /* Flat Panel Scaling */ - - frame = gtk_frame_new("Flat Panel Scaling"); - gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); - ctk_display_device_dfp->scaling_frame = frame; - - vbox = gtk_vbox_new(FALSE, FRAME_PADDING); - gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING); - gtk_container_add(GTK_CONTAINER(frame), vbox); - - button = gtk_check_button_new_with_label("Force Full GPU Scaling"); - ctk_display_device_dfp->scaling_gpu_button = button; - ctk_config_set_tooltip(ctk_config, button, __force_gpu_scaling_help); - - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); - - table = gtk_table_new(1, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 6); - gtk_table_set_col_spacings(GTK_TABLE(table), 15); - - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - - ctk_display_device_dfp->txt_scaling = - add_table_row_with_help_text(table, ctk_config, __gpu_scaling_help, - 0, 0, - 0, 0.5, "Scaling:", - 0, 0.5, ""); - - gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0); - - frame = gtk_frame_new("GPU Scaling Method"); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - vbox = gtk_vbox_new(FALSE, FRAME_PADDING); - gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING); - gtk_container_add(GTK_CONTAINER(frame), vbox); - - g_signal_connect(G_OBJECT(button), "toggled", - G_CALLBACK(dfp_scaling_changed), - (gpointer) ctk_display_device_dfp); - - radio0 = make_scaling_radio_button - (ctk_display_device_dfp, vbox, NULL, "Stretched", - NV_CTRL_GPU_SCALING_METHOD_STRETCHED); - ctk_config_set_tooltip(ctk_config, radio0, __gpu_scaling_stretched_help); - - radio1 = make_scaling_radio_button - (ctk_display_device_dfp, vbox, radio0, "Centered", - NV_CTRL_GPU_SCALING_METHOD_CENTERED); - ctk_config_set_tooltip(ctk_config, radio1, __gpu_scaling_centered_help); - - radio2 = make_scaling_radio_button - (ctk_display_device_dfp, vbox, radio1, "Aspect Ratio Scaled", - NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED); - ctk_config_set_tooltip(ctk_config, radio2, __gpu_scaling_ar_scaled_help); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_GPU_SCALING), - G_CALLBACK(dfp_update_received), - (gpointer) ctk_display_device_dfp); - - /* pack the EDID button */ - - hbox = gtk_hbox_new(FALSE, 0); - align = gtk_alignment_new(0, 1, 1, 1); - gtk_container_add(GTK_CONTAINER(align), hbox); - gtk_box_pack_end(GTK_BOX(nbox), align, FALSE, FALSE, 0); - ctk_display_device_dfp->edid_box = hbox; - - /* - * Create layout for second tab for dfp controls but don't - * add the tab until we make sure its required - */ - - nbox = gtk_vbox_new(FALSE, FRAME_PADDING); - gtk_container_set_border_width(GTK_CONTAINER(nbox), FRAME_PADDING); - - /* pack the color controls */ - - ctk_display_device_dfp->color_controls = - ctk_color_controls_new(handle, ctk_config, ctk_event, - ctk_display_device_dfp->reset_button, - display_device_mask, name); - - if (ctk_display_device_dfp->color_controls) { - gtk_box_pack_start(GTK_BOX(nbox), - ctk_display_device_dfp->color_controls, - FALSE, FALSE, 0); - } - - /* pack the dithering controls */ - - ctk_display_device_dfp->dithering_controls = - ctk_dithering_controls_new(handle, ctk_config, ctk_event, - ctk_display_device_dfp->reset_button, - display_device_mask, name); - - if (ctk_display_device_dfp->dithering_controls) { - gtk_box_pack_start(GTK_BOX(nbox), - ctk_display_device_dfp->dithering_controls, - FALSE, FALSE, 0); - } - - /* pack the image sliders */ - - ctk_display_device_dfp->image_sliders = - ctk_image_sliders_new(handle, ctk_config, ctk_event, - ctk_display_device_dfp->reset_button, - display_device_mask, name); - if (ctk_display_device_dfp->image_sliders) { - gtk_box_pack_start(GTK_BOX(nbox), - ctk_display_device_dfp->image_sliders, - FALSE, FALSE, 0); - } - - /* If no controls are created, don't add a controls tab */ - - if (ctk_display_device_dfp->color_controls || - ctk_display_device_dfp->dithering_controls || - ctk_display_device_dfp->image_sliders) { - gtk_notebook_append_page(GTK_NOTEBOOK(notebook),nbox,gtk_label_new("Controls")); - } - - /* show the page */ - - gtk_widget_show_all(GTK_WIDGET(object)); - - /* Update the GUI */ - - update_display_enabled_flag(ctk_display_device_dfp->handle, - &ctk_display_device_dfp->display_enabled, - ctk_display_device_dfp->display_device_mask); - - ctk_display_device_dfp_setup(ctk_display_device_dfp); - - /* handle enable/disable events on the display device */ - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_ENABLED_DISPLAYS), - G_CALLBACK(enabled_displays_received), - (gpointer) ctk_display_device_dfp); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_GPU_SCALING_ACTIVE), - G_CALLBACK(info_update_received), - (gpointer) ctk_display_device_dfp); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_DFP_SCALING_ACTIVE), - G_CALLBACK(info_update_received), - (gpointer) ctk_display_device_dfp); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_FRONTEND_RESOLUTION), - G_CALLBACK(info_update_received), - (gpointer) ctk_display_device_dfp); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION), - G_CALLBACK(info_update_received), - (gpointer) ctk_display_device_dfp); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_BACKEND_RESOLUTION), - G_CALLBACK(info_update_received), - (gpointer) ctk_display_device_dfp); - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_REFRESH_RATE), - G_CALLBACK(info_update_received), - (gpointer) ctk_display_device_dfp); - - return GTK_WIDGET(object); - -} /* ctk_display_device_dfp_new() */ - - - -/* - * make_scaling_radio_button() - create a radio button and plug it - * into the scaling radio group. - */ - -static GtkWidget *make_scaling_radio_button(CtkDisplayDeviceDfp - *ctk_display_device_dfp, - GtkWidget *vbox, - GtkWidget *prev_radio, - char *label, - gint value) -{ - GtkWidget *radio; - - if (prev_radio) { - radio = gtk_radio_button_new_with_label_from_widget - (GTK_RADIO_BUTTON(prev_radio), label); - } else { - radio = gtk_radio_button_new_with_label(NULL, label); - } - - gtk_box_pack_start(GTK_BOX(vbox), radio, FALSE, FALSE, 0); - - g_object_set_data(G_OBJECT(radio), "scaling_value", - GINT_TO_POINTER(value)); - - g_signal_connect(G_OBJECT(radio), "toggled", - G_CALLBACK(dfp_scaling_changed), - (gpointer) ctk_display_device_dfp); - - ctk_display_device_dfp->scaling_method_buttons[value -1] = radio; - - return radio; - -} /* make_scaling_radio_button() */ - - - -/* - * post_dfp_scaling_update() - helper function for - * dfp_scaling_changed() and dfp_update_received(); this does whatever - * work is necessary after scaling has been updated -- currently, this - * just means posting a statusbar message. - */ - -static void -post_dfp_scaling_update(CtkDisplayDeviceDfp *ctk_display_device_dfp, - gint value) -{ - int scaling_target = GET_SCALING_TARGET(value); - int scaling_method = GET_SCALING_METHOD(value); - - static const char *scaling_target_string_table[] = { - "Best Fit", /* NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT */ - "Native", /* NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE */ - }; - - static const char *scaling_method_string_table[] = { - "Stretched", /* NV_CTRL_GPU_SCALING_METHOD_STRETCHED */ - "Centered", /* NV_CTRL_GPU_SCALING_METHOD_CENTERED */ - "Aspect Ratio Scaled" /* NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED */ - }; - - if ((scaling_target < NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT) || - (scaling_target > NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE)) return; - - if ((scaling_method < NV_CTRL_GPU_SCALING_METHOD_STRETCHED) || - (scaling_method > NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED)) return; - - ctk_config_statusbar_message(ctk_display_device_dfp->ctk_config, - "Set Flat Panel Scaling for %s to %s %s.", - ctk_display_device_dfp->name, - scaling_method_string_table[scaling_method -1], - scaling_target_string_table[scaling_target -1]); - -} /* post_dfp_scaling_update() */ - - - -/* - * dfp_scaling_changed() - callback function for changes to the - * scaling target and method buttons. - */ - -static void dfp_scaling_changed(GtkWidget *widget, gpointer user_data) -{ - CtkDisplayDeviceDfp *ctk_display_device_dfp = - CTK_DISPLAY_DEVICE_DFP(user_data); - gboolean enabled; - int scaling_target; - int scaling_method; - gint value; - int i; - GtkWidget *radio; - - /* Get the scaling target */ - - enabled = gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON(ctk_display_device_dfp->scaling_gpu_button)); - - if (enabled) { - scaling_target = NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE; - } else { - scaling_target = NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT; - } - - /* Get the scaling method */ - - scaling_method = NV_CTRL_GPU_SCALING_METHOD_INVALID; - - for (i = 0; i < NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED; i++) { - radio = ctk_display_device_dfp->scaling_method_buttons[i]; - - if (!radio) continue; - - enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)); - - if (enabled) { - user_data = g_object_get_data(G_OBJECT(radio), "scaling_value"); - scaling_method = GPOINTER_TO_INT(user_data); - break; - } - } - - if (scaling_method == NV_CTRL_GPU_SCALING_METHOD_INVALID) { - return; - } - - value = MAKE_SCALING_VALUE(scaling_target, scaling_method); - - NvCtrlSetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_GPU_SCALING, value); - - gtk_widget_set_sensitive(ctk_display_device_dfp->reset_button, TRUE); - - post_dfp_scaling_update(ctk_display_device_dfp, value); - -} /* dfp_scaling_changed() */ - - - -/* - * reset_button_clicked() - callback when the reset button is clicked - */ - -static void reset_button_clicked(GtkButton *button, gpointer user_data) -{ - CtkDisplayDeviceDfp *ctk_display_device_dfp = - CTK_DISPLAY_DEVICE_DFP(user_data); - - gint value; - - ctk_image_sliders_reset - (CTK_IMAGE_SLIDERS(ctk_display_device_dfp->image_sliders)); - - /* - * if scaling is active, send the default scaling value to the - * server and update the radio button group - */ - - if (ctk_display_device_dfp->active_attributes & __SCALING) { - - value = - MAKE_SCALING_VALUE(ctk_display_device_dfp->default_scaling_target, - ctk_display_device_dfp->default_scaling_method); - - - NvCtrlSetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_GPU_SCALING, value); - - dfp_scaling_setup(ctk_display_device_dfp); - } - - /* Reset the color configuration */ - if (ctk_display_device_dfp->color_controls) { - ctk_color_controls_reset - (CTK_COLOR_CONTROLS(ctk_display_device_dfp->color_controls)); - } - - /* Reset the dithering configuration */ - if (ctk_display_device_dfp->dithering_controls) { - ctk_dithering_controls_reset - (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls)); - } - - /* Update the reset button */ - - gtk_widget_set_sensitive(ctk_display_device_dfp->reset_button, FALSE); - - /* status bar message */ - - ctk_config_statusbar_message(ctk_display_device_dfp->ctk_config, - "Reset hardware defaults for %s.", - ctk_display_device_dfp->name); - -} /* reset_button_clicked() */ - - - -/* - * dfp_scaling_update_buttons() - update the GUI state of the scaling button - * group, making the specified scaling value active. - */ - -static void -dfp_scaling_update_buttons(CtkDisplayDeviceDfp *ctk_display_device_dfp, - gint value) -{ - GtkWidget *b, *button = NULL; - int scaling_target = GET_SCALING_TARGET(value); - int scaling_method = GET_SCALING_METHOD(value); - gboolean enabled; - int i; - - if ((scaling_target < NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_BEST_FIT) || - (scaling_target > NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE)) - return; - - if ((scaling_method < NV_CTRL_GPU_SCALING_METHOD_STRETCHED) || - (scaling_method > NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED)) - return; - - if (scaling_target == NV_CTRL_GPU_SCALING_TARGET_FLATPANEL_NATIVE) { - enabled = TRUE; - } else { - enabled = FALSE; - } - - button = ctk_display_device_dfp->scaling_method_buttons[scaling_method -1]; - - if (!button) return; - - /* turn off signal handling for all the scaling buttons */ - - for (i = 0; i < NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED; i++) { - b = ctk_display_device_dfp->scaling_method_buttons[i]; - if (!b) continue; - - g_signal_handlers_block_by_func - (G_OBJECT(b), G_CALLBACK(dfp_scaling_changed), - (gpointer) ctk_display_device_dfp); - } - - g_signal_handlers_block_by_func - (G_OBJECT(ctk_display_device_dfp->scaling_gpu_button), - G_CALLBACK(dfp_scaling_changed), - (gpointer) ctk_display_device_dfp); - - /* set the appropriate button active */ - - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE); - gtk_toggle_button_set_active - (GTK_TOGGLE_BUTTON(ctk_display_device_dfp->scaling_gpu_button), - enabled); - - /* turn on signal handling for all the scaling buttons */ - - for (i = 0; i < NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED; i++) { - b = ctk_display_device_dfp->scaling_method_buttons[i]; - if (!b) continue; - - g_signal_handlers_unblock_by_func - (G_OBJECT(b), G_CALLBACK(dfp_scaling_changed), - (gpointer) ctk_display_device_dfp); - } - - g_signal_handlers_unblock_by_func - (G_OBJECT(ctk_display_device_dfp->scaling_gpu_button), - G_CALLBACK(dfp_scaling_changed), - (gpointer) ctk_display_device_dfp); - -} /* dfp_scaling_update_buttons() */ - - - -/* - * dfp_update_received() - callback function for changed DFP - * settings; this is called when we receive an event indicating that - * another NV-CONTROL client changed any of the settings that we care - * about. - */ - -static void dfp_update_received(GtkObject *object, gpointer arg1, - gpointer user_data) -{ - CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - CtkDisplayDeviceDfp *ctk_display_device_dfp = - CTK_DISPLAY_DEVICE_DFP(user_data); - - /* if the event is not for this display device, return */ - - if (!(event_struct->display_mask & - ctk_display_device_dfp->display_device_mask)) { - return; - } - - switch (event_struct->attribute) { - case NV_CTRL_GPU_SCALING: - dfp_scaling_update_buttons(ctk_display_device_dfp, - event_struct->value); - post_dfp_scaling_update(ctk_display_device_dfp, event_struct->value); - break; - - default: - break; - } - -} /* dfp_update_received() */ - - - -/* - * ctk_display_device_dfp_create_help() - construct the DFP display - * device help page - */ - -GtkTextBuffer *ctk_display_device_dfp_create_help(GtkTextTagTable *table, - CtkDisplayDeviceDfp - *ctk_display_device_dfp) -{ - GtkTextIter i; - GtkTextBuffer *b; - GtkTooltipsData *td; - - b = gtk_text_buffer_new(table); - - gtk_text_buffer_get_iter_at_offset(b, &i, 0); - - ctk_help_title(b, &i, "%s Help", ctk_display_device_dfp->name); - - ctk_help_heading(b, &i, "Flat Panel Information"); - ctk_help_para(b, &i, __info_help); - - ctk_help_term(b, &i, "Chip Location"); - ctk_help_para(b, &i, __info_chip_location_help); - - ctk_help_term(b, &i, "Link"); - ctk_help_para(b, &i, __info_link_help); - - ctk_help_term(b, &i, "Signal"); - ctk_help_para(b, &i, __info_signal_help); - - ctk_help_term(b, &i, "Native Resolution"); - ctk_help_para(b, &i, __native_res_help); - - ctk_help_term(b, &i, "Best Fit Resolution"); - ctk_help_para(b, &i, __best_fit_res_help); - - ctk_help_term(b, &i, "Frontend Resolution"); - ctk_help_para(b, &i, __frontend_res_help); - - ctk_help_term(b, &i, "Backend Resolution"); - ctk_help_para(b, &i, __backend_res_help); - - ctk_help_term(b, &i, "Refresh Rate"); - ctk_help_para(b, &i, __refresh_rate_help); - - ctk_help_heading(b, &i, "Flat Panel Scaling"); - ctk_help_para(b, &i, __scaling_help); - - ctk_help_term(b, &i, "Force Full GPU Scaling"); - ctk_help_para(b, &i, __force_gpu_scaling_help); - - ctk_help_term(b, &i, "Scaling"); - ctk_help_para(b, &i, __gpu_scaling_help); - - ctk_help_term(b, &i, "Stretched"); - ctk_help_para(b, &i, __gpu_scaling_stretched_help); - - ctk_help_term(b, &i, "Centered"); - ctk_help_para(b, &i, __gpu_scaling_centered_help); - - ctk_help_term(b, &i, "Aspect Ratio Scaled"); - ctk_help_para(b, &i, __gpu_scaling_ar_scaled_help); - - if (ctk_display_device_dfp->edid) { - add_acquire_edid_help(b, &i); - } - - if (ctk_display_device_dfp->color_controls) { - add_color_controls_help - (CTK_COLOR_CONTROLS(ctk_display_device_dfp->color_controls), b, &i); - } - - if (ctk_display_device_dfp->dithering_controls) { - add_dithering_controls_help - (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls), b, &i); - } - - add_image_sliders_help - (CTK_IMAGE_SLIDERS(ctk_display_device_dfp->image_sliders), b, &i); - - td = gtk_tooltips_data_get(GTK_WIDGET(ctk_display_device_dfp->reset_button)); - ctk_help_reset_hardware_defaults (b, &i, td->tip_text); - - ctk_help_finish(b); - - return b; - -} /* ctk_display_device_dfp_create_help() */ - - -static void update_link(CtkDisplayDeviceDfp *ctk_display_device_dfp) -{ - ReturnStatus ret; - gint val, signal_type = ctk_display_device_dfp->signal_type; - const char *link = "Unknown"; - char tmp[32]; - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_FLATPANEL_LINK, &val); - if (ret == NvCtrlSuccess) { - if (signal_type == NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT) { - int lanes; - - lanes = val + 1; - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_DISPLAYPORT_LINK_RATE, &val); - if (ret == NvCtrlSuccess && val == NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED) { - link = "Disabled"; - } else { - const char *bw = "unknown bandwidth"; - - if (ret == NvCtrlSuccess) { - switch (val) { - case NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS: - bw = "1.62 Gbps"; - break; - case NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS: - bw = "2.70 Gbps"; - break; - } - } - - snprintf(tmp, 32, "%d lane%s @ %s", lanes, lanes == 1 ? "" : "s", - bw); - link = tmp; - } - } else { - // LVDS or TMDS - switch(val) { - case NV_CTRL_FLATPANEL_LINK_SINGLE: - link = "Single"; - break; - case NV_CTRL_FLATPANEL_LINK_DUAL: - link = "Dual"; - break; - } - } - } - - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_link), link); -} - - -static void callback_link_changed(GtkObject *object, gpointer arg1, - gpointer user_data) -{ - CtkDisplayDeviceDfp *ctk_display_device_dfp = - CTK_DISPLAY_DEVICE_DFP(user_data); - - update_link(ctk_display_device_dfp); -} - -/* - * dfp_info_setup() - - * - * - */ -static void dfp_info_setup(CtkDisplayDeviceDfp *ctk_display_device_dfp) -{ - ReturnStatus ret; - gint val, gpu_scaling, dfp_scaling; - char *chip_location, *link, *signal; - char *scaling; - CtkEvent *ctk_event = ctk_display_device_dfp->ctk_event; - - chip_location = link = signal = "Unknown"; - scaling = "Unknown"; - - /* Chip location */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_FLATPANEL_CHIP_LOCATION, &val); - if (ret == NvCtrlSuccess) { - switch (val) { - case NV_CTRL_FLATPANEL_CHIP_LOCATION_INTERNAL: - chip_location = "Internal"; - break; - case NV_CTRL_FLATPANEL_CHIP_LOCATION_EXTERNAL: - chip_location = "External"; - break; - } - } - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_chip_location), chip_location); - - /* Signal */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_FLATPANEL_SIGNAL, &val); - if (ret == NvCtrlSuccess) { - switch (val) { - case NV_CTRL_FLATPANEL_SIGNAL_LVDS: - signal = "LVDS"; - break; - case NV_CTRL_FLATPANEL_SIGNAL_TMDS: - signal = "TMDS"; - break; - case NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT: - signal = "DisplayPort"; - break; - } - } - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_signal), signal); - ctk_display_device_dfp->signal_type = val; - - /* Link */ - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_FLATPANEL_LINK), - G_CALLBACK(callback_link_changed), - (gpointer) ctk_display_device_dfp); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_DISPLAYPORT_LINK_RATE), - G_CALLBACK(callback_link_changed), - (gpointer) ctk_display_device_dfp); - - update_link(ctk_display_device_dfp); - - /* Native Resolution */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_FLATPANEL_NATIVE_RESOLUTION, &val); - if (ret == NvCtrlSuccess) { - gchar *resolution = - g_strdup_printf("%dx%d", (val >> 16), (val & 0xFFFF)); - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_native_resolution), - resolution); - g_free(resolution); - } else { - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_native_resolution), - "Unknown"); - } - - /* Frontend Resolution */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_FRONTEND_RESOLUTION, &val); - if (ret == NvCtrlSuccess) { - gchar *resolution = - g_strdup_printf("%dx%d", (val >> 16), (val & 0xFFFF)); - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_frontend_resolution), - resolution); - g_free(resolution); - } else { - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_frontend_resolution), - "Unknown"); - } - - /* Best Fit Resolution */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_FLATPANEL_BEST_FIT_RESOLUTION, &val); - if (ret == NvCtrlSuccess) { - gchar *resolution = - g_strdup_printf("%dx%d", (val >> 16), (val & 0xFFFF)); - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_best_fit_resolution), - resolution); - g_free(resolution); - } else { - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_best_fit_resolution), - "Unknown"); - } - - /* Backend Resolution */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_BACKEND_RESOLUTION, &val); - if (ret == NvCtrlSuccess) { - gchar *resolution = - g_strdup_printf("%dx%d", (val >> 16), (val & 0xFFFF)); - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_backend_resolution), - resolution); - g_free(resolution); - } else { - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_backend_resolution), - "Unknown"); - } - /* Refresh Rate */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_REFRESH_RATE, &val); - if (ret == NvCtrlSuccess) { - char str[32]; - float fvalue = ((float)(val)) / 100.0f; - snprintf(str, 32, "%.2f Hz", fvalue); - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_refresh_rate), - str); - } else { - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_refresh_rate), - "Unknown"); - - } - - /* GPU/DFP Scaling */ - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_GPU_SCALING_ACTIVE, - &gpu_scaling); - if (ret == NvCtrlSuccess) { - ret = NvCtrlGetDisplayAttribute - (ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_DFP_SCALING_ACTIVE, &dfp_scaling); - } - if (ret != NvCtrlSuccess) { - scaling = "Unknown"; - } else { - if (gpu_scaling && dfp_scaling) { - scaling = "GPU & DFP"; - } else if (gpu_scaling) { - scaling = "GPU"; - } else if (dfp_scaling) { - scaling = "DFP"; - } else { - scaling = "None"; - } - } - - gtk_label_set_text - (GTK_LABEL(ctk_display_device_dfp->txt_scaling), scaling); - -} /* dfp_info_setup() */ - - - -/* - * dfp_scaling_setup() - Update GUI to reflect X server settings of - * DFP Scaling. - */ -static void dfp_scaling_setup(CtkDisplayDeviceDfp *ctk_display_device_dfp) -{ - ReturnStatus ret; - int val; - - ret = - NvCtrlGetDisplayAttribute(ctk_display_device_dfp->handle, - ctk_display_device_dfp->display_device_mask, - NV_CTRL_GPU_SCALING, &val); - if (ret != NvCtrlSuccess) { - gtk_widget_set_sensitive(ctk_display_device_dfp->scaling_frame, FALSE); - gtk_widget_hide(ctk_display_device_dfp->scaling_frame); - ctk_display_device_dfp->active_attributes &= ~__SCALING; - return; - } - - gtk_widget_show(ctk_display_device_dfp->scaling_frame); - ctk_display_device_dfp->active_attributes |= __SCALING; - - gtk_widget_set_sensitive(ctk_display_device_dfp->scaling_frame, TRUE); - - dfp_scaling_update_buttons(ctk_display_device_dfp, val); - -} /* dfp_scaling_setup() */ - - - -/* - * Updates the display device page to reflect the current - * configuration of the display device. - */ -static void ctk_display_device_dfp_setup(CtkDisplayDeviceDfp - *ctk_display_device_dfp) -{ - /* Update DFP-specific settings */ - - dfp_info_setup(ctk_display_device_dfp); - - dfp_scaling_setup(ctk_display_device_dfp); - - - /* Update the image sliders */ - - ctk_image_sliders_setup - (CTK_IMAGE_SLIDERS(ctk_display_device_dfp->image_sliders)); - - - /* update acquire EDID button */ - - if (ctk_display_device_dfp->edid) { - GList *list; - - list = gtk_container_get_children - (GTK_CONTAINER(ctk_display_device_dfp->edid_box)); - if (list) { - gtk_container_remove - (GTK_CONTAINER(ctk_display_device_dfp->edid_box), - (GtkWidget *)(list->data)); - g_list_free(list); - } - } - - ctk_display_device_dfp->edid = - ctk_edid_new(ctk_display_device_dfp->handle, - ctk_display_device_dfp->ctk_config, - ctk_display_device_dfp->ctk_event, - ctk_display_device_dfp->reset_button, - ctk_display_device_dfp->display_device_mask, - ctk_display_device_dfp->name); - - if (ctk_display_device_dfp->edid) { - gtk_box_pack_start(GTK_BOX(ctk_display_device_dfp->edid_box), - ctk_display_device_dfp->edid, TRUE, TRUE, 0); - } - - /* Update the color control setup */ - - ctk_color_controls_setup - (CTK_COLOR_CONTROLS(ctk_display_device_dfp->color_controls)); - - /* Update the dithering setup */ - - ctk_dithering_controls_setup - (CTK_DITHERING_CONTROLS(ctk_display_device_dfp->dithering_controls)); - - /* update the reset button */ - - gtk_widget_set_sensitive(ctk_display_device_dfp->reset_button, FALSE); - -} /* ctk_display_device_dfp_setup() */ - - - -/* - * When the list of enabled displays on the GPU changes, - * this page should disable/enable access based on whether - * or not the display device is enabled. - */ -static void enabled_displays_received(GtkObject *object, gpointer arg1, - gpointer user_data) -{ - CtkDisplayDeviceDfp *ctk_object = CTK_DISPLAY_DEVICE_DFP(user_data); - - /* Requery display information only if display disabled */ - - update_display_enabled_flag(ctk_object->handle, - &ctk_object->display_enabled, - ctk_object->display_device_mask); - - if (ctk_object->display_enabled) { - return; - } - - ctk_display_device_dfp_setup(ctk_object); - -} /* enabled_displays_received() */ - - -/* - * When DFP/GPU scaling activation and/or resolution changes occur, - * we should update the GUI to reflect the current state. - */ -static void info_update_received(GtkObject *object, gpointer arg1, - gpointer user_data) -{ - CtkDisplayDeviceDfp *ctk_object = CTK_DISPLAY_DEVICE_DFP(user_data); - CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - - /* if the event is not for this display device, return */ - - if (!(event_struct->display_mask & ctk_object->display_device_mask)) { - return; - } - - dfp_info_setup(ctk_object); -} diff --git a/src/gtk+-2.x/ctkdisplaydevice-dfp.h b/src/gtk+-2.x/ctkdisplaydevice-dfp.h deleted file mode 100644 index 7286a95..0000000 --- a/src/gtk+-2.x/ctkdisplaydevice-dfp.h +++ b/dev/null @@ -1,106 +0,0 @@ -/* - * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix - * and Linux systems. - * - * Copyright (C) 2004 NVIDIA Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses>. - */ - -#ifndef __CTK_DISPLAYDEVICE_DFP_H__ -#define __CTK_DISPLAYDEVICE_DFP_H__ - -#include "ctkevent.h" -#include "ctkconfig.h" - -G_BEGIN_DECLS - -#define CTK_TYPE_DISPLAY_DEVICE_DFP (ctk_display_device_dfp_get_type()) - -#define CTK_DISPLAY_DEVICE_DFP(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_DISPLAY_DEVICE_DFP, \ - CtkDisplayDeviceDfp)) - -#define CTK_DISPLAY_DEVICE_DFP_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_DISPLAY_DEVICE_DFP, \ - CtkDisplayDeviceDfpClass)) - -#define CTK_IS_DISPLAY_DEVICE_DFP(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_DISPLAY_DEVICE_DFP)) - -#define CTK_IS_DISPLAY_DEVICE_DFP_CLASS(class) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_DISPLAY_DEVICE_DFP)) - -#define CTK_DISPLAY_DEVICE_DFP_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_DISPLAY_DEVICE_DFP, \ - CtkDisplayDeviceDfpClass)) - - -typedef struct _CtkDisplayDeviceDfp CtkDisplayDeviceDfp; -typedef struct _CtkDisplayDeviceDfpClass CtkDisplayDeviceDfpClass; - -struct _CtkDisplayDeviceDfp -{ - GtkVBox parent; - - NvCtrlAttributeHandle *handle; - CtkConfig *ctk_config; - CtkEvent *ctk_event; - GtkWidget *image_sliders; - GtkWidget *reset_button; - GtkWidget *edid_box; - GtkWidget *edid; - GtkWidget *dithering_controls; - GtkWidget *color_controls; - - GtkWidget *txt_chip_location; - GtkWidget *txt_link; - GtkWidget *txt_signal; - GtkWidget *txt_native_resolution; - GtkWidget *txt_frontend_resolution; - GtkWidget *txt_best_fit_resolution; - GtkWidget *txt_backend_resolution; - - GtkWidget *txt_refresh_rate; - GtkWidget *txt_scaling; - - GtkWidget *scaling_frame; - GtkWidget *scaling_gpu_button; - GtkWidget *scaling_method_buttons[NV_CTRL_GPU_SCALING_METHOD_ASPECT_SCALED]; - - unsigned int display_device_mask; - gboolean display_enabled; - unsigned int active_attributes; - - char *name; - gint default_scaling_target; - gint default_scaling_method; - gint signal_type; -}; - -struct _CtkDisplayDeviceDfpClass -{ - GtkVBoxClass parent_class; -}; - -GType ctk_display_device_dfp_get_type (void) G_GNUC_CONST; -GtkWidget* ctk_display_device_dfp_new (NvCtrlAttributeHandle *, - CtkConfig *, CtkEvent *, - unsigned int, char *); - -GtkTextBuffer *ctk_display_device_dfp_create_help(GtkTextTagTable *, - CtkDisplayDeviceDfp *); - -G_END_DECLS - -#endif /* __CTK_DISPLAYDEVICE_DFP_H__ */ diff --git a/src/gtk+-2.x/ctkdisplaydevice-tv.c b/src/gtk+-2.x/ctkdisplaydevice-tv.c index febfdfe..c7310dd 100644 --- a/src/gtk+-2.x/ctkdisplaydevice-tv.c +++ b/src/gtk+-2.x/ctkdisplaydevice-tv.c @@ -73,7 +73,7 @@ static GtkWidget * add_scale(CtkDisplayDeviceTv *ctk_display_device_tv, static void adjustment_value_changed(GtkAdjustment *adjustment, gpointer user_data); -static void reset_defaults(GtkButton *button, gpointer user_data); +static void reset_button_clicked(GtkButton *button, gpointer user_data); static void value_received(GtkObject *object, gpointer arg1, gpointer user_data); @@ -104,6 +104,7 @@ GType ctk_display_device_tv_get_type(void) sizeof (CtkDisplayDeviceTv), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_display_device_tv_type = g_type_register_static (GTK_TYPE_VBOX, @@ -145,7 +146,6 @@ static void ctk_display_device_tv_finalize( GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle, CtkConfig *ctk_config, CtkEvent *ctk_event, - unsigned int display_device_mask, char *name) { GObject *object; @@ -165,7 +165,6 @@ GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle, ctk_display_device_tv->handle = handle; ctk_display_device_tv->ctk_config = ctk_config; ctk_display_device_tv->ctk_event = ctk_event; - ctk_display_device_tv->display_device_mask = display_device_mask; ctk_display_device_tv->name = g_strdup(name); gtk_box_set_spacing(GTK_BOX(object), 10); @@ -345,7 +344,7 @@ GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle, ctk_display_device_tv->image_sliders = ctk_image_sliders_new(handle, ctk_config, ctk_event, ctk_display_device_tv->reset_button, - display_device_mask, name); + name); if (ctk_display_device_tv->image_sliders) { gtk_box_pack_start(GTK_BOX(object), ctk_display_device_tv->image_sliders, @@ -355,7 +354,7 @@ GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle, /* reset button */ g_signal_connect(G_OBJECT(ctk_display_device_tv->reset_button), "clicked", - G_CALLBACK(reset_defaults), + G_CALLBACK(reset_button_clicked), (gpointer) ctk_display_device_tv); alignment = gtk_alignment_new(1, 1, 0, 0); @@ -373,9 +372,16 @@ GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle, /* EDID button box */ + ctk_display_device_tv->edid = + ctk_edid_new(ctk_display_device_tv->handle, + ctk_display_device_tv->ctk_config, + ctk_display_device_tv->ctk_event, + ctk_display_device_tv->name); + hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, 0); - ctk_display_device_tv->edid_box = hbox; + gtk_box_pack_start(GTK_BOX(hbox), ctk_display_device_tv->edid, + TRUE, TRUE, 0); /* finally, display the widget */ @@ -384,8 +390,7 @@ GtkWidget* ctk_display_device_tv_new(NvCtrlAttributeHandle *handle, /* update the GUI */ update_display_enabled_flag(ctk_display_device_tv->handle, - &ctk_display_device_tv->display_enabled, - ctk_display_device_tv->display_device_mask); + &ctk_display_device_tv->display_enabled); ctk_display_device_tv_setup(ctk_display_device_tv); @@ -505,11 +510,10 @@ static void adjustment_value_changed(GtkAdjustment *adjustment, user_data = g_object_get_data(G_OBJECT(adjustment), "attribute"); attribute = GPOINTER_TO_INT(user_data); - - NvCtrlSetDisplayAttribute(ctk_display_device_tv->handle, - ctk_display_device_tv->display_device_mask, - attribute, (int) value); - + + NvCtrlSetAttribute(ctk_display_device_tv->handle, + attribute, (int) value); + post_adjustment_value_changed(adjustment, ctk_display_device_tv, value); } /* adjustment_value_changed() */ @@ -537,10 +541,8 @@ static void reset_slider(CtkDisplayDeviceTv *ctk_display_device_tv, if (!get_scale_active(CTK_SCALE(scale))) return; attribute = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(adj), "attribute")); - - ret = NvCtrlGetDisplayAttribute(ctk_display_device_tv->handle, - ctk_display_device_tv->display_device_mask, - attribute, &val); + + ret = NvCtrlGetAttribute(ctk_display_device_tv->handle, attribute, &val); if (ret != NvCtrlSuccess) return; g_signal_handlers_block_matched(adj, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, @@ -572,8 +574,6 @@ static void reset_sliders(CtkDisplayDeviceTv *ctk_display_device_tv) reset_slider(ctk_display_device_tv, ctk_display_device_tv->contrast); reset_slider(ctk_display_device_tv, ctk_display_device_tv->saturation); - gtk_widget_set_sensitive(ctk_display_device_tv->reset_button, FALSE); - ctk_config_statusbar_message(ctk_display_device_tv->ctk_config, "Reset TV Hardware defaults for %s.", ctk_display_device_tv->name); @@ -582,17 +582,23 @@ static void reset_sliders(CtkDisplayDeviceTv *ctk_display_device_tv) /* - * reset_defaults() - called when the "reset defaults" button is + * reset_button_clicked() - called when the "reset defaults" button is * pressed; tells the X server to reset its defaults, and then resets * all the sliders. */ -static void reset_defaults(GtkButton *button, gpointer user_data) +static void reset_button_clicked(GtkButton *button, gpointer user_data) { CtkDisplayDeviceTv *ctk_display_device_tv = CTK_DISPLAY_DEVICE_TV(user_data); gint active = 0; + + /* Disable the reset button here and allow the controls below to (re)enable + * it if need be,. + */ + gtk_widget_set_sensitive(ctk_display_device_tv->reset_button, FALSE); + /* Make sure something is active */ active = @@ -604,19 +610,16 @@ static void reset_defaults(GtkButton *button, gpointer user_data) get_scale_active(CTK_SCALE(ctk_display_device_tv->saturation))); if (active) { - NvCtrlSetDisplayAttribute(ctk_display_device_tv->handle, - ctk_display_device_tv->display_device_mask, - NV_CTRL_TV_RESET_SETTINGS, 1); - } - - if (ctk_display_device_tv->image_sliders) { - ctk_image_sliders_reset - (CTK_IMAGE_SLIDERS(ctk_display_device_tv->image_sliders)); + NvCtrlSetAttribute(ctk_display_device_tv->handle, + NV_CTRL_TV_RESET_SETTINGS, 1); } + ctk_image_sliders_reset + (CTK_IMAGE_SLIDERS(ctk_display_device_tv->image_sliders)); + reset_sliders(ctk_display_device_tv); -} /* reset_defaults() */ +} /* reset_button_clicked() */ @@ -660,6 +663,7 @@ static void value_received(GtkObject *object, gpointer arg1, break; case NV_CTRL_TV_RESET_SETTINGS: reset_sliders(ctk_display_device_tv); + ctk_display_device_tv_setup(ctk_display_device_tv); return; default: return; @@ -733,10 +737,8 @@ GtkTextBuffer *ctk_display_device_tv_create_help(GtkTextTagTable *table, add_image_sliders_help (CTK_IMAGE_SLIDERS(ctk_display_device_tv->image_sliders), b, &i); - if (ctk_display_device_tv->edid) { - add_acquire_edid_help(b, &i); - } - + add_acquire_edid_help(b, &i); + td = gtk_tooltips_data_get(GTK_WIDGET(ctk_display_device_tv->reset_button)); ctk_help_reset_hardware_defaults (b, &i, td->tip_text); @@ -757,17 +759,15 @@ static void setup_scale(CtkDisplayDeviceTv *ctk_display_device_tv, ReturnStatus ret0, ret1; NVCTRLAttributeValidValuesRec valid; NvCtrlAttributeHandle *handle = ctk_display_device_tv->handle; - unsigned int mask = ctk_display_device_tv->display_device_mask; int val; GtkAdjustment *adj = CTK_SCALE(scale)->gtk_adjustment; /* Read settings from X server */ - ret0 = NvCtrlGetValidDisplayAttributeValues(handle, mask, - attribute, &valid); - - ret1 = NvCtrlGetDisplayAttribute(handle, mask, attribute, &val); - + ret0 = NvCtrlGetValidAttributeValues(handle, attribute, &valid); + + ret1 = NvCtrlGetAttribute(handle, attribute, &val); + if ((ret0 == NvCtrlSuccess) && (ret1 == NvCtrlSuccess) && (valid.type == ATTRIBUTE_TYPE_RANGE)) { @@ -809,80 +809,56 @@ static void setup_scale(CtkDisplayDeviceTv *ctk_display_device_tv, static void ctk_display_device_tv_setup(CtkDisplayDeviceTv *ctk_display_device_tv) { - /* Update Information Frame */ - + /* Disable the reset button here and allow the controls below to (re)enable + * it if need be,. + */ + gtk_widget_set_sensitive(ctk_display_device_tv->reset_button, FALSE); + + + /* Update info */ + tv_info_setup(ctk_display_device_tv); - /* Update sliders */ - + /* update acquire EDID button */ + + ctk_edid_setup(CTK_EDID(ctk_display_device_tv->edid)); + + + /* Update controls */ + /* NV_CTRL_TV_OVERSCAN */ - + setup_scale(ctk_display_device_tv, NV_CTRL_TV_OVERSCAN, ctk_display_device_tv->overscan); - + /* NV_CTRL_TV_FLICKER_FILTER */ - + setup_scale(ctk_display_device_tv, NV_CTRL_TV_FLICKER_FILTER, ctk_display_device_tv->flicker_filter); - + /* NV_CTRL_TV_BRIGHTNESS */ - + setup_scale(ctk_display_device_tv, NV_CTRL_TV_BRIGHTNESS, ctk_display_device_tv->brightness); - + /* NV_CTRL_TV_HUE */ - + setup_scale(ctk_display_device_tv, NV_CTRL_TV_HUE, ctk_display_device_tv->hue); /* NV_CTRL_TV_CONTRAST */ - + setup_scale(ctk_display_device_tv, NV_CTRL_TV_CONTRAST, ctk_display_device_tv->contrast); /* NV_CTRL_TV_SATURATION */ - + setup_scale(ctk_display_device_tv, NV_CTRL_TV_SATURATION, ctk_display_device_tv->saturation); - /* Update the image sliders */ - ctk_image_sliders_setup (CTK_IMAGE_SLIDERS(ctk_display_device_tv->image_sliders)); - - /* update acquire EDID button */ - - if (ctk_display_device_tv->edid) { - GList *list; - list = gtk_container_get_children - (GTK_CONTAINER(ctk_display_device_tv->edid_box)); - if (list) { - gtk_container_remove - (GTK_CONTAINER(ctk_display_device_tv->edid_box), - (GtkWidget *)(list->data)); - g_list_free(list); - } - } - - ctk_display_device_tv->edid = - ctk_edid_new(ctk_display_device_tv->handle, - ctk_display_device_tv->ctk_config, - ctk_display_device_tv->ctk_event, - ctk_display_device_tv->reset_button, - ctk_display_device_tv->display_device_mask, - ctk_display_device_tv->name); - - if (ctk_display_device_tv->edid) { - gtk_box_pack_start(GTK_BOX(ctk_display_device_tv->edid_box), - ctk_display_device_tv->edid, TRUE, TRUE, 0); - } - - - /* update the reset button */ - - gtk_widget_set_sensitive(ctk_display_device_tv->reset_button, FALSE); - } /* ctk_display_device_tv_setup() */ static void tv_info_setup(CtkDisplayDeviceTv *ctk_display_device_tv) @@ -893,11 +869,9 @@ static void tv_info_setup(CtkDisplayDeviceTv *ctk_display_device_tv) /* NV_CTRL_STRING_TV_ENCODER_NAME */ - ret = NvCtrlGetStringDisplayAttribute - (ctk_display_device_tv->handle, - ctk_display_device_tv->display_device_mask, - NV_CTRL_STRING_TV_ENCODER_NAME, - &str); + ret = NvCtrlGetStringDisplayAttribute(ctk_display_device_tv->handle, 0, + NV_CTRL_STRING_TV_ENCODER_NAME, + &str); if (ret == NvCtrlSuccess) { gtk_label_set_text(GTK_LABEL(ctk_display_device_tv->txt_encoder_name), str); @@ -905,14 +879,12 @@ static void tv_info_setup(CtkDisplayDeviceTv *ctk_display_device_tv) } else { gtk_widget_hide(ctk_display_device_tv->info_frame); } - + /* NV_CTRL_REFRESH_RATE */ - - ret = NvCtrlGetDisplayAttribute - (ctk_display_device_tv->handle, - ctk_display_device_tv->display_device_mask, - NV_CTRL_REFRESH_RATE, - &val); + + ret = NvCtrlGetAttribute(ctk_display_device_tv->handle, + NV_CTRL_REFRESH_RATE, + &val); if (ret == NvCtrlSuccess) { float fvalue = ((float)(val)) / 100.0f; snprintf(str, 32, "%.2f Hz", fvalue); @@ -938,12 +910,7 @@ static void enabled_displays_received(GtkObject *object, gpointer arg1, /* Requery display information only if display disabled */ update_display_enabled_flag(ctk_object->handle, - &ctk_object->display_enabled, - ctk_object->display_device_mask); - - if (ctk_object->display_enabled) { - return; - } + &ctk_object->display_enabled); ctk_display_device_tv_setup(ctk_object); @@ -957,13 +924,6 @@ static void info_update_received(GtkObject *object, gpointer arg1, gpointer user_data) { CtkDisplayDeviceTv *ctk_object = CTK_DISPLAY_DEVICE_TV(user_data); - CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - - /* if the event is not for this display device, return */ - - if (!(event_struct->display_mask & ctk_object->display_device_mask)) { - return; - } tv_info_setup(ctk_object); } diff --git a/src/gtk+-2.x/ctkdisplaydevice-tv.h b/src/gtk+-2.x/ctkdisplaydevice-tv.h index b37deaf..65742ee 100644 --- a/src/gtk+-2.x/ctkdisplaydevice-tv.h +++ b/src/gtk+-2.x/ctkdisplaydevice-tv.h @@ -56,7 +56,6 @@ struct _CtkDisplayDeviceTv CtkEvent *ctk_event; NvCtrlAttributeHandle *handle; - unsigned int display_device_mask; gboolean display_enabled; char *name; @@ -65,7 +64,7 @@ struct _CtkDisplayDeviceTv GtkWidget *overscan; GtkWidget *flicker_filter; - + GtkWidget *brightness; GtkWidget *hue; GtkWidget *contrast; @@ -74,7 +73,6 @@ struct _CtkDisplayDeviceTv GtkWidget *image_sliders; - GtkWidget *edid_box; GtkWidget *edid; GtkWidget *reset_button; }; @@ -87,7 +85,7 @@ struct _CtkDisplayDeviceTvClass GType ctk_display_device_tv_get_type (void) G_GNUC_CONST; GtkWidget* ctk_display_device_tv_new (NvCtrlAttributeHandle *, CtkConfig *, CtkEvent *, - unsigned int, char *); + char *); GtkTextBuffer *ctk_display_device_tv_create_help(GtkTextTagTable *, CtkDisplayDeviceTv *); diff --git a/src/gtk+-2.x/ctkdisplaydevice.c b/src/gtk+-2.x/ctkdisplaydevice.c new file mode 100644 index 0000000..3421e75 --- a/dev/null +++ b/src/gtk+-2.x/ctkdisplaydevice.c @@ -0,0 +1,708 @@ +/* + * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix + * and Linux systems. + * + * Copyright (C) 2004 NVIDIA Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses>. + */ + +#include <gtk/gtk.h> +#include <NvCtrlAttributes.h> + +#include "ctkbanner.h" + +#include "ctkdisplaydevice.h" + +#include "ctkditheringcontrols.h" +#include "ctkcolorcontrols.h" +#include "ctkimagesliders.h" +#include "ctkedid.h" +#include "ctkconfig.h" +#include "ctkhelp.h" +#include "ctkutils.h" +#include <stdio.h> + +static void ctk_display_device_class_init(CtkDisplayDeviceClass *); +static void ctk_display_device_finalize(GObject *); + +static void reset_button_clicked(GtkButton *button, gpointer user_data); + +static void update_device_info(CtkDisplayDevice *ctk_object); + +static void display_device_setup(CtkDisplayDevice *ctk_object); + +static void enabled_displays_received(GtkObject *object, gpointer arg1, + gpointer user_data); + +static void info_update_received(GtkObject *object, gpointer arg1, + gpointer user_data); + + +#define FRAME_PADDING 5 + +static const char *__info_help = +"This section describes basic information about the connection to the display " +"device."; + +static const char *__info_chip_location_help = +"Report whether the display device is driven by the on-chip controller " +"(internal), or a separate controller chip elsewhere on the graphics " +"board (external)."; + +static const char *__info_link_help = +"For DVI connections, reports whether the specified display device is " +"driven by a single link or dual link connection. For DisplayPort " +"connections, reports the bandwidth of the connection."; + +static const char *__info_signal_help = +"Report whether the flat panel is driven by an LVDS, TMDS, or DisplayPort " +"signal."; + +static const char * __native_res_help = +"The Native Resolution is the width and height in pixels that the display " +"device uses to display the image. All other resolutions must be scaled " +"to this resolution by the GPU and/or the device's built-in scaler."; + +static const char * __refresh_rate_help = +"The refresh rate displays the rate at which the screen is currently " +"refreshing the image."; + +GType ctk_display_device_get_type(void) +{ + static GType ctk_object_type = 0; + + if (!ctk_object_type) { + static const GTypeInfo ctk_object_info = { + sizeof (CtkDisplayDeviceClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc) ctk_display_device_class_init, + NULL, /* class_finalize, */ + NULL, /* class_data */ + sizeof (CtkDisplayDevice), + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL /* value_table */ + }; + + ctk_object_type = g_type_register_static(GTK_TYPE_VBOX, + "CtkDisplayDevice", + &ctk_object_info, 0); + } + + return ctk_object_type; +} + +static void ctk_display_device_class_init( + CtkDisplayDeviceClass *ctk_object_class +) +{ + GObjectClass *gobject_class = (GObjectClass *)ctk_object_class; + gobject_class->finalize = ctk_display_device_finalize; +} + +static void ctk_display_device_finalize( + GObject *object +) +{ + CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(object); + g_free(ctk_object->name); + g_signal_handlers_disconnect_matched(ctk_object->ctk_event, + G_SIGNAL_MATCH_DATA, + 0, + 0, + NULL, + NULL, + (gpointer) ctk_object); +} + + +/* + * ctk_display_device_new() - constructor for the dissplay device page. + */ + +GtkWidget* ctk_display_device_new(NvCtrlAttributeHandle *handle, + CtkConfig *ctk_config, + CtkEvent *ctk_event, + char *name, + char *typeBaseName) +{ + GObject *object; + CtkDisplayDevice *ctk_object; + GtkWidget *banner; + GtkWidget *frame; + GtkWidget *hbox, *tmpbox; + + GtkWidget *alignment; + GtkWidget *notebook; + GtkWidget *nbox; + GtkWidget *align; + + object = g_object_new(CTK_TYPE_DISPLAY_DEVICE, NULL); + if (!object) return NULL; + + ctk_object = CTK_DISPLAY_DEVICE(object); + ctk_object->handle = handle; + ctk_object->ctk_event = ctk_event; + ctk_object->ctk_config = ctk_config; + ctk_object->name = g_strdup(name); + + gtk_box_set_spacing(GTK_BOX(object), 10); + + /* banner */ + + banner = ctk_banner_image_new(BANNER_ARTWORK_DFP); + gtk_box_pack_start(GTK_BOX(object), banner, FALSE, FALSE, 0); + + /* + * create the reset button (which we need while creating the + * controls in this page so that we can set the button's + * sensitivity), though we pack it at the bottom of the page + */ + + ctk_object->reset_button = + gtk_button_new_with_label("Reset Hardware Defaults"); + + alignment = gtk_alignment_new(1, 1, 0, 0); + gtk_container_add(GTK_CONTAINER(alignment), ctk_object->reset_button); + gtk_box_pack_end(GTK_BOX(object), alignment, TRUE, TRUE, 0); + + g_signal_connect(G_OBJECT(ctk_object->reset_button), + "clicked", G_CALLBACK(reset_button_clicked), + (gpointer) ctk_object); + + ctk_config_set_tooltip(ctk_config, ctk_object->reset_button, + ctk_help_create_reset_hardware_defaults_text(typeBaseName, + name)); + + /* Create tabbed notebook for widget */ + + notebook = gtk_notebook_new(); + gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP); + align = gtk_alignment_new(0, 0, 1, 1); + gtk_container_add(GTK_CONTAINER(align), notebook); + gtk_box_pack_start(GTK_BOX(object), align, FALSE, FALSE, 0); + + /* Create first tab for device info */ + + nbox = gtk_vbox_new(FALSE, FRAME_PADDING); + gtk_container_set_border_width(GTK_CONTAINER(nbox), FRAME_PADDING); + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nbox, + gtk_label_new("Information")); + + /* create the hbox to store device info */ + + hbox = gtk_hbox_new(FALSE, FRAME_PADDING); + gtk_box_pack_start(GTK_BOX(nbox), hbox, FALSE, FALSE, FRAME_PADDING); + + /* Device info */ + + frame = gtk_frame_new("Device Information"); + gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); + + /* + * insert a vbox between the frame and the widgets, so that the + * widgets don't expand to fill all of the space within the + * frame + */ + + tmpbox = gtk_vbox_new(FALSE, FRAME_PADDING); + gtk_container_set_border_width(GTK_CONTAINER(tmpbox), FRAME_PADDING); + gtk_container_add(GTK_CONTAINER(frame), tmpbox); + + /* Make the txt widgets that will get updated */ + ctk_object->txt_chip_location = gtk_label_new(""); + ctk_object->txt_link = gtk_label_new(""); + ctk_object->txt_signal = gtk_label_new(""); + ctk_object->txt_native_resolution = gtk_label_new(""); + ctk_object->txt_refresh_rate = gtk_label_new(""); + + /* Add information widget lines */ + { + typedef struct { + GtkWidget *label; + GtkWidget *txt; + const gchar *tooltip; + } TextLineInfo; + + TextLineInfo lines[] = { + { + gtk_label_new("Chip location:"), + ctk_object->txt_chip_location, + __info_chip_location_help + }, + { + gtk_label_new("Connection link:"), + ctk_object->txt_link, + __info_link_help + }, + { + gtk_label_new("Signal:"), + ctk_object->txt_signal, + __info_signal_help + }, + { + gtk_label_new("Native Resolution:"), + ctk_object->txt_native_resolution, + __native_res_help, + }, + { + gtk_label_new("Refresh Rate:"), + ctk_object->txt_refresh_rate, + __refresh_rate_help, + }, + { NULL, NULL, NULL } + }; + int i; + + GtkRequisition req; + int max_width; + + /* Compute max width of lables and setup text alignments */ + max_width = 0; + for (i = 0; lines[i].label; i++) { + gtk_misc_set_alignment(GTK_MISC(lines[i].label), 0.0f, 0.5f); + gtk_misc_set_alignment(GTK_MISC(lines[i].txt), 0.0f, 0.5f); + + gtk_widget_size_request(lines[i].label, &req); + if (max_width < req.width) { + max_width = req.width; + } + } + + /* Pack labels */ + for (i = 0; lines[i].label; i++) { + GtkWidget *tmphbox; + + /* Add separators */ + if (i == 3 || i == 5 || i == 7) { + GtkWidget *separator = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(tmpbox), separator, + FALSE, FALSE, 0); + } + + /* Set the label's width */ + gtk_widget_set_size_request(lines[i].label, max_width, -1); + + /* add the widgets for this line */ + tmphbox = gtk_hbox_new(FALSE, FRAME_PADDING); + gtk_box_pack_start(GTK_BOX(tmphbox), lines[i].label, + FALSE, TRUE, FRAME_PADDING); + gtk_box_pack_start(GTK_BOX(tmphbox), lines[i].txt, + FALSE, TRUE, FRAME_PADDING); + + /* Include tooltips */ + if (lines[i].tooltip) { + ctk_config_set_tooltip(ctk_config, + lines[i].label, + lines[i].tooltip); + ctk_config_set_tooltip(ctk_config, + lines[i].txt, + lines[i].tooltip); + } + gtk_box_pack_start(GTK_BOX(tmpbox), tmphbox, FALSE, FALSE, 0); + } + } + + /* pack the EDID button */ + + ctk_object->edid = ctk_edid_new(ctk_object->handle, + ctk_object->ctk_config, + ctk_object->ctk_event, + ctk_object->name); + + hbox = gtk_hbox_new(FALSE, 0); + align = gtk_alignment_new(0, 1, 1, 1); + gtk_container_add(GTK_CONTAINER(align), hbox); + gtk_box_pack_end(GTK_BOX(nbox), align, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), ctk_object->edid, TRUE, TRUE, 0); + + /* + * Create layout for second tab for controls but don't add the tab until we + * make sure its required + */ + + nbox = gtk_vbox_new(FALSE, FRAME_PADDING); + gtk_container_set_border_width(GTK_CONTAINER(nbox), FRAME_PADDING); + + /* pack the color controls */ + + ctk_object->color_controls = + ctk_color_controls_new(handle, ctk_config, ctk_event, + ctk_object->reset_button, name); + + if (ctk_object->color_controls) { + gtk_box_pack_start(GTK_BOX(nbox), ctk_object->color_controls, + FALSE, FALSE, 0); + } + + /* pack the dithering controls */ + + ctk_object->dithering_controls = + ctk_dithering_controls_new(handle, ctk_config, ctk_event, + ctk_object->reset_button, name); + + if (ctk_object->dithering_controls) { + gtk_box_pack_start(GTK_BOX(nbox), ctk_object->dithering_controls, + FALSE, FALSE, 0); + } + + /* pack the image sliders */ + + ctk_object->image_sliders = + ctk_image_sliders_new(handle, ctk_config, ctk_event, + ctk_object->reset_button, name); + if (ctk_object->image_sliders) { + gtk_box_pack_start(GTK_BOX(nbox), ctk_object->image_sliders, + FALSE, FALSE, 0); + } + + /* If no controls are created, don't add a controls tab */ + + if (ctk_object->color_controls || + ctk_object->dithering_controls || + ctk_object->image_sliders) { + gtk_notebook_append_page(GTK_NOTEBOOK(notebook), nbox, + gtk_label_new("Controls")); + } + + /* show the page */ + + gtk_widget_show_all(GTK_WIDGET(object)); + + /* Update the GUI */ + + update_display_enabled_flag(ctk_object->handle, + &ctk_object->display_enabled); + + display_device_setup(ctk_object); + + /* handle enable/disable events on the display device */ + + g_signal_connect(G_OBJECT(ctk_event), + CTK_EVENT_NAME(NV_CTRL_ENABLED_DISPLAYS), + G_CALLBACK(enabled_displays_received), + (gpointer) ctk_object); + + g_signal_connect(G_OBJECT(ctk_event), + CTK_EVENT_NAME(NV_CTRL_REFRESH_RATE), + G_CALLBACK(info_update_received), + (gpointer) ctk_object); + + return GTK_WIDGET(object); + +} /* ctk_display_device_new() */ + + + +/* + * reset_button_clicked() - callback when the reset button is clicked + */ + +static void reset_button_clicked(GtkButton *button, gpointer user_data) +{ + CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(user_data); + + /* Disable the reset button here and allow the controls below to (re)enable + * it if need be,. + */ + gtk_widget_set_sensitive(ctk_object->reset_button, FALSE); + + ctk_color_controls_reset(CTK_COLOR_CONTROLS(ctk_object->color_controls)); + + ctk_dithering_controls_reset + (CTK_DITHERING_CONTROLS(ctk_object->dithering_controls)); + + ctk_image_sliders_reset(CTK_IMAGE_SLIDERS(ctk_object->image_sliders)); + + ctk_config_statusbar_message(ctk_object->ctk_config, + "Reset hardware defaults for %s.", + ctk_object->name); + +} /* reset_button_clicked() */ + + + +/* + * ctk_display_device_create_help() - construct the display device help page + */ + +GtkTextBuffer *ctk_display_device_create_help(GtkTextTagTable *table, + CtkDisplayDevice *ctk_object) +{ + GtkTextIter i; + GtkTextBuffer *b; + GtkTooltipsData *td; + + b = gtk_text_buffer_new(table); + + gtk_text_buffer_get_iter_at_offset(b, &i, 0); + + ctk_help_title(b, &i, "%s Help", ctk_object->name); + + ctk_help_heading(b, &i, "Device Information"); + ctk_help_para(b, &i, __info_help); + + ctk_help_term(b, &i, "Chip Location"); + ctk_help_para(b, &i, __info_chip_location_help); + + ctk_help_term(b, &i, "Link"); + ctk_help_para(b, &i, __info_link_help); + + ctk_help_term(b, &i, "Signal"); + ctk_help_para(b, &i, __info_signal_help); + + ctk_help_term(b, &i, "Native Resolution"); + ctk_help_para(b, &i, __native_res_help); + + ctk_help_term(b, &i, "Refresh Rate"); + ctk_help_para(b, &i, __refresh_rate_help); + + add_acquire_edid_help(b, &i); + + add_color_controls_help + (CTK_COLOR_CONTROLS(ctk_object->color_controls), b, &i); + + add_dithering_controls_help + (CTK_DITHERING_CONTROLS(ctk_object->dithering_controls), b, &i); + + add_image_sliders_help + (CTK_IMAGE_SLIDERS(ctk_object->image_sliders), b, &i); + + td = gtk_tooltips_data_get(GTK_WIDGET(ctk_object->reset_button)); + ctk_help_reset_hardware_defaults(b, &i, td->tip_text); + + ctk_help_finish(b); + + return b; + +} /* ctk_display_device_create_help() */ + + +static void update_link(CtkDisplayDevice *ctk_object) +{ + ReturnStatus ret; + gint val, signal_type = ctk_object->signal_type; + const char *link = "Unknown"; + char tmp[32]; + + ret = NvCtrlGetAttribute(ctk_object->handle, NV_CTRL_FLATPANEL_LINK, &val); + if (ret == NvCtrlSuccess) { + if (signal_type == NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT) { + int lanes; + + lanes = val + 1; + + ret = NvCtrlGetAttribute(ctk_object->handle, + NV_CTRL_DISPLAYPORT_LINK_RATE, &val); + if ((ret == NvCtrlSuccess) && + (val == NV_CTRL_DISPLAYPORT_LINK_RATE_DISABLED)) { + link = "Disabled"; + } else { + const char *bw = "unknown bandwidth"; + + if (ret == NvCtrlSuccess) { + switch (val) { + case NV_CTRL_DISPLAYPORT_LINK_RATE_1_62GBPS: + bw = "1.62 Gbps"; + break; + case NV_CTRL_DISPLAYPORT_LINK_RATE_2_70GBPS: + bw = "2.70 Gbps"; + break; + } + } + + snprintf(tmp, 32, "%d lane%s @ %s", lanes, lanes == 1 ? "" : "s", + bw); + link = tmp; + } + } else { + // LVDS or TMDS + switch(val) { + case NV_CTRL_FLATPANEL_LINK_SINGLE: + link = "Single"; + break; + case NV_CTRL_FLATPANEL_LINK_DUAL: + link = "Dual"; + break; + } + } + } + + gtk_label_set_text(GTK_LABEL(ctk_object->txt_link), link); +} + + +static void callback_link_changed(GtkObject *object, gpointer arg1, + gpointer user_data) +{ + CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(user_data); + + update_link(ctk_object); +} + +/* + * update_device_info() - (Re)Queries the static display device information. + */ +static void update_device_info(CtkDisplayDevice *ctk_object) +{ + ReturnStatus ret; + gint val; + char *chip_location, *link, *signal; + CtkEvent *ctk_event = ctk_object->ctk_event; + + chip_location = link = signal = "Unknown"; + + /* Chip location */ + + ret = NvCtrlGetAttribute(ctk_object->handle, + NV_CTRL_FLATPANEL_CHIP_LOCATION, &val); + if (ret == NvCtrlSuccess) { + switch (val) { + case NV_CTRL_FLATPANEL_CHIP_LOCATION_INTERNAL: + chip_location = "Internal"; + break; + case NV_CTRL_FLATPANEL_CHIP_LOCATION_EXTERNAL: + chip_location = "External"; + break; + } + } + gtk_label_set_text(GTK_LABEL(ctk_object->txt_chip_location), chip_location); + + /* Signal */ + + ret = NvCtrlGetAttribute(ctk_object->handle, NV_CTRL_FLATPANEL_SIGNAL, + &val); + if (ret == NvCtrlSuccess) { + switch (val) { + case NV_CTRL_FLATPANEL_SIGNAL_LVDS: + signal = "LVDS"; + break; + case NV_CTRL_FLATPANEL_SIGNAL_TMDS: + signal = "TMDS"; + break; + case NV_CTRL_FLATPANEL_SIGNAL_DISPLAYPORT: + signal = "DisplayPort"; + break; + } + } + gtk_label_set_text(GTK_LABEL(ctk_object->txt_signal), signal); + ctk_object->signal_type = val; + + /* Link */ + + g_signal_connect(G_OBJECT(ctk_event), + CTK_EVENT_NAME(NV_CTRL_FLATPANEL_LINK), + G_CALLBACK(callback_link_changed), + (gpointer) ctk_object); + + g_signal_connect(G_OBJECT(ctk_event), + CTK_EVENT_NAME(NV_CTRL_DISPLAYPORT_LINK_RATE), + G_CALLBACK(callback_link_changed), + (gpointer) ctk_object); + + update_link(ctk_object); + + /* Native Resolution */ + + ret = NvCtrlGetAttribute(ctk_object->handle, + NV_CTRL_FLATPANEL_NATIVE_RESOLUTION, &val); + if (ret == NvCtrlSuccess) { + gchar *resolution = + g_strdup_printf("%dx%d", (val >> 16), (val & 0xFFFF)); + gtk_label_set_text(GTK_LABEL(ctk_object->txt_native_resolution), + resolution); + g_free(resolution); + } else { + gtk_label_set_text(GTK_LABEL(ctk_object->txt_native_resolution), + "Unknown"); + } + + /* Refresh Rate */ + + ret = NvCtrlGetAttribute(ctk_object->handle, NV_CTRL_REFRESH_RATE, &val); + if (ret == NvCtrlSuccess) { + char str[32]; + float fvalue = ((float)(val)) / 100.0f; + snprintf(str, 32, "%.2f Hz", fvalue); + gtk_label_set_text(GTK_LABEL(ctk_object->txt_refresh_rate), str); + } else { + gtk_label_set_text(GTK_LABEL(ctk_object->txt_refresh_rate), "Unknown"); + } + +} /* update_device_info() */ + + + +/* + * Updates the display device page to reflect the current + * configuration of the display device. + */ +static void display_device_setup(CtkDisplayDevice *ctk_object) +{ + /* Disable the reset button here and allow the controls below to (re)enable + * it if need be,. + */ + gtk_widget_set_sensitive(ctk_object->reset_button, FALSE); + + + /* Update info */ + + update_device_info(ctk_object); + + ctk_edid_setup(CTK_EDID(ctk_object->edid)); + + /* Update controls */ + + ctk_color_controls_setup(CTK_COLOR_CONTROLS(ctk_object->color_controls)); + + ctk_dithering_controls_setup + (CTK_DITHERING_CONTROLS(ctk_object->dithering_controls)); + + ctk_image_sliders_setup(CTK_IMAGE_SLIDERS(ctk_object->image_sliders)); + +} /* display_device_setup() */ + + + +/* + * When the list of enabled displays on the GPU changes, + * this page should disable/enable access based on whether + * or not the display device is enabled. + */ +static void enabled_displays_received(GtkObject *object, gpointer arg1, + gpointer user_data) +{ + CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(user_data); + + /* Requery display information only if display disabled */ + + update_display_enabled_flag(ctk_object->handle, + &ctk_object->display_enabled); + + display_device_setup(ctk_object); + +} /* enabled_displays_received() */ + + +/* + * Update UI when display information changed. + */ +static void info_update_received(GtkObject *object, gpointer arg1, + gpointer user_data) +{ + CtkDisplayDevice *ctk_object = CTK_DISPLAY_DEVICE(user_data); + + update_device_info(ctk_object); +} diff --git a/src/gtk+-2.x/ctkdisplaydevice.h b/src/gtk+-2.x/ctkdisplaydevice.h new file mode 100644 index 0000000..ed69aa0 --- a/dev/null +++ b/src/gtk+-2.x/ctkdisplaydevice.h @@ -0,0 +1,93 @@ +/* + * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix + * and Linux systems. + * + * Copyright (C) 2004 NVIDIA Corporation. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses>. + */ + +#ifndef __CTK_DISPLAYDEVICE_H__ +#define __CTK_DISPLAYDEVICE_H__ + +#include "ctkevent.h" +#include "ctkconfig.h" + +G_BEGIN_DECLS + +#define CTK_TYPE_DISPLAY_DEVICE (ctk_display_device_get_type()) + +#define CTK_DISPLAY_DEVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_DISPLAY_DEVICE, \ + CtkDisplayDevice)) + +#define CTK_DISPLAY_DEVICE_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_DISPLAY_DEVICE, \ + CtkDisplayDeviceClass)) + +#define CTK_IS_DISPLAY_DEVICE(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_DISPLAY_DEVICE)) + +#define CTK_IS_DISPLAY_DEVICE_CLASS(class) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_DISPLAY_DEVICE)) + +#define CTK_DISPLAY_DEVICE_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_DISPLAY_DEVICE, \ + CtkDisplayDeviceClass)) + + +typedef struct _CtkDisplayDevice CtkDisplayDevice; +typedef struct _CtkDisplayDeviceClass CtkDisplayDeviceClass; + +struct _CtkDisplayDevice +{ + GtkVBox parent; + + NvCtrlAttributeHandle *handle; + CtkConfig *ctk_config; + CtkEvent *ctk_event; + GtkWidget *image_sliders; + GtkWidget *reset_button; + GtkWidget *edid; + GtkWidget *dithering_controls; + GtkWidget *color_controls; + + GtkWidget *txt_chip_location; + GtkWidget *txt_link; + GtkWidget *txt_signal; + GtkWidget *txt_native_resolution; + GtkWidget *txt_refresh_rate; + + gboolean display_enabled; + unsigned int active_attributes; + + char *name; + gint signal_type; +}; + +struct _CtkDisplayDeviceClass +{ + GtkVBoxClass parent_class; +}; + +GType ctk_display_device_get_type (void) G_GNUC_CONST; +GtkWidget* ctk_display_device_new (NvCtrlAttributeHandle *, + CtkConfig *, CtkEvent *, + char *, char *); + +GtkTextBuffer *ctk_display_device_create_help(GtkTextTagTable *, + CtkDisplayDevice *); + +G_END_DECLS + +#endif /* __CTK_DISPLAYDEVICE_H__ */ diff --git a/src/gtk+-2.x/ctkdisplaylayout.c b/src/gtk+-2.x/ctkdisplaylayout.c index f5318ec..83f0579 100644 --- a/src/gtk+-2.x/ctkdisplaylayout.c +++ b/src/gtk+-2.x/ctkdisplaylayout.c @@ -265,30 +265,6 @@ static void zorder_layout(CtkDisplayLayout *ctk_object) -/** get_selected() *************************************************** - * - * Returns the currently selected display and/or screen. This - * function is only useful for keeping track of when something new - * has been selected. - * - **/ - -static void * get_selected(CtkDisplayLayout *ctk_object) -{ - if (ctk_object->selected_display) { - return ctk_object->selected_display; - } - - if (ctk_object->selected_screen) { - return ctk_object->selected_screen; - } - - return NULL; - -} /* get_selected() */ - - - /** get_metamode() *************************************************** * * Returns a screen's metamode_idx'th metamode, clamping to the last @@ -2225,10 +2201,10 @@ static int pan_selected(CtkDisplayLayout *ctk_object, int x, int y, int snap) * **/ -ZNode *get_screen_zorder_move_data(CtkDisplayLayout *ctk_object, - nvScreenPtr screen, - int move_to, - int *screen_at) +static ZNode *get_screen_zorder_move_data(CtkDisplayLayout *ctk_object, + nvScreenPtr screen, + int move_to, + int *screen_at) { ZNode *tmpzo; int i; @@ -2411,119 +2387,6 @@ static void select_default_item(CtkDisplayLayout *ctk_object) -/** pushback_display() *********************************************** - * - * Moves the specified display to the end of the Z-order. - * - **/ - -static void pushback_display(CtkDisplayLayout *ctk_object, - nvDisplayPtr display) -{ - int i; - int move_to; - - for (i = 0; i < ctk_object->Zcount; i++) { - - /* Find the display */ - if (ctk_object->Zorder[i].type == ZNODE_TYPE_DISPLAY && - ctk_object->Zorder[i].u.display == display) { - - if (!display->screen) { - /* Move display to the end of the list. */ - move_to = ctk_object->Zcount - 1; - } else { - /* Move display prior to its X screen */ - for (move_to = i+1; - move_to < ctk_object->Zcount; - move_to++) { - if (ctk_object->Zorder[move_to].type == - ZNODE_TYPE_SCREEN && - ctk_object->Zorder[move_to].u.screen == - display->screen) { - break; - } - } - move_to--; - } - - // Now move dispay from i to move_to - if (i != move_to) { - memmove(ctk_object->Zorder + i, - ctk_object->Zorder + i + 1, - (move_to - i)*sizeof(ZNode)); - - /* Place the display at the top */ - ctk_object->Zorder[move_to].type = ZNODE_TYPE_DISPLAY; - ctk_object->Zorder[move_to].u.display = display; - } - - break; - } - } - -} /* pushback_display() */ - - - -/** pushback_screen() ************************************************ - * - * Moves the specified screen to the end of the Z-order. - * - **/ - -static void pushback_screen(CtkDisplayLayout *ctk_object, - nvScreenPtr screen) -{ - int move_to = ctk_object->Zcount -1; - int screen_at; - ZNode *tmpzo; - - /* Get a copy of the zorder buffer for the screen */ - tmpzo = get_screen_zorder_move_data(ctk_object, screen, move_to, - &screen_at); - if (!tmpzo) return; - - /* Move other nodes up to make room at the bottom */ - memmove(ctk_object->Zorder + screen_at - screen->num_displays, - ctk_object->Zorder + screen_at + 1, - (move_to - screen_at)*sizeof(ZNode)); - - /* Copy the screen and its displays to the bottom */ - memcpy(ctk_object->Zorder + move_to - screen->num_displays, - tmpzo, - (1 + screen->num_displays)*sizeof(ZNode)); - - free(tmpzo); - -} /* pushback_screen() */ - - - -/** pushback_selected() ********************************************** - * - * Moves the specified display or screen to the end of the Z-order. - * - **/ - -static void pushback_selected(CtkDisplayLayout *ctk_object) -{ - /* Pushback the selected display if it has no screen or - * is part of twinview to avoid selecting the screen of - * single-display screens. - */ - if (ctk_object->selected_display && - (!ctk_object->selected_screen || - ctk_object->selected_screen->num_displays > 1)) { - pushback_display(ctk_object, ctk_object->selected_display); - } else if (ctk_object->selected_screen) { - pushback_screen(ctk_object, ctk_object->selected_screen); - } - -} /* pushback_selected() */ - - - /** get_display_tooltip() ******************************************** * * Returns the text to use for displaying a tooltip from the given @@ -2549,7 +2412,7 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display does not have a screen (not configured) */ if (!(display->screen)) { tip = g_strdup_printf("%s : Disabled (GPU: %s)", - display->name, display->gpu->name); + display->logName, display->gpu->name); /* Basic view */ @@ -2557,19 +2420,19 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display has no mode */ if (!display->cur_mode) { - tip = g_strdup_printf("%s", display->name); + tip = g_strdup_printf("%s", display->logName); /* Display does not have a current modeline (Off) */ } else if (!(display->cur_mode->modeline)) { tip = g_strdup_printf("%s : Off", - display->name); + display->logName); /* Display has mode/modeline */ } else { float ref = display->cur_mode->modeline->refresh_rate; tip = g_strdup_printf("%s : %dx%d @ %.*f Hz", - display->name, + display->logName, display->cur_mode->modeline->data.hdisplay, display->cur_mode->modeline->data.vdisplay, (display->is_sdi ? 3 : 0), @@ -2584,14 +2447,14 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) /* Display has no mode */ if (!display->cur_mode) { tip = g_strdup_printf("%s\n(X Screen %d)\n(GPU: %s)", - display->name, + display->logName, display->screen->scrnum, display->gpu->name); /* Display does not have a current modeline (Off) */ } else if (!(display->cur_mode->modeline)) { tip = g_strdup_printf("%s : Off\n(X Screen %d)\n(GPU: %s)", - display->name, + display->logName, display->screen->scrnum, display->gpu->name); @@ -2600,7 +2463,7 @@ static char *get_display_tooltip(nvDisplayPtr display, Bool advanced) float ref = display->cur_mode->modeline->refresh_rate; tip = g_strdup_printf("%s : %dx%d @ %.*f Hz\n(X Screen %d)\n" "(GPU: %s)", - display->name, + display->logName, display->cur_mode->modeline->data.hdisplay, display->cur_mode->modeline->data.vdisplay, (display->is_sdi ? 3 : 0), @@ -2739,8 +2602,7 @@ static char *get_tooltip_under_mouse(CtkDisplayLayout *ctk_object, * **/ -static int click_layout(CtkDisplayLayout *ctk_object, int x, int y, - nvScreenPtr reselect_screen) +static int click_layout(CtkDisplayLayout *ctk_object, int x, int y) { int i; nvDisplayPtr cur_selected_display = ctk_object->selected_display; @@ -2754,7 +2616,7 @@ static int click_layout(CtkDisplayLayout *ctk_object, int x, int y, ctk_object->clicked_outside = 1; ctk_object->selected_display = NULL; ctk_object->selected_screen = NULL; - + /* Look through the Z-order for the next element */ for (i = 0; i < ctk_object->Zcount; i++) { @@ -2763,19 +2625,10 @@ static int click_layout(CtkDisplayLayout *ctk_object, int x, int y, if (display->cur_mode && point_in_dim(display->cur_mode->pan, x, y)) { - /* Re-select the screen instead of the display - * (after a move) - */ - if (display->screen && - (reselect_screen == display->screen)) { - select_screen(ctk_object, display->screen); - } else { - select_display(ctk_object, display); - } + select_display(ctk_object, display); ctk_object->clicked_outside = 0; break; } - } else if (ctk_object->Zorder[i].type == ZNODE_TYPE_SCREEN) { screen = ctk_object->Zorder[i].u.screen; sdim = get_screen_dim(screen, 1); @@ -2826,6 +2679,7 @@ GType ctk_display_layout_get_type(void) sizeof(CtkDisplayLayout), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_display_layout_type = g_type_register_static @@ -3188,7 +3042,7 @@ static void draw_display(CtkDisplayLayout *ctk_object, draw_rect_strs(ctk_object, mode->dim, &(ctk_object->fg_color), - display->name, + display->logName, tmp_str); g_free(tmp_str); @@ -4042,6 +3896,25 @@ void ctk_display_layout_select_display(CtkDisplayLayout *ctk_object, +/** ctk_display_layout_select_screen() ************************ + * + * Makes the given screen the thing that is selected. + * + **/ + +void ctk_display_layout_select_screen(CtkDisplayLayout *ctk_object, + nvScreenPtr screen) +{ + /* Select the new display */ + ctk_object->selected_display = NULL; + select_screen(ctk_object, screen); + + queue_layout_redraw(ctk_object); + +} /* ctk_display_layout_select_screen() */ + + + /** ctk_display_layout_update_display_count() ************************ * * Updates the number of displays shown in the layout by re-building @@ -4477,15 +4350,12 @@ button_press_event_callback(GtkWidget *widget, GdkEventButton *event, gpointer data) { CtkDisplayLayout *ctk_object = CTK_DISPLAY_LAYOUT(data); - void *last_selected; /* Last thing selected */ - void *new_selected; /* Scale and offset x & y so they reside in the clickable area */ int x = (event->x -ctk_object->img_dim[X]) / ctk_object->scale; int y = (event->y -ctk_object->img_dim[Y]) / ctk_object->scale; GdkEvent *next_event; - nvScreenPtr reselect_screen = NULL; ctk_object->last_mouse_x = event->x; @@ -4516,74 +4386,10 @@ button_press_event_callback(GtkWidget *widget, GdkEventButton *event, switch (event->button) { - /* Select a display device */ + /* Handle selection of displays/X screens */ case Button1: ctk_object->button1 = 1; - last_selected = get_selected(ctk_object); - - /* If the user had a screen selected - * and is not cycling through overlapping - * elements (screens/displays), try to - * re-select the screen instead of the display. - */ - if (!ctk_object->first_selected_display && - !ctk_object->first_selected_screen && - !ctk_object->selected_display && - ctk_object->selected_screen - ) { - reselect_screen = ctk_object->selected_screen; - } - - /* If user clicked on the same spot twice, push last - * selection back in the Z-order. - */ - if (ctk_object->first_selected_display || - ctk_object->first_selected_screen) { - pushback_selected(ctk_object); - } - - /* Do the click */ - click_layout(ctk_object, x, y, reselect_screen); - - /* Keep track of what is first selected to properly handle - * cycling through displays and screens when user keeps - * clicks on same spot. - */ - new_selected = get_selected(ctk_object); - - /* If the user clicks a second time on a display that has a - * screen (or has cycled/clicked through all the displays - * on that screen), select the screen instead of the first - * display that was originally clicked. - */ - if (ctk_object->first_selected_display && - ctk_object->first_selected_screen && - (ctk_object->first_selected_display == - ctk_object->selected_display) - ) { - ctk_object->first_selected_display = NULL; - ctk_object->selected_display = NULL; - new_selected = ctk_object->first_selected_screen; - } else { - /* Keep track of the first display the user - * clicked on wrt the screen the display - * belongs to. (ie, if the user clicked - * and we cycled to the next display in a - * TwinView screen, don't reset the first - * selected display. - */ - if (!ctk_object->first_selected_display || - (ctk_object->first_selected_screen!= - ctk_object->selected_screen)) { - ctk_object->first_selected_display = - ctk_object->selected_display; - } - } - - /* Keep track of the selected screen */ - ctk_object->first_selected_screen = - ctk_object->selected_screen; - + click_layout(ctk_object, x, y); /* Report back selection event */ if (ctk_object->selected_callback) { diff --git a/src/gtk+-2.x/ctkdisplaylayout.h b/src/gtk+-2.x/ctkdisplaylayout.h index dfc6dab..bf74a58 100644 --- a/src/gtk+-2.x/ctkdisplaylayout.h +++ b/src/gtk+-2.x/ctkdisplaylayout.h @@ -128,6 +128,12 @@ G_BEGIN_DECLS /*** T Y P E D E F I N I T I O N S *****************************************/ +typedef enum { + PASSIVE_STEREO_EYE_NONE = 0, + PASSIVE_STEREO_EYE_LEFT, + PASSIVE_STEREO_EYE_RIGHT, +} PassiveStereoEye; + typedef struct nvModeLineRec { struct nvModeLineRec *next; @@ -167,6 +173,8 @@ typedef struct nvModeRec { int position_type; /* Relative, Absolute, etc. */ struct nvDisplayRec *relative_to; /* Display Relative/RightOf etc */ + PassiveStereoEye passive_stereo_eye; /* Stereo mode 4 per-dpy setting */ + } nvMode, *nvModePtr; @@ -177,11 +185,19 @@ typedef struct nvDisplayRec { struct nvDisplayRec *next_in_screen; XConfigMonitorPtr conf_monitor; + NvCtrlAttributeHandle *handle; /* NV-CONTROL handle to device */ + struct nvGpuRec *gpu; /* GPU the display belongs to */ struct nvScreenRec *screen; /* X screen the display is tied to */ - unsigned int device_mask; /* Bit mask to identify the display */ - char *name; /* Display name (from NV-CONTROL) */ + char *logName; /* Display name (from NV-CONTROL) */ + char *typeBaseName; /* e.g. "CRT", "DFP", "TV" */ + char *typeIdName; /* e.g. "DFP-1", "TV-0" */ + char *dpGuidName; /* e.g. "DP-GUID-11111111-1111-1111-1111-111111111111" */ + char *edidHashName; /* e.g. "DPY-EDID-11111111-1111-1111-1111-111111111111" */ + char *targetIdName; /* e.g. "DPY-3" */ + char *randrName; /* e.g. "VGA-1", "DVI-I-2" */ + Bool is_sdi; /* Is an SDI display */ nvModeLinePtr modelines; /* Modelines validated by X */ @@ -238,8 +254,8 @@ typedef struct nvScreenRec { struct nvGpuRec *gpu; /* GPU driving this X screen */ int depth; /* Depth of the screen */ + int stereo; /* Stereo mode enabled on this screen */ - unsigned int displays_mask; /* Display devices on this X screen */ nvDisplayPtr displays; /* List of displays using this screen */ int num_displays; /* # of displays using this screen */ @@ -259,6 +275,7 @@ typedef struct nvScreenRec { Bool sli; Bool dynamic_twinview; /* This screen supports dynamic twinview */ Bool no_scanout; /* This screen has no display devices */ + Bool stereo_supported; /* Can stereo be configured on this screen */ } nvScreen, *nvScreenPtr; @@ -289,8 +306,6 @@ typedef struct nvGpuRec { char *name; /* Name of the GPU */ - unsigned int connected_displays; /* Bitmask of connected displays */ - gchar *pci_bus_id; GvoModeData *gvo_mode_data; /* Information about GVO modes available */ @@ -487,6 +502,8 @@ void ctk_display_layout_set_display_panning (CtkDisplayLayout *ctk_object, int width, int height); void ctk_display_layout_select_display (CtkDisplayLayout *ctk_object, nvDisplayPtr display); +void ctk_display_layout_select_screen (CtkDisplayLayout *ctk_object, + nvScreenPtr screen); void ctk_display_layout_update_display_count (CtkDisplayLayout *, nvDisplayPtr); diff --git a/src/gtk+-2.x/ctkditheringcontrols.c b/src/gtk+-2.x/ctkditheringcontrols.c index 1e98233..6898489 100644 --- a/src/gtk+-2.x/ctkditheringcontrols.c +++ b/src/gtk+-2.x/ctkditheringcontrols.c @@ -41,6 +41,8 @@ static gint map_nvctrl_value_to_table(CtkDitheringControls *ctk_dithering_contro static Bool update_dithering_info(gpointer user_data); +static void setup_reset_button(CtkDitheringControls *ctk_dithering_controls); + static void dithering_depth_menu_changed(GtkOptionMenu *dithering_depth_menu, gpointer user_data); static void dithering_mode_menu_changed(GtkOptionMenu *dithering_mode_menu, @@ -63,6 +65,10 @@ static void post_dithering_depth_update(CtkDitheringControls *ctk_dithering_controls, gint dithering_depth); +static gint map_dithering_config_menu_idx_to_nvctrl(gint idx); + +static gint map_dithering_depth_menu_idx_to_nvctrl(gint idx); + /* macros */ #define FRAME_PADDING 5 @@ -98,6 +104,7 @@ GType ctk_dithering_controls_get_type(void) sizeof (CtkDitheringControls), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_dithering_controls_type = @@ -113,7 +120,6 @@ GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle, CtkConfig *ctk_config, CtkEvent *ctk_event, GtkWidget *reset_button, - unsigned int display_device_mask, char *name) { GObject *object; @@ -131,14 +137,13 @@ GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle, ctk_dithering_controls->handle = handle; ctk_dithering_controls->ctk_config = ctk_config; ctk_dithering_controls->reset_button = reset_button; - ctk_dithering_controls->display_device_mask = display_device_mask; ctk_dithering_controls->name = strdup(name); /* create main dithering box & frame */ hbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(object), hbox, FALSE, FALSE, FRAME_PADDING); - ctk_dithering_controls->dithering_controls_main = hbox; + ctk_dithering_controls->dithering_controls_box = hbox; frame = gtk_frame_new("Dithering Controls"); gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, FALSE, 0); @@ -205,7 +210,7 @@ GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle, gtk_table_attach(GTK_TABLE(table), hbox, 3, 4, 0, 1, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); label = gtk_label_new(NULL); - ctk_dithering_controls->dithering_current_config = label; + ctk_dithering_controls->dithering_config_txt = label; gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -255,7 +260,7 @@ GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle, gtk_table_attach(GTK_TABLE(table), hbox, 3, 4, 2, 3, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); label = gtk_label_new(NULL); - ctk_dithering_controls->dithering_current_mode = label; + ctk_dithering_controls->dithering_mode_txt = label; gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -322,7 +327,7 @@ GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle, gtk_table_attach(GTK_TABLE(table), hbox, 3, 4, 4, 5, GTK_FILL, GTK_FILL | GTK_EXPAND, 5, 0); label = gtk_label_new(NULL); - ctk_dithering_controls->dithering_current_depth = label; + ctk_dithering_controls->dithering_depth_txt = label; gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); @@ -361,6 +366,58 @@ GtkWidget* ctk_dithering_controls_new(NvCtrlAttributeHandle *handle, } /* ctk_dithering_controls_new() */ + +/* + * setup_reset_button() - enables the reset button if any of the current + * settings are not the default. + */ +static void setup_reset_button(CtkDitheringControls *ctk_dithering_controls) +{ + gint history; + gint val; + + if (!GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_controls_box)) { + /* Nothing is available, don't bother enabling the reset button yet. */ + return; + } + + /* The config menu is always available */ + history = gtk_option_menu_get_history + (GTK_OPTION_MENU(ctk_dithering_controls->dithering_config_menu)); + val = map_dithering_config_menu_idx_to_nvctrl(history); + if (val != NV_CTRL_DITHERING_AUTO) { + goto enable; + } + + if (GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_mode_box)) { + history = gtk_option_menu_get_history + (GTK_OPTION_MENU(ctk_dithering_controls->dithering_mode_menu)); + val = ctk_dithering_controls->dithering_mode_table[history]; + if (val != NV_CTRL_DITHERING_MODE_AUTO) { + goto enable; + } + } + + if (GTK_WIDGET_SENSITIVE(ctk_dithering_controls->dithering_depth_box)) { + history = gtk_option_menu_get_history + (GTK_OPTION_MENU(ctk_dithering_controls->dithering_depth_menu)); + val = map_dithering_depth_menu_idx_to_nvctrl(history); + if (val != NV_CTRL_DITHERING_DEPTH_AUTO) { + goto enable; + } + } + + /* Don't disable reset button here, since other settings that are not + * managed by the ctk_image_slider here may need it enabled + */ + return; + + enable: + gtk_widget_set_sensitive(ctk_dithering_controls->reset_button, TRUE); +} + + + /* * ctk_dithering_controls_setup() - Setup routine for dithering attributes. Used * in DFP setup stage as well as for updating the GUI when there is change in @@ -377,9 +434,8 @@ void ctk_dithering_controls_setup(CtkDitheringControls *ctk_dithering_controls) /* dithering */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING, &val)) { + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING, &val)) { val = NV_CTRL_DITHERING_AUTO; } @@ -438,10 +494,12 @@ void ctk_dithering_controls_setup(CtkDitheringControls *ctk_dithering_controls) if (!update_dithering_info((gpointer)ctk_dithering_controls)) { - gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_main, + gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_box, FALSE); } + setup_reset_button(ctk_dithering_controls); + } /* ctk_dithering_controls_setup() */ @@ -453,21 +511,20 @@ static Bool update_dithering_info(gpointer user_data) /* requested dithering */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING, &val)) { - gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_main, + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING, &val)) { + gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_box, FALSE); } else if (val == NV_CTRL_DITHERING_ENABLED || val == NV_CTRL_DITHERING_AUTO) { - gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_main, + gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_box, TRUE); gtk_widget_set_sensitive(ctk_dithering_controls->dithering_mode_box, TRUE); gtk_widget_set_sensitive(ctk_dithering_controls->dithering_depth_box, TRUE); gtk_widget_show(ctk_dithering_controls->dithering_mode_box); gtk_widget_show(ctk_dithering_controls->dithering_depth_box); } else if (val == NV_CTRL_DITHERING_DISABLED) { - gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_main, + gtk_widget_set_sensitive(ctk_dithering_controls->dithering_controls_box, TRUE); gtk_widget_set_sensitive(ctk_dithering_controls->dithering_mode_box, FALSE); gtk_widget_set_sensitive(ctk_dithering_controls->dithering_depth_box, FALSE); @@ -475,26 +532,24 @@ static Bool update_dithering_info(gpointer user_data) /* current dithering */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_CURRENT_DITHERING, &val)) { + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_CURRENT_DITHERING, &val)) { val = NV_CTRL_CURRENT_DITHERING_DISABLED; } if (val == NV_CTRL_CURRENT_DITHERING_ENABLED) { - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_config), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_config_txt), "Enabled"); } else { - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_config), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_config_txt), "Disabled"); } /* dithering mode */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_MODE, - &dithering_mode)) { + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_MODE, + &dithering_mode)) { dithering_mode = NV_CTRL_DITHERING_MODE_AUTO; } @@ -517,39 +572,37 @@ static Bool update_dithering_info(gpointer user_data) /* current dithering mode */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_CURRENT_DITHERING_MODE, - &dithering_mode)) { + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_CURRENT_DITHERING_MODE, + &dithering_mode)) { dithering_mode = NV_CTRL_CURRENT_DITHERING_MODE_NONE; } switch (dithering_mode) { case NV_CTRL_CURRENT_DITHERING_MODE_DYNAMIC_2X2: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_mode), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), "Dynamic 2x2"); break; case NV_CTRL_CURRENT_DITHERING_MODE_STATIC_2X2: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_mode), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), "Static 2x2"); break; case NV_CTRL_CURRENT_DITHERING_MODE_TEMPORAL: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_mode), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), "Temporal"); break; default: case NV_CTRL_CURRENT_DITHERING_MODE_NONE: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_mode), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_mode_txt), "None"); break; } /* dithering depth */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_DEPTH, - &dithering_depth)) { + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_DEPTH, + &dithering_depth)) { dithering_depth = NV_CTRL_DITHERING_DEPTH_AUTO; } @@ -569,25 +622,24 @@ static Bool update_dithering_info(gpointer user_data) /* current dithering depth */ if (NvCtrlSuccess != - NvCtrlGetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_CURRENT_DITHERING_DEPTH, - &dithering_depth)) { + NvCtrlGetAttribute(ctk_dithering_controls->handle, + NV_CTRL_CURRENT_DITHERING_DEPTH, + &dithering_depth)) { dithering_depth = NV_CTRL_CURRENT_DITHERING_DEPTH_NONE; } switch (dithering_depth) { case NV_CTRL_CURRENT_DITHERING_DEPTH_6_BITS: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_depth), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_depth_txt), "6 bpc"); break; case NV_CTRL_CURRENT_DITHERING_DEPTH_8_BITS: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_depth), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_depth_txt), "8 bpc"); break; default: case NV_CTRL_CURRENT_DITHERING_DEPTH_NONE: - gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_current_depth), + gtk_label_set_text(GTK_LABEL(ctk_dithering_controls->dithering_depth_txt), "None"); break; } @@ -671,23 +723,11 @@ static void dithering_config_menu_changed(GtkOptionMenu *dithering_config_menu, history = gtk_option_menu_get_history(dithering_config_menu); - switch (history) { - case 2: - dithering_config = NV_CTRL_DITHERING_DISABLED; - break; - case 1: - dithering_config = NV_CTRL_DITHERING_ENABLED; - break; - default: - case 0: - dithering_config = NV_CTRL_DITHERING_AUTO; - break; - } + dithering_config = map_dithering_config_menu_idx_to_nvctrl(history); - NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING, - dithering_config); + NvCtrlSetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING, + dithering_config); g_signal_handlers_block_by_func (G_OBJECT(ctk_dithering_controls->dithering_config_menu), @@ -721,10 +761,9 @@ static void dithering_mode_menu_changed(GtkOptionMenu *dithering_mode_menu, dithering_mode = ctk_dithering_controls->dithering_mode_table[history]; - NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_MODE, - dithering_mode); + NvCtrlSetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_MODE, + dithering_mode); dithering_mode = map_nvctrl_value_to_table(ctk_dithering_controls, dithering_mode); @@ -757,23 +796,11 @@ static void dithering_depth_menu_changed(GtkOptionMenu *dithering_depth_menu, history = gtk_option_menu_get_history(dithering_depth_menu); - switch (history) { - case 2: - dithering_depth = NV_CTRL_DITHERING_DEPTH_8_BITS; - break; - case 1: - dithering_depth = NV_CTRL_DITHERING_DEPTH_6_BITS; - break; - default: - case 0: - dithering_depth = NV_CTRL_DITHERING_DEPTH_AUTO; - break; - } + dithering_depth = map_dithering_depth_menu_idx_to_nvctrl(history); - NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_DEPTH, - dithering_depth); + NvCtrlSetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_DEPTH, + dithering_depth); g_signal_handlers_block_by_func (G_OBJECT(ctk_dithering_controls->dithering_depth_menu), @@ -806,20 +833,17 @@ void ctk_dithering_controls_reset(CtkDitheringControls *ctk_dithering_controls) return; } - NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING, - NV_CTRL_DITHERING_AUTO); + NvCtrlSetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING, + NV_CTRL_DITHERING_AUTO); - NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_MODE, - NV_CTRL_DITHERING_MODE_AUTO); + NvCtrlSetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_MODE, + NV_CTRL_DITHERING_MODE_AUTO); - NvCtrlSetDisplayAttribute(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_DEPTH, - NV_CTRL_DITHERING_DEPTH_AUTO); + NvCtrlSetAttribute(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_DEPTH, + NV_CTRL_DITHERING_DEPTH_AUTO); ctk_dithering_controls_setup(ctk_dithering_controls); } /* ctk_dithering_controls_reset() */ @@ -856,12 +880,6 @@ static void dithering_update_received(GtkObject *object, gpointer arg1, CtkDitheringControls *ctk_object = CTK_DITHERING_CONTROLS(user_data); CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - /* if the event is not for this display device, return */ - - if (!(event_struct->display_mask & ctk_object->display_device_mask)) { - return; - } - ctk_dithering_controls_setup(ctk_object); /* update status bar message */ @@ -892,12 +910,11 @@ static gboolean build_dithering_mode_table(CtkDitheringControls *ctk_dithering_c free(ctk_dithering_controls->dithering_mode_table); } - ret = - NvCtrlGetValidDisplayAttributeValues(ctk_dithering_controls->handle, - ctk_dithering_controls->display_device_mask, - NV_CTRL_DITHERING_MODE, - &valid); - + ret = + NvCtrlGetValidAttributeValues(ctk_dithering_controls->handle, + NV_CTRL_DITHERING_MODE, + &valid); + if (ret != NvCtrlSuccess || valid.type != ATTRIBUTE_TYPE_INT_BITS) { /* * We do not have valid information to build a mode table @@ -954,3 +971,25 @@ static gint map_nvctrl_value_to_table(CtkDitheringControls *ctk_dithering_contro return 0; } /*map_nvctrl_value_to_table() */ + + +static gint map_dithering_config_menu_idx_to_nvctrl(gint idx) +{ + switch (idx) { + case 2: return NV_CTRL_DITHERING_DISABLED; + case 1: return NV_CTRL_DITHERING_ENABLED; + default: /* fallthrough; w/ warning? */ + case 0: return NV_CTRL_DITHERING_AUTO; + } +} + + +static gint map_dithering_depth_menu_idx_to_nvctrl(gint idx) +{ + switch (idx) { + case 2: return NV_CTRL_DITHERING_DEPTH_8_BITS; + case 1: return NV_CTRL_DITHERING_DEPTH_6_BITS; + default: /* fallthrough; w/ warning? */ + case 0: return NV_CTRL_DITHERING_DEPTH_AUTO; + } +} diff --git a/src/gtk+-2.x/ctkditheringcontrols.h b/src/gtk+-2.x/ctkditheringcontrols.h index 8ce37fe..f87ac9c 100644 --- a/src/gtk+-2.x/ctkditheringcontrols.h +++ b/src/gtk+-2.x/ctkditheringcontrols.h @@ -54,22 +54,23 @@ struct _CtkDitheringControls NvCtrlAttributeHandle *handle; CtkConfig *ctk_config; + char *name; GtkWidget *reset_button; - GtkWidget *dithering_controls_main; + + GtkWidget *dithering_controls_box; GtkWidget *dithering_mode_box; GtkWidget *dithering_depth_box; GtkWidget *dithering_config_menu; GtkWidget *dithering_mode_menu; GtkWidget *dithering_depth_menu; - GtkWidget *dithering_current_config; - GtkWidget *dithering_current_mode; - GtkWidget *dithering_current_depth; - gint display_device_mask; + GtkWidget *dithering_config_txt; + GtkWidget *dithering_mode_txt; + GtkWidget *dithering_depth_txt; + gint *dithering_mode_table; gint dithering_mode_table_size; - char *name; }; struct _CtkDitheringControlsClass @@ -81,7 +82,6 @@ GType ctk_dithering_controls_get_type (void) G_GNUC_CONST; GtkWidget* ctk_dithering_controls_new (NvCtrlAttributeHandle *, CtkConfig *, CtkEvent *, GtkWidget *, - unsigned int display_device_mask, char *); void ctk_dithering_controls_reset (CtkDitheringControls*); diff --git a/src/gtk+-2.x/ctkdropdownmenu.c b/src/gtk+-2.x/ctkdropdownmenu.c index f2665cd..0593a44 100644 --- a/src/gtk+-2.x/ctkdropdownmenu.c +++ b/src/gtk+-2.x/ctkdropdownmenu.c @@ -52,6 +52,7 @@ GType ctk_drop_down_menu_get_type( sizeof (CtkDropDownMenu), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_drop_down_menu_type = g_type_register_static(GTK_TYPE_VBOX, diff --git a/src/gtk+-2.x/ctkecc.c b/src/gtk+-2.x/ctkecc.c index 5fb1b31..d6f0c3f 100644 --- a/src/gtk+-2.x/ctkecc.c +++ b/src/gtk+-2.x/ctkecc.c @@ -85,6 +85,7 @@ GType ctk_ecc_get_type(void) sizeof (CtkEcc), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_ecc_type = diff --git a/src/gtk+-2.x/ctkedid.c b/src/gtk+-2.x/ctkedid.c index d31fdbd..e2e0bc6 100644 --- a/src/gtk+-2.x/ctkedid.c +++ b/src/gtk+-2.x/ctkedid.c @@ -72,6 +72,7 @@ GType ctk_edid_get_type(void) sizeof (CtkEdid), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_edid_type = g_type_register_static (GTK_TYPE_VBOX, @@ -82,37 +83,39 @@ GType ctk_edid_get_type(void) } -GtkWidget* ctk_edid_new(NvCtrlAttributeHandle *handle, - CtkConfig *ctk_config, CtkEvent *ctk_event, - GtkWidget *reset_button, - unsigned int display_device_mask, - char *name) +void ctk_edid_setup(CtkEdid *ctk_object) { - CtkEdid *ctk_edid; - GObject *object; - GtkWidget *frame, *vbox, *label, *hbox, *alignment; ReturnStatus ret; gint val; - /* check if EDID is available for this display device */ + ret = NvCtrlGetAttribute(ctk_object->handle, NV_CTRL_EDID_AVAILABLE, &val); - ret = NvCtrlGetDisplayAttribute(handle, display_device_mask, - NV_CTRL_EDID_AVAILABLE, &val); - if ((ret != NvCtrlSuccess) || (val != NV_CTRL_EDID_AVAILABLE_TRUE)) { - return NULL; + gtk_widget_set_sensitive(ctk_object->button, FALSE); + return; } + gtk_widget_set_sensitive(ctk_object->button, TRUE); +} + + +GtkWidget* ctk_edid_new(NvCtrlAttributeHandle *handle, + CtkConfig *ctk_config, CtkEvent *ctk_event, + char *name) +{ + CtkEdid *ctk_edid; + GObject *object; + GtkWidget *frame, *vbox, *label, *hbox, *alignment; + /* create the object */ - + object = g_object_new(CTK_TYPE_EDID, NULL); + if (!object) return NULL; ctk_edid = CTK_EDID(object); - + ctk_edid->handle = handle; ctk_edid->ctk_config = ctk_config; - ctk_edid->reset_button = reset_button; - ctk_edid->display_device_mask = display_device_mask; ctk_edid->name = name; ctk_edid->filename = DEFAULT_EDID_FILENAME_BINARY; ctk_edid->file_format = FILE_FORMAT_BINARY; @@ -197,6 +200,8 @@ GtkWidget* ctk_edid_new(NvCtrlAttributeHandle *handle, gtk_widget_show_all(GTK_WIDGET(object)); + ctk_edid_setup(ctk_edid); + return GTK_WIDGET(object); } /* ctk_edid_new() */ @@ -290,8 +295,7 @@ static void button_clicked(GtkButton *button, gpointer user_data) /* Grab EDID information */ - ret = NvCtrlGetBinaryAttribute(ctk_edid->handle, - ctk_edid->display_device_mask, + ret = NvCtrlGetBinaryAttribute(ctk_edid->handle, 0, NV_CTRL_BINARY_DATA_EDID, &data, &len); if (ret != NvCtrlSuccess) { diff --git a/src/gtk+-2.x/ctkedid.h b/src/gtk+-2.x/ctkedid.h index a9e9d8f..d29738d 100644 --- a/src/gtk+-2.x/ctkedid.h +++ b/src/gtk+-2.x/ctkedid.h @@ -51,19 +51,17 @@ typedef struct _CtkEdidClass CtkEdidClass; struct _CtkEdid { GtkVBox parent; - + NvCtrlAttributeHandle *handle; CtkConfig *ctk_config; - GtkWidget *reset_button; GtkWidget *button; GtkWidget *file_selector; GtkWidget *file_format_binary_radio_button; GtkWidget *file_format_ascii_radio_button; - + const gchar *filename; char *name; - unsigned int display_device_mask; gint file_format; }; @@ -75,11 +73,9 @@ struct _CtkEdidClass GType ctk_edid_get_type (void) G_GNUC_CONST; GtkWidget* ctk_edid_new (NvCtrlAttributeHandle *, CtkConfig *, CtkEvent *, - GtkWidget *reset_button, - unsigned int display_device_mask, char *name); -void ctk_edid_reset(CtkEdid *); +void ctk_edid_setup(CtkEdid *ctk_object); void add_acquire_edid_help(GtkTextBuffer *b, GtkTextIter *i); diff --git a/src/gtk+-2.x/ctkevent.c b/src/gtk+-2.x/ctkevent.c index 296d07b..f26ad4d 100644 --- a/src/gtk+-2.x/ctkevent.c +++ b/src/gtk+-2.x/ctkevent.c @@ -91,6 +91,7 @@ GType ctk_event_get_type(void) sizeof(CtkEvent), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_event_type = g_type_register_static @@ -187,7 +188,6 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) MAKE_SIGNAL(NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT); MAKE_SIGNAL(NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT); MAKE_SIGNAL(NV_CTRL_GVO_DATA_FORMAT); - MAKE_SIGNAL(NV_CTRL_GVO_DISPLAY_X_SCREEN); MAKE_SIGNAL(NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED); MAKE_SIGNAL(NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECT_MODE); MAKE_SIGNAL(NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED); @@ -200,8 +200,6 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) MAKE_SIGNAL(NV_CTRL_GVIO_VIDEO_FORMAT_WIDTH); MAKE_SIGNAL(NV_CTRL_GVIO_VIDEO_FORMAT_HEIGHT); MAKE_SIGNAL(NV_CTRL_GVIO_VIDEO_FORMAT_REFRESH_RATE); - MAKE_SIGNAL(NV_CTRL_GVO_X_SCREEN_PAN_X); - MAKE_SIGNAL(NV_CTRL_GVO_X_SCREEN_PAN_Y); MAKE_SIGNAL(NV_CTRL_GPU_OVERCLOCKING_STATE); MAKE_SIGNAL(NV_CTRL_GPU_2D_CLOCK_FREQS); MAKE_SIGNAL(NV_CTRL_GPU_3D_CLOCK_FREQS); @@ -327,6 +325,8 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) MAKE_SIGNAL(NV_CTRL_GPU_PCIE_CURRENT_LINK_WIDTH); MAKE_SIGNAL(NV_CTRL_GPU_PCIE_CURRENT_LINK_SPEED); MAKE_SIGNAL(NV_CTRL_GVO_AUDIO_BLANKING); + MAKE_SIGNAL(NV_CTRL_CURRENT_METAMODE_ID); + MAKE_SIGNAL(NV_CTRL_DISPLAY_ENABLED); #undef MAKE_SIGNAL /* @@ -336,7 +336,7 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) * knows about. */ -#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_GVO_AUDIO_BLANKING +#if NV_CTRL_LAST_ATTRIBUTE != NV_CTRL_DISPLAY_ENABLED #warning "There are attributes that do not emit signals!" #endif @@ -380,13 +380,20 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) MAKE_STRING_SIGNAL(NV_CTRL_STRING_GVIO_VIDEO_FORMAT_NAME); MAKE_STRING_SIGNAL(NV_CTRL_STRING_GPU_CURRENT_CLOCK_FREQS); MAKE_STRING_SIGNAL(NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_CURRENT_METAMODE_VERSION_2); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_DISPLAY_NAME_DP_GUID); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_DISPLAY_NAME_EDID_HASH); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_DISPLAY_NAME_TARGET_INDEX); + MAKE_STRING_SIGNAL(NV_CTRL_STRING_DISPLAY_NAME_RANDR); #undef MAKE_STRING_SIGNAL -#if NV_CTRL_STRING_LAST_ATTRIBUTE != NV_CTRL_STRING_3D_VISION_PRO_GLASSES_NAME +#if NV_CTRL_STRING_LAST_ATTRIBUTE != NV_CTRL_STRING_DISPLAY_NAME_RANDR #warning "There are attributes that do not emit signals!" #endif - - + + /* make signals for binary attribute */ for (i = 0; i <= NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE; i++) binary_signals[i] = 0; @@ -410,10 +417,11 @@ static void ctk_event_class_init(CtkEventClass *ctk_event_class) MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_THERMAL_SENSORS_USED_BY_GPU); MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_DISPLAY_TARGETS); MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU); - + MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_METAMODES_VERSION_2); + MAKE_BINARY_SIGNAL(NV_CTRL_BINARY_DATA_DISPLAYS_ENABLED_ON_XSCREEN); #undef MAKE_BINARY_SIGNAL -#if NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE != NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU +#if NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE != NV_CTRL_BINARY_DATA_DISPLAYS_ENABLED_ON_XSCREEN #warning "There are attributes that do not emit signals!" #endif @@ -469,7 +477,9 @@ static void ctk_event_register_source(CtkEvent *ctk_event) ctk_event_prepare, ctk_event_check, ctk_event_dispatch, - NULL + NULL, /* finalize */ + NULL, /* closure_callback */ + NULL, /* closure_marshal */ }; source = g_source_new(&ctk_source_funcs, sizeof(CtkEventSource)); @@ -636,8 +646,7 @@ static gboolean ctk_event_dispatch(GSource *source, /* make sure the attribute is in our signal array */ - if ((nvctrlevent->attribute >= 0) && - (nvctrlevent->attribute <= NV_CTRL_LAST_ATTRIBUTE) && + if ((nvctrlevent->attribute <= NV_CTRL_LAST_ATTRIBUTE) && (signals[nvctrlevent->attribute] != 0)) { event_struct.attribute = nvctrlevent->attribute; @@ -669,8 +678,7 @@ static gboolean ctk_event_dispatch(GSource *source, /* make sure the attribute is in our signal array */ - if ((nvctrlevent->attribute >= 0) && - (nvctrlevent->attribute <= NV_CTRL_LAST_ATTRIBUTE) && + if ((nvctrlevent->attribute <= NV_CTRL_LAST_ATTRIBUTE) && (signals[nvctrlevent->attribute] != 0)) { event_struct.attribute = nvctrlevent->attribute; @@ -703,8 +711,7 @@ static gboolean ctk_event_dispatch(GSource *source, /* make sure the attribute is in our signal array */ - if ((nvctrlevent->attribute >= 0) && - (nvctrlevent->attribute <= NV_CTRL_LAST_ATTRIBUTE) && + if ((nvctrlevent->attribute <= NV_CTRL_LAST_ATTRIBUTE) && (signals[nvctrlevent->attribute] != 0)) { event_struct.attribute = nvctrlevent->attribute; @@ -735,8 +742,7 @@ static gboolean ctk_event_dispatch(GSource *source, /* make sure the attribute is in our signal array */ - if ((nvctrlevent->attribute >= 0) && - (nvctrlevent->attribute <= NV_CTRL_STRING_LAST_ATTRIBUTE) && + if ((nvctrlevent->attribute <= NV_CTRL_STRING_LAST_ATTRIBUTE) && (string_signals[nvctrlevent->attribute] != 0)) { event_struct.attribute = nvctrlevent->attribute; @@ -764,8 +770,7 @@ static gboolean ctk_event_dispatch(GSource *source, (XNVCtrlBinaryAttributeChangedEventTarget *) &event; /* make sure the attribute is in our signal array */ - if ((nvctrlevent->attribute >= 0) && - (nvctrlevent->attribute <= NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE) && + if ((nvctrlevent->attribute <= NV_CTRL_BINARY_DATA_LAST_ATTRIBUTE) && (binary_signals[nvctrlevent->attribute] != 0)) { event_struct.attribute = nvctrlevent->attribute; diff --git a/src/gtk+-2.x/ctkframelock.c b/src/gtk+-2.x/ctkframelock.c index 32d4192..6c6bfb6 100644 --- a/src/gtk+-2.x/ctkframelock.c +++ b/src/gtk+-2.x/ctkframelock.c @@ -44,6 +44,7 @@ #include "parse.h" #include "msg.h" +#include "common-utils.h" #define DEFAULT_UPDATE_STATUS_TIME_INTERVAL 1000 @@ -743,9 +744,9 @@ static GtkWidget *create_enable_confirm_dialog(CtkFramelock *ctk_framelock) * Creates a button with padding. * */ -GtkWidget *my_button_new_with_label(const gchar *txt, - gint hpad, - gint vpad) +static GtkWidget *my_button_new_with_label(const gchar *txt, + gint hpad, + gint vpad) { GtkWidget *btn; GtkWidget *hbox; @@ -771,9 +772,9 @@ GtkWidget *my_button_new_with_label(const gchar *txt, * Creates a toggle button with padding. * */ -GtkWidget *my_toggle_button_new_with_label(const gchar *txt, - gint hpad, - gint vpad) +static GtkWidget *my_toggle_button_new_with_label(const gchar *txt, + gint hpad, + gint vpad) { GtkWidget *btn; GtkWidget *hbox; @@ -799,7 +800,7 @@ GtkWidget *my_toggle_button_new_with_label(const gchar *txt, * Updates the container to hold a duplicate of the given image. * */ -void update_image(GtkWidget *container, GdkPixbuf *new_pixbuf) +static void update_image(GtkWidget *container, GdkPixbuf *new_pixbuf) { ctk_empty_container(container); @@ -1194,7 +1195,14 @@ static void list_entry_update_gpu_controls(CtkFramelock *ctk_framelock, } } +static gboolean framelock_refresh_rates_compatible(int server, int client) +{ + int range = ABS(((int64_t)(server - client) * 1000000) / client); + /* Framelock can be achieved if the range between refresh rates is less + * than 50 ppm */ + return range <= 50; +} /** list_entry_update_display_controls() ***************************** * @@ -1249,8 +1257,9 @@ static void list_entry_update_display_controls(CtkFramelock *ctk_framelock, * the same as the current server's, or the X server tells us * the client cannot be frame locked. */ - sensitive = ((!server_data || data->rate == server_data->rate) && - data->slaveable); + sensitive = (data->slaveable && + (!server_data || + framelock_refresh_rates_compatible(server_data->rate, data->rate))); gtk_widget_set_sensitive(data->rate_label, sensitive); gtk_widget_set_sensitive(data->rate_text, sensitive); gtk_widget_set_sensitive(data->label, sensitive); @@ -2522,79 +2531,6 @@ static gboolean get_server_id(NvCtrlAttributeHandle *handle, -/** find_entry_by_name() ********************************************* - * - * - Looks in the list tree for the first list entry to have a handle - * to the given server name with the given entry data type and - * target id. - * - */ -static nvListEntryPtr find_entry_by_name(nvListEntryPtr entry, - gchar *server_name, - int entry_type, - int entry_id - ) -{ - nvListEntryPtr found_entry = NULL; - - if (!entry) return NULL; - - /* Check this entry */ - - if ((entry->data_type == ENTRY_DATA_FRAMELOCK && - entry_type == NV_CTRL_TARGET_TYPE_FRAMELOCK) || - (entry->data_type == ENTRY_DATA_GPU && - entry_type == NV_CTRL_TARGET_TYPE_GPU)) { - gpointer handle; - - switch (entry->data_type) { - case ENTRY_DATA_FRAMELOCK: - handle = ((nvFrameLockDataPtr)(entry->data))->handle; - break; - case ENTRY_DATA_GPU: - handle = ((nvGPUDataPtr)(entry->data))->handle; - break; - default: - handle = NULL; - break; - } - - if (handle) { - gchar *name = NvCtrlGetDisplayName(handle); - int id = NvCtrlGetTargetId(handle); - - if (name && !strcasecmp(server_name, name) && - id == entry_id) { - free(name); - return entry; - } - free(name); - } - } - - /* Check children */ - - found_entry = find_entry_by_name(entry->children, - server_name, - entry_type, - entry_id); - if (found_entry) return found_entry; - - /* Check siblings */ - - found_entry = find_entry_by_name(entry->next_sibling, - server_name, - entry_type, - entry_id); - if (found_entry) return found_entry; - - /* Entry not found in this branch */ - - return NULL; -} - - - /**************************************************************************/ /* @@ -3572,8 +3508,8 @@ static void toggle_detect_video_mode(GtkToggleButton *button, * querying the current state of the X Server. * */ -void list_entry_update_framelock_status(CtkFramelock *ctk_framelock, - nvListEntryPtr entry) +static void list_entry_update_framelock_status(CtkFramelock *ctk_framelock, + nvListEntryPtr entry) { nvFrameLockDataPtr data = (nvFrameLockDataPtr)(entry->data); gint rate, delay, house, port0, port1; @@ -3665,8 +3601,8 @@ void list_entry_update_framelock_status(CtkFramelock *ctk_framelock, * current state of the X Server. * */ -void list_entry_update_gpu_status(CtkFramelock *ctk_framelock, - nvListEntryPtr entry) +static void list_entry_update_gpu_status(CtkFramelock *ctk_framelock, + nvListEntryPtr entry) { nvGPUDataPtr data = (nvGPUDataPtr)(entry->data); gboolean framelock_enabled; @@ -3724,8 +3660,8 @@ void list_entry_update_gpu_status(CtkFramelock *ctk_framelock, * the current state of the X Server. * */ -void list_entry_update_display_status(CtkFramelock *ctk_framelock, - nvListEntryPtr entry) +static void list_entry_update_display_status(CtkFramelock *ctk_framelock, + nvListEntryPtr entry) { nvDisplayDataPtr data = (nvDisplayDataPtr)(entry->data); gboolean framelock_enabled; @@ -3793,8 +3729,8 @@ void list_entry_update_display_status(CtkFramelock *ctk_framelock, * by querying the X Server. * */ -void list_entry_update_status(CtkFramelock *ctk_framelock, - nvListEntryPtr entry) +static void list_entry_update_status(CtkFramelock *ctk_framelock, + nvListEntryPtr entry) { if (!entry) return; @@ -4456,6 +4392,7 @@ GType ctk_framelock_get_type( sizeof (CtkFramelock), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_framelock_type = g_type_register_static @@ -5715,7 +5652,7 @@ static gint add_devices(CtkFramelock *ctk_framelock, a.target_type = target_type; \ a.target_id = target_id; \ a.attr = (x); \ - a.val = (y); \ + a.val.i = (y); \ a.display_device_mask = (z); \ a.flags |= NV_PARSER_HAS_TARGET; \ nv_parsed_attribute_add(head, &a); @@ -5723,13 +5660,17 @@ static gint add_devices(CtkFramelock *ctk_framelock, static void add_entry_to_parsed_attributes(nvListEntryPtr entry, ParsedAttribute *head) { - ParsedAttribute a = { 0 }; + ParsedAttribute a; char *display_name = NULL; int target_type = 0; int target_id = 0; - if (!entry) return; - + if (!entry) { + return; + } + + memset(&a, 0, sizeof(a)); + switch (entry->data_type) { case ENTRY_DATA_FRAMELOCK: diff --git a/src/gtk+-2.x/ctkgauge.c b/src/gtk+-2.x/ctkgauge.c index 74bcc02..276dbd3 100644 --- a/src/gtk+-2.x/ctkgauge.c +++ b/src/gtk+-2.x/ctkgauge.c @@ -65,6 +65,7 @@ GType ctk_gauge_get_type( sizeof (CtkGauge), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gauge_type = g_type_register_static(GTK_TYPE_DRAWING_AREA, diff --git a/src/gtk+-2.x/ctkglx.c b/src/gtk+-2.x/ctkglx.c index bd65f90..cdbb9b9 100644 --- a/src/gtk+-2.x/ctkglx.c +++ b/src/gtk+-2.x/ctkglx.c @@ -146,6 +146,7 @@ GType ctk_glx_get_type(void) sizeof (CtkGLX), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_glx_type = g_type_register_static (GTK_TYPE_VBOX, diff --git a/src/gtk+-2.x/ctkgpu.c b/src/gtk+-2.x/ctkgpu.c index 001f491..fa22fb1 100644 --- a/src/gtk+-2.x/ctkgpu.c +++ b/src/gtk+-2.x/ctkgpu.c @@ -54,6 +54,7 @@ GType ctk_gpu_get_type( sizeof (CtkGpu), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gpu_type = @@ -65,54 +66,10 @@ GType ctk_gpu_get_type( } -static gchar *make_display_device_list(NvCtrlAttributeHandle *handle, - unsigned int display_devices) +static gchar *make_display_device_list(NvCtrlAttributeHandle *handle) { - gchar *displays = NULL; - gchar *type; - gchar *name; - gchar *tmp_str; - unsigned int mask; - ReturnStatus ret; - - - /* List of Display Device connected on GPU */ - - for (mask = 1; mask; mask <<= 1) { - - if (!(mask & display_devices)) continue; - - type = display_device_mask_to_display_device_name(mask); - name = NULL; - - ret = - NvCtrlGetStringDisplayAttribute(handle, - mask, - NV_CTRL_STRING_DISPLAY_DEVICE_NAME, - &name); - if (ret != NvCtrlSuccess) { - tmp_str = g_strdup_printf("Unknown (%s)", type); - } else { - tmp_str = g_strdup_printf("%s (%s)", name, type); - XFree(name); - } - free(type); - - if (displays) { - name = g_strdup_printf("%s,\n%s", tmp_str, displays); - g_free(displays); - g_free(tmp_str); - } else { - name = tmp_str; - } - displays = name; - } - - if (!displays) { - displays = g_strdup("None"); - } - - return displays; + return create_display_name_list_string(handle, + NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU); } /* make_display_device_list() */ @@ -250,7 +207,6 @@ GtkWidget* ctk_gpu_new( gchar *link_width_str = NULL; gchar *pcie_gen_str = NULL; - unsigned int display_devices; int xinerama_enabled; int *pData; int len; @@ -394,17 +350,8 @@ GtkWidget* ctk_gpu_new( screens = g_strdup("Unknown"); } - /* List of Display Device connected on GPU */ - - displays = NULL; - ret = NvCtrlGetAttribute(handle, NV_CTRL_CONNECTED_DISPLAYS, - (int *)&display_devices); - if (ret == NvCtrlSuccess) { - displays = make_display_device_list(handle, display_devices); - } - /* now, create the object */ - + object = g_object_new(CTK_TYPE_GPU, NULL); ctk_gpu = CTK_GPU(object); @@ -525,6 +472,8 @@ GtkWidget* ctk_gpu_new( 0, 0, "X Screens:", 0, 0, screens); /* spacing */ + displays = make_display_device_list(handle); + row += 3; ctk_gpu->displays = add_table_row(table, row, @@ -662,12 +611,10 @@ GtkTextBuffer *ctk_gpu_create_help(GtkTextTagTable *table, static void probe_displays_received(GtkObject *object, gpointer arg1, gpointer user_data) { - CtkEventStruct *event_struct = (CtkEventStruct *) arg1; CtkGpu *ctk_object = CTK_GPU(user_data); - unsigned int probed_displays = event_struct->value; gchar *str; - str = make_display_device_list(ctk_object->handle, probed_displays); + str = make_display_device_list(ctk_object->handle); gtk_label_set_text(GTK_LABEL(ctk_object->displays), str); diff --git a/src/gtk+-2.x/ctkgvi.c b/src/gtk+-2.x/ctkgvi.c index 49934ee..591c237 100644 --- a/src/gtk+-2.x/ctkgvi.c +++ b/src/gtk+-2.x/ctkgvi.c @@ -51,6 +51,7 @@ GType ctk_gvi_get_type(void) sizeof (CtkGvi), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gvi_type = @@ -96,8 +97,8 @@ static gboolean update_sdi_input_info(gpointer user_data); /* * ctk_gvio_get_format_name() - retrun name of format. */ -const char * ctk_gvio_get_format_name(const GvioFormatName *formatTable, - const gint format) +static const char *ctk_gvio_get_format_name(const GvioFormatName *formatTable, + const gint format) { int i; for (i = 0; formatTable[i].name; i++) { diff --git a/src/gtk+-2.x/ctkgvo-banner.c b/src/gtk+-2.x/ctkgvo-banner.c index 23146ac..ca2128a 100644 --- a/src/gtk+-2.x/ctkgvo-banner.c +++ b/src/gtk+-2.x/ctkgvo-banner.c @@ -109,6 +109,7 @@ GType ctk_gvo_banner_get_type(void) sizeof (CtkGvoBanner), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gvo_banner_type = diff --git a/src/gtk+-2.x/ctkgvo-csc.c b/src/gtk+-2.x/ctkgvo-csc.c index dfd5090..71f813f 100644 --- a/src/gtk+-2.x/ctkgvo-csc.c +++ b/src/gtk+-2.x/ctkgvo-csc.c @@ -169,6 +169,7 @@ GType ctk_gvo_csc_get_type(void) sizeof (CtkGvoCsc), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gvo_csc_type = diff --git a/src/gtk+-2.x/ctkgvo-sync.c b/src/gtk+-2.x/ctkgvo-sync.c index 5861a5d..43e5212 100644 --- a/src/gtk+-2.x/ctkgvo-sync.c +++ b/src/gtk+-2.x/ctkgvo-sync.c @@ -165,6 +165,7 @@ GType ctk_gvo_sync_get_type(void) sizeof (CtkGvoSync), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gvo_sync_type = diff --git a/src/gtk+-2.x/ctkgvo.c b/src/gtk+-2.x/ctkgvo.c index 799ba01..425159b 100644 --- a/src/gtk+-2.x/ctkgvo.c +++ b/src/gtk+-2.x/ctkgvo.c @@ -21,7 +21,6 @@ #include <string.h> #include <X11/Xlib.h> -#include <X11/extensions/Xrandr.h> #include "NvCtrlAttributes.h" @@ -40,101 +39,39 @@ #define TABLE_PADDING 5 -/* Some defaults */ - -#define DEFAULT_OUTPUT_VIDEO_FORMAT \ - NV_CTRL_GVIO_VIDEO_FORMAT_487I_59_94_SMPTE259_NTSC - -#define DEFAULT_OUTPUT_DATA_FORMAT \ - NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB444 - - /* General information help */ -static const char * __general_firmware_version_help = +static const char *__general_firmware_version_help = "The Firmware Version reports the version of the firmware running on the " "SDI device."; -static const char * __general_current_sdi_resolution_help = +static const char *__general_current_sdi_resolution_help = "The Current SDI Resolution reports the current active resolution that the " "SDI device is driving or 'Inactive' if SDI is currently disabled."; -static const char * __general_current_sdi_state_help = -"The Current SDI state reports on the current usage of the SDI device."; - - -/* Clone mode help */ - -static const char * __clone_mode_video_format_help = -"The Video Format drop-down allows you to select the desired resolution and " -"refresh rate to be used for Clone Mode."; - -static const char * __clone_mode_data_format_help = -"The Data Format drop-down allows you to select the desired data format that " -"the SDI will output. Note that the new data format " -"will be applied at modeset time."; - -static const char * __clone_mode_x_offset_help = -"The X Offset determines the start location of the left side of SDI output " -"window when in Clone Mode."; - -static const char * __clone_mode_y_offset_help = -"The Y Offset determines the start location of the top of the SDI output " -"window when in Clone Mode."; +static const char *__general_current_sdi_state_help = +"The Current SDI state reports the current usage of the SDI device."; -static const char * __clone_mode_enable_clone_mode_help = -"The Enable Clone Mode button toggles SDI Clone mode."; +static const char *__requested_sdi_video_format_help = +"The Requested SDI Video Format indicates what video format is currently " +"requested through NV-CONTROL."; +static const char *__requested_sdi_data_format_help = +"The Requested SDI Data Format indicates what data format is currently " +"requested through NV-CONTROL."; /* local prototypes */ -static gboolean query_init_gvo_state(CtkGvo *ctk_gvo); - static void query_video_format_details(CtkGvo *ctk_gvo); -static void register_for_gvo_events(CtkGvo *ctk_gvo); - - -static GtkWidget *start_menu(const gchar *name, GtkWidget *table, - const gint row); -static void finish_menu(GtkWidget *menu, GtkWidget *table, const gint row); - - -static void fill_output_video_format_menu(CtkGvo *ctk_gvo); -static void output_video_format_ui_changed(CtkDropDownMenu *menu, - gpointer user_data); -static void post_output_video_format_changed(CtkGvo *ctk_gvo); - - -static void fill_output_data_format_menu(CtkGvo *ctk_gvo); -static void output_data_format_ui_changed(CtkDropDownMenu *menu, - gpointer user_data); -static void post_output_data_format_changed(CtkGvo *ctk_gvo); - - -static void x_offset_ui_changed(GtkSpinButton *spinbutton, gpointer user_data); -static void y_offset_ui_changed(GtkSpinButton *spinbutton, gpointer user_data); - - -static void create_toggle_clone_mode_button(CtkGvo *ctk_gvo); -static void clone_mode_button_ui_toggled(GtkWidget *button, - gpointer user_data); -static void post_clone_mode_button_toggled(CtkGvo *gvo); - +static void register_for_gvo_events(CtkGvo *ctk_gvo, CtkEvent *ctk_event); static void update_gvo_current_info(CtkGvo *ctk_gvo); -static void update_offset_spin_button_ranges(CtkGvo *ctk_gvo); -static void update_gvo_sensitivity(CtkGvo *ctk_gvo); - static void gvo_event_received(GtkObject *object, gpointer arg1, gpointer user_data); -static void screen_changed_handler(GtkWidget *widget, - XRRScreenChangeNotifyEvent *ev, - gpointer data); - /* * video format table -- should this be moved into NV-CONTROL? @@ -280,12 +217,9 @@ static GvioFormatDetails videoFormatDetails[] = { static const GvioFormatName dataFormatNames[] = { - /* Valid for Clone Mode */ { NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB444, "RGB -> YCrCb (4:4:4)" }, { NV_CTRL_GVO_DATA_FORMAT_R8G8B8_TO_YCRCB422, "RGB -> YCrCb (4:2:2)" }, { NV_CTRL_GVO_DATA_FORMAT_X8X8X8_444_PASSTHRU, "RGB (4:4:4)" }, - - /* Invalid for Clone Mode usage */ { NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_YCRCBA4444, "RGBA -> YCrCbA (4:4:4:4)" }, { NV_CTRL_GVO_DATA_FORMAT_R8G8B8Z10_TO_YCRCBZ4444, "RGBZ -> YCrCbZ (4:4:4:4)" }, { NV_CTRL_GVO_DATA_FORMAT_R8G8B8A8_TO_YCRCBA4224, "RGBA -> YCrCbA (4:2:2:4)" }, @@ -363,109 +297,6 @@ void ctk_gvo_get_video_format_resolution(const gint format, gint *w, gint *h) /* - * ctk_gvo_get_video_format_refresh() - return the refresh rate of the - * given video format - */ - -void ctk_gvo_get_video_format_refresh(const gint format, gint *r) -{ - gint i; - - *r = 0; - - for (i = 0; videoFormatDetails[i].format != -1; i++) { - if (videoFormatDetails[i].format == format) { - *r = videoFormatDetails[i].rate; - return; - } - } -} /* ctk_gvo_get_video_format_refresh() */ - - - -/* - * ctk_gvo_video_format_valid() - returns a bitmask indicating whether or not - * the currently selected video format is valid for clone mode based on the - * current X screen resolution and current sync method. Returns a bitmask - * indicating possible valid/invalid state of the mode. - */ - -#define GVO_VIDEO_FORMAT_INVALID 0x00000000 -#define GVO_VIDEO_FORMAT_MODE_VALID 0x00000001 -#define GVO_VIDEO_FORMAT_RESOLUTION_VALID 0x00000002 -#define GVO_VIDEO_FORMAT_REFRESH_VALID 0x00000004 - -#define GVO_VIDEO_FORMAT_VALID \ - (GVO_VIDEO_FORMAT_MODE_VALID | \ - GVO_VIDEO_FORMAT_RESOLUTION_VALID | \ - GVO_VIDEO_FORMAT_REFRESH_VALID) - -guint ctk_gvo_video_format_valid(CtkGvo *ctk_gvo, const gint format) -{ - gint width, height, refresh_rate, input_refresh_rate; - guint valid = GVO_VIDEO_FORMAT_VALID; - - - /* Keep track of whether we'll need to re-set the video format - * when enabling clone mode. - */ - - /* Check to make sure the format size <= current screen size */ - ctk_gvo_get_video_format_resolution(format, &width, &height); - - /* Make sure the resolution fits */ - if ((width > ctk_gvo->screen_width) || (height > ctk_gvo->screen_height)) { - valid &= ~(GVO_VIDEO_FORMAT_RESOLUTION_VALID); - } - - /* Check that format is supported */ - if (((format / 32) >= - (sizeof(ctk_gvo->valid_output_video_format_mask)/ - sizeof(ctk_gvo->valid_output_video_format_mask[0]))) || - !(ctk_gvo->valid_output_video_format_mask[format / 32] & - (1 << (format % 32)))) { - valid &= ~(GVO_VIDEO_FORMAT_MODE_VALID); - } - - /* Check that formats match if Genlock is enabled */ - else if ((ctk_gvo->sync_mode == NV_CTRL_GVO_SYNC_MODE_GENLOCK) && - (ctk_gvo->input_video_format != NV_CTRL_GVIO_VIDEO_FORMAT_NONE) && - (ctk_gvo->input_video_format != format)) { - valid &= ~(GVO_VIDEO_FORMAT_REFRESH_VALID); - } - - - /* Check that format refresh rates match if Frame Lock is enabled */ - else if ((ctk_gvo->sync_mode == NV_CTRL_GVO_SYNC_MODE_FRAMELOCK) && - (ctk_gvo->input_video_format != NV_CTRL_GVIO_VIDEO_FORMAT_NONE)) { - - /* Get the refresh rate */ - ctk_gvo_get_video_format_refresh(format, &refresh_rate); - - /* Get the current input refresh rate */ - ctk_gvo_get_video_format_refresh(ctk_gvo->input_video_format, - &input_refresh_rate); - - /* Check that the refresh rates are the same, or, for those - * GVO devices that support multi-rate synchronization, check - * that the fractional part of the rates are either both zero - * or both non-zero. - */ - - if ((refresh_rate != input_refresh_rate) && - (!(ctk_gvo->caps & NV_CTRL_GVO_CAPABILITIES_MULTIRATE_SYNC) || - ((refresh_rate % 1000 == 0) != (input_refresh_rate % 1000 == 0)))) { - valid &= ~(GVO_VIDEO_FORMAT_REFRESH_VALID); - } - } - - return valid; - -} /* ctk_gvo_video_format_valid() */ - - - -/* * ctk_gvo_get_data_format_name() - return the name of the given data format */ @@ -486,28 +317,6 @@ const char *ctk_gvo_get_data_format_name(const gint format) /* - * ctk_gvo_data_format_valid() - return whether or not the given data - * format is valid for clone mode. - */ - -gboolean ctk_gvo_data_format_valid(const gint format) -{ - gint i; - - for (i = 0; dataFormatNames[i].name; i++) { - if (dataFormatNames[i].format == format) { - /* Only the first three formats are valid */ - return (i < 3); - } - } - - return FALSE; - -} /* ctk_gvo_data_format_valid() */ - - - -/* * ctk_gvo_get_type() - Returns the CtkGvo "class" type */ @@ -526,6 +335,7 @@ GType ctk_gvo_get_type(void) sizeof (CtkGvo), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_gvo_type = @@ -551,37 +361,36 @@ GtkWidget* ctk_gvo_new(NvCtrlAttributeHandle *handle, { GObject *object; CtkGvo *ctk_gvo; - GtkWidget *hbox, *vbox, *alignment, *label; + GtkWidget *hbox; ReturnStatus ret; gchar scratch[64], *firmware, *string; - gint val, width, height; + gint val; - GtkWidget *frame, *table, *menu; + GtkWidget *frame, *table; /* make sure we have a handle */ g_return_val_if_fail(handle != NULL, NULL); + /* Check if this screen supports GVO */ + + ret = NvCtrlGetAttribute(handle, NV_CTRL_GVO_SUPPORTED, &val); + if ((ret != NvCtrlSuccess) || (val != NV_CTRL_GVO_SUPPORTED_TRUE)) { + /* GVO not available */ + return NULL; + } + /* create and initialize the object */ object = g_object_new(CTK_TYPE_GVO, NULL); ctk_gvo = CTK_GVO(object); ctk_gvo->handle = handle; - ctk_gvo->ctk_config = ctk_config; - ctk_gvo->ctk_event = ctk_event; - - /* Query the current GVO state */ - if ( !query_init_gvo_state(ctk_gvo) ) { - // Free the object - g_object_ref(object); - gtk_object_sink(GTK_OBJECT(object)); - g_object_unref(object); - return NULL; - } - - /* Query the width, height and refresh rate for each video format */ + /* + * Query the validness, width, height and refresh rate for each + * video format + */ query_video_format_details(ctk_gvo); @@ -655,162 +464,30 @@ GtkWidget* ctk_gvo_new(NvCtrlAttributeHandle *handle, 0, 0.5, "Current SDI State:", 0, 0.5, "Inactive"); - /* - * Clone mode options + * Requested SDI Configuration */ - - frame = gtk_frame_new("Clone Mode"); - ctk_gvo->clone_mode_frame = frame; - vbox = gtk_vbox_new(FALSE, 0); + frame = gtk_frame_new("Requested SDI Configuration"); - table = gtk_table_new(3, 2, FALSE); - gtk_table_set_row_spacings(GTK_TABLE(table), 0); - gtk_table_set_col_spacings(GTK_TABLE(table), 0); - - gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); - - /* Output Video Format */ - - menu = start_menu("Video Format: ", table, 0); - ctk_gvo->output_video_format_menu = menu; - ctk_config_set_tooltip(ctk_config, CTK_DROP_DOWN_MENU(menu)->option_menu, - __clone_mode_video_format_help); - - fill_output_video_format_menu(ctk_gvo); - - finish_menu(menu, table, 0); - - ctk_drop_down_menu_set_current_value - (CTK_DROP_DOWN_MENU(ctk_gvo->output_video_format_menu), - ctk_gvo->output_video_format); - - g_signal_connect(G_OBJECT(ctk_gvo->output_video_format_menu), - "changed", G_CALLBACK(output_video_format_ui_changed), - (gpointer) ctk_gvo); - - /* Output Data Format */ - - menu = start_menu("Data Format: ", table, 1); - ctk_gvo->output_data_format_menu = menu; - ctk_config_set_tooltip(ctk_config, CTK_DROP_DOWN_MENU(menu)->option_menu, - __clone_mode_data_format_help); - - fill_output_data_format_menu(ctk_gvo); - - finish_menu(menu, table, 1); - - ctk_drop_down_menu_set_current_value - (CTK_DROP_DOWN_MENU(ctk_gvo->output_data_format_menu), - ctk_gvo->output_data_format); - - g_signal_connect(G_OBJECT(ctk_gvo->output_data_format_menu), - "changed", G_CALLBACK(output_data_format_ui_changed), - (gpointer) ctk_gvo); - - /* Region of Interest */ - - ctk_gvo_get_video_format_resolution(ctk_gvo->output_video_format, - &width, &height); - /* NV_CTRL_GVO_X_SCREEN_PAN_X */ - - label = gtk_label_new("X Offset: "); - - alignment = gtk_alignment_new(0, 0, 0, 0); - gtk_container_add(GTK_CONTAINER(alignment), label); - - gtk_table_attach(GTK_TABLE(table), alignment, - 0, 1, 2, 3, - GTK_FILL, GTK_FILL, - TABLE_PADDING, TABLE_PADDING); - - ret = NvCtrlGetAttribute(handle, NV_CTRL_GVO_X_SCREEN_PAN_X, &val); - if (ret != NvCtrlSuccess) val = 0; - - width = ctk_gvo->screen_width - width; - if (width < 1) width = 1; - - ctk_gvo->x_offset_spin_button = - gtk_spin_button_new_with_range(0.0, width, 1); - - ctk_config_set_tooltip(ctk_config, ctk_gvo->x_offset_spin_button, - __clone_mode_x_offset_help); - - gtk_spin_button_set_value - (GTK_SPIN_BUTTON(ctk_gvo->x_offset_spin_button), val); - - g_signal_connect(G_OBJECT(ctk_gvo->x_offset_spin_button), - "value-changed", - G_CALLBACK(x_offset_ui_changed), ctk_gvo); - - hbox = gtk_hbox_new(FALSE, FALSE); - gtk_box_pack_start(GTK_BOX(hbox), ctk_gvo->x_offset_spin_button, - FALSE, FALSE, 0); - - gtk_table_attach(GTK_TABLE(table), hbox, - 1, 2, 2, 3, - GTK_FILL | GTK_EXPAND, GTK_FILL, - TABLE_PADDING, TABLE_PADDING); - - /* NV_CTRL_GVO_X_SCREEN_PAN_Y */ - - label = gtk_label_new("Y Offset: "); - alignment = gtk_alignment_new(0, 0, 0, 0); - gtk_container_add(GTK_CONTAINER(alignment), label); - - gtk_table_attach(GTK_TABLE(table), alignment, - 0, 1, 3, 4, - GTK_FILL, GTK_FILL, - TABLE_PADDING, TABLE_PADDING); - - ret = NvCtrlGetAttribute(handle, NV_CTRL_GVO_X_SCREEN_PAN_Y, &val); - if (ret != NvCtrlSuccess) val = 0; - - height = ctk_gvo->screen_height - height; - if (height < 1) height = 1; - - ctk_gvo->y_offset_spin_button = - gtk_spin_button_new_with_range(0.0, height, 1); - - gtk_spin_button_set_value - (GTK_SPIN_BUTTON(ctk_gvo->y_offset_spin_button), val); - - ctk_config_set_tooltip(ctk_config, ctk_gvo->y_offset_spin_button, - __clone_mode_y_offset_help); - - g_signal_connect(G_OBJECT(ctk_gvo->y_offset_spin_button), - "value-changed", - G_CALLBACK(y_offset_ui_changed), ctk_gvo); - - hbox = gtk_hbox_new(FALSE, FALSE); - gtk_box_pack_start(GTK_BOX(hbox), ctk_gvo->y_offset_spin_button, - FALSE, FALSE, 0); - - gtk_table_attach(GTK_TABLE(table), hbox, - 1, 2, 3, 4, - GTK_FILL | GTK_EXPAND, GTK_FILL, - TABLE_PADDING, TABLE_PADDING); - - /* - * "Enable Clone Mode" button - */ - - create_toggle_clone_mode_button(ctk_gvo); - - ctk_config_set_tooltip(ctk_config, ctk_gvo->toggle_clone_mode_button, - __clone_mode_enable_clone_mode_help); - - hbox = gtk_hbox_new(FALSE, 0); + table = gtk_table_new(2, 2, FALSE); - gtk_box_pack_end(GTK_BOX(hbox), ctk_gvo->toggle_clone_mode_button, - FALSE, FALSE, 5); + gtk_table_set_row_spacings(GTK_TABLE(table), 3); + gtk_table_set_col_spacings(GTK_TABLE(table), 15); + gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); + gtk_container_add(GTK_CONTAINER(frame), table); + ctk_gvo->current_output_video_format_label = + add_table_row(table, 3, + 0, 0.5, "Requested SDI Video Format:", + 0, 0.5, "Inactive"); + ctk_gvo->current_output_data_format_label = + add_table_row(table, 4, + 0, 0.5, "Requested SDI Data Format:", + 0, 0.5, "Inactive"); /* * Set the initial UI state @@ -818,14 +495,11 @@ GtkWidget* ctk_gvo_new(NvCtrlAttributeHandle *handle, update_gvo_current_info(ctk_gvo); - update_gvo_sensitivity(ctk_gvo); - - /* * Start listening for events */ - register_for_gvo_events(ctk_gvo); + register_for_gvo_events(ctk_gvo, ctk_event); /* show the GVO widget */ @@ -837,415 +511,20 @@ GtkWidget* ctk_gvo_new(NvCtrlAttributeHandle *handle, -/* - * create_toggle_clone_mode_button() - - */ - -static void create_toggle_clone_mode_button(CtkGvo *ctk_gvo) -{ - GtkWidget *label; - GtkWidget *hbox, *hbox2; - GdkPixbuf *pixbuf; - GtkWidget *image = NULL; - GtkWidget *button; - gboolean enabled; - - button = gtk_toggle_button_new(); - - /* create the Enable Clone Mode icon */ - - pixbuf = gtk_widget_render_icon(button, - GTK_STOCK_EXECUTE, - GTK_ICON_SIZE_BUTTON, - "Enable Clone Mode"); - if (pixbuf) image = gtk_image_new_from_pixbuf(pixbuf); - label = gtk_label_new("Enable Clone Mode"); - - hbox = gtk_hbox_new(FALSE, 2); - - if (image) gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 2); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - hbox2 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox2), hbox, FALSE, FALSE, 15); - - gtk_widget_show_all(hbox2); - - /* - * XXX increment the reference count, so that when we do - * gtk_container_remove() later, it doesn't get destroyed - */ - - gtk_object_ref(GTK_OBJECT(hbox2)); - - ctk_gvo->enable_clone_mode_label = hbox2; - - - /* create the Disable Clone Mode icon */ - - pixbuf = gtk_widget_render_icon(button, - GTK_STOCK_STOP, - GTK_ICON_SIZE_BUTTON, - "Disable Clone Mode"); - if (pixbuf) image = gtk_image_new_from_pixbuf(pixbuf); - label = gtk_label_new("Disable Clone Mode"); - - hbox = gtk_hbox_new(FALSE, 2); - - if (image) gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 2); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - - hbox2 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox2), hbox, FALSE, FALSE, 15); - - gtk_widget_show_all(hbox2); - - /* - * XXX increment the reference count, so that when we do - * gtk_container_remove() later, it doesn't get destroyed - */ - - gtk_object_ref(GTK_OBJECT(hbox2)); - - ctk_gvo->disable_clone_mode_label = hbox2; - - /* Set the initial Clone Mode enabled state */ - - enabled = (ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_CLONE); - - gtk_container_add(GTK_CONTAINER(button), - enabled ? ctk_gvo->disable_clone_mode_label : - ctk_gvo->enable_clone_mode_label); - - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), enabled); - - ctk_gvo->toggle_clone_mode_button = button; - - g_signal_connect(G_OBJECT(button), "toggled", - G_CALLBACK(clone_mode_button_ui_toggled), - GTK_OBJECT(ctk_gvo)); - -} /* create_toggle_clone_mode_button() */ - - - -/* - * start_menu() - Start the creation of a labled dropdown menu. (Packs - * the dropdown label into the table row. - */ - -static GtkWidget *start_menu(const gchar *name, GtkWidget *table, - const gint row) -{ - GtkWidget *menu, *label, *alignment; - - label = gtk_label_new(name); - alignment = gtk_alignment_new(0, 0, 0, 0); - gtk_container_add(GTK_CONTAINER(alignment), label); - - gtk_table_attach(GTK_TABLE(table), - alignment, 0, 1, row, row+1, GTK_FILL, GTK_FILL, - TABLE_PADDING, TABLE_PADDING); - - menu = ctk_drop_down_menu_new(CTK_DROP_DOWN_MENU_FLAG_MONOSPACE); - - return menu; - -} /* start_menu() */ - - - -/* - * finish_menu() - Finish/Finalize a dropdown menu. (Packs the menu in - * the table row.) - */ - -static void finish_menu(GtkWidget *menu, GtkWidget *table, const gint row) -{ - gtk_widget_show_all(menu); - - gtk_table_attach(GTK_TABLE(table), menu, 1, 2, row, row+1, - GTK_FILL | GTK_EXPAND, GTK_FILL, - TABLE_PADDING, TABLE_PADDING); -} - - - -/* - * fill_output_video_format_menu() - Populates the output video - * format menu. - */ - -static void fill_output_video_format_menu(CtkGvo *ctk_gvo) -{ - int i; - CtkDropDownMenu *dmenu = - CTK_DROP_DOWN_MENU(ctk_gvo->output_video_format_menu); - GtkWidget *label; - guint valid; - gint num_valid_entries = 0; - gchar *str; - gchar *tmp; - const gchar *constStr; - - ctk_drop_down_menu_reset(CTK_DROP_DOWN_MENU(dmenu)); - - for (i = 0; videoFormatNames[i].name; i++) { - - /* - * runtime check that videoFormatDetails[] and - * videoFormatNames[] are in sync - */ - - if (videoFormatDetails[i].format != videoFormatNames[i].format) { - nv_error_msg("GVO format tables out of alignment!"); - return; - } - - valid = ctk_gvo_video_format_valid(ctk_gvo, - videoFormatNames[i].format); - - /* Mode must be supported */ - if (!(valid & GVO_VIDEO_FORMAT_MODE_VALID)) { - continue; - } - - /* Resolution must fit (or this is the selected mode) */ - if (!(valid & GVO_VIDEO_FORMAT_RESOLUTION_VALID) && - (ctk_gvo->output_video_format != videoFormatNames[i].format)) { - continue; - } - - if (valid == GVO_VIDEO_FORMAT_VALID) { - constStr = videoFormatNames[i].name; - str = NULL; - } else { - str = g_strconcat(videoFormatNames[i].name, " -", NULL); - - if (!(valid & GVO_VIDEO_FORMAT_RESOLUTION_VALID)) { - tmp = g_strconcat(str, " Resolution mismatch", NULL); - g_free(str); - str = tmp; - } - if (!(valid & GVO_VIDEO_FORMAT_REFRESH_VALID)) { - if (!(valid & GVO_VIDEO_FORMAT_RESOLUTION_VALID)) { - tmp = g_strconcat(str, ",", NULL); - g_free(str); - str = tmp; - } - tmp = g_strconcat(str, " Refresh mismatch", NULL); - g_free(str); - str = tmp; - } - constStr = str; - } - - label = ctk_drop_down_menu_append_item(dmenu, constStr, - videoFormatNames[i].format); - if (str) { - g_free(str); - } - - /* Gray out entry if it is not valid */ - gtk_widget_set_sensitive(label, (valid == GVO_VIDEO_FORMAT_VALID)); - - if (valid == GVO_VIDEO_FORMAT_VALID) { - num_valid_entries++; - } - } - - /* Show special menu if there are no valid entries */ - if (num_valid_entries <= 0) { - nv_warning_msg("There are currently no GVO video formats valid for " - "use with Clone Mode. Please make sure that the X " - "screen resolution (currently %d x %d) is at least " - "720 x 487.\n", - ctk_gvo->screen_width, ctk_gvo->screen_height); - - ctk_drop_down_menu_reset(CTK_DROP_DOWN_MENU(dmenu)); - label = ctk_drop_down_menu_append_item(dmenu, - "*** X screen is smaller than " - "720x487 ***", - ctk_gvo->output_video_format); - gtk_widget_set_sensitive(label, FALSE); - } - -} /* fill_output_video_format_menu() */ - - - -/* - * rebuild_output_video_format_menu() - Reconsutrcts the output data format - * menu. - */ - -static void rebuild_output_video_format_menu(CtkGvo *ctk_gvo) -{ - CtkDropDownMenu *dmenu = - CTK_DROP_DOWN_MENU(ctk_gvo->output_video_format_menu); - - g_signal_handlers_block_by_func - (G_OBJECT(dmenu), - G_CALLBACK(output_video_format_ui_changed), - (gpointer) ctk_gvo); - - fill_output_video_format_menu(ctk_gvo); - - ctk_drop_down_menu_set_current_value - (CTK_DROP_DOWN_MENU(ctk_gvo->output_video_format_menu), - ctk_gvo->output_video_format); - - gtk_widget_show_all(GTK_WIDGET(dmenu)); - - g_signal_handlers_unblock_by_func - (G_OBJECT(dmenu), - G_CALLBACK(output_video_format_ui_changed), - (gpointer) ctk_gvo); - - update_gvo_sensitivity(ctk_gvo); - -} /* rebuild_output_video_format_menu() */ - - - -/* - * fill_output_data_format_menu() - Populates the output data format menu. - */ - -static void fill_output_data_format_menu(CtkGvo *ctk_gvo) -{ - int i; - CtkDropDownMenu *dmenu = - CTK_DROP_DOWN_MENU(ctk_gvo->output_data_format_menu); - GtkWidget *label; - gboolean valid; - gchar *str; - const gchar *constStr; - - ctk_drop_down_menu_reset(CTK_DROP_DOWN_MENU(dmenu)); - - for (i = 0; dataFormatNames[i].name; i++) { - valid = ctk_gvo_data_format_valid(dataFormatNames[i].format); - if (!valid && - (ctk_gvo->output_data_format != dataFormatNames[i].format)) { - continue; - } - - if (valid) { - constStr = dataFormatNames[i].name; - str = NULL; - } else { - str = g_strconcat(dataFormatNames[i].name, - " - Invalid for Clone Mode", NULL); - constStr = str; - } - - label = ctk_drop_down_menu_append_item(dmenu, constStr, - dataFormatNames[i].format); - if (str) { - g_free(str); - } - - gtk_widget_set_sensitive(label, valid); - } - -} /* fill_output_data_format_menu() */ - - - -/* - * rebuild_output_data_format_menu() - Reconsutrcts the output data format - * menu. - */ - -static void rebuild_output_data_format_menu(CtkGvo *ctk_gvo) -{ - CtkDropDownMenu *dmenu = - CTK_DROP_DOWN_MENU(ctk_gvo->output_data_format_menu); - - g_signal_handlers_block_by_func - (G_OBJECT(dmenu), - G_CALLBACK(output_data_format_ui_changed), - (gpointer) ctk_gvo); - - fill_output_data_format_menu(ctk_gvo); - - ctk_drop_down_menu_set_current_value - (CTK_DROP_DOWN_MENU(ctk_gvo->output_data_format_menu), - ctk_gvo->output_data_format); - - gtk_widget_show_all(GTK_WIDGET(dmenu)); - - g_signal_handlers_unblock_by_func - (G_OBJECT(dmenu), - G_CALLBACK(output_data_format_ui_changed), - (gpointer) ctk_gvo); - - update_gvo_sensitivity(ctk_gvo); - -} /* rebuild_output_data_format_menu() */ - - - - /**** Initialization Functions ***********************************************/ /* - * query_init_gvo_state() - Query the initial GVO state so we can setup - * the UI correctly. + * query_video_format_details() - initialize the videoFormatDetails[] + * table by querying each of refresh rate, width, and height from + * NV-CONTROL. */ -static gboolean query_init_gvo_state(CtkGvo *ctk_gvo) +static void query_video_format_details(CtkGvo *ctk_gvo) { - gint val; ReturnStatus ret; NVCTRLAttributeValidValuesRec valid; + gint i, val; - - /* Check if this screen supports GVO */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVO_SUPPORTED, &val); - if ((ret != NvCtrlSuccess) || (val != NV_CTRL_GVO_SUPPORTED_TRUE)) { - /* GVO not available */ - return FALSE; - } - - /* Get this GVO device's capabilities */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVO_CAPABILITIES, &val); - if (ret != NvCtrlSuccess) return FALSE; - ctk_gvo->caps = val; - - /* Query the current GVO lock owner (GVO enabled/disabled) */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVO_LOCK_OWNER, &val); - if (ret != NvCtrlSuccess) return FALSE; - ctk_gvo->lock_owner = val; - - /* Query the sync mode */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVO_SYNC_MODE, &val); - if (ret != NvCtrlSuccess) { - val = NV_CTRL_GVO_SYNC_MODE_FREE_RUNNING; - } - ctk_gvo->sync_mode = val; - - /* Query the current input/output video formats */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT, - &val); - if (ret != NvCtrlSuccess) { - val = NV_CTRL_GVIO_VIDEO_FORMAT_NONE; - } - ctk_gvo->input_video_format = val; - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, - &val); - if (ret != NvCtrlSuccess) { - val = DEFAULT_OUTPUT_VIDEO_FORMAT; - } - ctk_gvo->output_video_format = val; - /* Valid output video formats */ ret = NvCtrlGetValidAttributeValues(ctk_gvo->handle, @@ -1256,11 +535,11 @@ static gboolean query_init_gvo_state(CtkGvo *ctk_gvo) } else { ctk_gvo->valid_output_video_format_mask[0] = valid.u.bits.ints; } - + ret = NvCtrlGetValidAttributeValues(ctk_gvo->handle, NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT2, &valid); - + if ((ret != NvCtrlSuccess) || (valid.type != ATTRIBUTE_TYPE_INT_BITS)) { ctk_gvo->valid_output_video_format_mask[1] = 0; } else { @@ -1277,36 +556,6 @@ static gboolean query_init_gvo_state(CtkGvo *ctk_gvo) ctk_gvo->valid_output_video_format_mask[2] = valid.u.bits.ints; } - /* Output data format */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, NV_CTRL_GVO_DATA_FORMAT, &val); - if (ret != NvCtrlSuccess) { - val = DEFAULT_OUTPUT_DATA_FORMAT; - } - ctk_gvo->output_data_format = val; - - /* Get the current screen dimensions */ - - ctk_gvo->screen_width = NvCtrlGetScreenWidth(ctk_gvo->handle); - ctk_gvo->screen_height = NvCtrlGetScreenHeight(ctk_gvo->handle); - - return TRUE; - -} /* query_init_gvo_state() */ - - - -/* - * query_video_format_details() - initialize the videoFormatDetails[] - * table by querying each of refresh rate, width, and height from - * NV-CONTROL. - */ - -static void query_video_format_details(CtkGvo *ctk_gvo) -{ - ReturnStatus ret; - gint i, val; - for (i = 0; videoFormatDetails[i].format != -1; i++) { ret = NvCtrlGetDisplayAttribute(ctk_gvo->handle, @@ -1346,346 +595,70 @@ static void query_video_format_details(CtkGvo *ctk_gvo) * GVO related evens. */ -static void register_for_gvo_events(CtkGvo *ctk_gvo) +static void register_for_gvo_events(CtkGvo *ctk_gvo, CtkEvent *ctk_event) { - g_signal_connect(G_OBJECT(ctk_gvo->ctk_event), + g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT), G_CALLBACK(gvo_event_received), (gpointer) ctk_gvo); - g_signal_connect(G_OBJECT(ctk_gvo->ctk_event), + g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_GVO_DATA_FORMAT), G_CALLBACK(gvo_event_received), (gpointer) ctk_gvo); - g_signal_connect(G_OBJECT(ctk_gvo->ctk_event), - CTK_EVENT_NAME(NV_CTRL_GVO_X_SCREEN_PAN_X), - G_CALLBACK(gvo_event_received), - (gpointer) ctk_gvo); - - g_signal_connect(G_OBJECT(ctk_gvo->ctk_event), - CTK_EVENT_NAME(NV_CTRL_GVO_X_SCREEN_PAN_Y), - G_CALLBACK(gvo_event_received), - (gpointer) ctk_gvo); - - g_signal_connect(G_OBJECT(ctk_gvo->ctk_event), + g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_GVO_LOCK_OWNER), G_CALLBACK(gvo_event_received), (gpointer) ctk_gvo); - /* Ask for screen change notify events so we can - * know when to reconstruct the output video format drop down - */ - - g_signal_connect(G_OBJECT(ctk_gvo->ctk_event), - "CTK_EVENT_RRScreenChangeNotify", - G_CALLBACK(screen_changed_handler), - (gpointer) ctk_gvo); - } /* register_for_gvo_events() */ -/**** User Interface Update Functions ****************************************/ - -/* - * output_video_format_ui_changed() - callback when the user makes a - * selection from the output video format menu (from the UI.) - */ - -static void output_video_format_ui_changed(CtkDropDownMenu *menu, - gpointer user_data) -{ - CtkGvo *ctk_gvo = CTK_GVO(user_data); - guint was_valid; - - was_valid = ctk_gvo_video_format_valid(ctk_gvo, - ctk_gvo->output_video_format); - - ctk_gvo->output_video_format = ctk_drop_down_menu_get_current_value(menu); - - if (ctk_gvo_video_format_valid(ctk_gvo, ctk_gvo->output_video_format) != - GVO_VIDEO_FORMAT_VALID) { - /* Video format is invalid, don't set it */ - update_gvo_sensitivity(ctk_gvo); - return; - } - - NvCtrlSetAttribute(ctk_gvo->handle, - NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, - ctk_gvo->output_video_format); - - /* Rebuild menu to remove previously invalid entry */ - if (was_valid != GVO_VIDEO_FORMAT_VALID) { - rebuild_output_video_format_menu(ctk_gvo); - } - - update_gvo_sensitivity(ctk_gvo); - - /* Made GVO banner to update current output video format */ - CTK_GVO_BANNER(ctk_gvo->banner)->output_video_format = - ctk_gvo->output_video_format; - - post_output_video_format_changed(ctk_gvo); - -} /* output_video_format_ui_changed() */ - - - -/* - * output_data_format_ui_changed() - callback when the output data format - * menu changes - */ - -static void output_data_format_ui_changed(CtkDropDownMenu *menu, - gpointer user_data) -{ - CtkGvo *ctk_gvo = CTK_GVO(user_data); - gboolean was_valid; - - - was_valid = ctk_gvo_data_format_valid(ctk_gvo->output_data_format); - - ctk_gvo->output_data_format = ctk_drop_down_menu_get_current_value(menu); - - if (!ctk_gvo_data_format_valid(ctk_gvo->output_data_format)) { - /* Data format is invalid, don't set it */ - update_gvo_sensitivity(ctk_gvo); - return; - } - - NvCtrlSetAttribute(ctk_gvo->handle, NV_CTRL_GVO_DATA_FORMAT, - ctk_gvo->output_data_format); - - /* Rebuild menu to remove previously invalid entry */ - if (!was_valid) { - rebuild_output_data_format_menu(ctk_gvo); - } - - update_gvo_sensitivity(ctk_gvo); - - /* Made GVO banner to update current output data format */ - CTK_GVO_BANNER(ctk_gvo->banner)->output_data_format = - ctk_gvo->output_data_format; - - post_output_data_format_changed(ctk_gvo); - -} /* output_data_format_ui_changed() */ - - - -/* - * x_offset_ui_changed() - Updates the X Server with the current setting of - * the spin button. - */ - -static void x_offset_ui_changed(GtkSpinButton *spinbutton, gpointer user_data) -{ - CtkGvo *ctk_gvo = CTK_GVO(user_data); - gint val; - - val = gtk_spin_button_get_value(spinbutton); - - NvCtrlSetAttribute(ctk_gvo->handle, NV_CTRL_GVO_X_SCREEN_PAN_X, val); - -} /* x_offset_ui_changed() */ - - - -/* - * y_offset_ui_changed() - Updates the X Server with the current setting of - * the spin button. - */ - -static void y_offset_ui_changed(GtkSpinButton *spinbutton, gpointer user_data) -{ - CtkGvo *ctk_gvo = CTK_GVO(user_data); - gint val; - - val = gtk_spin_button_get_value(spinbutton); - - NvCtrlSetAttribute(ctk_gvo->handle, NV_CTRL_GVO_X_SCREEN_PAN_Y, val); - -} /* y_offset_ui_changed() */ - - +/**** Common Update Functions ************************************************/ /* - * clone_mode_button_ui_toggled() - Updates the X server to enable/disable - * clone mode when the UI button is toggled. + * update_gvo_current_info() - Updates the page's information to reflect + * the GVO device's current state. */ -static void clone_mode_button_ui_toggled(GtkWidget *button, gpointer user_data) +static void update_gvo_current_info(CtkGvo *ctk_gvo) { - CtkGvo *ctk_gvo = CTK_GVO(user_data); - gboolean enabled; + int width; + int height; ReturnStatus ret; - gint val; - - enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); - - if (enabled) val = NV_CTRL_GVO_DISPLAY_X_SCREEN_ENABLE; - else val = NV_CTRL_GVO_DISPLAY_X_SCREEN_DISABLE; - - ret = NvCtrlSetDisplayAttributeWithReply(ctk_gvo->handle, - 0, /* display_mask */ - NV_CTRL_GVO_DISPLAY_X_SCREEN, - val); - - if (ret == NvCtrlSuccess) { - - /* - * XXX NV_CTRL_GVO_DISPLAY_X_SCREEN can silently fail if GLX - * locked GVO output for use by pbuffer(s). Check that the - * setting actually stuck. - */ - - ret = NvCtrlGetAttribute(ctk_gvo->handle, - NV_CTRL_GVO_LOCK_OWNER, - &ctk_gvo->lock_owner); - } - - if ((ret != NvCtrlSuccess) || - (enabled && - (ctk_gvo->lock_owner != NV_CTRL_GVO_LOCK_OWNER_CLONE))) { - - /* - * setting did not apply; restore the button to its previous - * state - */ - - g_signal_handlers_block_matched - (G_OBJECT(button), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, - G_CALLBACK(clone_mode_button_ui_toggled), NULL); - - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), !enabled); - - g_signal_handlers_unblock_matched - (G_OBJECT(button), G_SIGNAL_MATCH_FUNC, 0, 0, NULL, - G_CALLBACK(clone_mode_button_ui_toggled), NULL); + gchar res_string[64], state_string[64]; + int output_video_format; + int output_data_format; + int lock_owner; - // XXX update the status bar; maybe pop up a dialog box? - return; + ret = NvCtrlGetAttribute(ctk_gvo->handle, + NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT, + &output_video_format); + if (ret != NvCtrlSuccess) { + output_video_format = NV_CTRL_GVIO_VIDEO_FORMAT_NONE; } - - post_clone_mode_button_toggled(ctk_gvo); - -} /* clone_mode_button_ui_toggled() */ - - - -/**** Common Update Functions ************************************************/ - -/* - * post_output_video_format_changed() - Makes sure the CPL does the right - * things after the output video format has been changed. (by UI interaction - * or through an NV-CONTROL event. - * - */ - -static void post_output_video_format_changed(CtkGvo *ctk_gvo) -{ - /* Update UI state */ - - update_gvo_current_info(ctk_gvo); - - update_offset_spin_button_ranges(ctk_gvo); - - ctk_config_statusbar_message(ctk_gvo->ctk_config, - "Output Video Format set to: %s.", - ctk_gvio_get_video_format_name - (ctk_gvo->output_video_format)); - -} /* post_output_video_format_changed() */ - - - -/* - * post_output_data_format_changed() - Makes sure the CPL does the right - * things after the output data format has been changed (by UI interaction - * or through an NV-CONTROL event. - */ - -static void post_output_data_format_changed(CtkGvo *ctk_gvo) -{ - ctk_config_statusbar_message - (ctk_gvo->ctk_config, - "Output Data Format set to: %s.", - ctk_gvo_get_data_format_name(ctk_gvo->output_data_format)); - -} /* post_output_data_format_changed() */ - - -/* - * post_clone_mode_button_toggled() - Makes sure the CPL does the right - * things after clone mode is enabled/disabled (by UI interaction or - * through an NV-CONTROL event. - */ - -static void post_clone_mode_button_toggled(CtkGvo *ctk_gvo) -{ - GList *children; - GList *child; - gboolean enabled; - - children = gtk_container_get_children - (GTK_CONTAINER(ctk_gvo->toggle_clone_mode_button)); - - for (child = children; child; child = child->next) { - gtk_container_remove - (GTK_CONTAINER(ctk_gvo->toggle_clone_mode_button), - (GtkWidget *) child->data); + ret = NvCtrlGetAttribute(ctk_gvo->handle, + NV_CTRL_GVO_DATA_FORMAT, + &output_data_format); + if (ret != NvCtrlSuccess) { + output_data_format = -1; } - g_list_free(children); - - enabled = - (ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_CLONE); - - if (enabled) { - gtk_container_add(GTK_CONTAINER(ctk_gvo->toggle_clone_mode_button), - ctk_gvo->disable_clone_mode_label); - } else { - gtk_container_add(GTK_CONTAINER(ctk_gvo->toggle_clone_mode_button), - ctk_gvo->enable_clone_mode_label); + ret = NvCtrlGetAttribute(ctk_gvo->handle, + NV_CTRL_GVO_LOCK_OWNER, + &lock_owner); + if (ret != NvCtrlSuccess) { + lock_owner = NV_CTRL_GVO_LOCK_OWNER_NONE; } - - /* Update UI state */ - - update_gvo_current_info(ctk_gvo); - - update_gvo_sensitivity(ctk_gvo); - - ctk_config_statusbar_message(ctk_gvo->ctk_config, "Clone Mode %s.", - enabled ? "enabled" : "disabled"); - -} /* post_clone_mode_button_toggled() */ - -/* - * update_gvo_current_info() - Updates the page's information to reflect - * the GVO device's current state. - * - * This function must be called when the following have changed: - * - * ctk_gvo->lock_owner - * ctk_gvo->output_video_format - - */ - -static void update_gvo_current_info(CtkGvo *ctk_gvo) -{ - int width; - int height; - gchar res_string[64], state_string[64]; - /* Get the current video format sizes */ - ctk_gvo_get_video_format_resolution(ctk_gvo->output_video_format, - &width, &height); + ctk_gvo_get_video_format_resolution(output_video_format, &width, &height); - switch (ctk_gvo->lock_owner) { + switch (lock_owner) { case NV_CTRL_GVO_LOCK_OWNER_NONE: snprintf(res_string, 64, "Inactive"); @@ -1693,10 +666,7 @@ static void update_gvo_current_info(CtkGvo *ctk_gvo) break; case NV_CTRL_GVO_LOCK_OWNER_CLONE: - snprintf(res_string, 64, "%d x %d", width, height); - snprintf(state_string, 64, "In use by X (Clone mode)"); - break; - + /* fall through for compatibility */ case NV_CTRL_GVO_LOCK_OWNER_X_SCREEN: snprintf(res_string, 64, "%d x %d", width, height); snprintf(state_string, 64, "In use by X"); @@ -1706,7 +676,7 @@ static void update_gvo_current_info(CtkGvo *ctk_gvo) snprintf(res_string, 64, "%d x %d", width, height); snprintf(state_string, 64, "In use by GLX"); break; - + default: return; } @@ -1721,75 +691,19 @@ static void update_gvo_current_info(CtkGvo *ctk_gvo) state_string); } -} /* update_gvo_current_info() */ - - - -/* - * update_offset_spin_button_ranges() - Updates the range of the - * offset spin buttons based on the current screen's width/height. - */ - -static void update_offset_spin_button_ranges(CtkGvo *ctk_gvo) -{ - gint w, h, x, y; - - ctk_gvo_get_video_format_resolution(ctk_gvo->output_video_format, - &w, &h); - - x = ctk_gvo->screen_width - w; - y = ctk_gvo->screen_height - h; - - gtk_spin_button_set_range - (GTK_SPIN_BUTTON(ctk_gvo->x_offset_spin_button), 0, x); - gtk_spin_button_set_range - (GTK_SPIN_BUTTON(ctk_gvo->y_offset_spin_button), 0, y); - -} /* update_offset_spin_button_ranges() */ - - - -/* - * update_gvo_sensitivity() - Set the sensitivity of the GVO panel's widgets - */ - -static void update_gvo_sensitivity(CtkGvo *ctk_gvo) -{ - gboolean sensitive; - guint video_format_valid; - gboolean data_format_valid; - - sensitive = ((ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_NONE) || - (ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_CLONE)); - - gtk_widget_set_sensitive(ctk_gvo->clone_mode_frame, sensitive); - - if (sensitive) { - - /* Video & data formats */ - - sensitive = (ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_NONE); - gtk_widget_set_sensitive(ctk_gvo->output_video_format_menu, sensitive); - gtk_widget_set_sensitive(ctk_gvo->output_data_format_menu, sensitive); - - /* Enable/Disable clone mode button */ - - video_format_valid = - ctk_gvo_video_format_valid(ctk_gvo, ctk_gvo->output_video_format); - - data_format_valid = - ctk_gvo_data_format_valid(ctk_gvo->output_data_format); + if (ctk_gvo->current_output_video_format_label) { + gtk_label_set_text + (GTK_LABEL(ctk_gvo->current_output_video_format_label), + ctk_gvio_get_video_format_name(output_video_format)); + } - sensitive = - (ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_CLONE) || - ((ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_NONE) && - (video_format_valid == GVO_VIDEO_FORMAT_VALID) && - data_format_valid); - - gtk_widget_set_sensitive(ctk_gvo->toggle_clone_mode_button, sensitive); + if (ctk_gvo->current_output_data_format_label) { + gtk_label_set_text + (GTK_LABEL(ctk_gvo->current_output_data_format_label), + ctk_gvo_get_data_format_name(output_data_format)); } -} /* update_gvo_sensitivity() */ +} /* update_gvo_current_info() */ @@ -1803,165 +717,16 @@ static void gvo_event_received(GtkObject *object, gpointer arg1, gpointer user_data) { - CtkEventStruct *event_struct = (CtkEventStruct *) arg1; - CtkGvo *ctk_gvo = CTK_GVO(user_data); - GtkWidget *widget; - gint attribute = event_struct->attribute; - gint value = event_struct->value; - gboolean active; - - - switch (attribute) { - - case NV_CTRL_GVIO_REQUESTED_VIDEO_FORMAT: - widget = ctk_gvo->output_video_format_menu; - - ctk_gvo->output_video_format = value; - - rebuild_output_video_format_menu(ctk_gvo); - - post_output_video_format_changed(ctk_gvo); - break; - - case NV_CTRL_GVO_DATA_FORMAT: - widget = ctk_gvo->output_data_format_menu; - - ctk_gvo->output_data_format = value; - - rebuild_output_data_format_menu(ctk_gvo); - - post_output_data_format_changed(ctk_gvo); - break; - - case NV_CTRL_GVO_X_SCREEN_PAN_X: - widget = ctk_gvo->x_offset_spin_button; - - g_signal_handlers_block_by_func(G_OBJECT(widget), - G_CALLBACK(x_offset_ui_changed), - (gpointer) ctk_gvo); - - gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), value); - - g_signal_handlers_unblock_by_func(G_OBJECT(widget), - G_CALLBACK(x_offset_ui_changed), - (gpointer) ctk_gvo); - break; - - case NV_CTRL_GVO_X_SCREEN_PAN_Y: - widget = ctk_gvo->y_offset_spin_button; - - g_signal_handlers_block_by_func(G_OBJECT(widget), - G_CALLBACK(y_offset_ui_changed), - (gpointer) ctk_gvo); - - gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), value); - - g_signal_handlers_unblock_by_func(G_OBJECT(widget), - G_CALLBACK(y_offset_ui_changed), - (gpointer) ctk_gvo); - break; - - case NV_CTRL_GVO_LOCK_OWNER: - widget = ctk_gvo->toggle_clone_mode_button; - - g_signal_handlers_block_by_func - (G_OBJECT(widget), - G_CALLBACK(clone_mode_button_ui_toggled), - ctk_gvo); - - ctk_gvo->lock_owner = value; - active = (value != NV_CTRL_GVO_LOCK_OWNER_NONE); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), active); - - post_clone_mode_button_toggled(ctk_gvo); - - g_signal_handlers_unblock_by_func - (G_OBJECT(widget), - G_CALLBACK(clone_mode_button_ui_toggled), - ctk_gvo); - break; - } + update_gvo_current_info(CTK_GVO(user_data)); } /* gvo_event_received(() */ -/* - * screen_changed_handler() - Handle XRandR screen size update events. - */ - -static void screen_changed_handler(GtkWidget *widget, - XRRScreenChangeNotifyEvent *ev, - gpointer data) -{ - CtkGvo *ctk_gvo = CTK_GVO(data); - - /* Cache the new screen dimensions */ - - ctk_gvo->screen_width = ev->width; - ctk_gvo->screen_height = ev->height; - - /* Update UI */ - - rebuild_output_video_format_menu(ctk_gvo); - - rebuild_output_data_format_menu(ctk_gvo); - - update_gvo_current_info(ctk_gvo); - - update_offset_spin_button_ranges(ctk_gvo); - - update_gvo_sensitivity(ctk_gvo); - -} /* screen_changed_handler() */ - - - /**** Callback Handlers ******************************************************/ /* - * ctk_gvo_probe_callback() - This function gets called when the - * GVO probe occurs so that we can update the state of attributes that - * do not emit events. - * - * These attributes are: - * - * - NV_CTRL_GVO_SDI_SYNC_INPUT_DETECTED - * - NV_CTRL_GVO_COMPOSITE_SYNC_INPUT_DETECTED - * - NV_CTRL_GVIO_DETECTED_VIDEO_FORMAT - * - */ - -gint ctk_gvo_probe_callback(gpointer data) -{ - CtkGvo *ctk_gvo = CTK_GVO(data); - gint old_input_format = ctk_gvo->input_video_format; - gint old_sync_mode = ctk_gvo->sync_mode; - - /* Update our copies of some SDI state variables */ - - ctk_gvo->input_video_format = - CTK_GVO_BANNER(ctk_gvo->banner)->input_video_format; - - ctk_gvo->sync_mode = - CTK_GVO_BANNER(ctk_gvo->banner)->sync_mode; - - if ((ctk_gvo->lock_owner == NV_CTRL_GVO_LOCK_OWNER_NONE) && - ((old_input_format != ctk_gvo->input_video_format) || - (old_sync_mode != ctk_gvo->sync_mode))) { - - /* update the available output video formats */ - - rebuild_output_video_format_menu(ctk_gvo); - } - - return TRUE; - -} /* ctk_gvo_probe_callback() */ - - -/* * ctk_gvo_select() - Called when the ctk_gvo page is selected */ @@ -1972,8 +737,7 @@ void ctk_gvo_select(GtkWidget *widget) /* Grab the GVO banner */ ctk_gvo_banner_set_parent(CTK_GVO_BANNER(ctk_gvo->banner), - ctk_gvo->banner_box, - ctk_gvo_probe_callback, ctk_gvo); + ctk_gvo->banner_box, NULL, NULL); } /* ctk_gvo_select() */ @@ -2025,33 +789,10 @@ GtkTextBuffer* ctk_gvo_create_help(GtkTextTagTable *table) ctk_help_heading(b, &i, "Current SDI State"); ctk_help_para(b, &i, __general_current_sdi_state_help); - ctk_help_heading(b, &i, "Clone Mode"); - ctk_help_para(b, &i, "This section allows configuration and operation " - "of the SDI device in Clone Mode."); - ctk_help_heading(b, &i, "Video Format"); - ctk_help_para(b, &i, "%s The current size of the associated X screen " - "will limit the available clone mode video formats such " - "that only video modes that are smaller than or equal to " - "the current X screen size will be available. Also, the " - "current Sync Mode may limit available modes when not in " - "Free-Running (see Synchronization Options page for more " - "information).", __clone_mode_video_format_help); - ctk_help_heading(b, &i, "Data Format"); - ctk_help_para(b, &i, "%s Note that other NV-CONTROL clients are still " - "able to select a data format that is not supported with " - "clone mode. In this case, the current data format will " - "be shown as \"Invalid for Clone Mode\" and you will need " - "to select a valid data format in order to enable Clone " - "Mode.", __clone_mode_data_format_help); - ctk_help_heading(b, &i, "X Offset"); - ctk_help_para(b, &i, __clone_mode_x_offset_help); - ctk_help_heading(b, &i, "Y Offset"); - ctk_help_para(b, &i, __clone_mode_y_offset_help); - ctk_help_heading(b, &i, "Enable Clone Mode"); - ctk_help_para(b, &i, "%s Clone mode may only be enabled when the SDI " - "device is currently free (It is not being used by other " - "modes such as OpenGL, TwinView, or Separate X Screens).", - __clone_mode_enable_clone_mode_help); + ctk_help_heading(b, &i, "Requested SDI Video Format"); + ctk_help_para(b, &i, __requested_sdi_video_format_help); + ctk_help_heading(b, &i, "Requested SDI Data Format"); + ctk_help_para(b, &i, __requested_sdi_data_format_help); ctk_help_finish(b); diff --git a/src/gtk+-2.x/ctkgvo.h b/src/gtk+-2.x/ctkgvo.h index 2c5cf53..a5a073c 100644 --- a/src/gtk+-2.x/ctkgvo.h +++ b/src/gtk+-2.x/ctkgvo.h @@ -54,49 +54,21 @@ typedef struct _CtkGvoClass CtkGvoClass; struct _CtkGvo { GtkVBox parent; - NvCtrlAttributeHandle *handle; - GtkWidget *parent_window; - CtkConfig *ctk_config; - CtkEvent *ctk_event; - - /* State */ - - gint caps; // Capabilities - gint lock_owner; - - gint sync_mode; - gint input_video_format; + /* State */ - gint output_video_format; guint valid_output_video_format_mask[3]; - - gint output_data_format; - - gint screen_width; - gint screen_height; /* Widgets */ GtkWidget *banner_box; GtkWidget *banner; - GtkWidget *current_resolution_label; GtkWidget *current_state_label; - - GtkWidget *clone_mode_frame; - - GtkWidget *output_video_format_menu; - GtkWidget *output_data_format_menu; - - GtkWidget *x_offset_spin_button; - GtkWidget *y_offset_spin_button; - - GtkWidget *toggle_clone_mode_button; - GtkWidget *enable_clone_mode_label; - GtkWidget *disable_clone_mode_label; + GtkWidget *current_output_video_format_label; + GtkWidget *current_output_data_format_label; }; @@ -126,8 +98,6 @@ GtkWidget* ctk_gvo_new (NvCtrlAttributeHandle *, void ctk_gvo_select (GtkWidget *); void ctk_gvo_unselect (GtkWidget *); GtkTextBuffer* ctk_gvo_create_help (GtkTextTagTable *); -void ctk_gvo_pack_banner_slot (CtkGvoBanner *, gint slot, gint new); -gint ctk_gvo_probe (gpointer data); diff --git a/src/gtk+-2.x/ctkhelp.c b/src/gtk+-2.x/ctkhelp.c index 1ca7cd0..24b8bed 100644 --- a/src/gtk+-2.x/ctkhelp.c +++ b/src/gtk+-2.x/ctkhelp.c @@ -20,7 +20,7 @@ #include <gtk/gtk.h> #include "ctkhelp.h" -#include "msg.h" +#include "common-utils.h" #include "ctkconstants.h" #include "ctkbanner.h" @@ -51,6 +51,7 @@ GType ctk_help_get_type( sizeof (CtkHelp), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_help_type = g_type_register_static diff --git a/src/gtk+-2.x/ctkimagesliders.c b/src/gtk+-2.x/ctkimagesliders.c index fb6a190..3fff22e 100644 --- a/src/gtk+-2.x/ctkimagesliders.c +++ b/src/gtk+-2.x/ctkimagesliders.c @@ -32,10 +32,6 @@ static const char *__digital_vibrance_help = "The Digital Vibrance slider " "alters the level of Digital Vibrance for this display device."; -static const char *__overscan_compensation_help = "The Overscan Compensation " -"slider adjusts the amount of overscan compensation applied to this display " -"device, in raster pixels."; - static const char *__image_sharpening_help = "The Image Sharpening slider " "alters the level of Image Sharpening for this display device."; @@ -45,11 +41,14 @@ static GtkWidget * add_scale(CtkConfig *ctk_config, char *name, const char *help, gint value_type, + gint default_value, gpointer callback_data); static void setup_scale(CtkImageSliders *ctk_image_sliders, int attribute, GtkWidget *scale); +static void setup_reset_button(CtkImageSliders *ctk_image_sliders); + static void scale_value_changed(GtkAdjustment *adjustment, gpointer user_data); @@ -59,7 +58,7 @@ static void scale_value_received(GtkObject *, gpointer arg1, gpointer); GType ctk_image_sliders_get_type(void) { static GType ctk_image_sliders_type = 0; - + if (!ctk_image_sliders_type) { static const GTypeInfo ctk_image_sliders_info = { sizeof (CtkImageSlidersClass), @@ -71,6 +70,7 @@ GType ctk_image_sliders_get_type(void) sizeof (CtkImageSliders), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_image_sliders_type = g_type_register_static (GTK_TYPE_VBOX, @@ -84,59 +84,49 @@ GType ctk_image_sliders_get_type(void) GtkWidget* ctk_image_sliders_new(NvCtrlAttributeHandle *handle, CtkConfig *ctk_config, CtkEvent *ctk_event, GtkWidget *reset_button, - unsigned int display_device_mask, char *name) { CtkImageSliders *ctk_image_sliders; - + GObject *object; - + GtkWidget *frame; GtkWidget *vbox; ReturnStatus status; gint val; - + /* * now that we know that we will have atleast one attribute, * create the object */ object = g_object_new(CTK_TYPE_IMAGE_SLIDERS, NULL); + if (!object) return NULL; ctk_image_sliders = CTK_IMAGE_SLIDERS(object); ctk_image_sliders->handle = handle; ctk_image_sliders->ctk_config = ctk_config; ctk_image_sliders->ctk_event = ctk_event; ctk_image_sliders->reset_button = reset_button; - ctk_image_sliders->display_device_mask = display_device_mask; ctk_image_sliders->name = name; - - /* cache image sharpening default value */ - status = NvCtrlGetDisplayAttribute(ctk_image_sliders->handle, - ctk_image_sliders->display_device_mask, - NV_CTRL_IMAGE_SHARPENING_DEFAULT, - &val); - if (status != NvCtrlSuccess) { - val = 0; - } - ctk_image_sliders->default_val = val; - /* create the frame and vbox */ - + frame = gtk_frame_new(NULL); vbox = gtk_vbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(vbox), FRAME_PADDING); gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_box_pack_start(GTK_BOX(object), frame, FALSE, FALSE, 0); ctk_image_sliders->frame = frame; - + /* Digital Vibrance */ - + ctk_image_sliders->digital_vibrance = add_scale(ctk_config, NV_CTRL_DIGITAL_VIBRANCE, "Digital Vibrance", - __digital_vibrance_help, G_TYPE_DOUBLE, ctk_image_sliders); + __digital_vibrance_help, G_TYPE_INT, + 0, /* default value */ + ctk_image_sliders); g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_DIGITAL_VIBRANCE), @@ -146,28 +136,19 @@ GtkWidget* ctk_image_sliders_new(NvCtrlAttributeHandle *handle, gtk_box_pack_start(GTK_BOX(vbox), ctk_image_sliders->digital_vibrance, TRUE, TRUE, 0); - /* Overscan Compensation */ - - ctk_image_sliders->overscan_compensation = - add_scale(ctk_config, - NV_CTRL_OVERSCAN_COMPENSATION, "Overscan Compensation", - __overscan_compensation_help, G_TYPE_INT, - ctk_image_sliders); - - g_signal_connect(G_OBJECT(ctk_event), - CTK_EVENT_NAME(NV_CTRL_OVERSCAN_COMPENSATION), - G_CALLBACK(scale_value_received), - (gpointer) ctk_image_sliders); + /* Image Sharpening */ - gtk_box_pack_start(GTK_BOX(vbox), ctk_image_sliders->overscan_compensation, - TRUE, TRUE, 0); + status = NvCtrlGetAttribute(ctk_image_sliders->handle, + NV_CTRL_IMAGE_SHARPENING_DEFAULT, + &val); + if (status != NvCtrlSuccess) { + val = 0; + } - /* Image Sharpening */ - ctk_image_sliders->image_sharpening = add_scale(ctk_config, NV_CTRL_IMAGE_SHARPENING, "Image Sharpening", - __image_sharpening_help, G_TYPE_DOUBLE, ctk_image_sliders); + __image_sharpening_help, G_TYPE_INT, val, ctk_image_sliders); g_signal_connect(G_OBJECT(ctk_event), CTK_EVENT_NAME(NV_CTRL_IMAGE_SHARPENING), @@ -184,23 +165,8 @@ GtkWidget* ctk_image_sliders_new(NvCtrlAttributeHandle *handle, ctk_image_sliders_setup(ctk_image_sliders); return GTK_WIDGET(object); - -} /* ctk_image_sliders_new() */ - - -/* - * Returns whether or not the scale is active - */ - -static gint get_scale_active(CtkScale *scale) -{ - GtkAdjustment *adj = scale->gtk_adjustment; - - return - GPOINTER_TO_INT(g_object_get_data(G_OBJECT(adj), "attribute active")); - -} /* get_scale_active() */ +} /* ctk_image_sliders_new() */ @@ -214,33 +180,32 @@ static GtkWidget * add_scale(CtkConfig *ctk_config, char *name, const char *help, gint value_type, + gint default_value, gpointer callback_data) { GtkObject *adj; GtkWidget *scale; - + adj = gtk_adjustment_new(0, 0, 10, 1, 1, 0); - + g_object_set_data(G_OBJECT(adj), "attribute", GINT_TO_POINTER(attribute)); g_object_set_data(G_OBJECT(adj), "attribute name", name); - - g_object_set_data(G_OBJECT(adj), "attribute active", - GINT_TO_POINTER(0)); + + g_object_set_data(G_OBJECT(adj), "attribute default value", + GINT_TO_POINTER(default_value)); g_signal_connect(G_OBJECT(adj), "value_changed", G_CALLBACK(scale_value_changed), (gpointer) callback_data); - + scale = ctk_scale_new(GTK_ADJUSTMENT(adj), name, ctk_config, value_type); - - if (help) { - ctk_config_set_tooltip(ctk_config, CTK_SCALE_TOOLTIP_WIDGET(scale), - help); - } - + + ctk_config_set_tooltip(ctk_config, CTK_SCALE_TOOLTIP_WIDGET(scale), + help); + return scale; } /* add_scale() */ @@ -259,12 +224,12 @@ static void post_scale_value_changed(GtkAdjustment *adjustment, gint value) { char *name = g_object_get_data(G_OBJECT(adjustment), "attribute name"); - + gtk_widget_set_sensitive(ctk_image_sliders->reset_button, TRUE); ctk_config_statusbar_message(ctk_image_sliders->ctk_config, "%s set to %d.", name, value); - + } /* post_scale_value_changed() */ @@ -289,11 +254,10 @@ static void scale_value_changed(GtkAdjustment *adjustment, user_data = g_object_get_data(G_OBJECT(adjustment), "attribute"); attribute = GPOINTER_TO_INT(user_data); - - NvCtrlSetDisplayAttribute(ctk_image_sliders->handle, - ctk_image_sliders->display_device_mask, - attribute, (int) value); - + + NvCtrlSetAttribute(ctk_image_sliders->handle, + attribute, (int) value); + post_scale_value_changed(adjustment, ctk_image_sliders, value); } /* scale_value_changed() */ @@ -301,51 +265,45 @@ static void scale_value_changed(GtkAdjustment *adjustment, /* - * ctk_image_sliders_reset() - + * ctk_image_sliders_reset() - resets sliders to their default values */ void ctk_image_sliders_reset(CtkImageSliders *ctk_image_sliders) { + GtkAdjustment *adj; + gint val; + if (!ctk_image_sliders) return; - if (get_scale_active(CTK_SCALE(ctk_image_sliders->digital_vibrance))) { - NvCtrlSetDisplayAttribute(ctk_image_sliders->handle, - ctk_image_sliders->display_device_mask, - NV_CTRL_DIGITAL_VIBRANCE, - 0); - } + if (GTK_WIDGET_SENSITIVE(ctk_image_sliders->digital_vibrance)) { + adj = CTK_SCALE(ctk_image_sliders->digital_vibrance)->gtk_adjustment; + val = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(adj), + "attribute default value")); - /* - * Reset IMAGE_SHARPENING before OVERSCAN_COMPENSATION, even though they're - * in the other order in the page, because setting OVERSCAN_COMPENSATION to - * 0 may cause IMAGE_SHARPENING to become unavailable and trying to reset it - * here would cause a BadValue error. - */ - if (get_scale_active(CTK_SCALE(ctk_image_sliders->image_sharpening))) { - NvCtrlSetDisplayAttribute(ctk_image_sliders->handle, - ctk_image_sliders->display_device_mask, - NV_CTRL_IMAGE_SHARPENING, - ctk_image_sliders->default_val); + NvCtrlSetAttribute(ctk_image_sliders->handle, + NV_CTRL_DIGITAL_VIBRANCE, + val); } - if (get_scale_active(CTK_SCALE(ctk_image_sliders->overscan_compensation))) { - NvCtrlSetDisplayAttribute(ctk_image_sliders->handle, - ctk_image_sliders->display_device_mask, - NV_CTRL_OVERSCAN_COMPENSATION, - 0); + if (GTK_WIDGET_SENSITIVE(ctk_image_sliders->image_sharpening)) { + adj = CTK_SCALE(ctk_image_sliders->image_sharpening)->gtk_adjustment; + val = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(adj), + "attribute default value")); + + NvCtrlSetAttribute(ctk_image_sliders->handle, + NV_CTRL_IMAGE_SHARPENING, + val); } /* - * The above may have triggered events (e.g., changing - * NV_CTRL_OVERSCAN_COMPENSATION may trigger an - * NV_CTRL_IMAGE_SHARPENING value change). Such an event will + * The above may have triggered events. Such an event will * cause scale_value_changed() and post_scale_value_changed() to * be called when control returns to the gtk_main loop. * post_scale_value_changed() will write a status message to the * statusbar. * * However, the caller of ctk_image_sliders_reset() (e.g., - * ctkdisplaydevice-dfp.c:reset_button_clicked()) may also want to + * ctkdisplaydevice.c:reset_button_clicked()) may also want to * write a status message to the statusbar. To ensure that the * caller's statusbar message takes precedence (i.e., is the last * thing written to the statusbar), process any generated events @@ -357,7 +315,7 @@ void ctk_image_sliders_reset(CtkImageSliders *ctk_image_sliders) } ctk_image_sliders_setup(ctk_image_sliders); - + } /* ctk_image_sliders_reset() */ @@ -372,9 +330,8 @@ static void scale_value_received(GtkObject *object, gpointer arg1, gpointer user_data) { CtkEventStruct *event_struct; - CtkImageSliders *ctk_image_sliders = - CTK_IMAGE_SLIDERS(user_data); - + CtkImageSliders *ctk_image_sliders = CTK_IMAGE_SLIDERS(user_data); + GtkAdjustment *adj; GtkWidget *scale; gint val; @@ -382,20 +339,10 @@ static void scale_value_received(GtkObject *object, gpointer arg1, event_struct = (CtkEventStruct *) arg1; - /* if the event is not for this display device, return */ - - if (!(event_struct->display_mask & - ctk_image_sliders->display_device_mask)) { - return; - } - switch (event_struct->attribute) { case NV_CTRL_DIGITAL_VIBRANCE: scale = ctk_image_sliders->digital_vibrance; break; - case NV_CTRL_OVERSCAN_COMPENSATION: - scale = ctk_image_sliders->overscan_compensation; - break; case NV_CTRL_IMAGE_SHARPENING: scale = ctk_image_sliders->image_sharpening; break; @@ -445,11 +392,6 @@ void add_image_sliders_help(CtkImageSliders *ctk_image_sliders, "including 2D, 3D, and video appear brighter and " "crisper (even on flat panels) in your applications."); - ctk_help_heading(b, i, "Overscan Compensation"); - ctk_help_para(b, i, "Use the Overscan Compensation slider to adjust the " - "size of the display, to adjust for the overscan behavior of " - "certain display devices."); - ctk_help_heading(b, i, "Image Sharpening"); ctk_help_para(b, i, "Use the Image Sharpening slider to adjust the " "sharpness of the image quality by amplifying high " @@ -470,17 +412,15 @@ static void setup_scale(CtkImageSliders *ctk_image_sliders, ReturnStatus ret0, ret1; NVCTRLAttributeValidValuesRec valid; NvCtrlAttributeHandle *handle = ctk_image_sliders->handle; - unsigned int mask = ctk_image_sliders->display_device_mask; int val; GtkAdjustment *adj = CTK_SCALE(scale)->gtk_adjustment; - + /* Read settings from X server */ - ret0 = NvCtrlGetValidDisplayAttributeValues(handle, mask, - attribute, &valid); - - ret1 = NvCtrlGetDisplayAttribute(handle, mask, attribute, &val); - + ret0 = NvCtrlGetValidAttributeValues(handle, attribute, &valid); + + ret1 = NvCtrlGetAttribute(handle, attribute, &val); + if ((ret0 == NvCtrlSuccess) && (ret1 == NvCtrlSuccess) && (valid.type == ATTRIBUTE_TYPE_RANGE)) { @@ -496,20 +436,62 @@ static void setup_scale(CtkImageSliders *ctk_image_sliders, g_signal_handlers_unblock_by_func(adj, scale_value_changed, ctk_image_sliders); - g_object_set_data(G_OBJECT(adj), "attribute active", - GINT_TO_POINTER(1)); - gtk_widget_set_sensitive(scale, TRUE); } else { - g_object_set_data(G_OBJECT(adj), "attribute active", - GINT_TO_POINTER(0)); - gtk_widget_set_sensitive(scale, FALSE); } } /* setup_scale() */ + +static void setup_reset_button(CtkImageSliders *ctk_image_sliders) +{ + GtkWidget *scale; + GtkAdjustment *adj; + gint default_val; + gint current_val; + + + /* Reset button should be sensitive if all scales are sensitive and + * at least one scale is set to the non-default value + */ + + scale = ctk_image_sliders->digital_vibrance; + if (GTK_WIDGET_SENSITIVE(scale)) { + adj = CTK_SCALE(scale)->gtk_adjustment; + current_val = (gint) gtk_adjustment_get_value(adj); + default_val = + GPOINTER_TO_INT(g_object_get_data(G_OBJECT(adj), + "attribute default value")); + if (current_val != default_val) { + goto enable; + } + } + + scale = ctk_image_sliders->image_sharpening; + if (GTK_WIDGET_SENSITIVE(scale)) { + adj = CTK_SCALE(scale)->gtk_adjustment; + current_val = (gint) gtk_adjustment_get_value(adj); + default_val = + GPOINTER_TO_INT(g_object_get_data(G_OBJECT(adj), + "attribute default value")); + if (current_val != default_val) { + goto enable; + } + } + + /* Don't disable reset button here, since other settings that are not + * managed by the ctk_image_slider here may need it enabled + */ + return; + + enable: + gtk_widget_set_sensitive(ctk_image_sliders->reset_button, TRUE); +} + + + /* * Updates the page to reflect the current configuration of * the display device. @@ -519,27 +501,18 @@ void ctk_image_sliders_setup(CtkImageSliders *ctk_image_sliders) if (!ctk_image_sliders) return; /* Update sliders */ - + /* NV_CTRL_DIGITAL_VIBRANCE */ - + setup_scale(ctk_image_sliders, NV_CTRL_DIGITAL_VIBRANCE, ctk_image_sliders->digital_vibrance); - /* NV_CTRL_OVERSCAN_COMPENSATION */ - - setup_scale(ctk_image_sliders, NV_CTRL_OVERSCAN_COMPENSATION, - ctk_image_sliders->overscan_compensation); - /* NV_CTRL_IMAGE_SHARPENING */ - + setup_scale(ctk_image_sliders, NV_CTRL_IMAGE_SHARPENING, ctk_image_sliders->image_sharpening); - gtk_widget_set_sensitive(ctk_image_sliders->digital_vibrance, - get_scale_active(CTK_SCALE(ctk_image_sliders->digital_vibrance))); - gtk_widget_set_sensitive(ctk_image_sliders->overscan_compensation, - get_scale_active(CTK_SCALE(ctk_image_sliders->overscan_compensation))); - gtk_widget_set_sensitive(ctk_image_sliders->image_sharpening, - get_scale_active(CTK_SCALE(ctk_image_sliders->image_sharpening))); + + setup_reset_button(ctk_image_sliders); } /* ctk_image_sliders_setup() */ diff --git a/src/gtk+-2.x/ctkimagesliders.h b/src/gtk+-2.x/ctkimagesliders.h index b900cf7..1ded2ac 100644 --- a/src/gtk+-2.x/ctkimagesliders.h +++ b/src/gtk+-2.x/ctkimagesliders.h @@ -51,20 +51,18 @@ typedef struct _CtkImageSlidersClass CtkImageSlidersClass; struct _CtkImageSliders { GtkVBox parent; - + NvCtrlAttributeHandle *handle; - unsigned int display_device_mask; char *name; CtkConfig *ctk_config; CtkEvent *ctk_event; GtkWidget *reset_button; - + GtkWidget *frame; + GtkWidget *digital_vibrance; - GtkWidget *overscan_compensation; GtkWidget *image_sharpening; - gint default_val; }; struct _CtkImageSlidersClass @@ -76,7 +74,6 @@ GType ctk_image_sliders_get_type (void) G_GNUC_CONST; GtkWidget* ctk_image_sliders_new (NvCtrlAttributeHandle *, CtkConfig *, CtkEvent *, GtkWidget *reset_button, - unsigned int display_device_mask, char *name); void ctk_image_sliders_reset(CtkImageSliders *); diff --git a/src/gtk+-2.x/ctklicense.c b/src/gtk+-2.x/ctklicense.c index fc0308c..02027a7 100644 --- a/src/gtk+-2.x/ctklicense.c +++ b/src/gtk+-2.x/ctklicense.c @@ -121,6 +121,7 @@ GType ctk_license_dialog_get_type(void) sizeof (CtkLicenseDialog), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_license_dialog_type = g_type_register_static(GTK_TYPE_VBOX, diff --git a/src/gtk+-2.x/ctkmultisample.c b/src/gtk+-2.x/ctkmultisample.c index 7596965..c58862c 100644 --- a/src/gtk+-2.x/ctkmultisample.c +++ b/src/gtk+-2.x/ctkmultisample.c @@ -134,21 +134,23 @@ static const char *__texture_sharpening_help = #define __LOG_ANISO_RANGE (1 << 2) #define __TEXTURE_SHARPEN (1 << 3) #define __FSAA (1 << 4) -#define __FSAA_NONE (1 << (__FSAA + NV_CTRL_FSAA_MODE_NONE)) -#define __FSAA_2x (1 << (__FSAA + NV_CTRL_FSAA_MODE_2x)) -#define __FSAA_2x_5t (1 << (__FSAA + NV_CTRL_FSAA_MODE_2x_5t)) -#define __FSAA_15x15 (1 << (__FSAA + NV_CTRL_FSAA_MODE_15x15)) -#define __FSAA_2x2 (1 << (__FSAA + NV_CTRL_FSAA_MODE_2x2)) -#define __FSAA_4x (1 << (__FSAA + NV_CTRL_FSAA_MODE_4x)) -#define __FSAA_4x_9t (1 << (__FSAA + NV_CTRL_FSAA_MODE_4x_9t)) -#define __FSAA_8x (1 << (__FSAA + NV_CTRL_FSAA_MODE_8x)) -#define __FSAA_16x (1 << (__FSAA + NV_CTRL_FSAA_MODE_16x)) -#define __FSAA_8xS (1 << (__FSAA + NV_CTRL_FSAA_MODE_8xS)) -#define __FSAA_8xQ (1 << (__FSAA + NV_CTRL_FSAA_MODE_8xQ)) -#define __FSAA_16xS (1 << (__FSAA + NV_CTRL_FSAA_MODE_16xS)) -#define __FSAA_16xQ (1 << (__FSAA + NV_CTRL_FSAA_MODE_16xQ)) -#define __FSAA_32xS (1 << (__FSAA + NV_CTRL_FSAA_MODE_32xS)) -#define __FSAA_ENHANCE (1 << (__FSAA + NV_CTRL_FSAA_MODE_MAX +1)) +#define __FSAA_NONE (__FSAA << NV_CTRL_FSAA_MODE_NONE) +#define __FSAA_2x (__FSAA << NV_CTRL_FSAA_MODE_2x) +#define __FSAA_2x_5t (__FSAA << NV_CTRL_FSAA_MODE_2x_5t) +#define __FSAA_15x15 (__FSAA << NV_CTRL_FSAA_MODE_15x15) +#define __FSAA_2x2 (__FSAA << NV_CTRL_FSAA_MODE_2x2) +#define __FSAA_4x (__FSAA << NV_CTRL_FSAA_MODE_4x) +#define __FSAA_4x_9t (__FSAA << NV_CTRL_FSAA_MODE_4x_9t) +#define __FSAA_8x (__FSAA << NV_CTRL_FSAA_MODE_8x) +#define __FSAA_16x (__FSAA << NV_CTRL_FSAA_MODE_16x) +#define __FSAA_8xS (__FSAA << NV_CTRL_FSAA_MODE_8xS) +#define __FSAA_8xQ (__FSAA << NV_CTRL_FSAA_MODE_8xQ) +#define __FSAA_16xS (__FSAA << NV_CTRL_FSAA_MODE_16xS) +#define __FSAA_16xQ (__FSAA << NV_CTRL_FSAA_MODE_16xQ) +#define __FSAA_32xS (__FSAA << NV_CTRL_FSAA_MODE_32xS) +#define __FSAA_32x (__FSAA << NV_CTRL_FSAA_MODE_32x) +#define __FSAA_64xS (__FSAA << NV_CTRL_FSAA_MODE_64xS) +#define __FSAA_ENHANCE (__FSAA << (NV_CTRL_FSAA_MODE_MAX + 1)) #define FRAME_PADDING 5 @@ -169,6 +171,7 @@ GType ctk_multisample_get_type( sizeof (CtkMultisample), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_multisample_type = @@ -526,6 +529,8 @@ static void build_fsaa_translation_table(CtkMultisample *ctk_multisample, gint i, n = 0; gint index_8xs = -1; gint index_16x = -1; + gint index_32x = -1; + gint index_32xs = -1; gint mask = valid.u.bits.ints; ctk_multisample->fsaa_translation_table_size = 0; @@ -543,15 +548,17 @@ static void build_fsaa_translation_table(CtkMultisample *ctk_multisample, if (i == NV_CTRL_FSAA_MODE_8xS) index_8xs = n; if (i == NV_CTRL_FSAA_MODE_16x) index_16x = n; + if (i == NV_CTRL_FSAA_MODE_32x) index_32x = n; + if (i == NV_CTRL_FSAA_MODE_32xS) index_32xs = n; n++; } } /* - * XXX 8xS was added to the NV_CTRL_FSAA_MODE list after 16x, but - * should appear before it in the slider. If both were added to - * the fsaa_translation_table[], then swap their positions. + * XXX 8xS was added to the NV_CTRL_FSAA_MODE list after 16x, but should + * appear before it in the slider. Same with 32x and 32xS. If both were + * added to the fsaa_translation_table[], then re-order them appropriately. */ if ((index_8xs != -1) && (index_16x != -1)) { @@ -560,7 +567,14 @@ static void build_fsaa_translation_table(CtkMultisample *ctk_multisample, ctk_multisample->fsaa_translation_table[index_16x] = NV_CTRL_FSAA_MODE_8xS; } - + + if ((index_32x != -1) && (index_32xs != -1)) { + ctk_multisample->fsaa_translation_table[index_32x] = + NV_CTRL_FSAA_MODE_32xS; + ctk_multisample->fsaa_translation_table[index_32xs] = + NV_CTRL_FSAA_MODE_32x; + } + ctk_multisample->fsaa_translation_table_size = n; } /* build_fsaa_translation_table() */ diff --git a/src/gtk+-2.x/ctkopengl.c b/src/gtk+-2.x/ctkopengl.c index d18d3ca..97f957e 100644 --- a/src/gtk+-2.x/ctkopengl.c +++ b/src/gtk+-2.x/ctkopengl.c @@ -48,6 +48,8 @@ static void post_stereo_eyes_exchange_button_toggled(CtkOpenGL *, gboolean); static void post_aa_line_gamma_toggled(CtkOpenGL *, gboolean); +static void post_use_conformant_clamping_button_toggled(CtkOpenGL *, gint); + static void allow_flipping_button_toggled(GtkWidget *, gpointer); static void force_stereo_button_toggled (GtkWidget *, gpointer); @@ -58,6 +60,8 @@ static void stereo_eyes_exchange_button_toggled (GtkWidget *, gpointer); static void aa_line_gamma_toggled (GtkWidget *, gpointer); +static void use_conformant_clamping_button_toggled(GtkWidget *, gpointer); + static void show_sli_visual_indicator_button_toggled (GtkWidget *, gpointer); static void show_multigpu_visual_indicator_button_toggled (GtkWidget *, gpointer); @@ -142,6 +146,12 @@ static const char *__stereo_eyes_exchange_help = "eye image in the right eye and vice versa for stereo " "drawables. This option is applied immediately."; +static const char *__use_conformant_clamping_help = +"Disabling this option causes OpenGL to replace GL_CLAMP with " +"GL_CLAMP_TO_EDGE for borderless 2D textures. This eliminates " +"seams at the edges of textures in some older games such as " +"Quake 3."; + #define __SYNC_TO_VBLANK (1 << 1) #define __ALLOW_FLIPPING (1 << 2) #define __AA_LINE_GAMMA_VALUE (1 << 3) @@ -153,6 +163,7 @@ static const char *__stereo_eyes_exchange_help = #define __SHOW_SLI_VISUAL_INDICATOR (1 << 9) #define __STEREO_EYES_EXCHANGE (1 << 10) #define __SHOW_MULTIGPU_VISUAL_INDICATOR (1 << 11) +#define __CONFORMANT_CLAMPING (1 << 12) @@ -173,6 +184,7 @@ GType ctk_opengl_get_type( sizeof (CtkOpenGL), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_opengl_type = g_type_register_static (GTK_TYPE_VBOX, @@ -206,6 +218,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle, NVCTRLAttributeValidValuesRec image_settings_valid; gint image_settings_value; gint aa_line_gamma; + gint use_conformant_clamping; gint show_sli_visual_indicator; gint show_multigpu_visual_indicator; @@ -216,6 +229,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle, ReturnStatus ret_stereo_eyes_exchange; ReturnStatus ret_image_settings; ReturnStatus ret_aa_line_gamma; + ReturnStatus ret_use_conformant_clamping; ReturnStatus ret_show_sli_visual_indicator; ReturnStatus ret_show_multigpu_visual_indicator; @@ -252,6 +266,11 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle, ret_aa_line_gamma = NvCtrlGetAttribute(handle, NV_CTRL_OPENGL_AA_LINE_GAMMA, &aa_line_gamma); + + ret_use_conformant_clamping = + NvCtrlGetAttribute(handle, NV_CTRL_TEXTURE_CLAMPING, + &use_conformant_clamping); + ret_show_sli_visual_indicator = NvCtrlGetAttribute(handle, NV_CTRL_SHOW_SLI_VISUAL_INDICATOR, &show_sli_visual_indicator); @@ -267,6 +286,7 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle, (ret_stereo_eyes_exchange != NvCtrlSuccess) && (ret_image_settings != NvCtrlSuccess) && (ret_aa_line_gamma != NvCtrlSuccess) && + (ret_use_conformant_clamping != NvCtrlSuccess) && (ret_show_sli_visual_indicator != NvCtrlSuccess) && (ret_show_multigpu_visual_indicator != NvCtrlSuccess)) { return NULL; @@ -565,6 +585,37 @@ GtkWidget* ctk_opengl_new(NvCtrlAttributeHandle *handle, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(check_button))); } + + /* + * NV_CTRL_TEXTURE_CLAMPING + */ + + if (ret_use_conformant_clamping == NvCtrlSuccess) { + label = gtk_label_new("Use Conformant Texture Clamping"); + + check_button = gtk_check_button_new(); + gtk_container_add(GTK_CONTAINER(check_button), label); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_button), + use_conformant_clamping); + + gtk_box_pack_start(GTK_BOX(vbox), check_button, FALSE, FALSE, 0); + + g_signal_connect(G_OBJECT(check_button), "toggled", + G_CALLBACK(use_conformant_clamping_button_toggled), + (gpointer) ctk_opengl); + + g_signal_connect(G_OBJECT(ctk_event), + CTK_EVENT_NAME(NV_CTRL_TEXTURE_CLAMPING), + G_CALLBACK(value_changed), (gpointer) ctk_opengl); + + ctk_config_set_tooltip(ctk_config, check_button, + __use_conformant_clamping_help); + + ctk_opengl->active_attributes |= __CONFORMANT_CLAMPING; + + ctk_opengl->use_conformant_clamping_button = check_button; + } if (ret_show_sli_visual_indicator == NvCtrlSuccess) { @@ -696,6 +747,15 @@ static void post_aa_line_gamma_toggled(CtkOpenGL *ctk_opengl, enabled ? "enabled" : "disabled"); } +static void +post_use_conformant_clamping_button_toggled(CtkOpenGL *ctk_opengl, + int clamping) +{ + ctk_config_statusbar_message(ctk_opengl->ctk_config, + "Use %sConformant OpenGL Texture Clamping", + (clamping == NV_CTRL_TEXTURE_CLAMPING_SPEC) ? + "" : "Non-"); +} static void vblank_sync_button_toggled( GtkWidget *widget, @@ -826,6 +886,24 @@ static void aa_line_gamma_toggled( post_aa_line_gamma_toggled(ctk_opengl, enabled); } +static void use_conformant_clamping_button_toggled(GtkWidget *widget, + gpointer user_data) +{ + CtkOpenGL *ctk_opengl; + int clamping; + + ctk_opengl = CTK_OPENGL(user_data); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { + clamping = NV_CTRL_TEXTURE_CLAMPING_SPEC; + } else { + clamping = NV_CTRL_TEXTURE_CLAMPING_EDGE; + } + + NvCtrlSetAttribute(ctk_opengl->handle, NV_CTRL_TEXTURE_CLAMPING, clamping); + + post_use_conformant_clamping_button_toggled(ctk_opengl, clamping); +} /* @@ -877,6 +955,13 @@ static void value_changed(GtkObject *object, gpointer arg1, gpointer user_data) gtk_widget_set_sensitive(ctk_opengl->aa_line_gamma_scale, event_struct->value); break; + case NV_CTRL_TEXTURE_CLAMPING: + button = + GTK_TOGGLE_BUTTON(ctk_opengl->use_conformant_clamping_button); + func = G_CALLBACK(use_conformant_clamping_button_toggled); + post_use_conformant_clamping_button_toggled(ctk_opengl, + event_struct->value); + break; case NV_CTRL_SHOW_SLI_VISUAL_INDICATOR: button = GTK_TOGGLE_BUTTON(ctk_opengl->show_sli_visual_indicator_button); func = G_CALLBACK(show_sli_visual_indicator_button_toggled); @@ -1201,6 +1286,11 @@ GtkTextBuffer *ctk_opengl_create_help(GtkTextTagTable *table, ctk_help_para(b, &i, __aa_line_gamma_slider_help); } + if (ctk_opengl->active_attributes & __CONFORMANT_CLAMPING) { + ctk_help_heading(b, &i, "Use Conformant Texture Clamping"); + ctk_help_para(b, &i, __use_conformant_clamping_help); + } + if (ctk_opengl->active_attributes & __SHOW_SLI_VISUAL_INDICATOR) { ctk_help_heading(b, &i, "SLI Visual Indicator"); ctk_help_para(b, &i, "This option draws information about the current " diff --git a/src/gtk+-2.x/ctkopengl.h b/src/gtk+-2.x/ctkopengl.h index 6a5c6de..be88c94 100644 --- a/src/gtk+-2.x/ctkopengl.h +++ b/src/gtk+-2.x/ctkopengl.h @@ -55,6 +55,7 @@ struct _CtkOpenGL GtkWidget *sync_to_vblank_button; GtkWidget *allow_flipping_button; + GtkWidget *use_conformant_clamping_button; GtkWidget *force_stereo_button; GtkWidget *xinerama_stereo_button; GtkWidget *stereo_eyes_exchange_button; diff --git a/src/gtk+-2.x/ctkpowermizer.c b/src/gtk+-2.x/ctkpowermizer.c index 23c3bac..da791ce 100644 --- a/src/gtk+-2.x/ctkpowermizer.c +++ b/src/gtk+-2.x/ctkpowermizer.c @@ -100,6 +100,7 @@ GType ctk_powermizer_get_type(void) sizeof (CtkPowermizer), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_powermizer_type = diff --git a/src/gtk+-2.x/ctkpowersavings.c b/src/gtk+-2.x/ctkpowersavings.c index 744b4a4..fe293ce 100644 --- a/src/gtk+-2.x/ctkpowersavings.c +++ b/src/gtk+-2.x/ctkpowersavings.c @@ -54,6 +54,7 @@ GType ctk_power_savings_get_type(void) sizeof (CtkPowerSavings), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_power_savings_type = g_type_register_static (GTK_TYPE_VBOX, diff --git a/src/gtk+-2.x/ctkrandr.c b/src/gtk+-2.x/ctkrandr.c deleted file mode 100644 index 322b410..0000000 --- a/src/gtk+-2.x/ctkrandr.c +++ b/dev/null @@ -1,644 +0,0 @@ -/* - * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix - * and Linux systems. - * - * Copyright (C) 2004 NVIDIA Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses>. - */ - -#include <stdlib.h> /* malloc */ -#include <gtk/gtk.h> -#include <gdk/gdkx.h> -#include <gdk-pixbuf/gdk-pixdata.h> - -#include <X11/Xlib.h> -#include <X11/extensions/Xrandr.h> - -#include "ctkevent.h" -#include "ctkhelp.h" -#include "ctkrandr.h" -#include "ctkbanner.h" - -#include "rotation_orientation_horz_pixdata.h" -#include "rotation_orientation_vert_pixdata.h" - -#include "rotate_left_on_pixdata.h" -#include "rotate_left_off_pixdata.h" -#include "rotate_right_on_pixdata.h" -#include "rotate_right_off_pixdata.h" - - -GType ctk_randr_get_type(void) -{ - static GType ctk_randr_type = 0; - - if (!ctk_randr_type) { - static const GTypeInfo ctk_randr_info = { - sizeof (CtkRandRClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - NULL, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof(CtkRandR), - 0, /* n_preallocs */ - NULL, /* instance_init */ - }; - - ctk_randr_type = g_type_register_static - (GTK_TYPE_VBOX, "CtkRandR", &ctk_randr_info, 0); - } - - return ctk_randr_type; -} - - - -/* - * Human readable rotation settings - */ -static char *get_rotation_string(int rotation) -{ - switch ( rotation ) { - case RR_Rotate_0: - return "Normal (0 degree rotation)"; - break; - case RR_Rotate_90: - return "Rotated left (90 degree rotation)"; - break; - case RR_Rotate_180: - return "Inverted (180 degree rotation)"; - break; - case RR_Rotate_270: - return "Rotated right (270 degree rotation)"; - break; - default: - return "Unknown rotation"; - break; - } -} - - - -/* - * Helper function to flip the contents of a pixbuf - * horizontally. This is used to perform a 180 degree - * rotation + vertical flip. - */ - -static void horz_flip_pixbuf(GdkPixbuf *pixbuf) -{ - guchar *pixels; - int width; - int height; - int rowstride; // # bytes per row - int bits_per_sample; // # bits per color sample - int n_channels; // # color samples per component - - guchar *row; - guchar *head; - guchar *tail; - int x, y, c; - int component_size; - - /* Get pixbuf information */ - pixels = gdk_pixbuf_get_pixels(pixbuf); - width = gdk_pixbuf_get_width(pixbuf); - height = gdk_pixbuf_get_height(pixbuf); - rowstride = gdk_pixbuf_get_rowstride(pixbuf); - bits_per_sample = gdk_pixbuf_get_bits_per_sample(pixbuf); - n_channels = gdk_pixbuf_get_n_channels(pixbuf); - - /* Compute the number of bytes per component (RGB/RGBA) */ - component_size = n_channels * (bits_per_sample / 8); - - /* Swap all components in all rows */ - for (y = 0; y < height; y++) { - - row = pixels + (y * rowstride); - head = row; - tail = row + (width - 1) * (component_size); - - for (x = 0; x < width/2; x++) { - - for (c = 0; c < component_size; c++) { - guchar h = head[c]; - head[c] = tail[c]; - tail[c] = h; - } - head += component_size; - tail -= component_size; - } - } - -} /* horz_flip_pixbuf() */ - - - -/* - * Helper function to load the correctly oriented pixbuf - * orientation image from the nv_image dump repository - */ -static GdkPixbuf *load_orientation_image_pixbuf(Rotation rotation) -{ - const GdkPixdata *pixdata; - GdkPixbuf *pixbuf; - gboolean tweak_img; /* Rotate and flip image */ - - - /* Figure out which image and rotation to use */ - switch ( rotation ) { - case RR_Rotate_0: /* Normal */ - pixdata = &rotation_orientation_horz_pixdata; - tweak_img = FALSE; - break; - case RR_Rotate_90: /* Left */ - pixdata = &rotation_orientation_vert_pixdata; - tweak_img = TRUE; - break; - case RR_Rotate_180: /* Inverted */ - pixdata = &rotation_orientation_horz_pixdata; - tweak_img = TRUE; - break; - case RR_Rotate_270: /* Right */ - pixdata = &rotation_orientation_vert_pixdata; - tweak_img = FALSE; - break; - default: /* Unknown */ - pixdata = &rotation_orientation_horz_pixdata; - tweak_img = FALSE; - break; - } - - - /* Generate the pixbuf from the pixdata */ - pixbuf = gdk_pixbuf_from_pixdata(pixdata, TRUE, NULL); - if (!pixbuf) { - return NULL; - } - - - /* Image requires 180 degree rotation + vertical flip, - * this is the same as a horizontal flip. - */ - if (tweak_img) { - horz_flip_pixbuf(pixbuf); - } - - return pixbuf; - -} /* load_orientation_image_pixbuf() */ - - - -/* - * Makes widgets associated with rotation reflect the given - * rotation setting. - */ -static void update_rotation(CtkRandR *ctk_randr, Rotation rotation) -{ - /* Update screen image */ - gtk_image_set_from_pixbuf(ctk_randr->orientation_image, - ctk_randr->orientation_image_pixbufs[rotation]); - - /* Update label */ - gtk_label_set_text(ctk_randr->label, - get_rotation_string(rotation)); - - - /* Update the status bar */ - ctk_config_statusbar_message(ctk_randr->ctk_config, - "Screen rotation set to %s.", - get_rotation_string(rotation)); - -} /* update_rotation() */ - - - -/* - * When XRandR events happens outside of the control panel, - * they are trapped by this function so the gui can be updated - * with the new rotation setting. - */ -void ctk_randr_event_handler(GtkWidget *widget, - XRRScreenChangeNotifyEvent *ev, - gpointer data) -{ - update_rotation((CtkRandR *)data, ev->rotation); -} /* ctk_randr_event_handler() */ - - - -/* - * Rotate left button event handlers - */ -static void do_button_rotate_left_clicked(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - int orig_rotation; - int rotation; - int rotations; - ReturnStatus status; - - - /* Get current rotation */ - NvCtrlGetAttribute(ctk_randr->handle, NV_CTRL_ATTR_XRANDR_ROTATION, - &orig_rotation); - - /* Get available rotations */ - NvCtrlGetAttribute(ctk_randr->handle, NV_CTRL_ATTR_XRANDR_ROTATIONS, - &rotations); - - /* Find next available rotation to the left */ - rotation = orig_rotation; - do { - rotation <<= 1; - if ( rotation > 8 ) { - rotation = 1; - } - } while ( !(rotation & rotations) && (rotation != orig_rotation) ); - - /* Set rotation */ - status = NvCtrlSetAttribute(ctk_randr->handle, - NV_CTRL_ATTR_XRANDR_ROTATION, - rotation); - - /* Update widgets */ - update_rotation(ctk_randr, rotation); -} - -static void do_button_rotate_left_press(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - ctk_randr->rotate_left_button_pressed = True; - gtk_image_set_from_pixbuf(ctk_randr->rotate_left_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_ON]); -} - -static void do_button_rotate_left_release(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - ctk_randr->rotate_left_button_pressed = False; - gtk_image_set_from_pixbuf(ctk_randr->rotate_left_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_OFF]); -} - -static void do_button_rotate_left_enter(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - if ( ctk_randr->rotate_left_button_pressed ) { - gtk_image_set_from_pixbuf(ctk_randr->rotate_left_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_ON]); - } -} - -static void do_button_rotate_left_leave(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - if ( ctk_randr->rotate_left_button_pressed ) { - gtk_image_set_from_pixbuf(ctk_randr->rotate_left_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_OFF]); - } -} - - - -/* - * Rotate right button event handlers - */ -static void do_button_rotate_right_clicked(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - int orig_rotation; - int rotation; - int rotations; - ReturnStatus status; - - - /* Get current rotation */ - NvCtrlGetAttribute(ctk_randr->handle, NV_CTRL_ATTR_XRANDR_ROTATION, - &orig_rotation); - - /* Get available rotations */ - NvCtrlGetAttribute(ctk_randr->handle, NV_CTRL_ATTR_XRANDR_ROTATIONS, - &rotations); - - /* Find next available rotation to the left */ - rotation = orig_rotation; - do { - rotation >>= 1; - if ( rotation == 0 ) { - rotation = 8; - } - } while ( !(rotation & rotations) && (rotation != orig_rotation) ); - - - /* Set rotation */ - status = NvCtrlSetAttribute(ctk_randr->handle, - NV_CTRL_ATTR_XRANDR_ROTATION, - rotation); - - /* Update widgets */ - update_rotation(ctk_randr, rotation); -} - -static void do_button_rotate_right_press(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - ctk_randr->rotate_right_button_pressed = True; - gtk_image_set_from_pixbuf(ctk_randr->rotate_right_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_ON]); -} - - -static void do_button_rotate_right_release(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - ctk_randr->rotate_right_button_pressed = False; - gtk_image_set_from_pixbuf(ctk_randr->rotate_right_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_OFF]); -} - -static void do_button_rotate_right_enter(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - if ( ctk_randr->rotate_right_button_pressed ) { - gtk_image_set_from_pixbuf(ctk_randr->rotate_right_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_ON]); - } -} - -static void do_button_rotate_right_leave(GtkWidget *widget, gpointer data) -{ - CtkRandR *ctk_randr = (CtkRandR *)data; - - if ( ctk_randr->rotate_right_button_pressed ) { - gtk_image_set_from_pixbuf(ctk_randr->rotate_right_button_image, - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_OFF]); - } -} - - - -/* - * CTK RandR widget creation - * - */ -GtkWidget* ctk_randr_new(NvCtrlAttributeHandle *handle, - CtkConfig *ctk_config, - CtkEvent *ctk_event) -{ - GObject *object; - CtkRandR *ctk_randr; - - Bool ret; /* NvCtrlxxx function return value */ - int rotation_supported; - int rotation; - - - - /* Make sure we have a handle */ - g_return_val_if_fail(handle != NULL, NULL); - - - /* Check if this screen supports rotation */ - ret = NvCtrlGetAttribute(handle, NV_CTRL_ATTR_XRANDR_ROTATION_SUPPORTED, - &rotation_supported); - if ((ret != NvCtrlSuccess) || (!rotation_supported)) { - /* Rotation not available */ - return NULL; - } - - - /* Get the initial state of rotation */ - NvCtrlGetAttribute(handle, NV_CTRL_ATTR_XRANDR_ROTATION, &rotation); - - - /* Create the ctk object */ - object = g_object_new(CTK_TYPE_RANDR, NULL); - ctk_randr = CTK_RANDR(object); - - - /* Cache the attribute handle */ - ctk_randr->handle = handle; - - - /* Set container properties of the object */ - ctk_randr->ctk_config = ctk_config; - gtk_box_set_spacing(GTK_BOX(ctk_randr), 10); - - - /* Preload orientated screens pixbufs & image */ - ctk_randr->orientation_image_pixbufs[CTKRANDR_IMG_ROTATION_NORMAL] = - load_orientation_image_pixbuf(RR_Rotate_0); - - ctk_randr->orientation_image_pixbufs[CTKRANDR_IMG_ROTATION_LEFT] = - load_orientation_image_pixbuf(RR_Rotate_90); - - ctk_randr->orientation_image_pixbufs[CTKRANDR_IMG_ROTATION_INVERTED] = - load_orientation_image_pixbuf(RR_Rotate_180); - - ctk_randr->orientation_image_pixbufs[CTKRANDR_IMG_ROTATION_RIGHT] = - load_orientation_image_pixbuf(RR_Rotate_270); - - ctk_randr->orientation_image = - GTK_IMAGE(gtk_image_new_from_pixbuf(ctk_randr->orientation_image_pixbufs[rotation]) ); - - - /* Preload button pixbufs & images */ - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_OFF] = - gdk_pixbuf_from_pixdata(&rotate_left_off_pixdata, - TRUE, NULL); - - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_ON] = - gdk_pixbuf_from_pixdata(&rotate_left_on_pixdata, - TRUE, NULL); - - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_OFF] = - gdk_pixbuf_from_pixdata(&rotate_right_off_pixdata, - TRUE, NULL); - - ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_ON] = - gdk_pixbuf_from_pixdata(&rotate_right_on_pixdata, - TRUE, NULL); - - ctk_randr->rotate_left_button_image = - GTK_IMAGE(gtk_image_new_from_pixbuf(ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_LEFT_OFF]) ); - - ctk_randr->rotate_right_button_image = - GTK_IMAGE(gtk_image_new_from_pixbuf(ctk_randr->button_pixbufs[CTKRANDR_BTN_ROTATE_RIGHT_OFF]) ); - - - - { /* Banner image */ - GtkWidget *banner = ctk_banner_image_new(BANNER_ARTWORK_ROTATION); - gtk_box_pack_start(GTK_BOX(object), banner, FALSE, FALSE, 0); - } - - - { /* Rotation control pane */ - GtkWidget *vRotationPane = gtk_vbox_new(FALSE, 0); - GtkWidget *hStrechedControlBox = gtk_hbox_new(TRUE, 0); - GtkWidget *hControlBox = gtk_hbox_new(FALSE, 10); - - gtk_box_pack_start(GTK_BOX(object), vRotationPane, TRUE, FALSE, 0); - - gtk_box_pack_start(GTK_BOX(vRotationPane), hStrechedControlBox, - FALSE, FALSE, - 0); - - gtk_box_pack_start(GTK_BOX(hStrechedControlBox), hControlBox, - FALSE, FALSE, 0); - - - { /* Rotate left button */ - GtkWidget *vbox = gtk_vbox_new(FALSE, 0); - GtkWidget *btn_box = gtk_hbox_new(FALSE, 0); - GtkWidget *button = gtk_button_new(); - - gtk_box_pack_start(GTK_BOX(hControlBox), vbox, TRUE, FALSE, 0); - - gtk_widget_set_size_request(button, 26, 26); - ctk_config_set_tooltip(ctk_config, button, "Rotate left"); - g_signal_connect(G_OBJECT(button), "pressed", - G_CALLBACK(do_button_rotate_left_press), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "released", - G_CALLBACK(do_button_rotate_left_release), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "enter", - G_CALLBACK(do_button_rotate_left_enter), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "leave", - G_CALLBACK(do_button_rotate_left_leave), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(do_button_rotate_left_clicked), - (gpointer) (ctk_randr)); - - gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, FALSE, 0); - - gtk_container_add(GTK_CONTAINER(button), btn_box); - - gtk_container_add(GTK_CONTAINER(btn_box), - GTK_WIDGET(ctk_randr->rotate_left_button_image)); - } - - { /* Rotation orientation image */ - GtkWidget *frame = gtk_frame_new(NULL); - GtkWidget *img_box = gtk_hbox_new(TRUE, 0); - GtkWidget *hbox = gtk_hbox_new(TRUE, 0); - GtkWidget *vbox = gtk_vbox_new(TRUE, 0); - - gtk_box_pack_start(GTK_BOX(img_box), - GTK_WIDGET(ctk_randr->orientation_image), - FALSE, FALSE, 0); - gtk_container_add(GTK_CONTAINER(frame), img_box); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); - gtk_widget_set_size_request(hbox, 130, 130); - gtk_box_pack_start(GTK_BOX(hControlBox), hbox, FALSE, FALSE, 0); - } - - { /* Rotate right button */ - GtkWidget *vbox = gtk_vbox_new(FALSE, 0); - GtkWidget *btn_box = gtk_hbox_new(FALSE, 0); - GtkWidget *button = gtk_button_new(); - - gtk_box_pack_start(GTK_BOX(hControlBox), vbox, TRUE, FALSE, 0); - - gtk_widget_set_size_request(button, 26, 26); - ctk_config_set_tooltip(ctk_config, button, "Rotate right"); - g_signal_connect(G_OBJECT(button), "pressed", - G_CALLBACK(do_button_rotate_right_press), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "released", - G_CALLBACK(do_button_rotate_right_release), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "enter", - G_CALLBACK(do_button_rotate_right_enter), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "leave", - G_CALLBACK(do_button_rotate_right_leave), - (gpointer) ctk_randr); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(do_button_rotate_right_clicked), - (gpointer) (ctk_randr)); - - gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, FALSE, 0); - - gtk_container_add(GTK_CONTAINER(button), btn_box); - - gtk_container_add(GTK_CONTAINER(btn_box), - GTK_WIDGET(ctk_randr->rotate_right_button_image)); - } - - { /* Rotation label */ - ctk_randr->label = - GTK_LABEL( gtk_label_new(get_rotation_string(rotation))); - gtk_box_pack_start(GTK_BOX(vRotationPane), - GTK_WIDGET(ctk_randr->label), - TRUE, TRUE, 10); - } - - } /* Rotation control pane */ - - - - /* Show the widget */ - gtk_widget_show_all(GTK_WIDGET(ctk_randr)); - - - /* Link widget to XRandR events */ - g_signal_connect(ctk_event, "CTK_EVENT_RRScreenChangeNotify", - G_CALLBACK(ctk_randr_event_handler), - (gpointer) ctk_randr); - - - return GTK_WIDGET(ctk_randr); -} - - - -/* - * RandR help screen - */ -GtkTextBuffer *ctk_randr_create_help(GtkTextTagTable *table, - CtkRandR *ctk_randr) -{ - GtkTextIter i; - GtkTextBuffer *b; - - b = gtk_text_buffer_new(table); - - gtk_text_buffer_get_iter_at_offset(b, &i, 0); - - ctk_help_title(b, &i, "Rotation Help"); - ctk_help_para(b, &i, - "This page in the NVIDIA X Server Control Panel allows " - "you to select the desired screen orientation through " - "the XRandR extension." - ); - - ctk_help_finish(b); - - return b; -} diff --git a/src/gtk+-2.x/ctkrandr.h b/src/gtk+-2.x/ctkrandr.h deleted file mode 100644 index aed7887..0000000 --- a/src/gtk+-2.x/ctkrandr.h +++ b/dev/null @@ -1,92 +0,0 @@ -/* - * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix - * and Linux systems. - * - * Copyright (C) 2004 NVIDIA Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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 General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses>. - */ - -#ifndef __CTK_RANDR_H__ -#define __CTK_RANDR_H__ - -#include "ctkevent.h" -#include "ctkconfig.h" - -G_BEGIN_DECLS - -#define CTK_TYPE_RANDR (ctk_randr_get_type()) - -#define CTK_RANDR(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_RANDR, CtkRandR)) - -#define CTK_RANDR_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_RANDR, CtkRandRClass)) - -#define CTK_IS_RANDR(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_RANDR)) - -#define CTK_IS_RANDR_CLASS(class) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_RANDR)) - -#define CTK_RANDR_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_RANDR, CtkRandRClass)) - - -/* Image pixbuf indices */ -#define CTKRANDR_IMG_ROTATION_NORMAL RR_Rotate_0 -#define CTKRANDR_IMG_ROTATION_LEFT RR_Rotate_90 -#define CTKRANDR_IMG_ROTATION_INVERTED RR_Rotate_180 -#define CTKRANDR_IMG_ROTATION_RIGHT RR_Rotate_270 - -/* Button pixbuf indices */ -#define CTKRANDR_BTN_ROTATE_LEFT_OFF 0 -#define CTKRANDR_BTN_ROTATE_LEFT_ON 1 -#define CTKRANDR_BTN_ROTATE_RIGHT_OFF 2 -#define CTKRANDR_BTN_ROTATE_RIGHT_ON 3 - - -typedef struct _CtkRandR -{ - GtkVBox parent; - - NvCtrlAttributeHandle *handle; - CtkConfig *ctk_config; - - GtkLabel *label; - - GtkImage *orientation_image; - GdkPixbuf *orientation_image_pixbufs[9]; - - GtkImage *rotate_left_button_image; - Bool rotate_left_button_pressed; - GtkImage *rotate_right_button_image; - Bool rotate_right_button_pressed; - GdkPixbuf *button_pixbufs[4]; - -} CtkRandR; - -typedef struct _CtkRandRClass -{ - GtkVBoxClass parent_class; -} CtkRandRClass; - -GType ctk_randr_get_type (void) G_GNUC_CONST; -GtkWidget* ctk_randr_new (NvCtrlAttributeHandle *, CtkConfig *, - CtkEvent *); - -GtkTextBuffer *ctk_randr_create_help(GtkTextTagTable *, CtkRandR *); - -G_END_DECLS - -#endif /* __CTK_RANDR_H__ */ diff --git a/src/gtk+-2.x/ctkscale.c b/src/gtk+-2.x/ctkscale.c index ce0c924..5eaebff 100644 --- a/src/gtk+-2.x/ctkscale.c +++ b/src/gtk+-2.x/ctkscale.c @@ -47,6 +47,7 @@ GType ctk_scale_get_type( sizeof (CtkScale), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_scale_type = g_type_register_static (GTK_TYPE_VBOX, diff --git a/src/gtk+-2.x/ctkscreen.c b/src/gtk+-2.x/ctkscreen.c index a3fd5e3..4fa2541 100644 --- a/src/gtk+-2.x/ctkscreen.c +++ b/src/gtk+-2.x/ctkscreen.c @@ -88,6 +88,7 @@ GType ctk_screen_get_type( sizeof (CtkScreen), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_screen_type = @@ -108,76 +109,8 @@ static gchar *make_gpu_display_device_list(NvCtrlAttributeHandle *handle, int gpu_id, int xinerama_enabled) { - gchar *displays = NULL; - gchar *type; - gchar *name; - gchar *tmp_str; - unsigned int display_devices; - unsigned int mask; - Bool valid; - - - /* Get the list of enabled display devices on the GPU */ - - valid = - XNVCTRLQueryTargetAttribute(NvCtrlGetDisplayPtr(handle), - NV_CTRL_TARGET_TYPE_GPU, - gpu_id, - 0, - NV_CTRL_ENABLED_DISPLAYS, - (int *)&display_devices); - if (!valid) return NULL; - - /* If Xinerama is disabled, only show displays that are associated - * to this X screen. - */ - if (!xinerama_enabled) { - ReturnStatus ret; - unsigned int associated_devices; - - ret = NvCtrlGetAttribute(handle, - NV_CTRL_ASSOCIATED_DISPLAY_DEVICES, - (int *)&associated_devices); - if (ret == NvCtrlSuccess) { - display_devices &= associated_devices; - } - } - - /* Make the list of display device names */ - - for (mask = 1; mask; mask <<= 1) { - - if (!(mask & display_devices)) continue; - - type = display_device_mask_to_display_device_name(mask); - name = NULL; - - valid = - XNVCTRLQueryTargetStringAttribute(NvCtrlGetDisplayPtr(handle), - NV_CTRL_TARGET_TYPE_GPU, - gpu_id, - mask, - NV_CTRL_STRING_DISPLAY_DEVICE_NAME, - &name); - if (!valid) { - tmp_str = g_strdup_printf("Unknown (%s)", type); - } else { - tmp_str = g_strdup_printf("%s (%s)", name, type); - XFree(name); - } - free(type); - - if (displays) { - name = g_strdup_printf("%s,\n%s", tmp_str, displays); - g_free(displays); - g_free(tmp_str); - } else { - name = tmp_str; - } - displays = name; - } - - return displays; + return create_display_name_list_string(handle, + NV_CTRL_BINARY_DATA_DISPLAYS_ENABLED_ON_XSCREEN); } @@ -395,16 +328,14 @@ GtkWidget* ctk_screen_new(NvCtrlAttributeHandle *handle, /* get the number of gpu errors occurred */ gpu_errors = 0; - ret = NvCtrlGetDisplayAttribute(handle, - 0, - NV_CTRL_NUM_GPU_ERRORS_RECOVERED, - (int *)&gpu_errors); + ret = NvCtrlGetAttribute(handle, + NV_CTRL_NUM_GPU_ERRORS_RECOVERED, + (int *)&gpu_errors); snprintf(tmp, 16, "%d", gpu_errors); /* get the stereo mode set for this X screen */ - ret = NvCtrlGetDisplayAttribute(handle, 0, NV_CTRL_STEREO, - (int *)&stereo_mode); + ret = NvCtrlGetAttribute(handle, NV_CTRL_STEREO, (int *)&stereo_mode); if (ret != NvCtrlSuccess) { stereo_mode = -1; } @@ -625,11 +556,12 @@ static void info_update_gpu_error(GtkObject *object, gpointer arg1, char tmp[16]; /* get the number of gpu errors occurred */ - ret = NvCtrlGetDisplayAttribute(ctk_screen->handle, 0, - NV_CTRL_NUM_GPU_ERRORS_RECOVERED, - (int *)&gpu_errors); + ret = NvCtrlGetAttribute(ctk_screen->handle, + NV_CTRL_NUM_GPU_ERRORS_RECOVERED, + (int *)&gpu_errors); if (ret == NvCtrlSuccess) { snprintf(tmp, 16, "%d", gpu_errors); gtk_label_set_text(GTK_LABEL(ctk_screen->gpu_errors), tmp); } + } /* info_update_gpu_error() */ diff --git a/src/gtk+-2.x/ctkserver.c b/src/gtk+-2.x/ctkserver.c index 5d61038..c60eee9 100644 --- a/src/gtk+-2.x/ctkserver.c +++ b/src/gtk+-2.x/ctkserver.c @@ -47,6 +47,7 @@ GType ctk_server_get_type(void) sizeof(CtkServer), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_server_type = g_type_register_static diff --git a/src/gtk+-2.x/ctkslimm.c b/src/gtk+-2.x/ctkslimm.c index ecbf17a..93bc4b6 100644 --- a/src/gtk+-2.x/ctkslimm.c +++ b/src/gtk+-2.x/ctkslimm.c @@ -23,7 +23,6 @@ #include <stdlib.h> #include <string.h> #include <X11/Xlib.h> -#include <X11/extensions/Xrandr.h> #include "msg.h" #include "parse.h" @@ -106,6 +105,7 @@ GType ctk_slimm_get_type() sizeof (CtkSLIMM), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_slimm_type = @@ -348,7 +348,7 @@ static void save_xconfig_button_clicked(GtkWidget *widget, gpointer user_data) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - err_msg); + "%s", err_msg); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); diff --git a/src/gtk+-2.x/ctkthermal.c b/src/gtk+-2.x/ctkthermal.c index 187ff55..ca3967a 100644 --- a/src/gtk+-2.x/ctkthermal.c +++ b/src/gtk+-2.x/ctkthermal.c @@ -136,6 +136,7 @@ GType ctk_thermal_get_type(void) sizeof (CtkThermal), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_thermal_type = diff --git a/src/gtk+-2.x/ctkutils.c b/src/gtk+-2.x/ctkutils.c index aad233a..a65b411 100644 --- a/src/gtk+-2.x/ctkutils.c +++ b/src/gtk+-2.x/ctkutils.c @@ -19,6 +19,7 @@ #include <gtk/gtk.h> #include <NvCtrlAttributes.h> +#include "NVCtrlLib.h" #include "ctkutils.h" #include "msg.h" @@ -75,23 +76,22 @@ gchar *get_pcie_link_speed_string(NvCtrlAttributeHandle *handle, /* * Used to check if current display enabled or disabled. - */ + */ void update_display_enabled_flag(NvCtrlAttributeHandle *handle, - gboolean *display_enabled, - unsigned int display_device_mask) -{ + gboolean *display_enabled) +{ ReturnStatus ret; - unsigned int enabled_displays; + int val; /* Is display enabled? */ ret = NvCtrlGetAttribute(handle, - NV_CTRL_ENABLED_DISPLAYS, - (int *)&enabled_displays); + NV_CTRL_DISPLAY_ENABLED, + &val); *display_enabled = - (ret == NvCtrlSuccess && - (enabled_displays & (display_device_mask))); + ((ret == NvCtrlSuccess) && + (val == NV_CTRL_DISPLAY_ENABLED_TRUE)); } /* update_display_enabled_flag() */ @@ -102,10 +102,10 @@ gchar* create_gpu_name_string(NvCtrlAttributeHandle *gpu_handle) gchar *gpu_name; gchar *gpu_product_name; ReturnStatus ret; - - ret = NvCtrlGetStringDisplayAttribute(gpu_handle, 0, - NV_CTRL_STRING_PRODUCT_NAME, - &gpu_product_name); + + ret = NvCtrlGetStringAttribute(gpu_handle, + NV_CTRL_STRING_PRODUCT_NAME, + &gpu_product_name); if (ret == NvCtrlSuccess && gpu_product_name) { gpu_name = g_strdup_printf("GPU %d - (%s)", NvCtrlGetTargetId(gpu_handle), @@ -115,11 +115,91 @@ gchar* create_gpu_name_string(NvCtrlAttributeHandle *gpu_handle) NvCtrlGetTargetId(gpu_handle)); } g_free(gpu_product_name); - + return gpu_name; } +gchar* create_display_name_list_string(NvCtrlAttributeHandle *handle, + unsigned int attr) +{ + gchar *displays = NULL; + gchar *typeIdName; + gchar *logName; + gchar *tmp_str; + ReturnStatus ret; + int *pData; + int len; + int i; + Bool valid; + + + /* List of Display Device connected on GPU */ + + ret = NvCtrlGetBinaryAttribute(handle, 0, + attr, + (unsigned char **)(&pData), &len); + if (ret != NvCtrlSuccess) { + goto done; + } + + for (i = 0; i < pData[0]; i++) { + int display_id = pData[i+1]; + + valid = + XNVCTRLQueryTargetStringAttribute(NvCtrlGetDisplayPtr(handle), + NV_CTRL_TARGET_TYPE_DISPLAY, + display_id, + 0, + NV_CTRL_STRING_DISPLAY_DEVICE_NAME, + &tmp_str); + if (!valid) { + logName = g_strdup("Unknown"); + } else { + logName = g_strdup(tmp_str); + XFree(tmp_str); + } + + valid = + XNVCTRLQueryTargetStringAttribute(NvCtrlGetDisplayPtr(handle), + NV_CTRL_TARGET_TYPE_DISPLAY, + display_id, + 0, + NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID, + &tmp_str); + if (!valid) { + typeIdName = g_strdup_printf("DPY-%d", display_id); + } else { + typeIdName = g_strdup(tmp_str); + XFree(tmp_str); + } + + tmp_str = g_strdup_printf("%s (%s)", logName, typeIdName); + g_free(logName); + g_free(typeIdName); + + if (displays) { + logName = g_strdup_printf("%s,\n%s", tmp_str, displays); + g_free(displays); + g_free(tmp_str); + displays = logName; + } else { + displays = tmp_str; + } + } + + done: + + if (!displays) { + displays = g_strdup("None"); + } + + return displays; +} + + + + GtkWidget *add_table_row_with_help_text(GtkWidget *table, CtkConfig *ctk_config, const char *help, @@ -228,7 +308,7 @@ void ctk_display_error_msg(GtkWidget *parent, gchar * msg) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, - msg); + "%s", msg); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } @@ -256,7 +336,7 @@ void ctk_display_warning_msg(GtkWidget *parent, gchar * msg) GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, - msg); + "%s", msg); gtk_dialog_run(GTK_DIALOG(dlg)); gtk_widget_destroy(dlg); } diff --git a/src/gtk+-2.x/ctkutils.h b/src/gtk+-2.x/ctkutils.h index 446bcb8..76d707d 100644 --- a/src/gtk+-2.x/ctkutils.h +++ b/src/gtk+-2.x/ctkutils.h @@ -37,6 +37,8 @@ gchar *get_pcie_link_speed_string(NvCtrlAttributeHandle *handle, gchar* create_gpu_name_string(NvCtrlAttributeHandle *gpu_handle); +gchar* create_display_name_list_string(NvCtrlAttributeHandle *handle, + unsigned int attr); GtkWidget *add_table_row_with_help_text(GtkWidget *table, CtkConfig *ctk_config, @@ -65,8 +67,7 @@ void ctk_display_warning_msg(GtkWidget *parent, gchar *msg); void ctk_empty_container(GtkWidget *); void update_display_enabled_flag(NvCtrlAttributeHandle *handle, - gboolean *display_enabled, - unsigned int display_device_mask); + gboolean *display_enabled); G_END_DECLS diff --git a/src/gtk+-2.x/ctkvcs.c b/src/gtk+-2.x/ctkvcs.c index 5f252c5..9932fea 100644 --- a/src/gtk+-2.x/ctkvcs.c +++ b/src/gtk+-2.x/ctkvcs.c @@ -117,6 +117,7 @@ GType ctk_vcs_get_type(void) sizeof(CtkVcs), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_vcs_type = g_type_register_static @@ -231,7 +232,7 @@ static gboolean update_vcs_info(gpointer user_data) * **/ -GtkWidget * create_error_dialog(CtkVcs *ctk_object) +static GtkWidget * create_error_dialog(CtkVcs *ctk_object) { GtkWidget *dialog; GtkWidget *image; diff --git a/src/gtk+-2.x/ctkwindow.c b/src/gtk+-2.x/ctkwindow.c index 1a45bdd..d3d24f8 100644 --- a/src/gtk+-2.x/ctkwindow.c +++ b/src/gtk+-2.x/ctkwindow.c @@ -45,7 +45,6 @@ #include "ctkgpu.h" #include "ctkcolorcorrection.h" #include "ctkxvideo.h" -#include "ctkrandr.h" #include "ctkcursorshadow.h" #include "ctkopengl.h" #include "ctkglx.h" @@ -59,7 +58,7 @@ #include "ctkdisplaydevice-crt.h" #include "ctkdisplaydevice-tv.h" -#include "ctkdisplaydevice-dfp.h" +#include "ctkdisplaydevice.h" #include "ctkdisplayconfig.h" #include "ctkserver.h" @@ -156,6 +155,7 @@ GType ctk_window_get_type(void) sizeof(CtkWindow), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_window_type = g_type_register_static @@ -687,15 +687,6 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, "X Server XVideo Settings", NULL, NULL, NULL); } - /* randr settings */ - - child = ctk_randr_new(screen_handle, ctk_config, ctk_event); - if (child) { - help = ctk_randr_create_help(tag_table, CTK_RANDR(child)); - add_page(child, help, ctk_window, &iter, NULL, - "Rotation Settings", NULL, NULL, NULL); - } - /* cursor shadow */ child = ctk_cursor_shadow_new(screen_handle, ctk_config, ctk_event); @@ -887,9 +878,9 @@ GtkWidget *ctk_window_new(ParsedAttribute *p, ConfigProperties *conf, /* create the vcs entry name */ - ret = NvCtrlGetStringDisplayAttribute(vcs_handle, 0, - NV_CTRL_STRING_VCSC_PRODUCT_NAME, - &vcs_product_name); + ret = NvCtrlGetStringAttribute(vcs_handle, + NV_CTRL_STRING_VCSC_PRODUCT_NAME, + &vcs_product_name); if (ret == NvCtrlSuccess && vcs_product_name) { vcs_name = g_strdup_printf("VCS %d - (%s)", NvCtrlGetTargetId(vcs_handle), @@ -1360,102 +1351,117 @@ void add_special_config_file_attributes(CtkWindow *ctk_window) */ static void add_display_devices(CtkWindow *ctk_window, GtkTreeIter *iter, - NvCtrlAttributeHandle *handle, + NvCtrlAttributeHandle *gpu_handle, CtkEvent *ctk_event, GtkTextTagTable *tag_table, UpdateDisplaysData *data) { - GtkWidget *widget; GtkTextBuffer *help; ReturnStatus ret; - int i, connected, n, mask; - char *name; - char *type; - gchar *title; - - - /* retrieve the connected display device mask */ + int *pData; + int len; + int i; + NvCtrlAttributeHandle *display_handle; - ret = NvCtrlGetAttribute(handle, NV_CTRL_CONNECTED_DISPLAYS, &connected); - if (ret != NvCtrlSuccess) { - return; - } - /* count how many display devices are connected */ + /* retrieve the list of connected display devices */ - for (i = 0, n = 0; i < 24; i++) { - if (connected & (1 << i)) n++; - } - if (n == 0) { + ret = NvCtrlGetBinaryAttribute(gpu_handle, 0, + NV_CTRL_BINARY_DATA_DISPLAYS_CONNECTED_TO_GPU, + (unsigned char **)(&pData), &len); + if ((ret != NvCtrlSuccess) || (pData[0] <= 0)) { return; } - - if (data->display_iters) { - free(data->display_iters); - } - data->display_iters = calloc(n, sizeof(GtkTreeIter)); + nvfree(data->display_iters); + data->display_iters = calloc(pData[0], sizeof(GtkTreeIter)); data->num_displays = 0; if (!data->display_iters) return; /* - * create pages for each of the display devices driven by this handle. + * create pages for each of the display devices driven by this (gpu) + * handle. */ - for (i = 0; i < 24; i++) { - mask = (1 << i); - if (!(mask & connected)) continue; + for (i = 0; i < pData[0]; i++) { + int display_id = pData[i+1]; + char *logName; + char *typeBaseName; + char *typeIdName; + GtkWidget *widget; + gchar *title; + + display_handle = + NvCtrlAttributeInit(NvCtrlGetDisplayPtr(gpu_handle), + NV_CTRL_TARGET_TYPE_DISPLAY, + display_id, + NV_CTRL_ATTRIBUTES_NV_CONTROL_SUBSYSTEM); + if (!display_handle) { + continue; + } - type = display_device_mask_to_display_device_name(mask); - - ret = - NvCtrlGetStringDisplayAttribute(handle, mask, - NV_CTRL_STRING_DISPLAY_DEVICE_NAME, - &name); - - if ((ret != NvCtrlSuccess) || (!name)) { - title = g_strdup_printf("%s - (Unknown)", type); + /* Query display's names */ + ret = NvCtrlGetStringAttribute(display_handle, + NV_CTRL_STRING_DISPLAY_NAME_TYPE_BASENAME, + &typeBaseName); + if (ret != NvCtrlSuccess) { + NvCtrlAttributeClose(display_handle); + continue; + } + ret = NvCtrlGetStringAttribute(display_handle, + NV_CTRL_STRING_DISPLAY_DEVICE_NAME, + &logName); + if (ret != NvCtrlSuccess) { + logName = NULL; + } + ret = NvCtrlGetStringAttribute(display_handle, + NV_CTRL_STRING_DISPLAY_NAME_TYPE_ID, + &typeIdName); + if (ret != NvCtrlSuccess) { + typeIdName = NULL; + } + + if (!logName && !typeIdName) { + title = g_strdup_printf("DPY-%d - (Unknown)", display_id); } else { - title = g_strdup_printf("%s - (%s)", type, name); - XFree(name); + title = g_strdup_printf("%s - (%s)", typeIdName, logName); } - free(type); - - if (mask & CTK_DISPLAY_DEVICE_CRT_MASK) { - + XFree(logName); + XFree(typeIdName); + + /* Create the appropriate page for the display */ + if (strcmp(typeBaseName, "CRT") == 0) { widget = ctk_display_device_crt_new - (handle, ctk_window->ctk_config, ctk_event, mask, title); - + (display_handle, ctk_window->ctk_config, ctk_event, title); help = ctk_display_device_crt_create_help (tag_table, CTK_DISPLAY_DEVICE_CRT(widget)); - - } else if (mask & CTK_DISPLAY_DEVICE_TV_MASK) { - + } else if (strcmp(typeBaseName, "TV") == 0) { widget = ctk_display_device_tv_new - (handle, ctk_window->ctk_config, ctk_event, mask, title); - + (display_handle, ctk_window->ctk_config, ctk_event, title); help = ctk_display_device_tv_create_help (tag_table, CTK_DISPLAY_DEVICE_TV(widget)); - - } else if (mask & CTK_DISPLAY_DEVICE_DFP_MASK) { - - widget = ctk_display_device_dfp_new - (handle, ctk_window->ctk_config, ctk_event, mask, title); - - help = ctk_display_device_dfp_create_help - (tag_table, CTK_DISPLAY_DEVICE_DFP(widget)); - + } else if (strcmp(typeBaseName, "DFP") == 0) { + widget = ctk_display_device_new(display_handle, + ctk_window->ctk_config, ctk_event, + title, typeBaseName); + help = ctk_display_device_create_help(tag_table, + CTK_DISPLAY_DEVICE(widget)); } else { - g_free(title); - continue; + widget = NULL; + } + + if (!widget) { + NvCtrlAttributeClose(display_handle); + } else { + add_page(widget, help, ctk_window, iter, + &(data->display_iters[data->num_displays]), title, + NULL, NULL, NULL); + data->num_displays++; } - add_page(widget, help, ctk_window, iter, - &(data->display_iters[data->num_displays]), title, - NULL, NULL, NULL); + XFree(typeBaseName); g_free(title); - data->num_displays++; } } /* add_display_devices() */ diff --git a/src/gtk+-2.x/ctkxvideo.c b/src/gtk+-2.x/ctkxvideo.c index aae0cfb..f5313c3 100644 --- a/src/gtk+-2.x/ctkxvideo.c +++ b/src/gtk+-2.x/ctkxvideo.c @@ -181,6 +181,7 @@ GType ctk_xvideo_get_type( sizeof(CtkXVideo), 0, /* n_preallocs */ NULL, /* instance_init */ + NULL /* value_table */ }; ctk_xvideo_type = g_type_register_static diff --git a/src/gtk+-2.x/src.mk b/src/gtk+-2.x/src.mk deleted file mode 100644 index 1ba1b5d..0000000 --- a/src/gtk+-2.x/src.mk +++ b/dev/null @@ -1,99 +0,0 @@ -# -# files in the src/gtk+-2.x directory of nvidia-settings -# - -GTK_SRC += ctkxvideo.c -GTK_SRC += ctkcursorshadow.c -GTK_SRC += ctkui.c -GTK_SRC += ctkframelock.c -GTK_SRC += ctkgauge.c -GTK_SRC += ctkcurve.c -GTK_SRC += ctkcolorcorrection.c -GTK_SRC += ctkscale.c -GTK_SRC += ctkmultisample.c -GTK_SRC += ctkconfig.c -GTK_SRC += ctkevent.c -GTK_SRC += ctkwindow.c -GTK_SRC += ctkopengl.c -GTK_SRC += ctkglx.c -GTK_SRC += ctkhelp.c -GTK_SRC += ctkimagesliders.c -GTK_SRC += ctkdisplaydevice-crt.c -GTK_SRC += ctkdisplaydevice-tv.c -GTK_SRC += ctkdisplaydevice-dfp.c -GTK_SRC += ctkditheringcontrols.c -GTK_SRC += ctkthermal.c -GTK_SRC += ctkpowermizer.c -GTK_SRC += ctkgvo.c -GTK_SRC += ctkgvo-csc.c -GTK_SRC += ctkdropdownmenu.c -GTK_SRC += ctkrandr.c -GTK_SRC += ctkclocks.c -GTK_SRC += ctkutils.c -GTK_SRC += ctkedid.c -GTK_SRC += ctkserver.c -GTK_SRC += ctkdisplaylayout.c -GTK_SRC += ctkdisplayconfig.c -GTK_SRC += ctkscreen.c -GTK_SRC += ctkslimm.c -GTK_SRC += ctkgpu.c -GTK_SRC += ctkbanner.c -GTK_SRC += ctkvcs.c -GTK_SRC += ctkdisplayconfig-utils.c -GTK_SRC += ctkgvo-banner.c -GTK_SRC += ctkgvo-sync.c -GTK_SRC += ctkpowersavings.c -GTK_SRC += ctkgvi.c -GTK_SRC += ctklicense.c -GTK_SRC += ctkecc.c -GTK_SRC += ctkcolorcontrols.c -GTK_SRC += ctk3dvisionpro.c - -GTK_EXTRA_DIST += ctkxvideo.h -GTK_EXTRA_DIST += ctkcursorshadow.h -GTK_EXTRA_DIST += ctkui.h -GTK_EXTRA_DIST += ctkframelock.h -GTK_EXTRA_DIST += ctkgauge.h -GTK_EXTRA_DIST += ctkcurve.h -GTK_EXTRA_DIST += ctkcolorcorrection.h -GTK_EXTRA_DIST += ctkscale.h -GTK_EXTRA_DIST += ctkmultisample.h -GTK_EXTRA_DIST += ctkconfig.h -GTK_EXTRA_DIST += ctkevent.h -GTK_EXTRA_DIST += ctkwindow.h -GTK_EXTRA_DIST += ctkopengl.h -GTK_EXTRA_DIST += ctkglx.h -GTK_EXTRA_DIST += ctkhelp.h -GTK_EXTRA_DIST += ctkimagesliders.h -GTK_EXTRA_DIST += ctkdisplaydevice-crt.h -GTK_EXTRA_DIST += ctkdisplaydevice-tv.h -GTK_EXTRA_DIST += ctkdisplaydevice-dfp.h -GTK_EXTRA_DIST += ctkditheringcontrols.h -GTK_EXTRA_DIST += ctkconstants.h -GTK_EXTRA_DIST += ctkthermal.h -GTK_EXTRA_DIST += ctkpowermizer.h -GTK_EXTRA_DIST += ctkgvo.h -GTK_EXTRA_DIST += ctkgvo-csc.h -GTK_EXTRA_DIST += ctkdropdownmenu.h -GTK_EXTRA_DIST += ctkrandr.h -GTK_EXTRA_DIST += ctkclocks.h -GTK_EXTRA_DIST += ctkutils.h -GTK_EXTRA_DIST += ctkedid.h -GTK_EXTRA_DIST += ctkserver.h -GTK_EXTRA_DIST += ctkdisplaylayout.h -GTK_EXTRA_DIST += ctkdisplayconfig.h -GTK_EXTRA_DIST += ctkscreen.h -GTK_EXTRA_DIST += ctkslimm.h -GTK_EXTRA_DIST += ctkgpu.h -GTK_EXTRA_DIST += ctkbanner.h -GTK_EXTRA_DIST += ctkvcs.h -GTK_EXTRA_DIST += ctkdisplayconfig-utils.h -GTK_EXTRA_DIST += ctkpowersavings.h -GTK_EXTRA_DIST += ctkgvo-banner.h -GTK_EXTRA_DIST += ctkgvo-sync.h -GTK_EXTRA_DIST += ctkgvi.h -GTK_EXTRA_DIST += ctklicense.h -GTK_EXTRA_DIST += ctkecc.h -GTK_EXTRA_DIST += ctkcolorcontrols.h -GTK_EXTRA_DIST += ctk3dvisionpro.h -GTK_EXTRA_DIST += src.mk diff --git a/src/image_data/rotate_left_off.png b/src/image_data/rotate_left_off.png Binary files differdeleted file mode 100644 index 3b609a3..0000000 --- a/src/image_data/rotate_left_off.png +++ b/dev/null diff --git a/src/image_data/rotate_left_off_pixdata.h b/src/image_data/rotate_left_off_pixdata.h deleted file mode 100644 index bbd0282..0000000 --- a/src/image_data/rotate_left_off_pixdata.h +++ b/dev/null @@ -1,138 +0,0 @@ -/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */ - -static guint8 rotate_left_off_pixdata_pixel_data[] = { - 0x99,0x99,0x99,0x99,0x7f,0x72,0x72,0x72,0x99,0x99,0x99,0xff,0xff,0xff,0xfe, - 0xfe,0xfe,0xfd,0xfd,0xfd,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf9, - 0xf9,0xf9,0xf8,0xf8,0xf8,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9, - 0xe9,0xe9,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0x32,0x32,0x32,0x99,0x99,0x99,0xfe, - 0xfe,0xfe,0xfd,0xfd,0xfd,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0x32,0x32,0x32,0x99, - 0x99,0x99,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf9,0xf9,0xf9,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0x32, - 0x32,0x32,0x99,0x99,0x99,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf9,0xf9,0xf9,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xef,0xef,0xef,0xee,0xee,0xee,0xed, - 0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0xe3, - 0xe3,0xe3,0x32,0x32,0x32,0x99,0x99,0x99,0xfa,0xfa,0xfa,0xf9,0xf9,0xf9,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed, - 0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0x07,0xe4,0xe4,0xe4, - 0xe3,0xe3,0xe3,0xe1,0xe1,0xe1,0x32,0x32,0x32,0x99,0x99,0x99,0xf9,0xf9,0xf9, - 0xf8,0xf8,0xf8,0x82,0xf6,0xf6,0xf6,0x0b,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2, - 0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed, - 0xed,0xed,0xec,0xec,0xec,0xce,0xce,0xce,0x92,0x92,0x92,0x82,0x74,0x74,0x74, - 0x16,0xe5,0xe5,0xe5,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe3,0xe3,0xe3,0xe2,0xe2, - 0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0x32,0x32,0x32,0x99,0x99,0x99,0xf7,0xf7, - 0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2,0xf2, - 0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed,0xed, - 0xed,0xce,0xce,0xce,0x58,0x58,0x58,0x84,0x25,0x25,0x25,0x15,0xe1,0xe1,0xe1, - 0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0, - 0xdf,0xdf,0xdf,0x32,0x32,0x32,0x99,0x99,0x99,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5, - 0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0, - 0xef,0xef,0xef,0xee,0xee,0xee,0xed,0xed,0xed,0xc0,0xc0,0xc0,0x24,0x24,0x24, - 0x85,0x25,0x25,0x25,0x14,0xe0,0xe0,0xe0,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1, - 0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0x32,0x32,0x32,0x99, - 0x99,0x99,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2,0xf2,0xf2,0xf1, - 0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xed,0xed,0xed,0xec,0xec,0xec,0xce, - 0xce,0xce,0x24,0x24,0x24,0x83,0x25,0x25,0x25,0x01,0x4d,0x4d,0x4d,0x82,0x92, - 0x92,0x92,0x13,0xe0,0xe0,0xe0,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0, - 0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdc,0xdc,0xdc,0x32,0x32,0x32,0x99,0x99,0x99, - 0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef, - 0xee,0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0x57,0x57,0x57, - 0x82,0x25,0x25,0x25,0x17,0x32,0x32,0x32,0xbb,0xbb,0xbb,0xff,0xff,0xff,0xfa, - 0xfa,0xfa,0xf1,0xf1,0xf1,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xdf,0xdf,0xdf,0xde, - 0xde,0xde,0xdd,0xdd,0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0x32,0x32,0x32,0x99, - 0x99,0x99,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xcd,0xcd,0xcd,0x83, - 0x25,0x25,0x25,0x17,0xbb,0xbb,0xbb,0xfd,0xfd,0xfd,0xec,0xec,0xec,0xe3,0xe3, - 0xe3,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd, - 0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0x32,0x32,0x32,0x99,0x99, - 0x99,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed,0xed, - 0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0x91,0x91,0x91,0x82,0x25, - 0x25,0x25,0x14,0x4d,0x4d,0x4d,0xff,0xff,0xff,0xec,0xec,0xec,0xe2,0xe2,0xe2, - 0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd, - 0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd9,0xd9,0xd9,0x32,0x32,0x32, - 0x99,0x99,0x99,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed,0xed,0xed, - 0xec,0xec,0xec,0x82,0xea,0xea,0xea,0x02,0xe8,0xe8,0xe8,0x73,0x73,0x73,0x82, - 0x25,0x25,0x25,0x20,0x92,0x92,0x92,0xfa,0xfa,0xfa,0xe2,0xe2,0xe2,0xe1,0xe1, - 0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd,0xdc,0xdc, - 0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0x32,0x32, - 0x32,0x99,0x99,0x99,0xef,0xef,0xef,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb, - 0xeb,0xea,0xea,0xea,0x2b,0x2b,0x2b,0x0c,0x0c,0x0c,0x18,0x18,0x18,0x24,0x24, - 0x24,0x30,0x30,0x30,0x3c,0x3c,0x3c,0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61, - 0x61,0x82,0x82,0x82,0xdf,0xdf,0xdf,0xde,0xde,0xde,0x82,0xdc,0xdc,0xdc,0x28, - 0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6, - 0x32,0x32,0x32,0x99,0x99,0x99,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb, - 0xea,0xea,0xea,0xe9,0xe9,0xe9,0xda,0xda,0xda,0x25,0x25,0x25,0x24,0x24,0x24, - 0x30,0x30,0x30,0x3c,0x3c,0x3c,0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61, - 0x76,0x76,0x76,0xf7,0xf7,0xf7,0xf9,0xf9,0xf9,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb, - 0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6, - 0xd5,0xd5,0xd5,0x32,0x32,0x32,0x99,0x99,0x99,0xec,0xec,0xec,0xeb,0xeb,0xeb, - 0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xc3,0xc3,0xc3, - 0x82,0x3c,0x3c,0x3c,0x3c,0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61,0x76, - 0x76,0x76,0xe6,0xe6,0xe6,0xfd,0xfd,0xfd,0xde,0xde,0xde,0xdb,0xdb,0xdb,0xda, - 0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5, - 0xd5,0xd5,0xd4,0xd4,0xd4,0x32,0x32,0x32,0x99,0x99,0x99,0xeb,0xeb,0xeb,0xea, - 0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4, - 0xe4,0xe4,0xa7,0xa7,0xa7,0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61,0x6d, - 0x6d,0x6d,0xcd,0xcd,0xcd,0xfd,0xfd,0xfd,0xe3,0xe3,0xe3,0xdb,0xdb,0xdb,0xda, - 0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5, - 0xd5,0xd5,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0x32,0x32,0x32,0x99,0x99,0x99,0xea, - 0xea,0xea,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4, - 0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xa0,0xa0,0xa0,0x61,0x61,0x61,0x6d, - 0x6d,0x6d,0xbc,0xbc,0xbc,0xff,0xff,0xff,0xe9,0xe9,0xe9,0xdb,0xdb,0xdb,0xda, - 0xda,0xda,0xd8,0xd8,0xd8,0x82,0xd7,0xd7,0xd7,0x29,0xd5,0xd5,0xd5,0xd4,0xd4, - 0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0x32,0x32,0x32,0x99,0x99, - 0x99,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4, - 0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0x9d,0x9d, - 0x9d,0xab,0xab,0xab,0xff,0xff,0xff,0xee,0xee,0xee,0xda,0xda,0xda,0xd9,0xd9, - 0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4, - 0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0x32,0x32, - 0x32,0x99,0x99,0x99,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4, - 0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xdf,0xdf,0xdf,0x82,0xde, - 0xde,0xde,0x82,0xf2,0xf2,0xf2,0x21,0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8, - 0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3, - 0xd3,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0x32,0x32, - 0x32,0x99,0x99,0x99,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0xe3,0xe3, - 0xe3,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd, - 0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8, - 0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3, - 0xd3,0x82,0xd1,0xd1,0xd1,0x29,0xd0,0xd0,0xd0,0xce,0xce,0xce,0xcd,0xcd,0xcd, - 0x32,0x32,0x32,0x99,0x99,0x99,0xe5,0xe5,0xe5,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2, - 0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd, - 0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8, - 0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2, - 0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xce,0xce,0xce,0xcd,0xcd,0xcd, - 0xcc,0xcc,0xcc,0x32,0x32,0x32,0x99,0x99,0x99,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2, - 0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd, - 0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0x82,0xd8,0xd8,0xd8,0x24,0xd7, - 0xd7,0xd7,0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1, - 0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xce,0xce,0xce,0xcd,0xcd,0xcd,0xcc, - 0xcc,0xcc,0xcb,0xcb,0xcb,0x32,0x32,0x32,0x99,0x99,0x99,0xe2,0xe2,0xe2,0xe1, - 0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd,0xdc, - 0xdc,0xdc,0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6, - 0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1, - 0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xce,0xce,0xce,0xcd,0xcd,0xcd,0xcc, - 0xcc,0xcc,0x82,0xca,0xca,0xca,0x02,0x32,0x32,0x32,0x72,0x72,0x72,0x99,0x32, - 0x32,0x32 -}; - -static const GdkPixdata rotate_left_off_pixdata = { - 0x47646b50, /* Pixbuf magic: 'GdkP' */ - 24 + 1847, /* header length + pixel_data length */ - 0x2010001, /* pixdata_type */ - 78, /* rowstride */ - 26, /* width */ - 26, /* height */ - rotate_left_off_pixdata_pixel_data /* pixel_data */ -}; diff --git a/src/image_data/rotate_left_on.png b/src/image_data/rotate_left_on.png Binary files differdeleted file mode 100644 index 4adb3e9..0000000 --- a/src/image_data/rotate_left_on.png +++ b/dev/null diff --git a/src/image_data/rotate_left_on_pixdata.h b/src/image_data/rotate_left_on_pixdata.h deleted file mode 100644 index c489283..0000000 --- a/src/image_data/rotate_left_on_pixdata.h +++ b/dev/null @@ -1,135 +0,0 @@ -/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */ - -static guint8 rotate_left_on_pixdata_pixel_data[] = { - 0x99,0x32,0x32,0x32,0x7f,0x8c,0x8c,0x8c,0x32,0x32,0x32,0xc7,0xc7,0xc7,0xc5, - 0xc5,0xc5,0xc3,0xc3,0xc3,0xc1,0xc1,0xc1,0xc0,0xc0,0xc0,0xbe,0xbe,0xbe,0xbc, - 0xbc,0xbc,0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb5,0xb5,0xb5,0xb3, - 0xb3,0xb3,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab,0xab,0xa9, - 0xa9,0xa9,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2,0xa2,0xa0, - 0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xc5, - 0xc5,0xc5,0xc3,0xc3,0xc3,0xc1,0xc1,0xc1,0xbf,0xbf,0xbf,0xbd,0xbd,0xbd,0xbc, - 0xbc,0xbc,0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2, - 0xb2,0xb2,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab,0xab,0xa9, - 0xa9,0xa9,0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2,0xa2,0xa0, - 0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0xc1,0xc1,0xc1,0x32, - 0x32,0x32,0xc2,0xc2,0xc2,0xc1,0xc1,0xc1,0xbf,0xbf,0xbf,0xbd,0xbd,0xbd,0xbb, - 0xbb,0xbb,0xb9,0xb9,0xb9,0xb7,0xb7,0xb7,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2, - 0xb2,0xb2,0xb0,0xb0,0xb0,0xae,0xae,0xae,0xac,0xac,0xac,0xab,0xab,0xab,0xa9, - 0xa9,0xa9,0xa7,0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0xa0, - 0xa0,0xa0,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98,0x98,0x98,0xc1, - 0xc1,0xc1,0x32,0x32,0x32,0xc0,0xc0,0xc0,0xbf,0xbf,0xbf,0xbd,0xbd,0xbd,0xbb, - 0xbb,0xbb,0xb9,0xb9,0xb9,0xb7,0xb7,0xb7,0xb5,0xb5,0xb5,0xb4,0xb4,0xb4,0xb2, - 0xb2,0xb2,0xb0,0xb0,0xb0,0xae,0xae,0xae,0xac,0xac,0xac,0xaa,0xaa,0xaa,0xa9, - 0xa9,0xa9,0xa7,0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0x9f, - 0x9f,0x9f,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98,0x98,0x98,0x96, - 0x96,0x96,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xbe,0xbe,0xbe,0xbc,0xbc,0xbc,0xba, - 0xba,0xba,0xb9,0xb9,0xb9,0xb7,0xb7,0xb7,0xb5,0xb5,0xb5,0xb3,0xb3,0xb3,0xb1, - 0xb1,0xb1,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xac,0xac,0xac,0xaa,0xaa,0xaa,0xa8, - 0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0x9f, - 0x9f,0x9f,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x2f,0x98,0x98,0x98, - 0x96,0x96,0x96,0x94,0x94,0x94,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xbc,0xbc,0xbc, - 0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb7,0xb7,0xb7,0xb5,0xb5,0xb5,0xb3,0xb3,0xb3, - 0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab,0xab,0xaa,0xaa,0xaa, - 0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0x8f,0x8f,0x8f,0x65,0x65,0x65,0x50,0x50,0x50, - 0x4f,0x4f,0x4f,0x62,0x62,0x62,0x9a,0x9a,0x9a,0x99,0x99,0x99,0x97,0x97,0x97, - 0x95,0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0xc1,0xc1,0xc1,0x32,0x32,0x32, - 0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2,0xb2,0xb2, - 0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab,0xab,0xa9,0xa9,0xa9, - 0xa7,0xa7,0xa7,0x91,0x91,0x91,0x3d,0x3d,0x3d,0x00,0x00,0x00,0x20,0x20,0x20, - 0x60,0x60,0x60,0x82,0x80,0x80,0x80,0x16,0x98,0x98,0x98,0x97,0x97,0x97,0x95, - 0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0x90,0x90,0x90,0xc1,0xc1,0xc1,0x32, - 0x32,0x32,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2,0xb2,0xb2,0xb0, - 0xb0,0xb0,0xae,0xae,0xae,0xac,0xac,0xac,0xab,0xab,0xab,0xa9,0xa9,0xa9,0xa7, - 0xa7,0xa7,0x86,0x86,0x86,0x0a,0x0a,0x0a,0x20,0x20,0x20,0xa0,0xa0,0xa0,0x84, - 0xff,0xff,0xff,0x15,0x98,0x98,0x98,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91, - 0x91,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xb5,0xb5, - 0xb5,0xb4,0xb4,0xb4,0xb2,0xb2,0xb2,0xb0,0xb0,0xb0,0xae,0xae,0xae,0xac,0xac, - 0xac,0xab,0xab,0xab,0xa9,0xa9,0xa9,0xa7,0xa7,0xa7,0x90,0x90,0x90,0x0a,0x0a, - 0x0a,0x30,0x30,0x30,0xf0,0xf0,0xf0,0x85,0xff,0xff,0xff,0x14,0x97,0x97,0x97, - 0x93,0x93,0x93,0x91,0x91,0x91,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xb3,0xb3,0xb3,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf, - 0xae,0xae,0xae,0xac,0xac,0xac,0xaa,0xaa,0xaa,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6, - 0xa4,0xa4,0xa4,0x3d,0x3d,0x3d,0x20,0x20,0x20,0xf0,0xf0,0xf0,0x83,0xff,0xff, - 0xff,0x16,0xec,0xec,0xec,0xcb,0xcb,0xcb,0xca,0xca,0xca,0x94,0x94,0x94,0x90, - 0x90,0x90,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x89,0x89,0x89,0xc1, - 0xc1,0xc1,0x32,0x32,0x32,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xac, - 0xac,0xac,0xaa,0xaa,0xaa,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0x8e, - 0x8e,0x8e,0x00,0x00,0x00,0xa0,0xa0,0xa0,0x82,0xff,0xff,0xff,0x17,0xf9,0xf9, - 0xf9,0xb8,0xb8,0xb8,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90,0x90, - 0x90,0x8e,0x8e,0x8e,0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x89,0x89,0x89,0x87,0x87, - 0x87,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab, - 0xab,0xa9,0xa9,0xa9,0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2, - 0xa2,0x64,0x64,0x64,0x20,0x20,0x20,0x83,0xff,0xff,0xff,0x17,0xb8,0xb8,0xb8, - 0x95,0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0x90,0x90,0x90,0x8e,0x8e,0x8e, - 0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x87,0x87,0x87,0x85,0x85,0x85, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xad,0xad,0xad,0xab,0xab,0xab,0xa9,0xa9,0xa9, - 0xa7,0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa0,0xa0,0xa0, - 0x4f,0x4f,0x4f,0x60,0x60,0x60,0x82,0xff,0xff,0xff,0x14,0xec,0xec,0xec,0x95, - 0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b, - 0x8b,0x8b,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84,0x84,0x82, - 0x82,0x82,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xab,0xab,0xab,0xa9,0xa9,0xa9,0xa7, - 0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0x1e,0x1e,0x1e,0x83,0x00,0x00,0x00, - 0x01,0x80,0x80,0x80,0x82,0xff,0xff,0xff,0x15,0x80,0x80,0x80,0x00,0x00,0x00, - 0x1b,0x1b,0x1b,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a, - 0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4, - 0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0x95,0x95,0x95,0xd2,0xd2,0xd2,0x88,0xff,0xff, - 0xff,0x13,0xea,0xea,0xea,0x8b,0x8b,0x8b,0x89,0x89,0x89,0x87,0x87,0x87,0x85, - 0x85,0x85,0x84,0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80,0x7e,0x7e,0x7e,0xc1, - 0xc1,0xc1,0x32,0x32,0x32,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa1, - 0xa1,0xa1,0x9f,0x9f,0x9f,0x9d,0x9d,0x9d,0x86,0x86,0x86,0xf1,0xf1,0xf1,0x86, - 0xff,0xff,0xff,0x15,0xf8,0xf8,0xf8,0x92,0x92,0x92,0x89,0x89,0x89,0x87,0x87, - 0x87,0x85,0x85,0x85,0x83,0x83,0x83,0x81,0x81,0x81,0x80,0x80,0x80,0x7e,0x7e, - 0x7e,0x7c,0x7c,0x7c,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xa4,0xa4,0xa4,0xa2,0xa2, - 0xa2,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99, - 0x99,0x7c,0x7c,0x7c,0xf0,0xf0,0xf0,0x84,0xff,0xff,0xff,0x16,0xf8,0xf8,0xf8, - 0xa0,0xa0,0xa0,0x88,0x88,0x88,0x87,0x87,0x87,0x85,0x85,0x85,0x83,0x83,0x83, - 0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c,0x7a,0x7a,0x7a, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xa2,0xa2,0xa2,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e, - 0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x99,0x99,0x99,0x97,0x97,0x97,0x95,0x95,0x95, - 0x8e,0x8e,0x8e,0x84,0xff,0xff,0xff,0x17,0xb6,0xb6,0xb6,0x88,0x88,0x88,0x86, - 0x86,0x86,0x84,0x84,0x84,0x82,0x82,0x82,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d, - 0x7d,0x7d,0x7b,0x7b,0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0xc1,0xc1,0xc1,0x32, - 0x32,0x32,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98, - 0x98,0x98,0x96,0x96,0x96,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x9a, - 0x9a,0x9a,0x82,0xff,0xff,0xff,0x7f,0xc5,0xc5,0xc5,0x88,0x88,0x88,0x86,0x86, - 0x86,0x84,0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7d,0x7d, - 0x7d,0x7b,0x7b,0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0x76,0x76,0x76,0xc1,0xc1, - 0xc1,0x32,0x32,0x32,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x98,0x98, - 0x98,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90,0x90,0x90,0x8f,0x8f, - 0x8f,0x8d,0x8d,0x8d,0xd4,0xd4,0xd4,0xd3,0xd3,0xd3,0x87,0x87,0x87,0x85,0x85, - 0x85,0x84,0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80,0x7e,0x7e,0x7e,0x7c,0x7c, - 0x7c,0x7a,0x7a,0x7a,0x79,0x79,0x79,0x77,0x77,0x77,0x75,0x75,0x75,0x73,0x73, - 0x73,0xc1,0xc1,0xc1,0x32,0x32,0x32,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x98,0x98, - 0x98,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90,0x90,0x90,0x8f,0x8f, - 0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x89,0x89,0x89,0x87,0x87,0x87,0x85,0x85, - 0x85,0x83,0x83,0x83,0x82,0x82,0x82,0x80,0x80,0x80,0x7e,0x7e,0x7e,0x7c,0x7c, - 0x7c,0x7a,0x7a,0x7a,0x78,0x78,0x78,0x77,0x77,0x77,0x75,0x75,0x75,0x73,0x73, - 0x73,0x71,0x71,0x71,0xc1,0xc1,0xc1,0x32,0x32,0x32,0x99,0x99,0x99,0x97,0x97, - 0x97,0x95,0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0x90,0x90,0x90,0x8e,0x8e, - 0x8e,0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x87,0x87,0x87,0x85,0x85, - 0x85,0x83,0x83,0x83,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7c,0x7c, - 0x7c,0x7a,0x7a,0x7a,0x78,0x78,0x78,0x76,0x76,0x76,0x74,0x74,0x74,0x72,0x72, - 0x72,0x71,0x71,0x71,0x6f,0x6f,0x6f,0xc1,0xc1,0xc1,0x32,0x32,0x32,0x97,0x97, - 0x97,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x90,0x90,0x90,0x8e,0x8e, - 0x8e,0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84, - 0x84,0x83,0x83,0x83,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7b,0x7b, - 0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0x76,0x76,0x76,0x74,0x74,0x74,0x72,0x72, - 0x72,0x70,0x70,0x70,0x6e,0x6e,0x6e,0x6c,0x6c,0x6c,0xc1,0xc1,0xc1,0x32,0x32, - 0x32,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x8f,0x8f,0x8f,0x8d,0x8d, - 0x8d,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x86,0x86,0x86,0x11,0x84, - 0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7b, - 0x7b,0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0x76,0x76,0x76,0x74,0x74,0x74,0x72, - 0x72,0x72,0x70,0x70,0x70,0x6e,0x6e,0x6e,0x6c,0x6c,0x6c,0x6b,0x6b,0x6b,0xc1, - 0xc1,0xc1,0x8c,0x8c,0x8c,0x99,0xc1,0xc1,0xc1 -}; - -static const GdkPixdata rotate_left_on_pixdata = { - 0x47646b50, /* Pixbuf magic: 'GdkP' */ - 24 + 1809, /* header length + pixel_data length */ - 0x2010001, /* pixdata_type */ - 78, /* rowstride */ - 26, /* width */ - 26, /* height */ - rotate_left_on_pixdata_pixel_data /* pixel_data */ -}; diff --git a/src/image_data/rotate_right_off.png b/src/image_data/rotate_right_off.png Binary files differdeleted file mode 100644 index 3bd9413..0000000 --- a/src/image_data/rotate_right_off.png +++ b/dev/null diff --git a/src/image_data/rotate_right_off_pixdata.h b/src/image_data/rotate_right_off_pixdata.h deleted file mode 100644 index 1eb0be1..0000000 --- a/src/image_data/rotate_right_off_pixdata.h +++ b/dev/null @@ -1,138 +0,0 @@ -/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */ - -static guint8 rotate_right_off_pixdata_pixel_data[] = { - 0x99,0x99,0x99,0x99,0x7f,0x72,0x72,0x72,0x99,0x99,0x99,0xff,0xff,0xff,0xfe, - 0xfe,0xfe,0xfd,0xfd,0xfd,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf9, - 0xf9,0xf9,0xf8,0xf8,0xf8,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9, - 0xe9,0xe9,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0x32,0x32,0x32,0x99,0x99,0x99,0xfe, - 0xfe,0xfe,0xfd,0xfd,0xfd,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0x32,0x32,0x32,0x99, - 0x99,0x99,0xfc,0xfc,0xfc,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf9,0xf9,0xf9,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0x32, - 0x32,0x32,0x99,0x99,0x99,0xfb,0xfb,0xfb,0xfa,0xfa,0xfa,0xf9,0xf9,0xf9,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xef,0xef,0xef,0xee,0xee,0xee,0xed, - 0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0xe3, - 0xe3,0xe3,0x32,0x32,0x32,0x99,0x99,0x99,0xfa,0xfa,0xfa,0xf9,0xf9,0xf9,0xf8, - 0xf8,0xf8,0xf7,0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3, - 0xf3,0xf3,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed, - 0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0x07,0xe4,0xe4,0xe4, - 0xe3,0xe3,0xe3,0xe1,0xe1,0xe1,0x32,0x32,0x32,0x99,0x99,0x99,0xf9,0xf9,0xf9, - 0xf8,0xf8,0xf8,0x82,0xf6,0xf6,0xf6,0x1c,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0x79, - 0x79,0x79,0x78,0x78,0x78,0x96,0x96,0x96,0xd1,0xd1,0xd1,0xee,0xee,0xee,0xed, - 0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8, - 0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe3,0xe3,0xe3,0xe2, - 0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0x32,0x32,0x32,0x99,0x99,0x99,0xf7, - 0xf7,0xf7,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2, - 0xf2,0xf2,0x84,0x25,0x25,0x25,0x04,0x4d,0x4d,0x4d,0xce,0xce,0xce,0xeb,0xeb, - 0xeb,0xea,0xea,0xea,0x82,0xe8,0xe8,0xe8,0x10,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5, - 0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0, - 0xdf,0xdf,0xdf,0x32,0x32,0x32,0x99,0x99,0x99,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5, - 0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0x85,0x25,0x25, - 0x25,0x15,0x2d,0x2d,0x2d,0xa5,0xa5,0xa5,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6, - 0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1, - 0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0x32,0x32,0x32,0x99, - 0x99,0x99,0xf5,0xf5,0xf5,0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf2,0xf2,0xf2,0xf1, - 0xf1,0xf1,0xf0,0xf0,0xf0,0x82,0x92,0x92,0x92,0x01,0x4d,0x4d,0x4d,0x83,0x25, - 0x25,0x25,0x19,0x31,0x31,0x31,0xa4,0xa4,0xa4,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5, - 0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0, - 0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdc,0xdc,0xdc,0x32,0x32,0x32,0x99,0x99,0x99, - 0xf4,0xf4,0xf4,0xf3,0xf3,0xf3,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef, - 0xee,0xee,0xee,0xfc,0xfc,0xfc,0xf6,0xf6,0xf6,0xf5,0xf5,0xf5,0xb0,0xb0,0xb0, - 0x32,0x32,0x32,0x82,0x25,0x25,0x25,0x18,0x73,0x73,0x73,0xe8,0xe8,0xe8,0xe4, - 0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xdf,0xdf,0xdf,0xde, - 0xde,0xde,0xdd,0xdd,0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0x32,0x32,0x32,0x99, - 0x99,0x99,0xf2,0xf2,0xf2,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee, - 0xee,0xee,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9, - 0xe9,0xe9,0x7e,0x7e,0x7e,0x83,0x25,0x25,0x25,0x18,0xd7,0xd7,0xd7,0xe3,0xe3, - 0xe3,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd, - 0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0x32,0x32,0x32,0x99,0x99, - 0x99,0xf1,0xf1,0xf1,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed,0xed, - 0xed,0xec,0xec,0xec,0xeb,0xeb,0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8, - 0xe8,0xe6,0xe6,0xe6,0x33,0x33,0x33,0x82,0x25,0x25,0x25,0x11,0xad,0xad,0xad, - 0xe5,0xe5,0xe5,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd, - 0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd9,0xd9,0xd9,0x32,0x32,0x32, - 0x99,0x99,0x99,0xf0,0xf0,0xf0,0xef,0xef,0xef,0xee,0xee,0xee,0xed,0xed,0xed, - 0xec,0xec,0xec,0x82,0xea,0xea,0xea,0x05,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6, - 0xe6,0xe6,0xe5,0xe5,0xe5,0x72,0x72,0x72,0x82,0x25,0x25,0x25,0x4a,0x92,0x92, - 0x92,0xec,0xec,0xec,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd,0xdc,0xdc, - 0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0x32,0x32, - 0x32,0x99,0x99,0x99,0xef,0xef,0xef,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb, - 0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0x2a,0x2a, - 0x2a,0x0c,0x0c,0x0c,0x18,0x18,0x18,0x24,0x24,0x24,0x30,0x30,0x30,0x3c,0x3c, - 0x3c,0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61,0x81,0x81,0x81,0xdc,0xdc, - 0xdc,0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6, - 0xd6,0x32,0x32,0x32,0x99,0x99,0x99,0xed,0xed,0xed,0xec,0xec,0xec,0xeb,0xeb, - 0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6, - 0xe6,0xd7,0xd7,0xd7,0x25,0x25,0x25,0x24,0x24,0x24,0x30,0x30,0x30,0x3c,0x3c, - 0x3c,0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61,0x76,0x76,0x76,0xf7,0xf7, - 0xf7,0xf8,0xf8,0xf8,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6, - 0xd6,0xd5,0xd5,0xd5,0x32,0x32,0x32,0x99,0x99,0x99,0xec,0xec,0xec,0xeb,0xeb, - 0xeb,0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6, - 0xe6,0xe5,0xe5,0xe5,0xe4,0xe4,0xe4,0xc1,0xc1,0xc1,0x82,0x3c,0x3c,0x3c,0x39, - 0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61,0x76,0x76,0x76,0xe6,0xe6,0xe6, - 0xfd,0xfd,0xfd,0xdb,0xdb,0xdb,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6, - 0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0x32,0x32,0x32,0x99,0x99,0x99,0xeb,0xeb,0xeb, - 0xea,0xea,0xea,0xe9,0xe9,0xe9,0xe8,0xe8,0xe8,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5, - 0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xa6,0xa6,0xa6, - 0x48,0x48,0x48,0x54,0x54,0x54,0x61,0x61,0x61,0x6d,0x6d,0x6d,0xcd,0xcd,0xcd, - 0xfd,0xfd,0xfd,0xe0,0xe0,0xe0,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6, - 0xd5,0xd5,0xd5,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0x32,0x32,0x32,0x99,0x99,0x99, - 0xea,0xea,0xea,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5, - 0xe4,0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0, - 0xdf,0xdf,0xdf,0x9f,0x9f,0x9f,0x61,0x61,0x61,0x6d,0x6d,0x6d,0xbc,0xbc,0xbc, - 0xff,0xff,0xff,0xe7,0xe7,0xe7,0x82,0xd7,0xd7,0xd7,0x29,0xd5,0xd5,0xd5,0xd4, - 0xd4,0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0x32,0x32,0x32,0x99, - 0x99,0x99,0xe8,0xe8,0xe8,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4, - 0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf, - 0xdf,0xdf,0xde,0xde,0xde,0xdd,0xdd,0xdd,0x9d,0x9d,0x9d,0xab,0xab,0xab,0xff, - 0xff,0xff,0xec,0xec,0xec,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4, - 0xd4,0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0x32, - 0x32,0x32,0x99,0x99,0x99,0xe7,0xe7,0xe7,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4, - 0xe4,0xe4,0xe3,0xe3,0xe3,0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xdf,0xdf,0xdf,0x82, - 0xde,0xde,0xde,0x23,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xf1,0xf1, - 0xf1,0xf0,0xf0,0xf0,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4, - 0xd4,0xd3,0xd3,0xd3,0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf, - 0xcf,0x32,0x32,0x32,0x99,0x99,0x99,0xe6,0xe6,0xe6,0xe5,0xe5,0xe5,0xe4,0xe4, - 0xe4,0xe3,0xe3,0xe3,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde, - 0xde,0xdd,0xdd,0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd9,0xd9, - 0xd9,0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4, - 0xd4,0xd3,0xd3,0xd3,0x82,0xd1,0xd1,0xd1,0x29,0xd0,0xd0,0xd0,0xce,0xce,0xce, - 0xcd,0xcd,0xcd,0x32,0x32,0x32,0x99,0x99,0x99,0xe5,0xe5,0xe5,0xe3,0xe3,0xe3, - 0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde, - 0xdd,0xdd,0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0xd9,0xd9,0xd9, - 0xd8,0xd8,0xd8,0xd7,0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd3,0xd3,0xd3, - 0xd2,0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xce,0xce,0xce, - 0xcd,0xcd,0xcd,0xcc,0xcc,0xcc,0x32,0x32,0x32,0x99,0x99,0x99,0xe3,0xe3,0xe3, - 0xe2,0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde, - 0xdd,0xdd,0xdd,0xdc,0xdc,0xdc,0xdb,0xdb,0xdb,0xda,0xda,0xda,0x82,0xd8,0xd8, - 0xd8,0x24,0xd7,0xd7,0xd7,0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3,0xd3,0xd2, - 0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xce,0xce,0xce,0xcd, - 0xcd,0xcd,0xcc,0xcc,0xcc,0xcb,0xcb,0xcb,0x32,0x32,0x32,0x99,0x99,0x99,0xe2, - 0xe2,0xe2,0xe1,0xe1,0xe1,0xe0,0xe0,0xe0,0xdf,0xdf,0xdf,0xde,0xde,0xde,0xdd, - 0xdd,0xdd,0xdc,0xdc,0xdc,0xda,0xda,0xda,0xd9,0xd9,0xd9,0xd8,0xd8,0xd8,0xd7, - 0xd7,0xd7,0xd6,0xd6,0xd6,0xd5,0xd5,0xd5,0xd4,0xd4,0xd4,0xd3,0xd3,0xd3,0xd2, - 0xd2,0xd2,0xd1,0xd1,0xd1,0xd0,0xd0,0xd0,0xcf,0xcf,0xcf,0xce,0xce,0xce,0xcd, - 0xcd,0xcd,0xcc,0xcc,0xcc,0x82,0xca,0xca,0xca,0x02,0x32,0x32,0x32,0x72,0x72, - 0x72,0x99,0x32,0x32,0x32 -}; - -static const GdkPixdata rotate_right_off_pixdata = { - 0x47646b50, /* Pixbuf magic: 'GdkP' */ - 24 + 1850, /* header length + pixel_data length */ - 0x2010001, /* pixdata_type */ - 78, /* rowstride */ - 26, /* width */ - 26, /* height */ - rotate_right_off_pixdata_pixel_data /* pixel_data */ -}; diff --git a/src/image_data/rotate_right_on.png b/src/image_data/rotate_right_on.png Binary files differdeleted file mode 100644 index 5a99d55..0000000 --- a/src/image_data/rotate_right_on.png +++ b/dev/null diff --git a/src/image_data/rotate_right_on_pixdata.h b/src/image_data/rotate_right_on_pixdata.h deleted file mode 100644 index c4acd08..0000000 --- a/src/image_data/rotate_right_on_pixdata.h +++ b/dev/null @@ -1,135 +0,0 @@ -/* GdkPixbuf RGB C-Source image dump 1-byte-run-length-encoded */ - -static guint8 rotate_right_on_pixdata_pixel_data[] = { - 0x99,0x32,0x32,0x32,0x7f,0x8c,0x8c,0x8c,0x32,0x32,0x32,0xc7,0xc7,0xc7,0xc5, - 0xc5,0xc5,0xc3,0xc3,0xc3,0xc1,0xc1,0xc1,0xc0,0xc0,0xc0,0xbe,0xbe,0xbe,0xbc, - 0xbc,0xbc,0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb5,0xb5,0xb5,0xb3, - 0xb3,0xb3,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab,0xab,0xa9, - 0xa9,0xa9,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2,0xa2,0xa0, - 0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xc5, - 0xc5,0xc5,0xc3,0xc3,0xc3,0xc1,0xc1,0xc1,0xbf,0xbf,0xbf,0xbd,0xbd,0xbd,0xbc, - 0xbc,0xbc,0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2, - 0xb2,0xb2,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab,0xab,0xa9, - 0xa9,0xa9,0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2,0xa2,0xa0, - 0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0xc1,0xc1,0xc1,0x32, - 0x32,0x32,0xc2,0xc2,0xc2,0xc1,0xc1,0xc1,0xbf,0xbf,0xbf,0xbd,0xbd,0xbd,0xbb, - 0xbb,0xbb,0xb9,0xb9,0xb9,0xb7,0xb7,0xb7,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2, - 0xb2,0xb2,0xb0,0xb0,0xb0,0xae,0xae,0xae,0xac,0xac,0xac,0xab,0xab,0xab,0xa9, - 0xa9,0xa9,0xa7,0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0xa0, - 0xa0,0xa0,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98,0x98,0x98,0xc1, - 0xc1,0xc1,0x32,0x32,0x32,0xc0,0xc0,0xc0,0xbf,0xbf,0xbf,0xbd,0xbd,0xbd,0xbb, - 0xbb,0xbb,0xb9,0xb9,0xb9,0xb7,0xb7,0xb7,0xb5,0xb5,0xb5,0xb4,0xb4,0xb4,0xb2, - 0xb2,0xb2,0xb0,0xb0,0xb0,0xae,0xae,0xae,0xac,0xac,0xac,0xaa,0xaa,0xaa,0xa9, - 0xa9,0xa9,0xa7,0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0x9f, - 0x9f,0x9f,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98,0x98,0x98,0x96, - 0x96,0x96,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xbe,0xbe,0xbe,0xbc,0xbc,0xbc,0xba, - 0xba,0xba,0xb9,0xb9,0xb9,0xb7,0xb7,0xb7,0xb5,0xb5,0xb5,0xb3,0xb3,0xb3,0xb1, - 0xb1,0xb1,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xac,0xac,0xac,0xaa,0xaa,0xaa,0xa8, - 0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0x9f, - 0x9f,0x9f,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x26,0x98,0x98,0x98, - 0x96,0x96,0x96,0x94,0x94,0x94,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xbc,0xbc,0xbc, - 0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb7,0xb7,0xb7,0xb5,0xb5,0xb5,0xb3,0xb3,0xb3, - 0xb1,0xb1,0xb1,0x57,0x57,0x57,0x6c,0x6c,0x6c,0x96,0x96,0x96,0xaa,0xaa,0xaa, - 0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2,0xa2,0xa0,0xa0,0xa0, - 0x9f,0x9f,0x9f,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x97,0x97,0x97, - 0x95,0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0xc1,0xc1,0xc1,0x32,0x32,0x32, - 0xba,0xba,0xba,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2,0xb2,0xb2, - 0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0x82,0x80,0x80,0x80,0x18,0x60,0x60,0x60,0x36, - 0x36,0x36,0x91,0x91,0x91,0xa4,0xa4,0xa4,0xa2,0xa2,0xa2,0xa0,0xa0,0xa0,0x9e, - 0x9e,0x9e,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x97,0x97,0x97,0x95, - 0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0x90,0x90,0x90,0xc1,0xc1,0xc1,0x32, - 0x32,0x32,0xb8,0xb8,0xb8,0xb6,0xb6,0xb6,0xb4,0xb4,0xb4,0xb2,0xb2,0xb2,0xb0, - 0xb0,0xb0,0xae,0xae,0xae,0xac,0xac,0xac,0x84,0xff,0xff,0xff,0x16,0xa4,0xa4, - 0xa4,0x72,0x72,0x72,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a, - 0x9a,0x98,0x98,0x98,0x96,0x96,0x96,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91, - 0x91,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xb5,0xb5, - 0xb5,0xb4,0xb4,0xb4,0xb2,0xb2,0xb2,0xb0,0xb0,0xb0,0xae,0xae,0xae,0xac,0xac, - 0xac,0xab,0xab,0xab,0x85,0xff,0xff,0xff,0x18,0xf1,0xf1,0xf1,0xa5,0xa5,0xa5, - 0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98,0x98,0x98,0x96,0x96,0x96,0x95,0x95,0x95, - 0x93,0x93,0x93,0x91,0x91,0x91,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xb3,0xb3,0xb3,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf, - 0xae,0xae,0xae,0xac,0xac,0xac,0xaa,0xaa,0xaa,0xa8,0xa8,0xa8,0xd3,0xd3,0xd3, - 0xd2,0xd2,0xd2,0xed,0xed,0xed,0x83,0xff,0xff,0xff,0x19,0xf6,0xf6,0xf6,0xa6, - 0xa6,0xa6,0x98,0x98,0x98,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90, - 0x90,0x90,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x89,0x89,0x89,0xc1, - 0xc1,0xc1,0x32,0x32,0x32,0xb1,0xb1,0xb1,0xaf,0xaf,0xaf,0xae,0xae,0xae,0xac, - 0xac,0xac,0xaa,0xaa,0xaa,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2, - 0xa2,0xa2,0xa1,0xa1,0xa1,0x97,0x97,0x97,0xf0,0xf0,0xf0,0x82,0xff,0xff,0xff, - 0x18,0xdd,0xdd,0xdd,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90,0x90, - 0x90,0x8e,0x8e,0x8e,0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x89,0x89,0x89,0x87,0x87, - 0x87,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xaf,0xaf,0xaf,0xad,0xad,0xad,0xab,0xab, - 0xab,0xa9,0xa9,0xa9,0xa7,0xa7,0xa7,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa2,0xa2, - 0xa2,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x5a,0x5a,0x5a,0x83,0xff, - 0xff,0xff,0x18,0xa1,0xa1,0xa1,0x92,0x92,0x92,0x90,0x90,0x90,0x8e,0x8e,0x8e, - 0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x87,0x87,0x87,0x85,0x85,0x85, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xad,0xad,0xad,0xab,0xab,0xab,0xa9,0xa9,0xa9, - 0xa7,0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa2,0xa2,0xa2,0xa0,0xa0,0xa0, - 0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x4c,0x4c,0x4c,0xd0,0xd0,0xd0, - 0x82,0xff,0xff,0xff,0x14,0xba,0xba,0xba,0x8f,0x8f,0x8f,0x8d,0x8d,0x8d,0x8b, - 0x8b,0x8b,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84,0x84,0x82, - 0x82,0x82,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xab,0xab,0xab,0xa9,0xa9,0xa9,0xa7, - 0xa7,0xa7,0xa5,0xa5,0xa5,0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0xa0,0xa0,0xa0,0x9e, - 0x9e,0x9e,0x1d,0x1d,0x1d,0x83,0x00,0x00,0x00,0x01,0x80,0x80,0x80,0x82,0xff, - 0xff,0xff,0x15,0x80,0x80,0x80,0x00,0x00,0x00,0x1a,0x1a,0x1a,0x8a,0x8a,0x8a, - 0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xa8,0xa8,0xa8,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4, - 0xa3,0xa3,0xa3,0xa1,0xa1,0xa1,0x9f,0x9f,0x9f,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b, - 0x8f,0x8f,0x8f,0xd2,0xd2,0xd2,0x88,0xff,0xff,0xff,0x13,0xe9,0xe9,0xe9,0x85, - 0x85,0x85,0x84,0x84,0x84,0x82,0x82,0x82,0x80,0x80,0x80,0x7e,0x7e,0x7e,0xc1, - 0xc1,0xc1,0x32,0x32,0x32,0xa6,0xa6,0xa6,0xa4,0xa4,0xa4,0xa3,0xa3,0xa3,0xa1, - 0xa1,0xa1,0x9f,0x9f,0x9f,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x98, - 0x98,0x98,0x82,0x82,0x82,0xf1,0xf1,0xf1,0x86,0xff,0xff,0xff,0x15,0xf8,0xf8, - 0xf8,0x8d,0x8d,0x8d,0x83,0x83,0x83,0x81,0x81,0x81,0x80,0x80,0x80,0x7e,0x7e, - 0x7e,0x7c,0x7c,0x7c,0xc1,0xc1,0xc1,0x32,0x32,0x32,0xa4,0xa4,0xa4,0xa2,0xa2, - 0xa2,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x99,0x99, - 0x99,0x97,0x97,0x97,0x95,0x95,0x95,0x93,0x93,0x93,0x7a,0x7a,0x7a,0xf0,0xf0, - 0xf0,0x84,0xff,0xff,0xff,0x16,0xf8,0xf8,0xf8,0x9c,0x9c,0x9c,0x83,0x83,0x83, - 0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7c,0x7c,0x7c,0x7a,0x7a,0x7a, - 0xc1,0xc1,0xc1,0x32,0x32,0x32,0xa2,0xa2,0xa2,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e, - 0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x99,0x99,0x99,0x97,0x97,0x97,0x95,0x95,0x95, - 0x93,0x93,0x93,0x91,0x91,0x91,0x8f,0x8f,0x8f,0x8c,0x8c,0x8c,0x84,0xff,0xff, - 0xff,0x17,0xb2,0xb2,0xb2,0x82,0x82,0x82,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d, - 0x7d,0x7d,0x7b,0x7b,0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0xc1,0xc1,0xc1,0x32, - 0x32,0x32,0xa0,0xa0,0xa0,0x9e,0x9e,0x9e,0x9c,0x9c,0x9c,0x9a,0x9a,0x9a,0x98, - 0x98,0x98,0x96,0x96,0x96,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x8f, - 0x8f,0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x99,0x99,0x99,0x82,0xff,0xff,0xff, - 0x7f,0xc2,0xc2,0xc2,0x82,0x82,0x82,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7d,0x7d, - 0x7d,0x7b,0x7b,0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0x76,0x76,0x76,0xc1,0xc1, - 0xc1,0x32,0x32,0x32,0x9d,0x9d,0x9d,0x9b,0x9b,0x9b,0x9a,0x9a,0x9a,0x98,0x98, - 0x98,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90,0x90,0x90,0x8f,0x8f, - 0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x89,0x89,0x89,0x87,0x87,0x87,0xd2,0xd2, - 0xd2,0xd1,0xd1,0xd1,0x82,0x82,0x82,0x80,0x80,0x80,0x7e,0x7e,0x7e,0x7c,0x7c, - 0x7c,0x7a,0x7a,0x7a,0x79,0x79,0x79,0x77,0x77,0x77,0x75,0x75,0x75,0x73,0x73, - 0x73,0xc1,0xc1,0xc1,0x32,0x32,0x32,0x9b,0x9b,0x9b,0x99,0x99,0x99,0x98,0x98, - 0x98,0x96,0x96,0x96,0x94,0x94,0x94,0x92,0x92,0x92,0x90,0x90,0x90,0x8f,0x8f, - 0x8f,0x8d,0x8d,0x8d,0x8b,0x8b,0x8b,0x89,0x89,0x89,0x87,0x87,0x87,0x85,0x85, - 0x85,0x83,0x83,0x83,0x82,0x82,0x82,0x80,0x80,0x80,0x7e,0x7e,0x7e,0x7c,0x7c, - 0x7c,0x7a,0x7a,0x7a,0x78,0x78,0x78,0x77,0x77,0x77,0x75,0x75,0x75,0x73,0x73, - 0x73,0x71,0x71,0x71,0xc1,0xc1,0xc1,0x32,0x32,0x32,0x99,0x99,0x99,0x97,0x97, - 0x97,0x95,0x95,0x95,0x93,0x93,0x93,0x92,0x92,0x92,0x90,0x90,0x90,0x8e,0x8e, - 0x8e,0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x87,0x87,0x87,0x85,0x85, - 0x85,0x83,0x83,0x83,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7c,0x7c, - 0x7c,0x7a,0x7a,0x7a,0x78,0x78,0x78,0x76,0x76,0x76,0x74,0x74,0x74,0x72,0x72, - 0x72,0x71,0x71,0x71,0x6f,0x6f,0x6f,0xc1,0xc1,0xc1,0x32,0x32,0x32,0x97,0x97, - 0x97,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x90,0x90,0x90,0x8e,0x8e, - 0x8e,0x8c,0x8c,0x8c,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84, - 0x84,0x83,0x83,0x83,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7b,0x7b, - 0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0x76,0x76,0x76,0x74,0x74,0x74,0x72,0x72, - 0x72,0x70,0x70,0x70,0x6e,0x6e,0x6e,0x6c,0x6c,0x6c,0xc1,0xc1,0xc1,0x32,0x32, - 0x32,0x95,0x95,0x95,0x93,0x93,0x93,0x91,0x91,0x91,0x8f,0x8f,0x8f,0x8d,0x8d, - 0x8d,0x8b,0x8b,0x8b,0x8a,0x8a,0x8a,0x88,0x88,0x88,0x86,0x86,0x86,0x84,0x84, - 0x84,0x82,0x82,0x82,0x80,0x80,0x80,0x0e,0x7f,0x7f,0x7f,0x7d,0x7d,0x7d,0x7b, - 0x7b,0x7b,0x79,0x79,0x79,0x77,0x77,0x77,0x76,0x76,0x76,0x74,0x74,0x74,0x72, - 0x72,0x72,0x70,0x70,0x70,0x6e,0x6e,0x6e,0x6c,0x6c,0x6c,0x6b,0x6b,0x6b,0xc1, - 0xc1,0xc1,0x8c,0x8c,0x8c,0x99,0xc1,0xc1,0xc1 -}; - -static const GdkPixdata rotate_right_on_pixdata = { - 0x47646b50, /* Pixbuf magic: 'GdkP' */ - 24 + 1809, /* header length + pixel_data length */ - 0x2010001, /* pixdata_type */ - 78, /* rowstride */ - 26, /* width */ - 26, /* height */ - rotate_right_on_pixdata_pixel_data /* pixel_data */ -}; diff --git a/src/image_data/rotation.png b/src/image_data/rotation.png Binary files differdeleted file mode 100644 index 466812a..0000000 --- a/src/image_data/rotation.png +++ b/dev/null diff --git a/src/image_data/rotation_orientation_horz.png b/src/image_data/rotation_orientation_horz.png Binary files differdeleted file mode 100644 index 8280377..0000000 --- a/src/image_data/rotation_orientation_horz.png +++ b/dev/null diff --git a/src/image_data/rotation_orientation_horz_pixdata.h b/src/image_data/rotation_orientation_horz_pixdata.h deleted file mode 100644 index d346355..0000000 --- a/src/image_data/rotation_orientation_horz_pixdata.h +++ b/dev/null @@ -1,2304 +0,0 @@ -/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */ - -static guint8 rotation_orientation_horz_pixdata_pixel_data[] = { - 0x03,0x00,0x00,0x00,0xff,0x05,0x05,0x05,0xff,0x05,0x04,0x04,0xff,0x91,0x05, - 0x05,0x05,0xff,0x05,0x04,0x05,0x05,0xff,0x04,0x04,0x04,0xff,0x04,0x04,0x05, - 0xff,0x05,0x05,0x05,0xff,0x04,0x05,0x05,0xff,0x84,0x05,0x05,0x05,0xff,0x82, - 0x04,0x04,0x04,0xff,0xd5,0x05,0x05,0x05,0xff,0x82,0x04,0x04,0x04,0xff,0x0b, - 0x05,0x05,0x05,0xff,0x00,0x00,0x00,0xff,0x04,0x04,0x04,0xff,0xe5,0xe4,0xe4, - 0xff,0xdb,0xc6,0xc5,0xff,0xde,0xd4,0xd3,0xff,0xe5,0xe5,0xe5,0xff,0xe0,0xe0, - 0xe0,0xff,0xe2,0xe2,0xe2,0xff,0xde,0xde,0xde,0xff,0xe4,0xe4,0xe4,0xff,0x82, - 0xe2,0xe2,0xe2,0xff,0x18,0xe3,0xe3,0xe3,0xff,0xe4,0xe4,0xe4,0xff,0xe5,0xe5, - 0xe5,0xff,0xe1,0xe1,0xe1,0xff,0xe3,0xe3,0xe3,0xff,0xe2,0xe2,0xe2,0xff,0xe3, - 0xe3,0xe3,0xff,0xe4,0xe4,0xe4,0xff,0xde,0xdf,0xdf,0xff,0xc3,0xcf,0xcf,0xff, - 0xaf,0xc7,0xcc,0xff,0xc6,0xcd,0xd6,0xff,0xd1,0xd3,0xd3,0xff,0xc9,0xce,0xcf, - 0xff,0xd8,0xd9,0xd8,0xff,0xd1,0xd1,0xd1,0xff,0xd4,0xd4,0xd4,0xff,0xd5,0xd5, - 0xd8,0xff,0xb9,0xbc,0xc3,0xff,0xbd,0xc1,0xc8,0xff,0xd2,0xd4,0xd8,0xff,0xd0, - 0xd3,0xd5,0xff,0xd9,0xda,0xdb,0xff,0xe4,0xe4,0xe4,0xff,0xbf,0xe6,0xe6,0xe6, - 0xff,0x0f,0xe3,0xe3,0xe3,0xff,0xe4,0xe4,0xe4,0xff,0xdc,0xdc,0xdc,0xff,0xdf, - 0xdf,0xdf,0xff,0xe4,0xe4,0xe4,0xff,0xe1,0xe1,0xe1,0xff,0xe3,0xe3,0xe3,0xff, - 0xe4,0xe4,0xe4,0xff,0xe0,0xe0,0xe0,0xff,0xde,0xde,0xde,0xff,0xe4,0xe4,0xe4, - 0xff,0xdd,0xdd,0xdd,0xff,0xe1,0xe1,0xe1,0xff,0xdd,0xdd,0xdd,0xff,0xe3,0xe3, - 0xe3,0xff,0x82,0xde,0xde,0xde,0xff,0x04,0xe5,0xe5,0xe5,0xff,0xc9,0xc9,0xc9, - 0xff,0xc7,0xc7,0xc7,0xff,0xe5,0xe5,0xe5,0xff,0x82,0x04,0x04,0x04,0xff,0x22, - 0xde,0xd6,0xd6,0xff,0xb8,0x47,0x42,0xff,0xb7,0x64,0x62,0xff,0xcb,0xcb,0xcb, - 0xff,0x9b,0x9b,0x9b,0xff,0xa3,0xa3,0xa3,0xff,0x98,0x98,0x98,0xff,0xb8,0xb8, - 0xb8,0xff,0x9d,0x9d,0x9d,0xff,0xaa,0xaa,0xaa,0xff,0xa3,0xa3,0xa3,0xff,0xc0, - 0xc0,0xc0,0xff,0xda,0xda,0xda,0xff,0xb2,0xb2,0xb2,0xff,0xaa,0xaa,0xaa,0xff, - 0xa9,0xa9,0xa9,0xff,0xac,0xac,0xac,0xff,0xb0,0xb0,0xb0,0xff,0xc5,0xc8,0xca, - 0xff,0xa4,0xb6,0xb8,0xff,0x7f,0x99,0x9c,0xff,0xa4,0xa4,0xa5,0xff,0xc7,0xba, - 0x9e,0xff,0xbb,0xb3,0x99,0xff,0xc2,0xc0,0xb9,0xff,0xc6,0xc5,0xc5,0xff,0xce, - 0xce,0xcf,0xff,0xc7,0xc7,0xca,0xff,0xa4,0xae,0xb8,0xff,0xa7,0xb2,0xbd,0xff, - 0xad,0xbd,0xcf,0xff,0xa4,0xad,0xb7,0xff,0xc5,0xc2,0xc0,0xff,0xe0,0xe0,0xe0, - 0xff,0xbf,0xe6,0xe6,0xe6,0xff,0x82,0xe4,0xe4,0xe4,0xff,0x36,0xc8,0xc8,0xc8, - 0xff,0xab,0xab,0xab,0xff,0xba,0xba,0xba,0xff,0xa6,0xa6,0xa6,0xff,0xac,0xac, - 0xac,0xff,0xaf,0xaf,0xaf,0xff,0xb8,0xb8,0xb8,0xff,0xbb,0xbb,0xbb,0xff,0xda, - 0xda,0xda,0xff,0xc5,0xc5,0xc5,0xff,0xc0,0xc0,0xc0,0xff,0x9e,0x9e,0x9e,0xff, - 0xb4,0xb4,0xb4,0xff,0x96,0x96,0x96,0xff,0x8b,0x8b,0x8b,0xff,0xdc,0xdc,0xdc, - 0xff,0xa4,0xa4,0xa4,0xff,0xb6,0xb6,0xb6,0xff,0xe4,0xe4,0xe4,0xff,0x04,0x04, - 0x04,0xff,0x03,0x03,0x04,0xff,0xd0,0xd2,0xd7,0xff,0xc9,0xc8,0xcd,0xff,0xc5, - 0xc0,0xc4,0xff,0xcd,0xcf,0xd4,0xff,0xc0,0xc2,0xc6,0xff,0xba,0xbc,0xc1,0xff, - 0xc7,0xc9,0xce,0xff,0xc6,0xc8,0xcd,0xff,0xc3,0xc5,0xca,0xff,0xc6,0xc8,0xcd, - 0xff,0xc7,0xca,0xce,0xff,0xc8,0xca,0xcf,0xff,0xd0,0xd2,0xd7,0xff,0xcc,0xce, - 0xd3,0xff,0xc6,0xc8,0xcd,0xff,0xc7,0xc9,0xce,0xff,0xc7,0xca,0xce,0xff,0xc8, - 0xca,0xce,0xff,0xcd,0xcf,0xd3,0xff,0xc6,0xca,0xd0,0xff,0xb4,0xb8,0xc1,0xff, - 0xbe,0xc0,0xc6,0xff,0xc9,0xc6,0xc4,0xff,0xc3,0xbf,0xb7,0xff,0xc9,0xc8,0xc8, - 0xff,0xc4,0xc5,0xc9,0xff,0xbb,0xbd,0xc2,0xff,0xc3,0xc5,0xcb,0xff,0xbb,0xc3, - 0xce,0xff,0xba,0xc2,0xcd,0xff,0xbf,0xc3,0xcc,0xff,0xaa,0xaf,0xbf,0xff,0xbc, - 0xbf,0xca,0xff,0x86,0xd2,0xd4,0xd9,0xff,0x83,0xd2,0xd5,0xda,0xff,0x8c,0xd3, - 0xd5,0xda,0xff,0x82,0xd3,0xd5,0xdb,0xff,0x87,0xd3,0xd6,0xdb,0xff,0x87,0xd4, - 0xd6,0xdb,0xff,0x86,0xd4,0xd6,0xdc,0xff,0x87,0xd4,0xd7,0xdc,0xff,0x84,0xd5, - 0xd7,0xdc,0xff,0x8a,0xd5,0xd7,0xdd,0xff,0x1c,0xd3,0xd5,0xda,0xff,0xd4,0xd6, - 0xdb,0xff,0xd2,0xd5,0xda,0xff,0xcd,0xcf,0xd5,0xff,0xcb,0xcd,0xd3,0xff,0xce, - 0xd0,0xd5,0xff,0xca,0xcd,0xd2,0xff,0xbb,0xbe,0xc3,0xff,0xc3,0xc5,0xcb,0xff, - 0xc6,0xc8,0xcd,0xff,0xcb,0xce,0xd3,0xff,0xd0,0xd3,0xd8,0xff,0xd1,0xd4,0xd9, - 0xff,0xcc,0xce,0xd4,0xff,0xd0,0xd3,0xd8,0xff,0xcf,0xd1,0xd7,0xff,0xd0,0xd3, - 0xd8,0xff,0xd5,0xd7,0xdc,0xff,0xc0,0xc2,0xc7,0xff,0xc3,0xc6,0xcb,0xff,0xd4, - 0xd7,0xdc,0xff,0x03,0x04,0x04,0xff,0x01,0x01,0x02,0xff,0x23,0x3b,0x72,0xff, - 0x24,0x3c,0x72,0xff,0x24,0x3d,0x73,0xff,0x25,0x3e,0x74,0xff,0x26,0x3e,0x74, - 0xff,0x82,0x26,0x3e,0x75,0xff,0x82,0x26,0x3f,0x75,0xff,0x01,0x27,0x3f,0x75, - 0xff,0x82,0x27,0x40,0x75,0xff,0x0e,0x28,0x40,0x75,0xff,0x28,0x41,0x76,0xff, - 0x29,0x41,0x77,0xff,0x29,0x42,0x77,0xff,0x2a,0x42,0x78,0xff,0x2a,0x43,0x79, - 0xff,0x2b,0x43,0x79,0xff,0x2b,0x44,0x7a,0xff,0x2c,0x44,0x7a,0xff,0x2c,0x45, - 0x7b,0xff,0x2d,0x45,0x7c,0xff,0x2d,0x46,0x7d,0xff,0x2e,0x47,0x7d,0xff,0x2e, - 0x47,0x7e,0xff,0x82,0x2f,0x48,0x7f,0xff,0x12,0x30,0x49,0x80,0xff,0x30,0x49, - 0x81,0xff,0x31,0x49,0x81,0xff,0x31,0x4a,0x82,0xff,0x32,0x4a,0x83,0xff,0x33, - 0x4b,0x84,0xff,0x33,0x4c,0x85,0xff,0x34,0x4d,0x86,0xff,0x35,0x4e,0x87,0xff, - 0x36,0x4f,0x88,0xff,0x37,0x50,0x89,0xff,0x38,0x51,0x8b,0xff,0x38,0x53,0x8c, - 0xff,0x39,0x54,0x8d,0xff,0x3a,0x54,0x8e,0xff,0x3a,0x55,0x8e,0xff,0x3b,0x55, - 0x8f,0xff,0x3b,0x56,0x90,0xff,0x82,0x3c,0x57,0x91,0xff,0x03,0x3d,0x58,0x92, - 0xff,0x3d,0x58,0x94,0xff,0x3e,0x59,0x94,0xff,0x82,0x3f,0x5a,0x95,0xff,0x04, - 0x40,0x5b,0x96,0xff,0x40,0x5b,0x97,0xff,0x41,0x5c,0x97,0xff,0x41,0x5d,0x98, - 0xff,0x82,0x42,0x5e,0x99,0xff,0x21,0x43,0x5f,0x9a,0xff,0x43,0x5f,0x9b,0xff, - 0x44,0x60,0x9c,0xff,0x45,0x60,0x9c,0xff,0x45,0x61,0x9d,0xff,0x46,0x62,0x9d, - 0xff,0x46,0x62,0x9e,0xff,0x47,0x63,0x9f,0xff,0x47,0x63,0xa0,0xff,0x48,0x64, - 0xa0,0xff,0x48,0x65,0xa1,0xff,0x49,0x65,0xa2,0xff,0x4a,0x66,0xa2,0xff,0x4b, - 0x66,0xa3,0xff,0x4b,0x67,0xa4,0xff,0x4c,0x67,0xa4,0xff,0x4c,0x68,0xa5,0xff, - 0x4d,0x68,0xa6,0xff,0x4d,0x69,0xa6,0xff,0x4e,0x6a,0xa7,0xff,0x4f,0x6a,0xa8, - 0xff,0x4f,0x6b,0xa8,0xff,0x50,0x6b,0xa9,0xff,0x50,0x6c,0xaa,0xff,0x51,0x6c, - 0xaa,0xff,0x52,0x6d,0xab,0xff,0x52,0x6e,0xac,0xff,0x53,0x6e,0xad,0xff,0x53, - 0x6f,0xad,0xff,0x54,0x6f,0xae,0xff,0x54,0x70,0xaf,0xff,0x55,0x70,0xb0,0xff, - 0x55,0x71,0xb0,0xff,0x9a,0x56,0x71,0xb0,0xff,0x07,0x01,0x02,0x03,0xff,0x00, - 0x01,0x02,0xff,0x1e,0x37,0x6f,0xff,0x1f,0x37,0x70,0xff,0x1f,0x38,0x70,0xff, - 0x20,0x39,0x71,0xff,0x20,0x39,0x72,0xff,0x82,0x21,0x3a,0x73,0xff,0x06,0x22, - 0x3b,0x74,0xff,0x22,0x3c,0x75,0xff,0x23,0x3c,0x75,0xff,0x23,0x3d,0x76,0xff, - 0x24,0x3d,0x77,0xff,0x24,0x3e,0x77,0xff,0x83,0x25,0x3e,0x77,0xff,0x01,0x25, - 0x3f,0x77,0xff,0x82,0x25,0x3f,0x78,0xff,0x02,0x26,0x40,0x78,0xff,0x26,0x40, - 0x79,0xff,0x82,0x27,0x41,0x7a,0xff,0x02,0x28,0x41,0x7b,0xff,0x29,0x42,0x7c, - 0xff,0x82,0x29,0x43,0x7c,0xff,0x29,0x2a,0x44,0x7d,0xff,0x2a,0x44,0x7e,0xff, - 0x2b,0x45,0x7f,0xff,0x2c,0x45,0x7f,0xff,0x2c,0x45,0x80,0xff,0x2d,0x46,0x81, - 0xff,0x2d,0x46,0x82,0xff,0x2e,0x47,0x83,0xff,0x2f,0x48,0x83,0xff,0x2f,0x49, - 0x84,0xff,0x30,0x49,0x85,0xff,0x30,0x4a,0x86,0xff,0x31,0x4a,0x86,0xff,0x31, - 0x4b,0x87,0xff,0x32,0x4c,0x88,0xff,0x33,0x4d,0x89,0xff,0x33,0x4e,0x8a,0xff, - 0x34,0x4e,0x8b,0xff,0x35,0x50,0x8c,0xff,0x36,0x50,0x8d,0xff,0x37,0x51,0x8e, - 0xff,0x37,0x52,0x8f,0xff,0x38,0x53,0x90,0xff,0x38,0x54,0x91,0xff,0x39,0x55, - 0x93,0xff,0x3a,0x56,0x93,0xff,0x3b,0x57,0x94,0xff,0x3c,0x57,0x95,0xff,0x3c, - 0x58,0x96,0xff,0x3d,0x59,0x97,0xff,0x3e,0x5a,0x98,0xff,0x3e,0x5b,0x99,0xff, - 0x3f,0x5b,0x99,0xff,0x3f,0x5c,0x9a,0xff,0x40,0x5c,0x9b,0xff,0x40,0x5d,0x9c, - 0xff,0x41,0x5e,0x9c,0xff,0x41,0x5e,0x9d,0xff,0x42,0x5f,0x9e,0xff,0x43,0x5f, - 0x9e,0xff,0x43,0x60,0x9f,0xff,0x82,0x44,0x61,0xa0,0xff,0x14,0x45,0x62,0xa1, - 0xff,0x45,0x62,0xa2,0xff,0x46,0x63,0xa3,0xff,0x47,0x63,0xa3,0xff,0x48,0x64, - 0xa4,0xff,0x48,0x65,0xa5,0xff,0x49,0x65,0xa5,0xff,0x49,0x66,0xa6,0xff,0x4a, - 0x67,0xa7,0xff,0x4b,0x67,0xa8,0xff,0x4b,0x68,0xa8,0xff,0x4c,0x68,0xa9,0xff, - 0x4c,0x69,0xaa,0xff,0x4d,0x69,0xaa,0xff,0x4d,0x6a,0xab,0xff,0x4e,0x6b,0xac, - 0xff,0x4e,0x6b,0xad,0xff,0x4f,0x6c,0xad,0xff,0x4f,0x6c,0xae,0xff,0x50,0x6d, - 0xaf,0xff,0x82,0x51,0x6e,0xb0,0xff,0x9a,0x52,0x6f,0xb1,0xff,0x15,0x01,0x02, - 0x03,0xff,0x00,0x01,0x02,0xff,0x1e,0x36,0x6f,0xff,0x1e,0x37,0x6f,0xff,0x1f, - 0x38,0x70,0xff,0x1f,0x38,0x71,0xff,0x20,0x39,0x71,0xff,0x20,0x39,0x72,0xff, - 0x21,0x3a,0x73,0xff,0x21,0x3b,0x73,0xff,0x22,0x3b,0x74,0xff,0x23,0x3c,0x75, - 0xff,0x23,0x3c,0x76,0xff,0x24,0x3d,0x76,0xff,0x24,0x3e,0x77,0xff,0x25,0x3e, - 0x78,0xff,0x25,0x3f,0x78,0xff,0x26,0x3f,0x79,0xff,0x26,0x40,0x7a,0xff,0x27, - 0x40,0x7b,0xff,0x27,0x41,0x7b,0xff,0x84,0x28,0x42,0x7c,0xff,0x01,0x29,0x42, - 0x7c,0xff,0x83,0x29,0x43,0x7d,0xff,0x28,0x2a,0x44,0x7d,0xff,0x2a,0x45,0x7e, - 0xff,0x2b,0x45,0x7f,0xff,0x2c,0x45,0x7f,0xff,0x2c,0x45,0x80,0xff,0x2c,0x46, - 0x81,0xff,0x2d,0x46,0x81,0xff,0x2e,0x47,0x82,0xff,0x2e,0x48,0x83,0xff,0x2f, - 0x48,0x84,0xff,0x2f,0x49,0x84,0xff,0x30,0x49,0x85,0xff,0x30,0x4a,0x86,0xff, - 0x31,0x4b,0x86,0xff,0x32,0x4b,0x87,0xff,0x32,0x4c,0x88,0xff,0x33,0x4c,0x89, - 0xff,0x33,0x4d,0x89,0xff,0x34,0x4e,0x8a,0xff,0x34,0x4e,0x8b,0xff,0x35,0x4f, - 0x8b,0xff,0x35,0x4f,0x8c,0xff,0x36,0x50,0x8d,0xff,0x36,0x51,0x8e,0xff,0x37, - 0x51,0x8e,0xff,0x38,0x52,0x8f,0xff,0x38,0x53,0x90,0xff,0x39,0x54,0x92,0xff, - 0x3a,0x55,0x93,0xff,0x3b,0x56,0x94,0xff,0x3c,0x57,0x95,0xff,0x3d,0x58,0x96, - 0xff,0x3d,0x59,0x97,0xff,0x3e,0x5a,0x98,0xff,0x3f,0x5b,0x99,0xff,0x40,0x5c, - 0x9a,0xff,0x41,0x5c,0x9b,0xff,0x41,0x5d,0x9c,0xff,0x42,0x5e,0x9d,0xff,0x42, - 0x5f,0x9e,0xff,0x82,0x43,0x60,0x9f,0xff,0x0f,0x44,0x61,0xa0,0xff,0x44,0x61, - 0xa1,0xff,0x45,0x62,0xa1,0xff,0x45,0x62,0xa2,0xff,0x46,0x63,0xa3,0xff,0x47, - 0x64,0xa4,0xff,0x48,0x64,0xa4,0xff,0x49,0x65,0xa5,0xff,0x49,0x65,0xa6,0xff, - 0x4a,0x66,0xa6,0xff,0x4a,0x67,0xa7,0xff,0x4b,0x67,0xa8,0xff,0x4b,0x68,0xa8, - 0xff,0x4c,0x68,0xa9,0xff,0x4c,0x69,0xaa,0xff,0x82,0x4d,0x6a,0xab,0xff,0x05, - 0x4e,0x6b,0xac,0xff,0x4f,0x6b,0xad,0xff,0x4f,0x6c,0xad,0xff,0x50,0x6d,0xae, - 0xff,0x50,0x6d,0xaf,0xff,0x82,0x51,0x6e,0xb0,0xff,0x99,0x52,0x6f,0xb1,0xff, - 0x0a,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x1d,0x36,0x6e,0xff,0x1e,0x37, - 0x6f,0xff,0x1e,0x37,0x70,0xff,0x1f,0x38,0x70,0xff,0x1f,0x38,0x71,0xff,0x20, - 0x39,0x72,0xff,0x21,0x3a,0x72,0xff,0x21,0x3a,0x73,0xff,0x82,0x22,0x3b,0x74, - 0xff,0x05,0x23,0x3c,0x75,0xff,0x23,0x3d,0x76,0xff,0x24,0x3d,0x77,0xff,0x24, - 0x3e,0x77,0xff,0x25,0x3e,0x78,0xff,0x82,0x26,0x3f,0x79,0xff,0x08,0x27,0x40, - 0x7a,0xff,0x27,0x41,0x7b,0xff,0x28,0x41,0x7b,0xff,0x28,0x42,0x7c,0xff,0x29, - 0x42,0x7d,0xff,0x29,0x43,0x7e,0xff,0x2a,0x44,0x7e,0xff,0x2a,0x44,0x7f,0xff, - 0x82,0x2b,0x45,0x80,0xff,0x83,0x2c,0x46,0x80,0xff,0x01,0x2c,0x46,0x81,0xff, - 0x82,0x2c,0x47,0x81,0xff,0x82,0x2d,0x47,0x82,0xff,0x82,0x2e,0x48,0x83,0xff, - 0x38,0x2f,0x48,0x84,0xff,0x2f,0x49,0x85,0xff,0x30,0x4a,0x85,0xff,0x31,0x4a, - 0x86,0xff,0x31,0x4b,0x87,0xff,0x32,0x4b,0x87,0xff,0x32,0x4c,0x88,0xff,0x33, - 0x4d,0x89,0xff,0x33,0x4d,0x8a,0xff,0x34,0x4e,0x8a,0xff,0x34,0x4e,0x8b,0xff, - 0x35,0x4f,0x8c,0xff,0x36,0x50,0x8c,0xff,0x36,0x50,0x8d,0xff,0x37,0x51,0x8e, - 0xff,0x37,0x51,0x8f,0xff,0x38,0x52,0x8f,0xff,0x38,0x53,0x90,0xff,0x39,0x53, - 0x91,0xff,0x39,0x54,0x91,0xff,0x3a,0x54,0x92,0xff,0x3a,0x55,0x93,0xff,0x3b, - 0x55,0x93,0xff,0x3c,0x56,0x94,0xff,0x3c,0x57,0x95,0xff,0x3d,0x57,0x96,0xff, - 0x3e,0x59,0x97,0xff,0x3f,0x5a,0x98,0xff,0x3f,0x5b,0x9a,0xff,0x40,0x5c,0x9b, - 0xff,0x41,0x5d,0x9c,0xff,0x42,0x5e,0x9d,0xff,0x43,0x5f,0x9e,0xff,0x44,0x60, - 0x9f,0xff,0x45,0x61,0xa0,0xff,0x45,0x62,0xa1,0xff,0x46,0x62,0xa2,0xff,0x47, - 0x63,0xa3,0xff,0x48,0x64,0xa4,0xff,0x48,0x65,0xa4,0xff,0x49,0x65,0xa5,0xff, - 0x49,0x66,0xa6,0xff,0x4a,0x66,0xa7,0xff,0x4a,0x67,0xa7,0xff,0x4b,0x67,0xa8, - 0xff,0x4c,0x68,0xa9,0xff,0x4c,0x69,0xa9,0xff,0x4d,0x69,0xaa,0xff,0x4d,0x6a, - 0xab,0xff,0x4e,0x6a,0xab,0xff,0x4e,0x6b,0xac,0xff,0x4f,0x6c,0xad,0xff,0x50, - 0x6c,0xae,0xff,0x50,0x6d,0xaf,0xff,0x51,0x6e,0xaf,0xff,0x51,0x6e,0xb0,0xff, - 0x99,0x52,0x6f,0xb1,0xff,0x09,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x1c, - 0x36,0x6e,0xff,0x1d,0x36,0x6e,0xff,0x1e,0x37,0x6f,0xff,0x1f,0x37,0x70,0xff, - 0x1f,0x38,0x70,0xff,0x20,0x39,0x71,0xff,0x20,0x39,0x72,0xff,0x82,0x21,0x3a, - 0x73,0xff,0x17,0x22,0x3b,0x74,0xff,0x22,0x3c,0x74,0xff,0x24,0x3d,0x75,0xff, - 0x23,0x3d,0x76,0xff,0x24,0x3d,0x77,0xff,0x24,0x3e,0x78,0xff,0x25,0x3e,0x78, - 0xff,0x26,0x3f,0x79,0xff,0x26,0x40,0x7a,0xff,0x27,0x40,0x7a,0xff,0x27,0x41, - 0x7b,0xff,0x28,0x42,0x7c,0xff,0x28,0x42,0x7d,0xff,0x29,0x43,0x7d,0xff,0x29, - 0x43,0x7e,0xff,0x2a,0x44,0x7f,0xff,0x2b,0x44,0x7f,0xff,0x2b,0x45,0x80,0xff, - 0x2c,0x46,0x81,0xff,0x2c,0x47,0x81,0xff,0x2d,0x48,0x82,0xff,0x2d,0x49,0x83, - 0xff,0x2e,0x49,0x84,0xff,0x85,0x2f,0x4a,0x85,0xff,0x83,0x30,0x4a,0x86,0xff, - 0x03,0x31,0x4b,0x86,0xff,0x31,0x4b,0x87,0xff,0x31,0x4c,0x87,0xff,0x82,0x32, - 0x4c,0x88,0xff,0x05,0x33,0x4d,0x89,0xff,0x33,0x4d,0x8a,0xff,0x34,0x4e,0x8a, - 0xff,0x35,0x4f,0x8b,0xff,0x35,0x4f,0x8c,0xff,0x82,0x36,0x50,0x8d,0xff,0x05, - 0x37,0x51,0x8e,0xff,0x37,0x51,0x8f,0xff,0x38,0x52,0x90,0xff,0x38,0x53,0x90, - 0xff,0x39,0x53,0x91,0xff,0x82,0x3a,0x54,0x92,0xff,0x1c,0x3b,0x55,0x93,0xff, - 0x3b,0x56,0x94,0xff,0x3c,0x56,0x94,0xff,0x3c,0x57,0x95,0xff,0x3d,0x57,0x96, - 0xff,0x3d,0x58,0x97,0xff,0x3e,0x59,0x97,0xff,0x3e,0x59,0x98,0xff,0x3f,0x5a, - 0x99,0xff,0x40,0x5a,0x99,0xff,0x40,0x5b,0x9a,0xff,0x41,0x5c,0x9b,0xff,0x42, - 0x5d,0x9c,0xff,0x43,0x5e,0x9e,0xff,0x43,0x5f,0x9f,0xff,0x45,0x61,0xa0,0xff, - 0x46,0x61,0xa1,0xff,0x47,0x62,0xa2,0xff,0x48,0x63,0xa3,0xff,0x49,0x64,0xa4, - 0xff,0x49,0x65,0xa5,0xff,0x4a,0x66,0xa7,0xff,0x4a,0x67,0xa7,0xff,0x4b,0x67, - 0xa8,0xff,0x4c,0x68,0xa9,0xff,0x4c,0x69,0xaa,0xff,0x4d,0x69,0xaa,0xff,0x4d, - 0x6a,0xab,0xff,0x82,0x4e,0x6b,0xac,0xff,0x03,0x4f,0x6c,0xad,0xff,0x50,0x6d, - 0xae,0xff,0x50,0x6d,0xaf,0xff,0x82,0x51,0x6e,0xb0,0xff,0x98,0x52,0x6f,0xb1, - 0xff,0x1c,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x1c,0x35,0x6d,0xff,0x1c, - 0x36,0x6e,0xff,0x1e,0x36,0x6f,0xff,0x1e,0x37,0x6f,0xff,0x1f,0x38,0x70,0xff, - 0x1f,0x38,0x71,0xff,0x20,0x39,0x71,0xff,0x21,0x3a,0x73,0xff,0x2b,0x43,0x77, - 0xff,0x37,0x4f,0x80,0xff,0x3c,0x54,0x82,0xff,0x39,0x4f,0x7d,0xff,0x23,0x3c, - 0x75,0xff,0x24,0x3d,0x76,0xff,0x24,0x3e,0x77,0xff,0x25,0x3e,0x78,0xff,0x25, - 0x3f,0x79,0xff,0x26,0x3f,0x79,0xff,0x26,0x40,0x7a,0xff,0x27,0x40,0x7b,0xff, - 0x27,0x41,0x7b,0xff,0x28,0x42,0x7c,0xff,0x29,0x42,0x7d,0xff,0x29,0x43,0x7d, - 0xff,0x2a,0x43,0x7e,0xff,0x2a,0x44,0x7f,0xff,0x82,0x2b,0x45,0x80,0xff,0x0f, - 0x2c,0x46,0x81,0xff,0x2d,0x47,0x82,0xff,0x2d,0x48,0x83,0xff,0x2e,0x49,0x83, - 0xff,0x2e,0x49,0x84,0xff,0x2f,0x4a,0x85,0xff,0x2f,0x4b,0x86,0xff,0x30,0x4b, - 0x86,0xff,0x30,0x4c,0x87,0xff,0x31,0x4d,0x88,0xff,0x32,0x4d,0x89,0xff,0x32, - 0x4e,0x89,0xff,0x33,0x4e,0x89,0xff,0x32,0x4e,0x89,0xff,0x33,0x4e,0x89,0xff, - 0x83,0x33,0x4e,0x8a,0xff,0x03,0x34,0x4e,0x8a,0xff,0x34,0x4e,0x8b,0xff,0x34, - 0x4f,0x8c,0xff,0x82,0x35,0x4f,0x8c,0xff,0x12,0x36,0x50,0x8d,0xff,0x36,0x51, - 0x8e,0xff,0x37,0x51,0x8e,0xff,0x38,0x52,0x8f,0xff,0x38,0x52,0x90,0xff,0x39, - 0x53,0x91,0xff,0x39,0x54,0x91,0xff,0x3a,0x54,0x92,0xff,0x3a,0x55,0x93,0xff, - 0x3b,0x55,0x93,0xff,0x3b,0x56,0x94,0xff,0x3c,0x56,0x95,0xff,0x3c,0x57,0x95, - 0xff,0x3d,0x58,0x96,0xff,0x3e,0x58,0x97,0xff,0x3e,0x59,0x97,0xff,0x3f,0x59, - 0x98,0xff,0x3f,0x5a,0x99,0xff,0x82,0x40,0x5b,0x9a,0xff,0x05,0x41,0x5c,0x9b, - 0xff,0x41,0x5c,0x9c,0xff,0x42,0x5d,0x9c,0xff,0x42,0x5e,0x9d,0xff,0x43,0x5e, - 0x9e,0xff,0x82,0x44,0x5f,0x9f,0xff,0x11,0x45,0x60,0xa0,0xff,0x46,0x61,0xa1, - 0xff,0x46,0x62,0xa3,0xff,0x47,0x64,0xa4,0xff,0x49,0x65,0xa5,0xff,0x4a,0x66, - 0xa7,0xff,0x4a,0x67,0xa7,0xff,0x4b,0x68,0xa9,0xff,0x4c,0x69,0xaa,0xff,0x4d, - 0x6a,0xab,0xff,0x4e,0x6a,0xac,0xff,0x4e,0x6b,0xac,0xff,0x4f,0x6c,0xad,0xff, - 0x50,0x6d,0xae,0xff,0x50,0x6d,0xaf,0xff,0x51,0x6e,0xb0,0xff,0x52,0x6e,0xb1, - 0xff,0x97,0x52,0x6f,0xb1,0xff,0x1d,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff, - 0x1b,0x35,0x6d,0xff,0x1c,0x35,0x6d,0xff,0x1d,0x36,0x6e,0xff,0x1e,0x37,0x6f, - 0xff,0x1e,0x37,0x70,0xff,0x1f,0x38,0x70,0xff,0x1f,0x38,0x71,0xff,0x27,0x3f, - 0x75,0xff,0x59,0x6a,0x8d,0xff,0x8a,0xa3,0xbb,0xff,0x9a,0xb4,0xc9,0xff,0x85, - 0x94,0xaa,0xff,0x35,0x4a,0x7b,0xff,0x23,0x3d,0x76,0xff,0x24,0x3d,0x77,0xff, - 0x24,0x3e,0x77,0xff,0x25,0x3e,0x78,0xff,0x25,0x3f,0x79,0xff,0x26,0x3f,0x7a, - 0xff,0x27,0x40,0x7a,0xff,0x27,0x41,0x7b,0xff,0x28,0x41,0x7b,0xff,0x28,0x42, - 0x7c,0xff,0x29,0x42,0x7d,0xff,0x29,0x43,0x7e,0xff,0x2a,0x44,0x7e,0xff,0x2a, - 0x44,0x7f,0xff,0x82,0x2b,0x45,0x80,0xff,0x06,0x2c,0x47,0x81,0xff,0x2d,0x48, - 0x82,0xff,0x2d,0x48,0x83,0xff,0x2e,0x49,0x84,0xff,0x2e,0x4a,0x84,0xff,0x2f, - 0x4a,0x85,0xff,0x82,0x30,0x4b,0x86,0xff,0x09,0x31,0x4c,0x87,0xff,0x31,0x4d, - 0x88,0xff,0x32,0x4d,0x89,0xff,0x33,0x4e,0x89,0xff,0x33,0x4f,0x8a,0xff,0x34, - 0x4f,0x8b,0xff,0x34,0x50,0x8c,0xff,0x35,0x50,0x8c,0xff,0x35,0x51,0x8d,0xff, - 0x84,0x36,0x51,0x8e,0xff,0x02,0x36,0x52,0x8e,0xff,0x36,0x52,0x8f,0xff,0x82, - 0x37,0x52,0x8f,0xff,0x01,0x37,0x52,0x90,0xff,0x82,0x38,0x53,0x90,0xff,0x26, - 0x39,0x53,0x91,0xff,0x39,0x54,0x91,0xff,0x3a,0x54,0x92,0xff,0x3a,0x55,0x93, - 0xff,0x3b,0x56,0x94,0xff,0x3c,0x56,0x94,0xff,0x3c,0x57,0x95,0xff,0x3d,0x57, - 0x96,0xff,0x3d,0x58,0x96,0xff,0x3e,0x58,0x97,0xff,0x3e,0x59,0x98,0xff,0x3f, - 0x5a,0x98,0xff,0x3f,0x5a,0x99,0xff,0x40,0x5b,0x9a,0xff,0x40,0x5b,0x9b,0xff, - 0x41,0x5c,0x9b,0xff,0x42,0x5c,0x9c,0xff,0x42,0x5d,0x9d,0xff,0x43,0x5e,0x9d, - 0xff,0x43,0x5e,0x9e,0xff,0x44,0x5f,0x9f,0xff,0x44,0x60,0xa0,0xff,0x45,0x60, - 0xa0,0xff,0x45,0x61,0xa1,0xff,0x45,0x61,0xa2,0xff,0x45,0x62,0xa2,0xff,0x46, - 0x62,0xa3,0xff,0x47,0x63,0xa4,0xff,0x47,0x64,0xa4,0xff,0x48,0x65,0xa6,0xff, - 0x49,0x66,0xa7,0xff,0x4a,0x67,0xa8,0xff,0x4b,0x68,0xa9,0xff,0x4d,0x69,0xab, - 0xff,0x4e,0x6a,0xac,0xff,0x4e,0x6b,0xad,0xff,0x4f,0x6c,0xae,0xff,0x50,0x6d, - 0xaf,0xff,0x83,0x51,0x6e,0xb0,0xff,0x94,0x52,0x6f,0xb1,0xff,0x2f,0x01,0x02, - 0x03,0xff,0x00,0x01,0x02,0xff,0x1b,0x34,0x6c,0xff,0x1b,0x35,0x6d,0xff,0x1c, - 0x36,0x6e,0xff,0x1d,0x36,0x6e,0xff,0x1e,0x37,0x6f,0xff,0x1f,0x38,0x70,0xff, - 0x1f,0x38,0x71,0xff,0x2c,0x43,0x76,0xff,0x77,0x87,0xa1,0xff,0x98,0xc4,0xe3, - 0xff,0xac,0xc8,0xde,0xff,0xb6,0xbe,0xc7,0xff,0x6c,0x78,0x93,0xff,0x23,0x3c, - 0x75,0xff,0x23,0x3d,0x76,0xff,0x24,0x3d,0x77,0xff,0x25,0x3e,0x78,0xff,0x25, - 0x3f,0x78,0xff,0x26,0x3f,0x79,0xff,0x26,0x40,0x7a,0xff,0x27,0x40,0x7a,0xff, - 0x27,0x41,0x7b,0xff,0x28,0x42,0x7c,0xff,0x28,0x42,0x7d,0xff,0x29,0x43,0x7d, - 0xff,0x29,0x43,0x7e,0xff,0x2a,0x44,0x7f,0xff,0x2b,0x44,0x7f,0xff,0x2b,0x45, - 0x80,0xff,0x2c,0x46,0x81,0xff,0x2c,0x47,0x82,0xff,0x2d,0x48,0x82,0xff,0x2d, - 0x49,0x83,0xff,0x2e,0x49,0x84,0xff,0x2f,0x4a,0x84,0xff,0x2f,0x4a,0x85,0xff, - 0x30,0x4b,0x86,0xff,0x30,0x4c,0x87,0xff,0x31,0x4c,0x87,0xff,0x31,0x4d,0x88, - 0xff,0x32,0x4e,0x89,0xff,0x33,0x4e,0x8a,0xff,0x33,0x4f,0x8a,0xff,0x34,0x4f, - 0x8b,0xff,0x34,0x50,0x8c,0xff,0x82,0x35,0x51,0x8d,0xff,0x05,0x36,0x52,0x8e, - 0xff,0x37,0x52,0x8f,0xff,0x37,0x53,0x90,0xff,0x38,0x54,0x90,0xff,0x38,0x54, - 0x91,0xff,0x84,0x39,0x55,0x92,0xff,0x82,0x3a,0x56,0x93,0xff,0x83,0x3b,0x56, - 0x93,0xff,0x01,0x3c,0x56,0x94,0xff,0x82,0x3c,0x57,0x95,0xff,0x21,0x3c,0x58, - 0x96,0xff,0x3d,0x58,0x96,0xff,0x3d,0x58,0x97,0xff,0x3e,0x59,0x97,0xff,0x3e, - 0x59,0x98,0xff,0x3f,0x5a,0x99,0xff,0x40,0x5a,0x99,0xff,0x40,0x5b,0x9a,0xff, - 0x41,0x5c,0x9b,0xff,0x41,0x5c,0x9c,0xff,0x42,0x5d,0x9c,0xff,0x42,0x5d,0x9d, - 0xff,0x43,0x5e,0x9e,0xff,0x43,0x5f,0x9e,0xff,0x44,0x5f,0x9f,0xff,0x44,0x60, - 0xa0,0xff,0x45,0x60,0xa0,0xff,0x45,0x61,0xa1,0xff,0x45,0x61,0xa2,0xff,0x46, - 0x62,0xa3,0xff,0x46,0x63,0xa3,0xff,0x47,0x63,0xa4,0xff,0x47,0x64,0xa5,0xff, - 0x48,0x64,0xa5,0xff,0x48,0x65,0xa6,0xff,0x49,0x66,0xa7,0xff,0x4a,0x66,0xa8, - 0xff,0x4a,0x67,0xa8,0xff,0x4b,0x68,0xa9,0xff,0x4b,0x68,0xaa,0xff,0x4c,0x69, - 0xab,0xff,0x4d,0x6a,0xac,0xff,0x4e,0x6b,0xad,0xff,0x82,0x4f,0x6c,0xae,0xff, - 0x82,0x50,0x6d,0xaf,0xff,0x85,0x51,0x6e,0xb0,0xff,0x8c,0x52,0x6f,0xb1,0xff, - 0x35,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x1b,0x34,0x6c,0xff,0x1b,0x35, - 0x6d,0xff,0x1c,0x35,0x6d,0xff,0x1d,0x36,0x6e,0xff,0x1e,0x36,0x6f,0xff,0x1e, - 0x37,0x6f,0xff,0x1f,0x38,0x70,0xff,0x2c,0x43,0x76,0xff,0x7f,0x8a,0x9d,0xff, - 0xa4,0xb6,0xc5,0xff,0xa1,0xaa,0xb4,0xff,0xa2,0xa9,0xb2,0xff,0x66,0x73,0x8c, - 0xff,0x23,0x3c,0x75,0xff,0x23,0x3c,0x76,0xff,0x24,0x3d,0x76,0xff,0x24,0x3e, - 0x77,0xff,0x25,0x3e,0x78,0xff,0x25,0x3f,0x78,0xff,0x26,0x3f,0x79,0xff,0x26, - 0x40,0x7a,0xff,0x27,0x40,0x7b,0xff,0x27,0x41,0x7b,0xff,0x28,0x42,0x7c,0xff, - 0x29,0x42,0x7d,0xff,0x29,0x43,0x7d,0xff,0x2a,0x44,0x7e,0xff,0x2a,0x44,0x7f, - 0xff,0x2b,0x45,0x80,0xff,0x2b,0x45,0x81,0xff,0x2c,0x46,0x81,0xff,0x2d,0x47, - 0x82,0xff,0x2d,0x48,0x83,0xff,0x2e,0x49,0x83,0xff,0x2e,0x49,0x84,0xff,0x2f, - 0x4a,0x85,0xff,0x2f,0x4b,0x85,0xff,0x30,0x4b,0x86,0xff,0x30,0x4c,0x87,0xff, - 0x31,0x4c,0x88,0xff,0x31,0x4d,0x88,0xff,0x32,0x4e,0x89,0xff,0x33,0x4e,0x8a, - 0xff,0x33,0x4f,0x8b,0xff,0x34,0x50,0x8b,0xff,0x35,0x50,0x8c,0xff,0x35,0x51, - 0x8d,0xff,0x36,0x51,0x8e,0xff,0x36,0x52,0x8e,0xff,0x37,0x53,0x8f,0xff,0x37, - 0x53,0x90,0xff,0x82,0x38,0x54,0x91,0xff,0x07,0x39,0x55,0x92,0xff,0x39,0x56, - 0x93,0xff,0x3a,0x56,0x93,0xff,0x3b,0x57,0x94,0xff,0x3b,0x57,0x95,0xff,0x3c, - 0x58,0x95,0xff,0x3c,0x58,0x96,0xff,0x84,0x3d,0x59,0x97,0xff,0x83,0x3e,0x5a, - 0x98,0xff,0x01,0x3f,0x5a,0x98,0xff,0x82,0x3f,0x5a,0x99,0xff,0x82,0x40,0x5b, - 0x9a,0xff,0x06,0x40,0x5b,0x9b,0xff,0x41,0x5c,0x9b,0xff,0x41,0x5c,0x9c,0xff, - 0x42,0x5d,0x9c,0xff,0x42,0x5e,0x9d,0xff,0x43,0x5e,0x9e,0xff,0x82,0x44,0x5f, - 0x9f,0xff,0x01,0x45,0x60,0xa0,0xff,0x82,0x45,0x61,0xa1,0xff,0x0d,0x45,0x62, - 0xa2,0xff,0x46,0x62,0xa3,0xff,0x46,0x63,0xa3,0xff,0x47,0x63,0xa4,0xff,0x47, - 0x64,0xa5,0xff,0x48,0x65,0xa6,0xff,0x49,0x65,0xa7,0xff,0x49,0x66,0xa7,0xff, - 0x4a,0x67,0xa8,0xff,0x4a,0x67,0xa9,0xff,0x4b,0x68,0xa9,0xff,0x4c,0x68,0xaa, - 0xff,0x4c,0x69,0xab,0xff,0x86,0x4d,0x6a,0xac,0xff,0x83,0x4e,0x6b,0xad,0xff, - 0x01,0x4f,0x6c,0xae,0xff,0x83,0x50,0x6d,0xaf,0xff,0x85,0x51,0x6e,0xb0,0xff, - 0x84,0x52,0x6f,0xb1,0xff,0x48,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x1a, - 0x34,0x6b,0xff,0x1b,0x34,0x6c,0xff,0x1b,0x35,0x6d,0xff,0x1c,0x35,0x6d,0xff, - 0x1d,0x36,0x6e,0xff,0x1e,0x37,0x6f,0xff,0x1e,0x37,0x70,0xff,0x27,0x3e,0x73, - 0xff,0x5c,0x69,0x86,0xff,0x6e,0x77,0x8b,0xff,0x49,0x58,0x79,0xff,0x4f,0x61, - 0x87,0xff,0x3e,0x53,0x7b,0xff,0x22,0x3b,0x75,0xff,0x23,0x3c,0x75,0xff,0x23, - 0x3d,0x76,0xff,0x24,0x3d,0x77,0xff,0x24,0x3e,0x77,0xff,0x25,0x3e,0x78,0xff, - 0x25,0x3f,0x79,0xff,0x26,0x40,0x79,0xff,0x27,0x40,0x7a,0xff,0x27,0x41,0x7b, - 0xff,0x28,0x41,0x7c,0xff,0x28,0x42,0x7c,0xff,0x29,0x43,0x7d,0xff,0x29,0x43, - 0x7e,0xff,0x2a,0x44,0x7e,0xff,0x2a,0x44,0x7f,0xff,0x2b,0x45,0x80,0xff,0x2c, - 0x46,0x81,0xff,0x2c,0x47,0x81,0xff,0x2d,0x48,0x82,0xff,0x2d,0x48,0x83,0xff, - 0x2e,0x49,0x84,0xff,0x2e,0x4a,0x84,0xff,0x2f,0x4a,0x85,0xff,0x2f,0x4b,0x86, - 0xff,0x30,0x4b,0x86,0xff,0x31,0x4c,0x87,0xff,0x31,0x4d,0x88,0xff,0x32,0x4d, - 0x89,0xff,0x33,0x4e,0x8a,0xff,0x33,0x4f,0x8a,0xff,0x34,0x4f,0x8b,0xff,0x34, - 0x50,0x8c,0xff,0x35,0x51,0x8c,0xff,0x35,0x51,0x8d,0xff,0x36,0x52,0x8e,0xff, - 0x36,0x52,0x8f,0xff,0x37,0x53,0x8f,0xff,0x37,0x53,0x90,0xff,0x38,0x54,0x91, - 0xff,0x39,0x55,0x91,0xff,0x39,0x55,0x92,0xff,0x3a,0x56,0x93,0xff,0x3a,0x56, - 0x94,0xff,0x3b,0x57,0x94,0xff,0x3b,0x58,0x95,0xff,0x3c,0x58,0x96,0xff,0x3c, - 0x59,0x96,0xff,0x3d,0x59,0x97,0xff,0x3d,0x5a,0x98,0xff,0x3e,0x5a,0x98,0xff, - 0x3f,0x5b,0x99,0xff,0x3f,0x5c,0x9a,0xff,0x40,0x5c,0x9b,0xff,0x40,0x5d,0x9b, - 0xff,0x41,0x5d,0x9c,0xff,0x40,0x5d,0x9b,0xff,0x82,0x41,0x5d,0x9c,0xff,0x02, - 0x42,0x5d,0x9c,0xff,0x42,0x5d,0x9d,0xff,0x82,0x42,0x5e,0x9d,0xff,0x04,0x43, - 0x5e,0x9e,0xff,0x43,0x5f,0x9e,0xff,0x44,0x5f,0x9f,0xff,0x44,0x60,0xa0,0xff, - 0x82,0x45,0x60,0xa0,0xff,0x0f,0x45,0x61,0xa1,0xff,0x45,0x61,0xa2,0xff,0x45, - 0x62,0xa2,0xff,0x46,0x62,0xa3,0xff,0x47,0x63,0xa4,0xff,0x47,0x64,0xa4,0xff, - 0x48,0x64,0xa5,0xff,0x48,0x65,0xa6,0xff,0x49,0x66,0xa7,0xff,0x49,0x66,0xa8, - 0xff,0x4a,0x67,0xa8,0xff,0x4b,0x67,0xa9,0xff,0x4b,0x68,0xaa,0xff,0x4c,0x69, - 0xaa,0xff,0x4c,0x69,0xab,0xff,0x8d,0x4d,0x6a,0xac,0xff,0x83,0x4e,0x6b,0xad, - 0xff,0x01,0x4f,0x6c,0xae,0xff,0x83,0x50,0x6d,0xaf,0xff,0x0e,0x51,0x6e,0xb0, - 0xff,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x1a,0x33,0x6b,0xff,0x1a,0x34, - 0x6c,0xff,0x1b,0x35,0x6c,0xff,0x1b,0x35,0x6d,0xff,0x1c,0x36,0x6e,0xff,0x1d, - 0x36,0x6e,0xff,0x1f,0x38,0x70,0xff,0x29,0x3f,0x73,0xff,0x27,0x3e,0x73,0xff, - 0x2b,0x41,0x75,0xff,0x2a,0x41,0x76,0xff,0x82,0x2b,0x42,0x77,0xff,0x10,0x28, - 0x40,0x76,0xff,0x22,0x3c,0x75,0xff,0x23,0x3c,0x75,0xff,0x23,0x3d,0x76,0xff, - 0x24,0x3d,0x77,0xff,0x25,0x3e,0x78,0xff,0x25,0x3f,0x78,0xff,0x26,0x3f,0x79, - 0xff,0x26,0x40,0x7a,0xff,0x27,0x40,0x7a,0xff,0x27,0x41,0x7b,0xff,0x28,0x42, - 0x7c,0xff,0x28,0x42,0x7d,0xff,0x29,0x43,0x7d,0xff,0x29,0x43,0x7e,0xff,0x2a, - 0x44,0x7f,0xff,0x82,0x2b,0x45,0x80,0xff,0x05,0x2c,0x46,0x81,0xff,0x2c,0x47, - 0x82,0xff,0x2d,0x48,0x82,0xff,0x2e,0x49,0x83,0xff,0x2e,0x49,0x84,0xff,0x82, - 0x2f,0x4a,0x85,0xff,0x09,0x30,0x4b,0x86,0xff,0x30,0x4c,0x87,0xff,0x31,0x4c, - 0x87,0xff,0x31,0x4d,0x88,0xff,0x32,0x4d,0x89,0xff,0x32,0x4e,0x89,0xff,0x33, - 0x4f,0x8a,0xff,0x34,0x4f,0x8b,0xff,0x34,0x50,0x8c,0xff,0x82,0x35,0x51,0x8d, - 0xff,0x05,0x36,0x52,0x8e,0xff,0x37,0x52,0x8f,0xff,0x37,0x53,0x90,0xff,0x38, - 0x54,0x90,0xff,0x38,0x54,0x91,0xff,0x82,0x39,0x55,0x92,0xff,0x05,0x3a,0x56, - 0x93,0xff,0x3a,0x57,0x94,0xff,0x3b,0x57,0x95,0xff,0x3b,0x58,0x95,0xff,0x3c, - 0x58,0x96,0xff,0x82,0x3d,0x59,0x97,0xff,0x0b,0x3e,0x5a,0x98,0xff,0x3e,0x5b, - 0x99,0xff,0x3f,0x5b,0x99,0xff,0x3f,0x5c,0x9a,0xff,0x40,0x5c,0x9b,0xff,0x40, - 0x5d,0x9c,0xff,0x41,0x5e,0x9c,0xff,0x41,0x5e,0x9d,0xff,0x42,0x5f,0x9e,0xff, - 0x43,0x5f,0x9e,0xff,0x43,0x60,0x9f,0xff,0x84,0x44,0x61,0xa0,0xff,0x82,0x45, - 0x61,0xa1,0xff,0x82,0x46,0x61,0xa1,0xff,0x0e,0x46,0x62,0xa2,0xff,0x46,0x62, - 0xa3,0xff,0x46,0x63,0xa3,0xff,0x47,0x63,0xa3,0xff,0x47,0x63,0xa4,0xff,0x47, - 0x64,0xa4,0xff,0x47,0x64,0xa5,0xff,0x48,0x65,0xa6,0xff,0x49,0x65,0xa6,0xff, - 0x49,0x66,0xa7,0xff,0x4a,0x66,0xa8,0xff,0x4a,0x67,0xa9,0xff,0x4b,0x68,0xa9, - 0xff,0x4b,0x68,0xaa,0xff,0x82,0x4c,0x69,0xab,0xff,0x93,0x4d,0x6a,0xac,0xff, - 0x1a,0x4e,0x6b,0xad,0xff,0x01,0x02,0x03,0xff,0x00,0x01,0x02,0xff,0x19,0x33, - 0x6a,0xff,0x1a,0x34,0x6b,0xff,0x1a,0x34,0x6c,0xff,0x1b,0x35,0x6d,0xff,0x1c, - 0x35,0x6d,0xff,0x1d,0x36,0x6e,0xff,0x22,0x3a,0x70,0xff,0x3b,0x4e,0x78,0xff, - 0x38,0x4b,0x77,0xff,0x40,0x51,0x79,0xff,0x41,0x53,0x7b,0xff,0x42,0x53,0x7c, - 0xff,0x40,0x52,0x7b,0xff,0x34,0x48,0x77,0xff,0x22,0x3b,0x74,0xff,0x23,0x3c, - 0x75,0xff,0x23,0x3c,0x76,0xff,0x24,0x3d,0x76,0xff,0x24,0x3e,0x77,0xff,0x25, - 0x3e,0x78,0xff,0x25,0x3f,0x79,0xff,0x26,0x3f,0x79,0xff,0x26,0x40,0x7a,0xff, - 0x82,0x27,0x41,0x7b,0xff,0x1f,0x28,0x42,0x7c,0xff,0x29,0x42,0x7d,0xff,0x29, - 0x43,0x7d,0xff,0x2a,0x43,0x7e,0xff,0x2a,0x44,0x7f,0xff,0x2b,0x45,0x80,0xff, - 0x2b,0x45,0x81,0xff,0x2c,0x46,0x81,0xff,0x2d,0x47,0x82,0xff,0x2d,0x48,0x83, - 0xff,0x2e,0x49,0x83,0xff,0x2e,0x49,0x84,0xff,0x2f,0x4a,0x85,0xff,0x2f,0x4b, - 0x85,0xff,0x30,0x4b,0x86,0xff,0x30,0x4c,0x87,0xff,0x31,0x4c,0x88,0xff,0x31, - 0x4d,0x88,0xff,0x32,0x4e,0x89,0xff,0x33,0x4e,0x8a,0xff,0x33,0x4f,0x8b,0xff, - 0x34,0x50,0x8b,0xff,0x35,0x50,0x8c,0xff,0x35,0x51,0x8d,0xff,0x36,0x51,0x8e, - 0xff,0x36,0x52,0x8e,0xff,0x37,0x53,0x8f,0xff,0x37,0x53,0x90,0xff,0x38,0x54, - 0x90,0xff,0x38,0x54,0x91,0xff,0x39,0x55,0x92,0xff,0x82,0x3a,0x56,0x93,0xff, - 0x0f,0x3b,0x57,0x94,0xff,0x3b,0x57,0x95,0xff,0x3c,0x58,0x95,0xff,0x3c,0x59, - 0x96,0xff,0x3d,0x59,0x97,0xff,0x3d,0x5a,0x98,0xff,0x3e,0x5a,0x98,0xff,0x3e, - 0x5b,0x99,0xff,0x3f,0x5b,0x9a,0xff,0x3f,0x5c,0x9a,0xff,0x40,0x5d,0x9b,0xff, - 0x41,0x5d,0x9c,0xff,0x41,0x5e,0x9d,0xff |
