diff options
author | marha <marha@users.sourceforge.net> | 2013-09-04 16:27:02 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2013-09-04 16:27:02 +0200 |
commit | b828531d8b6da75a258d12f97df0f4e49f75ab98 (patch) | |
tree | fcb5da3afc321bb34cdfd8cd84dfd986a1f59083 | |
parent | 9e382b6be0e81397f18ec0b733a2e88dc3465a33 (diff) | |
download | vcxsrv-b828531d8b6da75a258d12f97df0f4e49f75ab98.tar.gz vcxsrv-b828531d8b6da75a258d12f97df0f4e49f75ab98.tar.bz2 vcxsrv-b828531d8b6da75a258d12f97df0f4e49f75ab98.zip |
fontconfig xkeyboard-config git update 4 Sep 2013
xkeyboard-config commit 8f49c92c54c53eab6d40d8be90ce06773d20d196
fontconfig commit 6720892e97f11fbe8d69ae5b3875d928c68ff90e
mesa commit 51a279254fecc05691524dab1bf291c7dfefccd5
47 files changed, 1510 insertions, 411 deletions
diff --git a/fontconfig/src/fcxml.c b/fontconfig/src/fcxml.c index b464b4ede..8ff10b6e6 100644 --- a/fontconfig/src/fcxml.c +++ b/fontconfig/src/fcxml.c @@ -2233,11 +2233,6 @@ FcParseInclude (FcConfigParse *parse) /* No config dir nor file on the XDG directory spec compliant place * so need to guess what it is supposed to be. */ - FcChar8 *parent = FcStrDirname (s); - - if (!FcFileIsDir (parent)) - FcMakeDirectory (parent); - FcStrFree (parent); if (FcStrStr (s, (const FcChar8 *)"conf.d") != NULL) goto userdir; else @@ -2259,6 +2254,11 @@ FcParseInclude (FcConfigParse *parse) { if (FcFileIsDir (filename)) { + FcChar8 *parent = FcStrDirname (userdir); + + if (!FcFileIsDir (parent)) + FcMakeDirectory (parent); + FcStrFree (parent); if (FcFileIsDir (userdir) || rename ((const char *)filename, (const char *)userdir) != 0 || symlink ((const char *)userdir, (const char *)filename) != 0) @@ -2272,6 +2272,11 @@ FcParseInclude (FcConfigParse *parse) } else { + FcChar8 *parent = FcStrDirname (userconf); + + if (!FcFileIsDir (parent)) + FcMakeDirectory (parent); + FcStrFree (parent); if (FcFileIsFile (userconf) || rename ((const char *)filename, (const char *)userconf) != 0 || symlink ((const char *)userconf, (const char *)filename) != 0) diff --git a/fontconfig/test/Makefile.am b/fontconfig/test/Makefile.am index 9d5acdd90..52c63dc41 100644 --- a/fontconfig/test/Makefile.am +++ b/fontconfig/test/Makefile.am @@ -16,14 +16,17 @@ TESTDATA=4x6.pcf 8x16.pcf out.expected fonts.conf.in AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) +check_PROGRAMS = test-migration if HAVE_PTHREAD -check_PROGRAMS = test-pthread -noinst_PROGRAMS = $(check_PROGRAMS) +check_PROGRAMS += test-pthread test_pthread_LDADD = $(top_builddir)/src/libfontconfig.la # We don't enable this test by default because it will require config and fonts # to meaningfully test anything, and we are not installed yet. #TESTS += test-pthread endif +noinst_PROGRAMS = $(check_PROGRAMS) + +test_migration_LDADD = $(top_builddir)/src/libfontconfig.la EXTRA_DIST=$(check_SCRIPTS) $(TESTDATA) diff --git a/fontconfig/test/test-migration.c b/fontconfig/test/test-migration.c new file mode 100644 index 000000000..a0ab83902 --- /dev/null +++ b/fontconfig/test/test-migration.c @@ -0,0 +1,172 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <dirent.h> +#include <fontconfig/fontconfig.h> + +FcBool +mkdir_p(const char *dir) +{ + char *parent; + FcBool ret; + + if (strlen (dir) == 0) + return FcFalse; + parent = (char *) FcStrDirname (dir); + if (!parent) + return FcFalse; + if (access (parent, F_OK) == 0) + ret = mkdir (dir, 0755) == 0 && chmod (dir, 0755) == 0; + else if (access (parent, F_OK) == -1) + ret = mkdir_p (parent) && (mkdir (dir, 0755) == 0) && chmod (dir, 0755) == 0; + else + ret = FcFalse; + free (parent); + + return ret; +} + +FcBool +unlink_dirs(const char *dir) +{ + DIR *d = opendir (dir); + struct dirent *e; + size_t len = strlen (dir); + char *n = NULL; + FcBool ret = FcTrue; + + if (!d) + return FcFalse; + while ((e = readdir(d)) != NULL) + { + size_t l; + + if (strcmp (e->d_name, ".") == 0 || + strcmp (e->d_name, "..") == 0) + continue; + l = strlen (e->d_name) + 1; + if (n) + free (n); + n = malloc (l + len + 1); + strcpy (n, dir); + n[len] = '/'; + strcpy (&n[len + 1], e->d_name); + if (e->d_type == DT_DIR) + { + if (!unlink_dirs (n)) + { + fprintf (stderr, "E: %s\n", n); + ret = FcFalse; + break; + } + } + else + { + if (unlink (n) == -1) + { + fprintf (stderr, "E: %s\n", n); + ret = FcFalse; + break; + } + } + } + if (n) + free (n); + closedir (d); + + if (rmdir (dir) == -1) + { + fprintf (stderr, "E: %s\n", dir); + return FcFalse; + } + + return ret; +} + +int +main(void) +{ + char template[32] = "fontconfig-XXXXXXXX"; + char *tmp = mkdtemp (template); + size_t len = strlen (tmp), xlen, dlen; + char xdg[256], confd[256], fn[256], nfn[256], ud[256], nud[256]; + int ret = -1; + FILE *fp; + char *content = "<fontconfig></fontconfig>"; + + strcpy (xdg, tmp); + strcpy (&xdg[len], "/.config"); + setenv ("HOME", tmp, 1); + setenv ("XDG_CONFIG_HOME", xdg, 1); + xlen = strlen (xdg); + strcpy (confd, xdg); + strcpy (&confd[xlen], "/fontconfig"); + dlen = strlen (confd); + /* In case there are no configuration files nor directory */ + FcInit (); + if (access (confd, F_OK) == 0) + { + fprintf (stderr, "%s unexpectedly exists\n", confd); + goto bail; + } + FcFini (); + if (!unlink_dirs (tmp)) + { + fprintf (stderr, "Unable to clean up\n"); + goto bail; + } + /* In case there are the user configuration file */ + strcpy (fn, tmp); + strcpy (&fn[len], "/.fonts.conf"); + strcpy (nfn, confd); + strcpy (&nfn[dlen], "/fonts.conf"); + if (!mkdir_p (confd)) + { + fprintf (stderr, "Unable to create a config dir: %s\n", confd); + goto bail; + } + if ((fp = fopen (fn, "wb")) == NULL) + { + fprintf (stderr, "Unable to create a config file: %s\n", fn); + goto bail; + } + fwrite (content, sizeof (char), strlen (content), fp); + fclose (fp); + FcInit (); + if (access (nfn, F_OK) != 0) + { + fprintf (stderr, "migration failed for %s\n", nfn); + goto bail; + } + FcFini (); + if (!unlink_dirs (tmp)) + { + fprintf (stderr, "Unable to clean up\n"); + goto bail; + } + /* In case there are the user configuration dir */ + strcpy (ud, tmp); + strcpy (&ud[len], "/.fonts.conf.d"); + strcpy (nud, confd); + strcpy (&nud[dlen], "/conf.d"); + if (!mkdir_p (ud)) + { + fprintf (stderr, "Unable to create a config dir: %s\n", ud); + goto bail; + } + FcInit (); + if (access (nud, F_OK) != 0) + { + fprintf (stderr, "migration failed for %s\n", nud); + goto bail; + } + FcFini (); + + ret = 0; +bail: + unlink_dirs (tmp); + + return ret; +} diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 82b908f43..71aa9a7bd 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -1107,6 +1107,7 @@ <type name="void" size="1"/> <type name="DEBUGPROCARB" size="4" pointer="true"/> + <type name="DEBUGPROC" size="4" pointer="true"/> <function name="NewList" offset="0" deprecated="3.1"> <param name="list" type="GLuint"/> @@ -8309,7 +8310,153 @@ <xi:include href="ARB_texture_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> -<!-- ARB extensions #118...#126 --> +<!-- ARB extension #118 --> + +<category name="GL_KHR_debug" number="119"> + <enum name="DEBUG_OUTPUT" value="0x92E0"/> + <enum name="DEBUG_OUTPUT_SYNCHRONOUS" value="0x8242"/> + + <enum name="CONTEXT_FLAG_DEBUG_BIT" value="0x00000002"/> + + <enum name="MAX_DEBUG_MESSAGE_LENGTH" count="1" value="0x9143"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_DEBUG_LOGGED_MESSAGES" count="1" value="0x9144"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEBUG_LOGGED_MESSAGES" count="1" value="0x9145"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEBUG_NEXT_LOGGED_MESSAGE_LENGTH" count="1" value="0x8243"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_DEBUG_GROUP_STACK_DEPTH" count="1" value="0x826C"> + <size name="Get" mode="get"/> + </enum> + <enum name="DEBUG_GROUP_STACK_DEPTH" count="1" value="0x826D"> + <size name="Get" mode="get"/> + </enum> + <enum name="MAX_LABEL_LENGTH" count="1" value="0x82E8"> + <size name="Get" mode="get"/> + </enum> + + <enum name="DEBUG_CALLBACK_FUNCTION" count="1" value="0x8244"> + <size name="GetPointerv" mode="get"/> + </enum> + <enum name="DEBUG_CALLBACK_USER_PARAM" count="1" value="0x8245"> + <size name="GetPointerv" mode="get"/> + </enum> + + <enum name="DEBUG_SOURCE_API" value="0x8246"/> + <enum name="DEBUG_SOURCE_WINDOW_SYSTEM" value="0x8247"/> + <enum name="DEBUG_SOURCE_SHADER_COMPILER" value="0x8248"/> + <enum name="DEBUG_SOURCE_THIRD_PARTY" value="0x8249"/> + <enum name="DEBUG_SOURCE_APPLICATION" value="0x824A"/> + <enum name="DEBUG_SOURCE_OTHER" value="0x824B"/> + + <enum name="DEBUG_TYPE_ERROR" value="0x824C"/> + <enum name="DEBUG_TYPE_DEPRECATED_BEHAVIOR" value="0x824D"/> + <enum name="DEBUG_TYPE_UNDEFINED_BEHAVIOR" value="0x824E"/> + <enum name="DEBUG_TYPE_PORTABILITY" value="0x824F"/> + <enum name="DEBUG_TYPE_PERFORMANCE" value="0x8250"/> + <enum name="DEBUG_TYPE_OTHER" value="0x8251"/> + <enum name="DEBUG_TYPE_MARKER" value="0x8268"/> + + <enum name="DEBUG_TYPE_PUSH_GROUP" value="0x8269"/> + <enum name="DEBUG_TYPE_POP_GROUP" value="0x826A"/> + + <enum name="DEBUG_SEVERITY_HIGH" value="0x9146"/> + <enum name="DEBUG_SEVERITY_MEDIUM" value="0x9147"/> + <enum name="DEBUG_SEVERITY_LOW" value="0x9148"/> + <enum name="DEBUG_SEVERITY_NOTIFICATION" value="0x826B"/> + + <enum name="STACK_UNDERFLOW" value="0x0504"/> + <enum name="STACK_OVERFLOW" value="0x0503"/> + + <enum name="BUFFER" value="0x82E0"/> + <enum name="SHADER" value="0x82E1"/> + <enum name="PROGRAM" value="0x82E2"/> + <enum name="QUERY" value="0x82E3"/> + <enum name="PROGRAM_PIPELINE" value="0x82E4"/> + <enum name="SAMPLER" value="0x82E6"/> + <!-- Compatibility Profile --> + <enum name="DISPLAY_LIST" value="0x82E7"/> + + <function name="DebugMessageControl" offset="assign"> + <param name="source" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="severity" type="GLenum"/> + <param name="count" type="GLsizei" counter="true"/> + <param name="ids" type="const GLuint *" count="count"/> + <param name="enabled" type="GLboolean"/> + </function> + + <function name="DebugMessageInsert" offset="assign"> + <param name="source" type="GLenum"/> + <param name="type" type="GLenum"/> + <param name="id" type="GLuint"/> + <param name="severity" type="GLenum"/> + <param name="length" type="GLsizei"/> + <param name="buf" type="const GLchar *"/> + </function> + + <function name="DebugMessageCallback" offset="assign"> + <param name="callback" type="GLDEBUGPROC"/> + <param name="userParam" type="const GLvoid *"/> + </function> + + <function name="GetDebugMessageLog" offset="assign"> + <return type="GLuint"/> + <param name="count" type="GLuint"/> + <param name="bufsize" type="GLsizei"/> + <param name="sources" type="GLenum *" output="true"/> + <param name="types" type="GLenum *" output="true"/> + <param name="ids" type="GLuint *" output="true"/> + <param name="severities" type="GLenum *" output="true"/> + <param name="lengths" type="GLsizei *" output="true"/> + <param name="messageLog" type="GLchar *" output="true"/> + </function> + + <function name="PushDebugGroup" offset="assign"> + <param name="source" type="GLenum"/> + <param name="id" type="GLuint"/> + <param name="length" type="GLsizei"/> + <param name="message" type="const GLchar *"/> + </function> + + <function name="PopDebugGroup" offset="assign"/> + + <function name="ObjectLabel" offset="assign"> + <param name="identifier" type="GLenum"/> + <param name="name" type="GLuint"/> + <param name="length" type="GLsizei"/> + <param name="label" type="const GLchar *"/> + </function> + + <function name="GetObjectLabel" offset="assign"> + <param name="identifier" type="GLenum"/> + <param name="name" type="GLuint"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="label" type="GLchar *"/> + </function> + + <function name="ObjectPtrLabel" offset="assign"> + <param name="ptr" type="const GLvoid *"/> + <param name="length" type="GLsizei"/> + <param name="label" type="const GLchar *"/> + </function> + + <function name="GetObjectPtrLabel" offset="assign"> + <param name="ptr" type="const GLvoid *"/> + <param name="bufSize" type="GLsizei"/> + <param name="length" type="GLsizei *"/> + <param name="label" type="GLchar *"/> + </function> + +</category> + +<!-- ARB extensions #120...#126 --> <xi:include href="ARB_ES3_compatibility.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/> diff --git a/mesalib/src/mapi/glapi/gen/gl_genexec.py b/mesalib/src/mapi/glapi/gen/gl_genexec.py index e91d4e9ac..be82f9089 100644 --- a/mesalib/src/mapi/glapi/gen/gl_genexec.py +++ b/mesalib/src/mapi/glapi/gen/gl_genexec.py @@ -81,6 +81,7 @@ header = """/** #include "main/lines.h" #include "main/matrix.h" #include "main/multisample.h" +#include "main/objectlabel.h" #include "main/pixel.h" #include "main/pixelstore.h" #include "main/points.h" diff --git a/mesalib/src/mesa/Makefile.sources b/mesalib/src/mesa/Makefile.sources index a5c1f5dea..122ea8e3a 100644 --- a/mesalib/src/mesa/Makefile.sources +++ b/mesalib/src/mesa/Makefile.sources @@ -62,6 +62,7 @@ MAIN_FILES = \ $(SRCDIR)main/mipmap.c \ $(SRCDIR)main/mm.c \ $(SRCDIR)main/multisample.c \ + $(SRCDIR)main/objectlabel.c \ $(SRCDIR)main/pack.c \ $(SRCDIR)main/pbo.c \ $(SRCDIR)main/pixel.c \ diff --git a/mesalib/src/mesa/SConscript b/mesalib/src/mesa/SConscript index d328fc13c..2cdb79c46 100644 --- a/mesalib/src/mesa/SConscript +++ b/mesalib/src/mesa/SConscript @@ -94,6 +94,7 @@ main_sources = [ 'main/mipmap.c', 'main/mm.c', 'main/multisample.c', + 'main/objectlabel.c', 'main/pack.c', 'main/pbo.c', 'main/pixel.c', diff --git a/mesalib/src/mesa/main/arrayobj.c b/mesalib/src/mesa/main/arrayobj.c index 922605034..5d50d29f8 100644 --- a/mesalib/src/mesa/main/arrayobj.c +++ b/mesalib/src/mesa/main/arrayobj.c @@ -60,8 +60,8 @@ * non-existent. */ -static inline struct gl_array_object * -lookup_arrayobj(struct gl_context *ctx, GLuint id) +struct gl_array_object * +_mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id) { if (id == 0) return NULL; @@ -115,6 +115,7 @@ _mesa_delete_array_object( struct gl_context *ctx, struct gl_array_object *obj ) unbind_array_object_vbos(ctx, obj); _mesa_reference_buffer_object(ctx, &obj->ElementArrayBufferObj, NULL); _glthread_DESTROY_MUTEX(obj->Mutex); + free(obj->Label); free(obj); } @@ -353,7 +354,7 @@ bind_vertex_array(struct gl_context *ctx, GLuint id, GLboolean genRequired) } else { /* non-default array object */ - newObj = lookup_arrayobj(ctx, id); + newObj = _mesa_lookup_arrayobj(ctx, id); if (!newObj) { if (genRequired) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBindVertexArray(non-gen name)"); @@ -439,7 +440,7 @@ _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids) } for (i = 0; i < n; i++) { - struct gl_array_object *obj = lookup_arrayobj(ctx, ids[i]); + struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, ids[i]); if ( obj != NULL ) { ASSERT( obj->Name == ids[i] ); @@ -545,7 +546,7 @@ _mesa_IsVertexArray( GLuint id ) if (id == 0) return GL_FALSE; - obj = lookup_arrayobj(ctx, id); + obj = _mesa_lookup_arrayobj(ctx, id); if (obj == NULL) return GL_FALSE; diff --git a/mesalib/src/mesa/main/arrayobj.h b/mesalib/src/mesa/main/arrayobj.h index 6dee1af69..492ef3501 100644 --- a/mesalib/src/mesa/main/arrayobj.h +++ b/mesalib/src/mesa/main/arrayobj.h @@ -46,6 +46,9 @@ struct gl_context; */ extern struct gl_array_object * +_mesa_lookup_arrayobj(struct gl_context *ctx, GLuint id); + +extern struct gl_array_object * _mesa_new_array_object( struct gl_context *ctx, GLuint name ); extern void diff --git a/mesalib/src/mesa/main/bufferobj.c b/mesalib/src/mesa/main/bufferobj.c index bd71688e8..b22340ff3 100644 --- a/mesalib/src/mesa/main/bufferobj.c +++ b/mesalib/src/mesa/main/bufferobj.c @@ -265,6 +265,7 @@ _mesa_delete_buffer_object(struct gl_context *ctx, bufObj->Name = ~0; _glthread_DESTROY_MUTEX(bufObj->Mutex); + free(bufObj->Label); free(bufObj); } diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h index 1d2ab4dc0..0bcf27c34 100644 --- a/mesalib/src/mesa/main/config.h +++ b/mesalib/src/mesa/main/config.h @@ -249,12 +249,17 @@ #define MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 1024 /*@}*/ -/** For GL_ARB_debug_output */ +/** For GL_ARB_debug_output and GL_KHR_debug */ /*@{*/ #define MAX_DEBUG_LOGGED_MESSAGES 10 #define MAX_DEBUG_MESSAGE_LENGTH 4096 /*@}*/ +/** For GL_KHR_debug */ +/*@{*/ +#define MAX_LABEL_LENGTH 256 +#define MAX_DEBUG_GROUP_STACK_DEPTH 64 +/*@}*/ /* * Color channel component order diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c index af2b468c5..595641915 100644 --- a/mesalib/src/mesa/main/dlist.c +++ b/mesalib/src/mesa/main/dlist.c @@ -561,8 +561,8 @@ make_list(GLuint name, GLuint count) /** * Lookup function to just encapsulate casting. */ -static inline struct gl_display_list * -lookup_list(struct gl_context *ctx, GLuint list) +struct gl_display_list * +_mesa_lookup_list(struct gl_context *ctx, GLuint list) { return (struct gl_display_list *) _mesa_HashLookup(ctx->Shared->DisplayList, list); @@ -769,6 +769,7 @@ _mesa_delete_list(struct gl_context *ctx, struct gl_display_list *dlist) } } + free(dlist->Label); free(dlist); } @@ -785,7 +786,7 @@ destroy_list(struct gl_context *ctx, GLuint list) if (list == 0) return; - dlist = lookup_list(ctx, list); + dlist = _mesa_lookup_list(ctx, list); if (!dlist) return; @@ -7278,7 +7279,7 @@ _mesa_compile_error(struct gl_context *ctx, GLenum error, const char *s) static GLboolean islist(struct gl_context *ctx, GLuint list) { - if (list > 0 && lookup_list(ctx, list)) { + if (list > 0 && _mesa_lookup_list(ctx, list)) { return GL_TRUE; } else { @@ -7314,7 +7315,7 @@ execute_list(struct gl_context *ctx, GLuint list) return; } - dlist = lookup_list(ctx, list); + dlist = _mesa_lookup_list(ctx, list); if (!dlist) return; @@ -9309,7 +9310,7 @@ print_list(struct gl_context *ctx, GLuint list) return; } - dlist = lookup_list(ctx, list); + dlist = _mesa_lookup_list(ctx, list); if (!dlist) return; diff --git a/mesalib/src/mesa/main/dlist.h b/mesalib/src/mesa/main/dlist.h index cd0b5235b..7726e77d8 100644 --- a/mesalib/src/mesa/main/dlist.h +++ b/mesalib/src/mesa/main/dlist.h @@ -53,6 +53,8 @@ _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); void GLAPIENTRY _mesa_ListBase(GLuint base); +extern struct gl_display_list * +_mesa_lookup_list(struct gl_context *ctx, GLuint list); extern void _mesa_compile_error( struct gl_context *ctx, GLenum error, const char *s ); diff --git a/mesalib/src/mesa/main/enable.c b/mesalib/src/mesa/main/enable.c index 21e593117..5e2fd80d2 100644 --- a/mesalib/src/mesa/main/enable.c +++ b/mesalib/src/mesa/main/enable.c @@ -364,6 +364,11 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state) FLUSH_VERTICES(ctx, _NEW_DEPTH); ctx->Depth.Test = state; break; + case GL_DEBUG_OUTPUT: + if (!_mesa_is_desktop_gl(ctx)) + goto invalid_enum_error; + ctx->Debug.DebugOutput = state; + break; case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB: if (!_mesa_is_desktop_gl(ctx)) goto invalid_enum_error; @@ -1201,6 +1206,10 @@ _mesa_IsEnabled( GLenum cap ) return ctx->Light.ColorMaterialEnabled; case GL_CULL_FACE: return ctx->Polygon.CullFlag; + case GL_DEBUG_OUTPUT: + if (!_mesa_is_desktop_gl(ctx)) + goto invalid_enum_error; + return ctx->Debug.DebugOutput; case GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB: if (!_mesa_is_desktop_gl(ctx)) goto invalid_enum_error; diff --git a/mesalib/src/mesa/main/errors.c b/mesalib/src/mesa/main/errors.c index cc93d3bd6..e1a9fe2f5 100644 --- a/mesalib/src/mesa/main/errors.c +++ b/mesalib/src/mesa/main/errors.c @@ -39,6 +39,9 @@ #include "hash_table.h" #include "glapi/glthread.h" +#define MESSAGE_LOG 1 +#define MESSAGE_LOG_ARB 2 + _glthread_DECLARE_STATIC_MUTEX(DynamicIDMutex); static GLuint NextDynamicID = 1; @@ -66,12 +69,16 @@ static const GLenum debug_type_enums[] = { GL_DEBUG_TYPE_PORTABILITY, GL_DEBUG_TYPE_PERFORMANCE, GL_DEBUG_TYPE_OTHER, + GL_DEBUG_TYPE_MARKER, + GL_DEBUG_TYPE_PUSH_GROUP, + GL_DEBUG_TYPE_POP_GROUP, }; static const GLenum debug_severity_enums[] = { GL_DEBUG_SEVERITY_LOW, GL_DEBUG_SEVERITY_MEDIUM, GL_DEBUG_SEVERITY_HIGH, + GL_DEBUG_SEVERITY_NOTIFICATION, }; static enum mesa_debug_source @@ -185,10 +192,14 @@ should_log(struct gl_context *ctx, GLuint id, enum mesa_debug_severity severity) { + GLint gstack = ctx->Debug.GroupStackDepth; struct gl_debug_namespace *nspace = - &ctx->Debug.Namespaces[source][type]; + &ctx->Debug.Namespaces[gstack][source][type]; uintptr_t state; + if (!ctx->Debug.DebugOutput) + return GL_FALSE; + /* In addition to not being able to store zero as a value, HashTable also can't use zero as a key. */ if (id) @@ -202,7 +213,7 @@ should_log(struct gl_context *ctx, struct gl_debug_severity *entry; if (state == NOT_FOUND) { - if (ctx->Debug.Defaults[severity][source][type]) + if (ctx->Debug.Defaults[gstack][severity][source][type]) state = ENABLED; else state = DISABLED; @@ -236,8 +247,9 @@ set_message_state(struct gl_context *ctx, enum mesa_debug_type type, GLuint id, GLboolean enabled) { + GLint gstack = ctx->Debug.GroupStackDepth; struct gl_debug_namespace *nspace = - &ctx->Debug.Namespaces[source][type]; + &ctx->Debug.Namespaces[gstack][source][type]; uintptr_t state; /* In addition to not being able to store zero as a value, HashTable also @@ -262,6 +274,71 @@ set_message_state(struct gl_context *ctx, nspace->ZeroID = state; } +static void +store_message_details(struct gl_debug_msg *emptySlot, + enum mesa_debug_source source, + enum mesa_debug_type type, GLuint id, + enum mesa_debug_severity severity, GLint len, + const char *buf) +{ + assert(!emptySlot->message && !emptySlot->length); + + emptySlot->message = malloc(len+1); + if (emptySlot->message) { + (void) strncpy(emptySlot->message, buf, (size_t)len); + emptySlot->message[len] = '\0'; + + emptySlot->length = len+1; + emptySlot->source = source; + emptySlot->type = type; + emptySlot->id = id; + emptySlot->severity = severity; + } else { + static GLuint oom_msg_id = 0; + debug_get_id(&oom_msg_id); + + /* malloc failed! */ + emptySlot->message = out_of_memory; + emptySlot->length = strlen(out_of_memory)+1; + emptySlot->source = MESA_DEBUG_SOURCE_OTHER; + emptySlot->type = MESA_DEBUG_TYPE_ERROR; + emptySlot->id = oom_msg_id; + emptySlot->severity = MESA_DEBUG_SEVERITY_HIGH; + } +} + + /** + * Remap any type exclusive to KHR_debug to something suitable + * for ARB_debug_output + */ +inline static int +remap_type(GLenum type) { + + switch(type) { + case GL_DEBUG_TYPE_MARKER: + case GL_DEBUG_TYPE_PUSH_GROUP: + case GL_DEBUG_TYPE_POP_GROUP: + type = GL_DEBUG_TYPE_OTHER; + default: + ; + } + + return type; +} + +/** + * Remap severity exclusive to KHR_debug to something suitable + * for ARB_debug_output + */ +inline static int +remap_severity(GLenum severity) { + + if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) + severity = GL_DEBUG_SEVERITY_LOW; + + return severity; +} + /** * 'buf' is not necessarily a null-terminated string. When logging, copy * 'len' characters from it, store them in a new, null-terminated string, @@ -282,10 +359,17 @@ _mesa_log_msg(struct gl_context *ctx, enum mesa_debug_source source, return; if (ctx->Debug.Callback) { + GLenum gl_type = debug_type_enums[type]; + GLenum gl_severity = debug_severity_enums[severity]; + + if (ctx->Debug.ARBCallback) { + gl_severity = remap_severity(gl_severity); + gl_type = remap_type(gl_type); + } ctx->Debug.Callback(debug_source_enums[source], - debug_type_enums[type], + gl_type, id, - debug_severity_enums[severity], + gl_severity, len, buf, ctx->Debug.CallbackData); return; } @@ -297,30 +381,7 @@ _mesa_log_msg(struct gl_context *ctx, enum mesa_debug_source source, % MAX_DEBUG_LOGGED_MESSAGES; emptySlot = &ctx->Debug.Log[nextEmpty]; - assert(!emptySlot->message && !emptySlot->length); - - emptySlot->message = malloc(len+1); - if (emptySlot->message) { - (void) strncpy(emptySlot->message, buf, (size_t)len); - emptySlot->message[len] = '\0'; - - emptySlot->length = len+1; - emptySlot->source = source; - emptySlot->type = type; - emptySlot->id = id; - emptySlot->severity = severity; - } else { - static GLuint oom_msg_id = 0; - debug_get_id(&oom_msg_id); - - /* malloc failed! */ - emptySlot->message = out_of_memory; - emptySlot->length = strlen(out_of_memory)+1; - emptySlot->source = MESA_DEBUG_SOURCE_OTHER; - emptySlot->type = MESA_DEBUG_TYPE_ERROR; - emptySlot->id = oom_msg_id; - emptySlot->severity = MESA_DEBUG_SEVERITY_HIGH; - } + store_message_details(emptySlot, source, type, id, severity, len, buf); if (ctx->Debug.NumMessages == 0) ctx->Debug.NextMsgLength = ctx->Debug.Log[ctx->Debug.NextMsg].length; @@ -340,7 +401,8 @@ _mesa_log_msg(struct gl_context *ctx, enum mesa_debug_source source, */ static GLsizei _mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type, - GLuint *id, GLenum *severity, GLsizei bufSize, char *buf) + GLuint *id, GLenum *severity, GLsizei bufSize, char *buf, + unsigned caller) { struct gl_debug_msg *msg; GLsizei length; @@ -356,12 +418,18 @@ _mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type, if (bufSize < length && buf != NULL) return 0; - if (severity) + if (severity) { *severity = debug_severity_enums[msg->severity]; + if (caller == MESSAGE_LOG_ARB) + *severity = remap_severity(*severity); + } if (source) *source = debug_source_enums[msg->source]; - if (type) + if (type) { *type = debug_type_enums[msg->type]; + if (caller == MESSAGE_LOG_ARB) + *type = remap_type(*type); + } if (id) *id = msg->id; @@ -388,13 +456,19 @@ _mesa_get_msg(struct gl_context *ctx, GLenum *source, GLenum *type, * glDebugMessageInsertARB only accepts two values for 'source', * and glDebugMessageControlARB will additionally accept GL_DONT_CARE * in any parameter, so handle those cases specially. + * + * There is also special cases for handling values available in + * GL_KHR_debug that are not avaliable in GL_ARB_debug_output */ static GLboolean validate_params(struct gl_context *ctx, unsigned caller, - GLenum source, GLenum type, GLenum severity) + const char *callerstr, GLenum source, GLenum type, + GLenum severity) { #define INSERT 1 #define CONTROL 2 +#define INSERT_ARB 3 +#define CONTROL_ARB 4 switch(source) { case GL_DEBUG_SOURCE_APPLICATION_ARB: case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: @@ -403,10 +477,10 @@ validate_params(struct gl_context *ctx, unsigned caller, case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: case GL_DEBUG_SOURCE_OTHER_ARB: - if (caller != INSERT) + if (caller != INSERT || caller == INSERT_ARB) break; case GL_DONT_CARE: - if (caller == CONTROL) + if (caller == CONTROL || caller == CONTROL_ARB) break; default: goto error; @@ -420,8 +494,12 @@ validate_params(struct gl_context *ctx, unsigned caller, case GL_DEBUG_TYPE_PORTABILITY_ARB: case GL_DEBUG_TYPE_OTHER_ARB: break; + case GL_DEBUG_TYPE_MARKER: + /* this value is only valid for GL_KHR_debug functions */ + if (caller == CONTROL || caller == INSERT) + break; case GL_DONT_CARE: - if (caller == CONTROL) + if (caller == CONTROL || caller == CONTROL_ARB) break; default: goto error; @@ -432,8 +510,12 @@ validate_params(struct gl_context *ctx, unsigned caller, case GL_DEBUG_SEVERITY_MEDIUM_ARB: case GL_DEBUG_SEVERITY_LOW_ARB: break; + case GL_DEBUG_SEVERITY_NOTIFICATION: + /* this value is only valid for GL_KHR_debug functions */ + if (caller == CONTROL || caller == INSERT) + break; case GL_DONT_CARE: - if (caller == CONTROL) + if (caller == CONTROL || caller == CONTROL_ARB) break; default: goto error; @@ -442,93 +524,13 @@ validate_params(struct gl_context *ctx, unsigned caller, error: { - const char *callerstr; - if (caller == INSERT) - callerstr = "glDebugMessageInsertARB"; - else if (caller == CONTROL) - callerstr = "glDebugMessageControlARB"; - else - return GL_FALSE; - - _mesa_error( ctx, GL_INVALID_ENUM, "bad values passed to %s" + _mesa_error(ctx, GL_INVALID_ENUM, "bad values passed to %s" "(source=0x%x, type=0x%x, severity=0x%x)", callerstr, source, type, severity); } return GL_FALSE; } -void GLAPIENTRY -_mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id, - GLenum severity, GLint length, - const GLcharARB* buf) -{ - GET_CURRENT_CONTEXT(ctx); - - if (!validate_params(ctx, INSERT, source, type, severity)) - return; /* GL_INVALID_ENUM */ - - if (length < 0) - length = strlen(buf); - - if (length >= MAX_DEBUG_MESSAGE_LENGTH) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDebugMessageInsertARB" - "(length=%d, which is not less than " - "GL_MAX_DEBUG_MESSAGE_LENGTH_ARB=%d)", length, - MAX_DEBUG_MESSAGE_LENGTH); - return; - } - - _mesa_log_msg(ctx, - gl_enum_to_debug_source(source), - gl_enum_to_debug_type(type), id, - gl_enum_to_debug_severity(severity), length, buf); -} - -GLuint GLAPIENTRY -_mesa_GetDebugMessageLogARB(GLuint count, GLsizei logSize, GLenum* sources, - GLenum* types, GLenum* ids, GLenum* severities, - GLsizei* lengths, GLcharARB* messageLog) -{ - GET_CURRENT_CONTEXT(ctx); - GLuint ret; - - if (!messageLog) - logSize = 0; - - if (logSize < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetDebugMessageLogARB" - "(logSize=%d : logSize must not be negative)", logSize); - return 0; - } - - for (ret = 0; ret < count; ret++) { - GLsizei written = _mesa_get_msg(ctx, sources, types, ids, severities, - logSize, messageLog); - if (!written) - break; - - if (messageLog) { - messageLog += written; - logSize -= written; - } - if (lengths) { - *lengths = written; - lengths++; - } - - if (severities) - severities++; - if (sources) - sources++; - if (types) - types++; - if (ids) - ids++; - } - - return ret; -} - /** * Set the state of all message IDs found in the given intersection of * 'source', 'type', and 'severity'. The _COUNT enum can be used for @@ -548,6 +550,7 @@ control_messages(struct gl_context *ctx, GLboolean enabled) { int s, t, sev, smax, tmax, sevmax; + GLint gstack = ctx->Debug.GroupStackDepth; if (source == MESA_DEBUG_SOURCE_COUNT) { source = 0; @@ -577,10 +580,10 @@ control_messages(struct gl_context *ctx, struct gl_debug_severity *entry; /* change the default for IDs we've never seen before. */ - ctx->Debug.Defaults[sev][s][t] = enabled; + ctx->Debug.Defaults[gstack][sev][s][t] = enabled; /* Now change the state of IDs we *have* seen... */ - foreach(node, &ctx->Debug.Namespaces[s][t].Severity[sev]) { + foreach(node, &ctx->Debug.Namespaces[gstack][s][t].Severity[sev]) { entry = (struct gl_debug_severity *)node; set_message_state(ctx, s, t, entry->ID, enabled); } @@ -618,28 +621,36 @@ control_app_messages(struct gl_context *ctx, GLenum esource, GLenum etype, control_messages(ctx, source, type, severity, enabled); } -void GLAPIENTRY -_mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type, - GLenum gl_severity, - GLsizei count, const GLuint *ids, - GLboolean enabled) +/** + * This is a generic message control function for use by both + * glDebugMessageControlARB and glDebugMessageControl. + */ +static void +message_control(GLenum gl_source, GLenum gl_type, + GLenum gl_severity, + GLsizei count, const GLuint *ids, + GLboolean enabled, + unsigned caller, const char *callerstr) { GET_CURRENT_CONTEXT(ctx); if (count < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDebugMessageControlARB" - "(count=%d : count must not be negative)", count); + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(count=%d : count must not be negative)", callerstr, + count); return; } - if (!validate_params(ctx, CONTROL, gl_source, gl_type, gl_severity)) + if (!validate_params(ctx, caller, callerstr, gl_source, gl_type, + gl_severity)) return; /* GL_INVALID_ENUM */ if (count && (gl_severity != GL_DONT_CARE || gl_type == GL_DONT_CARE || gl_source == GL_DONT_CARE)) { - _mesa_error(ctx, GL_INVALID_OPERATION, "glDebugMessageControlARB" - "(When passing an array of ids, severity must be" - " GL_DONT_CARE, and source and type must not be GL_DONT_CARE."); + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(When passing an array of ids, severity must be" + " GL_DONT_CARE, and source and type must not be GL_DONT_CARE.", + callerstr); return; } @@ -647,43 +658,84 @@ _mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type, count, ids, enabled); } -void GLAPIENTRY -_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const void *userParam) +/** + * This is a generic message insert function. + * Validation of source, type and severity parameters should be done + * before calling this funtion. + */ +static void +message_insert(GLenum source, GLenum type, GLuint id, + GLenum severity, GLint length, const GLchar* buf, + const char *callerstr) { GET_CURRENT_CONTEXT(ctx); - ctx->Debug.Callback = callback; - ctx->Debug.CallbackData = userParam; + + if (length < 0) + length = strlen(buf); + + if (length >= MAX_DEBUG_MESSAGE_LENGTH) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(length=%d, which is not less than " + "GL_MAX_DEBUG_MESSAGE_LENGTH=%d)", callerstr, length, + MAX_DEBUG_MESSAGE_LENGTH); + return; + } + + _mesa_log_msg(ctx, + gl_enum_to_debug_source(source), + gl_enum_to_debug_type(type), id, + gl_enum_to_debug_severity(severity), length, buf); } -void -_mesa_init_errors(struct gl_context *ctx) +/** + * This is a generic message insert function for use by both + * glGetDebugMessageLogARB and glGetDebugMessageLog. + */ +static GLuint +get_message_log(GLuint count, GLsizei logSize, GLenum* sources, + GLenum* types, GLenum* ids, GLenum* severities, + GLsizei* lengths, GLchar* messageLog, + unsigned caller, const char *callerstr) { - int s, t, sev; + GET_CURRENT_CONTEXT(ctx); + GLuint ret; - ctx->Debug.Callback = NULL; - ctx->Debug.SyncOutput = GL_FALSE; - ctx->Debug.Log[0].length = 0; - ctx->Debug.NumMessages = 0; - ctx->Debug.NextMsg = 0; - ctx->Debug.NextMsgLength = 0; + if (!messageLog) + logSize = 0; - /* Enable all the messages with severity HIGH or MEDIUM by default. */ - memset(ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_HIGH], GL_TRUE, - sizeof ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_HIGH]); - memset(ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_MEDIUM], GL_TRUE, - sizeof ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_MEDIUM]); - memset(ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_LOW], GL_FALSE, - sizeof ctx->Debug.Defaults[MESA_DEBUG_SEVERITY_LOW]); + if (logSize < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(logSize=%d : logSize must not be negative)", callerstr, + logSize); + return 0; + } - /* Initialize state for filtering known debug messages. */ - for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) - for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) { - ctx->Debug.Namespaces[s][t].IDs = _mesa_NewHashTable(); - assert(ctx->Debug.Namespaces[s][t].IDs); + for (ret = 0; ret < count; ret++) { + GLsizei written = _mesa_get_msg(ctx, sources, types, ids, severities, + logSize, messageLog, caller); + if (!written) + break; - for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) - make_empty_list(&ctx->Debug.Namespaces[s][t].Severity[sev]); + if (messageLog) { + messageLog += written; + logSize -= written; } + if (lengths) { + *lengths = written; + lengths++; + } + + if (severities) + severities++; + if (sources) + sources++; + if (types) + types++; + if (ids) + ids++; + } + + return ret; } static void @@ -691,8 +743,8 @@ do_nothing(GLuint key, void *data, void *userData) { } -void -_mesa_free_errors_data(struct gl_context *ctx) +static void +free_errors_data(struct gl_context *ctx, GLint gstack) { enum mesa_debug_type t; enum mesa_debug_source s; @@ -701,13 +753,15 @@ _mesa_free_errors_data(struct gl_context *ctx) /* Tear down state for filtering debug messages. */ for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) { - _mesa_HashDeleteAll(ctx->Debug.Namespaces[s][t].IDs, do_nothing, NULL); - _mesa_DeleteHashTable(ctx->Debug.Namespaces[s][t].IDs); + _mesa_HashDeleteAll(ctx->Debug.Namespaces[gstack][s][t].IDs, + do_nothing, NULL); + _mesa_DeleteHashTable(ctx->Debug.Namespaces[gstack][s][t].IDs); for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) { struct simple_node *node, *tmp; struct gl_debug_severity *entry; - foreach_s(node, tmp, &ctx->Debug.Namespaces[s][t].Severity[sev]) { + foreach_s(node, tmp, + &ctx->Debug.Namespaces[gstack][s][t].Severity[sev]) { entry = (struct gl_debug_severity *)node; free(entry); } @@ -715,6 +769,259 @@ _mesa_free_errors_data(struct gl_context *ctx) } } +void GLAPIENTRY +_mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id, + GLenum severity, GLint length, + const GLchar* buf) +{ + const char *callerstr = "glDebugMessageInsert"; + + GET_CURRENT_CONTEXT(ctx); + + if (!validate_params(ctx, INSERT, callerstr, source, type, severity)) + return; /* GL_INVALID_ENUM */ + + message_insert(source, type, id, severity, length, buf, + callerstr); +} + +GLuint GLAPIENTRY +_mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum* sources, + GLenum* types, GLenum* ids, GLenum* severities, + GLsizei* lengths, GLchar* messageLog) +{ + const char *callerstr = "glGetDebugMessageLog"; + + return get_message_log(count, logSize, sources, types, ids, severities, + lengths, messageLog, MESSAGE_LOG, callerstr); +} + +void GLAPIENTRY +_mesa_DebugMessageControl(GLenum source, GLenum type, GLenum severity, + GLsizei count, const GLuint *ids, + GLboolean enabled) +{ + const char *callerstr = "glDebugMessageControl"; + + message_control(source, type, severity, count, ids, + enabled, CONTROL, callerstr); +} + +void GLAPIENTRY +_mesa_DebugMessageCallback(GLDEBUGPROC callback, const void *userParam) +{ + GET_CURRENT_CONTEXT(ctx); + ctx->Debug.Callback = callback; + ctx->Debug.CallbackData = userParam; + ctx->Debug.ARBCallback = GL_FALSE; +} + +void GLAPIENTRY +_mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, + const GLchar *message) +{ + const char *callerstr = "glPushDebugGroup"; + int s, t, sev; + GLint prevStackDepth; + GLint currStackDepth; + struct gl_debug_msg *emptySlot; + + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Debug.GroupStackDepth >= MAX_DEBUG_GROUP_STACK_DEPTH-1) { + _mesa_error(ctx, GL_STACK_OVERFLOW, "%s", callerstr); + return; + } + + switch(source) { + case GL_DEBUG_SOURCE_APPLICATION: + case GL_DEBUG_SOURCE_THIRD_PARTY: + break; + default: + _mesa_error(ctx, GL_INVALID_ENUM, "bad value passed to %s" + "(source=0x%x)", callerstr, source); + return; + } + + message_insert(source, GL_DEBUG_TYPE_PUSH_GROUP, id, + GL_DEBUG_SEVERITY_NOTIFICATION, length, + message, callerstr); + + prevStackDepth = ctx->Debug.GroupStackDepth; + ctx->Debug.GroupStackDepth++; + currStackDepth = ctx->Debug.GroupStackDepth; + + /* pop reuses the message details from push so we store this */ + if (length < 0) + length = strlen(message); + emptySlot = &ctx->Debug.DebugGroupMsgs[ctx->Debug.GroupStackDepth]; + store_message_details(emptySlot, gl_enum_to_debug_source(source), + gl_enum_to_debug_source(GL_DEBUG_TYPE_PUSH_GROUP), + id, + gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION), + length, message); + + /* inherit the control volume of the debug group previously residing on + * the top of the debug group stack + */ + for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) + for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) { + /* copy id settings */ + ctx->Debug.Namespaces[currStackDepth][s][t].IDs = + _mesa_HashClone(ctx->Debug.Namespaces[prevStackDepth][s][t].IDs); + + for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) { + struct gl_debug_severity *entry, *prevEntry; + struct simple_node *node; + + /* copy default settings for unknown ids */ + ctx->Debug.Defaults[currStackDepth][sev][s][t] = ctx->Debug.Defaults[prevStackDepth][sev][s][t]; + + /* copy known id severity settings */ + make_empty_list(&ctx->Debug.Namespaces[currStackDepth][s][t].Severity[sev]); + foreach(node, &ctx->Debug.Namespaces[prevStackDepth][s][t].Severity[sev]) { + prevEntry = (struct gl_debug_severity *)node; + entry = malloc(sizeof *entry); + if (!entry) + return; + + entry->ID = prevEntry->ID; + insert_at_tail(&ctx->Debug.Namespaces[currStackDepth][s][t].Severity[sev], &entry->link); + } + } + } +} + +void GLAPIENTRY +_mesa_PopDebugGroup() +{ + const char *callerstr = "glPopDebugGroup"; + struct gl_debug_msg *gdmessage; + GLint prevStackDepth; + + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Debug.GroupStackDepth <= 0) { + _mesa_error(ctx, GL_STACK_UNDERFLOW, "%s", callerstr); + return; + } + + prevStackDepth = ctx->Debug.GroupStackDepth; + ctx->Debug.GroupStackDepth--; + + gdmessage = &ctx->Debug.DebugGroupMsgs[prevStackDepth]; + /* using _mesa_log_msg() directly here as verification of parameters + * already done in push + */ + _mesa_log_msg(ctx, gdmessage->source, + gl_enum_to_debug_type(GL_DEBUG_TYPE_POP_GROUP), + gdmessage->id, + gl_enum_to_debug_severity(GL_DEBUG_SEVERITY_NOTIFICATION), + gdmessage->length, gdmessage->message); + + if (gdmessage->message != (char*)out_of_memory) + free(gdmessage->message); + gdmessage->message = NULL; + gdmessage->length = 0; + + /* free popped debug group data */ + free_errors_data(ctx, prevStackDepth); +} + +void GLAPIENTRY +_mesa_DebugMessageInsertARB(GLenum source, GLenum type, GLuint id, + GLenum severity, GLint length, + const GLcharARB* buf) +{ + const char *callerstr = "glDebugMessageInsertARB"; + + GET_CURRENT_CONTEXT(ctx); + + if (!validate_params(ctx, INSERT_ARB, callerstr, source, type, severity)) + return; /* GL_INVALID_ENUM */ + + message_insert(source, type, id, severity, length, buf, + callerstr); +} + +GLuint GLAPIENTRY +_mesa_GetDebugMessageLogARB(GLuint count, GLsizei logSize, GLenum* sources, + GLenum* types, GLenum* ids, GLenum* severities, + GLsizei* lengths, GLcharARB* messageLog) +{ + const char *callerstr = "glGetDebugMessageLogARB"; + + return get_message_log(count, logSize, sources, types, ids, severities, + lengths, messageLog, MESSAGE_LOG_ARB, callerstr); +} + +void GLAPIENTRY +_mesa_DebugMessageControlARB(GLenum gl_source, GLenum gl_type, + GLenum gl_severity, + GLsizei count, const GLuint *ids, + GLboolean enabled) +{ + const char *callerstr = "glDebugMessageControlARB"; + + message_control(gl_source, gl_type, gl_severity, count, ids, + enabled, CONTROL_ARB, callerstr); +} + +void GLAPIENTRY +_mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const void *userParam) +{ + GET_CURRENT_CONTEXT(ctx); + ctx->Debug.Callback = callback; + ctx->Debug.CallbackData = userParam; + ctx->Debug.ARBCallback = GL_TRUE; +} + +void +_mesa_init_errors(struct gl_context *ctx) +{ + int s, t, sev; + + ctx->Debug.Callback = NULL; + ctx->Debug.SyncOutput = GL_FALSE; + ctx->Debug.Log[0].length = 0; + ctx->Debug.NumMessages = 0; + ctx->Debug.NextMsg = 0; + ctx->Debug.NextMsgLength = 0; + ctx->Debug.GroupStackDepth = 0; + + /* Enable all the messages with severity HIGH or MEDIUM by default. */ + memset(ctx->Debug.Defaults[0][MESA_DEBUG_SEVERITY_HIGH], GL_TRUE, + sizeof ctx->Debug.Defaults[0][MESA_DEBUG_SEVERITY_HIGH]); + memset(ctx->Debug.Defaults[0][MESA_DEBUG_SEVERITY_MEDIUM], GL_TRUE, + sizeof ctx->Debug.Defaults[0][MESA_DEBUG_SEVERITY_MEDIUM]); + memset(ctx->Debug.Defaults[0][MESA_DEBUG_SEVERITY_LOW], GL_FALSE, + sizeof ctx->Debug.Defaults[0][MESA_DEBUG_SEVERITY_LOW]); + + /* Initialize state for filtering known debug messages. */ + for (s = 0; s < MESA_DEBUG_SOURCE_COUNT; s++) + for (t = 0; t < MESA_DEBUG_TYPE_COUNT; t++) { + ctx->Debug.Namespaces[0][s][t].IDs = _mesa_NewHashTable(); + assert(ctx->Debug.Namespaces[0][s][t].IDs); + + for (sev = 0; sev < MESA_DEBUG_SEVERITY_COUNT; sev++) + make_empty_list(&ctx->Debug.Namespaces[0][s][t].Severity[sev]); + } +} + +/** + * Loop through debug group stack tearing down states for + * filtering debug messages. + */ +void +_mesa_free_errors_data(struct gl_context *ctx) +{ + GLint i; + + for (i = 0; i <= ctx->Debug.GroupStackDepth; i++) { + free_errors_data(ctx, i); + } +} + /**********************************************************************/ /** \name Diagnostics */ /*@{*/ diff --git a/mesalib/src/mesa/main/errors.h b/mesalib/src/mesa/main/errors.h index 5b4f36f55..a837dc8e1 100644 --- a/mesalib/src/mesa/main/errors.h +++ b/mesalib/src/mesa/main/errors.h @@ -102,6 +102,26 @@ _mesa_DebugMessageControlARB(GLenum source, GLenum type, GLenum severity, void GLAPIENTRY _mesa_DebugMessageCallbackARB(GLDEBUGPROCARB callback, const void *userParam); +void GLAPIENTRY +_mesa_DebugMessageInsert(GLenum source, GLenum type, GLuint id, + GLenum severity, GLint length, + const GLchar* buf); +GLuint GLAPIENTRY +_mesa_GetDebugMessageLog(GLuint count, GLsizei logSize, GLenum* sources, + GLenum* types, GLenum* ids, GLenum* severities, + GLsizei* lengths, GLchar* messageLog); +void GLAPIENTRY +_mesa_DebugMessageControl(GLenum source, GLenum type, GLenum severity, + GLsizei count, const GLuint *ids, + GLboolean enabled); +void GLAPIENTRY +_mesa_DebugMessageCallback(GLDEBUGPROC callback, + const void *userParam); +void GLAPIENTRY +_mesa_PushDebugGroup(GLenum source, GLuint id, GLsizei length, + const GLchar *message); +void GLAPIENTRY +_mesa_PopDebugGroup(void); #ifdef __cplusplus } diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 1a040ee3b..f60157f8c 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -283,6 +283,9 @@ static const struct extension extension_table[] = { { "GL_OES_texture_npot", o(ARB_texture_non_power_of_two), ES1 | ES2, 2005 }, { "GL_OES_vertex_array_object", o(dummy_true), ES1 | ES2, 2010 }, + /* KHR extensions */ + { "GL_KHR_debug", o(dummy_true), GL, 2012 }, + /* Vendor extensions */ { "GL_3DFX_texture_compression_FXT1", o(TDFX_texture_compression_FXT1), GL, 1999 }, { "GL_AMD_conservative_depth", o(ARB_conservative_depth), GL, 2009 }, diff --git a/mesalib/src/mesa/main/framebuffer.c b/mesalib/src/mesa/main/framebuffer.c index 4ec4118c5..2fad45880 100644 --- a/mesalib/src/mesa/main/framebuffer.c +++ b/mesalib/src/mesa/main/framebuffer.c @@ -195,6 +195,7 @@ _mesa_destroy_framebuffer(struct gl_framebuffer *fb) { if (fb) { _mesa_free_framebuffer_data(fb); + free(fb->Label); free(fb); } } diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index fde45379a..30855c37b 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -695,11 +695,15 @@ descriptor=[ # GL_ARB_robustness [ "RESET_NOTIFICATION_STRATEGY_ARB", "CONTEXT_ENUM(Const.ResetStrategy), NO_EXTRA" ], -# GL_ARB_debug_output - [ "DEBUG_LOGGED_MESSAGES_ARB", "CONTEXT_INT(Debug.NumMessages), NO_EXTRA" ], - [ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB", "CONTEXT_INT(Debug.NextMsgLength), NO_EXTRA" ], - [ "MAX_DEBUG_LOGGED_MESSAGES_ARB", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ], - [ "MAX_DEBUG_MESSAGE_LENGTH_ARB", "CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA" ], +# GL_KHR_debug (GL 4.3)/ GL_ARB_debug_output + [ "DEBUG_LOGGED_MESSAGES", "CONTEXT_INT(Debug.NumMessages), NO_EXTRA" ], + [ "DEBUG_NEXT_LOGGED_MESSAGE_LENGTH", "CONTEXT_INT(Debug.NextMsgLength), NO_EXTRA" ], + [ "MAX_DEBUG_LOGGED_MESSAGES", "CONST(MAX_DEBUG_LOGGED_MESSAGES), NO_EXTRA" ], + [ "MAX_DEBUG_MESSAGE_LENGTH", "CONST(MAX_DEBUG_MESSAGE_LENGTH), NO_EXTRA" ], + [ "MAX_LABEL_LENGTH", "CONST(MAX_LABEL_LENGTH), NO_EXTRA" ], + [ "MAX_DEBUG_GROUP_STACK_DEPTH", "CONST(MAX_DEBUG_GROUP_STACK_DEPTH), NO_EXTRA" ], + [ "DEBUG_GROUP_STACK_DEPTH", "CONTEXT_INT(Debug.GroupStackDepth), NO_EXTRA" ], + [ "MAX_DUAL_SOURCE_DRAW_BUFFERS", "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" ], # GL_ARB_uniform_buffer_object diff --git a/mesalib/src/mesa/main/hash.c b/mesalib/src/mesa/main/hash.c index 6591af9a6..b31fd4839 100644 --- a/mesalib/src/mesa/main/hash.c +++ b/mesalib/src/mesa/main/hash.c @@ -302,6 +302,34 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, /** + * Clone all entries in a hash table, into a new table. + * + * \param table the hash table to clone + */ +struct _mesa_HashTable * +_mesa_HashClone(const struct _mesa_HashTable *table) +{ + /* cast-away const */ + struct _mesa_HashTable *table2 = (struct _mesa_HashTable *) table; + struct hash_entry *entry; + struct _mesa_HashTable *clonetable; + + ASSERT(table); + _glthread_LOCK_MUTEX(table2->Mutex); + + clonetable = _mesa_NewHashTable(); + assert(clonetable); + hash_table_foreach(table->ht, entry) { + _mesa_HashInsert(clonetable, (GLint)(uintptr_t)entry->key, entry->data); + } + + _glthread_UNLOCK_MUTEX(table2->Mutex); + + return clonetable; +} + + +/** * Walk over all entries in a hash table, calling callback function for each. * Note: we use a separate mutex in this function to avoid a recursive * locking deadlock (in case the callback calls _mesa_HashRemove()) and to diff --git a/mesalib/src/mesa/main/hash.h b/mesalib/src/mesa/main/hash.h index 142d2842c..b34f32848 100644 --- a/mesalib/src/mesa/main/hash.h +++ b/mesalib/src/mesa/main/hash.h @@ -50,6 +50,9 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table, void (*callback)(GLuint key, void *data, void *userData), void *userData); +extern struct _mesa_HashTable * +_mesa_HashClone(const struct _mesa_HashTable *table); + extern void _mesa_HashWalk(const struct _mesa_HashTable *table, void (*callback)(GLuint key, void *data, void *userData), diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 22bb58c5f..ef16c5910 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -80,6 +80,7 @@ struct prog_instruction; struct gl_program_parameter_list; struct set; struct set_entry; +struct vbo_context; /*@}*/ @@ -1128,6 +1129,7 @@ struct gl_sampler_object { GLuint Name; GLint RefCount; + GLchar *Label; /**< GL_KHR_debug */ GLenum WrapS; /**< S-axis texture image wrap mode */ GLenum WrapT; /**< T-axis texture image wrap mode */ @@ -1155,6 +1157,7 @@ struct gl_texture_object _glthread_Mutex Mutex; /**< for thread safety */ GLint RefCount; /**< reference count */ GLuint Name; /**< the user-visible texture object ID */ + GLchar *Label; /**< GL_KHR_debug */ GLenum Target; /**< GL_TEXTURE_1D, GL_TEXTURE_2D, etc. */ struct gl_sampler_object Sampler; @@ -1403,6 +1406,7 @@ struct gl_buffer_object _glthread_Mutex Mutex; GLint RefCount; GLuint Name; + GLchar *Label; /**< GL_KHR_debug */ GLenum Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ GLsizeiptrARB Size; /**< Size of buffer storage in bytes */ GLubyte *Data; /**< Location of storage either in RAM or VRAM. */ @@ -1467,6 +1471,7 @@ struct gl_array_object { /** Name of the array object as received from glGenVertexArrayAPPLE. */ GLuint Name; + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; _glthread_Mutex Mutex; @@ -1704,6 +1709,7 @@ struct gl_transform_feedback_info struct gl_transform_feedback_object { GLuint Name; /**< AKA the object ID */ + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; GLboolean Active; /**< Is transform feedback enabled? */ GLboolean Paused; /**< Is transform feedback paused? */ @@ -2108,6 +2114,7 @@ struct gl_shader */ GLenum Type; GLuint Name; /**< AKA the handle */ + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; /**< Reference count */ GLboolean DeletePending; GLboolean CompileStatus; @@ -2279,6 +2286,7 @@ struct gl_shader_program { GLenum Type; /**< Always GL_SHADER_PROGRAM (internal token) */ GLuint Name; /**< aka handle or ID */ + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; /**< Reference count */ GLboolean DeletePending; @@ -2515,6 +2523,7 @@ struct gl_query_object { GLenum Target; /**< The query target, when active */ GLuint Id; /**< hash table ID/name */ + GLchar *Label; /**< GL_KHR_debug */ GLuint64EXT Result; /**< the counter */ GLboolean Active; /**< inside Begin/EndQuery */ GLboolean Ready; /**< result is ready? */ @@ -2550,6 +2559,7 @@ struct gl_sync_object { GLenum Type; /**< GL_SYNC_FENCE */ GLuint Name; /**< Fence name */ + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; /**< Reference count */ GLboolean DeletePending; /**< Object was deleted while there were still * live references (e.g., sync not yet finished) @@ -2632,6 +2642,7 @@ struct gl_renderbuffer _glthread_Mutex Mutex; /**< for thread safety */ GLuint ClassID; /**< Useful for drivers */ GLuint Name; + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; GLuint Width, Height; GLuint Depth; @@ -2715,6 +2726,7 @@ struct gl_framebuffer * polygon face orientation, and polygon stipple will have to be inverted. */ GLuint Name; + GLchar *Label; /**< GL_KHR_debug */ GLint RefCount; GLboolean DeletePending; @@ -3280,6 +3292,7 @@ union gl_dlist_node; struct gl_display_list { GLuint Name; + GLchar *Label; /**< GL_KHR_debug */ GLbitfield Flags; /**< DLIST_x flags */ /** The dlist commands are in a linked list of nodes */ union gl_dlist_node *Head; @@ -3315,8 +3328,8 @@ struct gl_dlist_state /** @{ * - * These are a mapping of the GL_ARB_debug_output enums to small enums - * suitable for use as an array index. + * These are a mapping of the GL_ARB_debug_output/GL_KHR_debug enums + * to small enums suitable for use as an array index. */ enum mesa_debug_source { @@ -3336,6 +3349,9 @@ enum mesa_debug_type { MESA_DEBUG_TYPE_PORTABILITY, MESA_DEBUG_TYPE_PERFORMANCE, MESA_DEBUG_TYPE_OTHER, + MESA_DEBUG_TYPE_MARKER, + MESA_DEBUG_TYPE_PUSH_GROUP, + MESA_DEBUG_TYPE_POP_GROUP, MESA_DEBUG_TYPE_COUNT }; @@ -3343,6 +3359,7 @@ enum mesa_debug_severity { MESA_DEBUG_SEVERITY_LOW, MESA_DEBUG_SEVERITY_MEDIUM, MESA_DEBUG_SEVERITY_HIGH, + MESA_DEBUG_SEVERITY_NOTIFICATION, MESA_DEBUG_SEVERITY_COUNT }; @@ -3350,7 +3367,7 @@ enum mesa_debug_severity { /** * An error, warning, or other piece of debug information for an application - * to consume via GL_ARB_debug_output. + * to consume via GL_ARB_debug_output/GL_KHR_debug. */ struct gl_debug_msg { @@ -3372,12 +3389,16 @@ struct gl_debug_namespace struct gl_debug_state { - GLDEBUGPROCARB Callback; + GLDEBUGPROC Callback; const void *CallbackData; GLboolean SyncOutput; - GLboolean Defaults[MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT]; - struct gl_debug_namespace Namespaces[MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT]; + GLboolean DebugOutput; + GLboolean ARBCallback; /* Used to track if current callback is of type ARB_debug_output or KHR_debug */ + GLboolean Defaults[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SEVERITY_COUNT][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT]; + struct gl_debug_namespace Namespaces[MAX_DEBUG_GROUP_STACK_DEPTH][MESA_DEBUG_SOURCE_COUNT][MESA_DEBUG_TYPE_COUNT]; struct gl_debug_msg Log[MAX_DEBUG_LOGGED_MESSAGES]; + struct gl_debug_msg DebugGroupMsgs[MAX_DEBUG_GROUP_STACK_DEPTH]; + GLint GroupStackDepth; GLint NumMessages; GLint NextMsg; GLint NextMsgLength; /* redundant, but copied here from Log[NextMsg].length @@ -3624,7 +3645,7 @@ struct gl_context const char *ErrorDebugFmtString; GLuint ErrorDebugCount; - /* GL_ARB_debug_output */ + /* GL_ARB_debug_output/GL_KHR_debug */ struct gl_debug_state Debug; GLenum RenderMode; /**< either GL_RENDER, GL_SELECT, GL_FEEDBACK */ @@ -3669,7 +3690,7 @@ struct gl_context void *swrast_context; void *swsetup_context; void *swtnl_context; - void *swtnl_im; + struct vbo_context *vbo_context; struct st_context *st; void *aelt_context; /*@}*/ diff --git a/mesalib/src/mesa/main/objectlabel.c b/mesalib/src/mesa/main/objectlabel.c new file mode 100644 index 000000000..90d9e09f5 --- /dev/null +++ b/mesalib/src/mesa/main/objectlabel.c @@ -0,0 +1,282 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2013 Timothy Arceri All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include "arrayobj.h" +#include "bufferobj.h" +#include "context.h" +#include "dlist.h" +#include "enums.h" +#include "fbobject.h" +#include "objectlabel.h" +#include "queryobj.h" +#include "samplerobj.h" +#include "shaderobj.h" +#include "syncobj.h" +#include "texobj.h" +#include "transformfeedback.h" + + +/** + * Helper for _mesa_ObjectLabel() and _mesa_ObjectPtrLabel(). + */ +static void +set_label(struct gl_context *ctx, char **labelPtr, const char *label, + int length, const char *caller) +{ + if (*labelPtr) { + /* free old label string */ + free(*labelPtr); + *labelPtr = NULL; + } + + /* set new label string */ + if (label) { + if (length >= 0) { + if (length >= MAX_LABEL_LENGTH) + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(length=%d, which is not less than " + "GL_MAX_LABEL_LENGTH=%d)", caller, length, + MAX_LABEL_LENGTH); + + /* explicit length */ + *labelPtr = (char *) malloc(length+1); + if (*labelPtr) { + memcpy(*labelPtr, label, length); + /* length is not required to include the null terminator so + * add one just in case + */ + (*labelPtr)[length] = '\0'; + } + } + else { + int len = strlen(label); + if (len >= MAX_LABEL_LENGTH) + _mesa_error(ctx, GL_INVALID_VALUE, + "%s(label length=%d, which is not less than " + "GL_MAX_LABEL_LENGTH=%d)", caller, len, + MAX_LABEL_LENGTH); + + /* null-terminated string */ + *labelPtr = _mesa_strdup(label); + } + } +} + +/** + * Helper for _mesa_GetObjectLabel() and _mesa_GetObjectPtrLabel(). + */ +static void +copy_label(char **labelPtr, char *label, int *length, int bufSize) +{ + int labelLen = 0; + + if (*labelPtr) + labelLen = strlen(*labelPtr); + + if (label) { + if (bufSize <= labelLen) + labelLen = bufSize-1; + + memcpy(label, *labelPtr, labelLen); + label[labelLen] = '\0'; + } + + if (length) + *length = labelLen; +} + +/** + * Helper for _mesa_ObjectLabel() and _mesa_GetObjectLabel(). + */ +static char ** +get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name, + const char *caller) +{ + char **labelPtr = NULL; + + switch (identifier) { + case GL_BUFFER: + { + struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj(ctx, name); + if (bufObj) + labelPtr = &bufObj->Label; + } + break; + case GL_SHADER: + { + struct gl_shader *shader = _mesa_lookup_shader(ctx, name); + if (shader) + labelPtr = &shader->Label; + } + break; + case GL_PROGRAM: + { + struct gl_shader_program *program = + _mesa_lookup_shader_program(ctx, name); + if (program) + labelPtr = &program->Label; + } + break; + case GL_VERTEX_ARRAY: + { + struct gl_array_object *obj = _mesa_lookup_arrayobj(ctx, name); + if (obj) + labelPtr = &obj->Label; + } + break; + case GL_QUERY: + { + struct gl_query_object *query = _mesa_lookup_query_object(ctx, name); + if (query) + labelPtr = &query->Label; + } + break; + case GL_TRANSFORM_FEEDBACK: + { + struct gl_transform_feedback_object *tfo = + _mesa_lookup_transform_feedback_object(ctx, name); + if (tfo) + labelPtr = &tfo->Label; + } + break; + case GL_SAMPLER: + { + struct gl_sampler_object *so = _mesa_lookup_samplerobj(ctx, name); + if (so) + labelPtr = &so->Label; + } + break; + case GL_TEXTURE: + { + struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name); + if (texObj) + labelPtr = &texObj->Label; + } + break; + case GL_RENDERBUFFER: + { + struct gl_renderbuffer *rb = _mesa_lookup_renderbuffer(ctx, name); + if (rb) + labelPtr = &rb->Label; + } + break; + case GL_FRAMEBUFFER: + { + struct gl_framebuffer *rb = _mesa_lookup_framebuffer(ctx, name); + if (rb) + labelPtr = &rb->Label; + } + break; + case GL_DISPLAY_LIST: + if (ctx->API == API_OPENGL_COMPAT) { + struct gl_display_list *list = _mesa_lookup_list(ctx, name); + if (list) + labelPtr = &list->Label; + } + else { + goto invalid_enum; + } + break; + case GL_PROGRAM_PIPELINE: + /* requires GL 4.2 */ + goto invalid_enum; + default: + goto invalid_enum; + } + + if (NULL == labelPtr) { + _mesa_error(ctx, GL_INVALID_VALUE, "glObjectLabel(name = %u)", name); + } + + return labelPtr; + +invalid_enum: + _mesa_error(ctx, GL_INVALID_ENUM, "%s(identifier = %s)", + caller, _mesa_lookup_enum_by_nr(identifier)); + return NULL; +} + +void GLAPIENTRY +_mesa_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, + const GLchar *label) +{ + GET_CURRENT_CONTEXT(ctx); + char **labelPtr; + + labelPtr = get_label_pointer(ctx, identifier, name, "glObjectLabel"); + if (!labelPtr) + return; + + set_label(ctx, labelPtr, label, length, "glObjectLabel"); +} + +void GLAPIENTRY +_mesa_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, + GLsizei *length, GLchar *label) +{ + GET_CURRENT_CONTEXT(ctx); + char **labelPtr; + + labelPtr = get_label_pointer(ctx, identifier, name, "glGetObjectLabel"); + if (!labelPtr) + return; + + copy_label(labelPtr, label, length, bufSize); +} + +void GLAPIENTRY +_mesa_ObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label) +{ + GET_CURRENT_CONTEXT(ctx); + char **labelPtr; + struct gl_sync_object *const syncObj = (struct gl_sync_object *) ptr; + + if (!_mesa_validate_sync(ctx, syncObj)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glObjectPtrLabel (not a valid sync object)"); + return; + } + + labelPtr = &syncObj->Label; + + set_label(ctx, labelPtr, label, length, "glObjectPtrLabel"); +} + +void GLAPIENTRY +_mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, + GLchar *label) +{ + GET_CURRENT_CONTEXT(ctx); + char **labelPtr; + struct gl_sync_object *const syncObj = (struct gl_sync_object *) ptr; + + if (!_mesa_validate_sync(ctx, syncObj)) { + _mesa_error(ctx, GL_INVALID_VALUE, "glGetObjectPtrLabel (not a valid sync object)"); + return; + } + + labelPtr = &syncObj->Label; + + copy_label(labelPtr, label, length, bufSize); +} diff --git a/mesalib/src/mesa/main/objectlabel.h b/mesalib/src/mesa/main/objectlabel.h new file mode 100644 index 000000000..f57d5f7b5 --- /dev/null +++ b/mesalib/src/mesa/main/objectlabel.h @@ -0,0 +1,61 @@ +/* + * Mesa 3-D graphics library + * + * Copyright (C) 2013 Timothy Arceri All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file objectlabel.h + * Mesa object label functions. + * + * This file provides functions to assign and retrieve object labels. + */ + +#ifndef OBJECTLABEL_H +#define OBJECTLABEL_H + + +#include "glheader.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +void GLAPIENTRY +_mesa_ObjectLabel(GLenum identifier, GLuint name, GLsizei length, + const GLchar *label); +void GLAPIENTRY +_mesa_GetObjectLabel(GLenum identifier, GLuint name, GLsizei bufSize, + GLsizei *length, GLchar *label); +void GLAPIENTRY +_mesa_ObjectPtrLabel(const void *ptr, GLsizei length, const GLchar *label); +void GLAPIENTRY +_mesa_GetObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, + GLchar *label); + +#ifdef __cplusplus +} +#endif + + +#endif /* OBJECTLABEL_H */ diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c index 60356b85d..6b636f4cb 100644 --- a/mesalib/src/mesa/main/queryobj.c +++ b/mesalib/src/mesa/main/queryobj.c @@ -126,6 +126,7 @@ _mesa_check_query(struct gl_context *ctx, struct gl_query_object *q) static void _mesa_delete_query(struct gl_context *ctx, struct gl_query_object *q) { + free(q->Label); free(q); } diff --git a/mesalib/src/mesa/main/renderbuffer.c b/mesalib/src/mesa/main/renderbuffer.c index d2bde803f..2ff96e548 100644 --- a/mesalib/src/mesa/main/renderbuffer.c +++ b/mesalib/src/mesa/main/renderbuffer.c @@ -84,6 +84,7 @@ void _mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb) { _glthread_DESTROY_MUTEX(rb->Mutex); + free(rb->Label); free(rb); } diff --git a/mesalib/src/mesa/main/samplerobj.c b/mesalib/src/mesa/main/samplerobj.c index 3857eda06..39cfcd086 100644 --- a/mesalib/src/mesa/main/samplerobj.c +++ b/mesalib/src/mesa/main/samplerobj.c @@ -155,6 +155,7 @@ static void _mesa_delete_sampler_object(struct gl_context *ctx, struct gl_sampler_object *sampObj) { + free(sampObj->Label); free(sampObj); } diff --git a/mesalib/src/mesa/main/shaderobj.c b/mesalib/src/mesa/main/shaderobj.c index a62ad0413..0d794ad96 100644 --- a/mesalib/src/mesa/main/shaderobj.c +++ b/mesalib/src/mesa/main/shaderobj.c @@ -125,6 +125,7 @@ static void _mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh) { free((void *)sh->Source); + free(sh->Label); _mesa_reference_program(ctx, &sh->Program, NULL); ralloc_free(sh); } @@ -351,6 +352,8 @@ _mesa_free_shader_program_data(struct gl_context *ctx, shProg->_LinkedShaders[sh] = NULL; } } + + free(shProg->Label); } diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c index c8d25cdf1..92c7cb0e1 100644 --- a/mesalib/src/mesa/main/syncobj.c +++ b/mesalib/src/mesa/main/syncobj.c @@ -83,6 +83,7 @@ static void _mesa_delete_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj) { (void) ctx; + free(syncObj->Label); free(syncObj); } @@ -160,7 +161,7 @@ _mesa_free_sync_data(struct gl_context *ctx) } -static int +int _mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj) { return (syncObj != NULL) diff --git a/mesalib/src/mesa/main/syncobj.h b/mesalib/src/mesa/main/syncobj.h index faa3f558d..025a9b132 100644 --- a/mesalib/src/mesa/main/syncobj.h +++ b/mesalib/src/mesa/main/syncobj.h @@ -53,6 +53,9 @@ _mesa_ref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); extern void _mesa_unref_sync_object(struct gl_context *ctx, struct gl_sync_object *syncObj); +extern int +_mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj); + extern GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync); diff --git a/mesalib/src/mesa/main/texobj.c b/mesalib/src/mesa/main/texobj.c index 7c8f04db9..cc2c786bb 100644 --- a/mesalib/src/mesa/main/texobj.c +++ b/mesalib/src/mesa/main/texobj.c @@ -238,6 +238,8 @@ _mesa_delete_texture_object(struct gl_context *ctx, /* destroy the mutex -- it may have allocated memory (eg on bsd) */ _glthread_DESTROY_MUTEX(texObj->Mutex); + free(texObj->Label); + /* free this object */ free(texObj); } diff --git a/mesalib/src/mesa/main/transformfeedback.c b/mesalib/src/mesa/main/transformfeedback.c index 03f188300..3f8a7f48d 100644 --- a/mesalib/src/mesa/main/transformfeedback.c +++ b/mesalib/src/mesa/main/transformfeedback.c @@ -195,6 +195,7 @@ delete_transform_feedback(struct gl_context *ctx, _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL); } + free(obj->Label); free(obj); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c index 2e5e253a4..25cc61aef 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -81,6 +81,7 @@ st_bufferobj_free(struct gl_context *ctx, struct gl_buffer_object *obj) if (st_obj->buffer) pipe_resource_reference(&st_obj->buffer, NULL); + free(st_obj->Base.Label); free(st_obj); } diff --git a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c index 94bf4861d..6d875b851 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_syncobj.c +++ b/mesalib/src/mesa/state_tracker/st_cb_syncobj.c @@ -60,6 +60,7 @@ static void st_delete_sync_object(struct gl_context *ctx, struct st_sync_object *so = (struct st_sync_object*)obj; screen->fence_reference(screen, &so->fence, NULL); + free(so->b.Label); free(so); } diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index 9c2b4d24e..098e6c02c 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -626,8 +626,12 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, return NULL; } - if (attribs->flags & ST_CONTEXT_FLAG_DEBUG) + st->ctx->Debug.DebugOutput = GL_FALSE; + if (attribs->flags & ST_CONTEXT_FLAG_DEBUG){ st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT; + st->ctx->Debug.DebugOutput = GL_TRUE; + } + if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE) st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT; diff --git a/mesalib/src/mesa/vbo/vbo_context.c b/mesalib/src/mesa/vbo/vbo_context.c index b97313dfb..b2806274d 100644 --- a/mesalib/src/mesa/vbo/vbo_context.c +++ b/mesalib/src/mesa/vbo/vbo_context.c @@ -152,7 +152,7 @@ GLboolean _vbo_CreateContext( struct gl_context *ctx ) { struct vbo_context *vbo = CALLOC_STRUCT(vbo_context); - ctx->swtnl_im = (void *)vbo; + ctx->vbo_context = vbo; /* Initialize the arrayelt helper */ @@ -224,7 +224,7 @@ void _vbo_DestroyContext( struct gl_context *ctx ) if (ctx->API == API_OPENGL_COMPAT) vbo_save_destroy(ctx); free(vbo); - ctx->swtnl_im = NULL; + ctx->vbo_context = NULL; } } diff --git a/mesalib/src/mesa/vbo/vbo_context.h b/mesalib/src/mesa/vbo/vbo_context.h index 27fae83a5..1680e23dc 100644 --- a/mesalib/src/mesa/vbo/vbo_context.h +++ b/mesalib/src/mesa/vbo/vbo_context.h @@ -90,7 +90,7 @@ struct vbo_context { static inline struct vbo_context *vbo_context(struct gl_context *ctx) { - return (struct vbo_context *)(ctx->swtnl_im); + return ctx->vbo_context; } diff --git a/xorg-server/xkeyboard-config/README b/xorg-server/xkeyboard-config/README index d91eda6e6..2be1ab633 100644 --- a/xorg-server/xkeyboard-config/README +++ b/xorg-server/xkeyboard-config/README @@ -1,28 +1,28 @@ X Keyboard Extension -------------------- -The X Keyboard Extension essentially replaces the core protocol definition of -keyboard. The extension makes possible to clearly and explicitly specify most -aspects of keyboard behaviour on per-key basis and to more closely track the -logical and physical state of the keyboard. It also includes a number of -keyboard controls designed to make keyboards more accessible to people with -physical impairments. +The X Keyboard Extension essentially replaces the core protocol definition +of the keyboard. The extension makes it possible to clearly and explicitly +specify most aspects of keyboard behaviour on a per-key basis and to more +closely track the logical and physical state of the keyboard. It also +includes a number of keyboard controls designed to make keyboards more +accessible to people with physical impairments. -There are five types of components in the server database corresponing to five -xkb symbolic names: symbols, geometry, keycodes, compat and types which -determine the keyboard behaviour. These five components can combined together -into a resulting keyboard mapping using the 'rules' component. +There are five types of components in the server database corresponding to +five xkb symbolic names (symbols, geometry, keycodes, compat, and types) +which determine the keyboard behaviour. These five components can be +combined into a resulting keyboard mapping using the 'rules' component. -The complete specification can be found on -http://xfree86.org/current/XKBproto.pdf +The complete specification can be found in: + http://www.x.org/current/doc/kbproto/xkbproto.pdf -For XKB configuration information see 'docs/README.config' file. +For XKB configuration information, see the 'docs/README.config' file. -For information how to further enhance XKB configuration see 'docs/README.enhancing' -file. +For information on how to further enhance XKB configuration, see the +'docs/README.enhancing' file. -For information how to replace existing XKB configuration database with -XKeyboardConfig see 'docs/HOWTO.transition' file. +For information on how to replace an existing XKB configuration database +with XKeyboardConfig, see the 'docs/HOWTO.transition' file. -Contribution guidelines are described at -http://www.freedesktop.org/wiki/Software/XKeyboardConfig/Rules +Contribution guidelines are described on: + http://www.freedesktop.org/wiki/Software/XKeyboardConfig/Rules diff --git a/xorg-server/xkeyboard-config/docs/README.symbols b/xorg-server/xkeyboard-config/docs/README.symbols index 749618e77..31ca053eb 100644 --- a/xorg-server/xkeyboard-config/docs/README.symbols +++ b/xorg-server/xkeyboard-config/docs/README.symbols @@ -1,51 +1,48 @@ -The files in the symbols directory describe possible layouts for a given -keyboard. +The files in the symbols directory describe possible keyboard layouts +for a given country or language or script. The default layout in each file should describe the most common layout -for its kind, usually the symbols printed on the keys. Layout variants -can describe common differences that are not necessarily printed on the keys. -(e.g. a phonetic version of Cyrillic). +for its kind, usually the one that matches the symbols printed on the +keys. Layout variants can describe common deviations that are not +necessarily printed on the keys (e.g. a phonetic version of Cyrillic). -The names of the files are referenced throughout the XKB rules, and may be -exposed in the X server configuration and in user configuration tools. +The names of the files are referenced throughout the XKB rules, and may +be exposed in the X server configuration and in user configuration tools. The filenames use the following convention: Country layouts: - Keyboard layouts for a country must use the 2-letter code from the ISO-3166 standard. Language layouts: - Keyboard layouts for a language must use the 3-letter code from the ISO-639 standard. Script layouts: - Keyboard layouts for a script must use the 4-letter code from the ISO-15924 standard. Other: + Keyboard layouts that do not fit in the above categories must use a + filename between 5 and 8 characters. - Keyboard layouts that do not fit in the above model and directories - must use a filename between 5 and 8 characters. - -The ISO codes can be found at the following addressed: +The relevant ISO codes can be found at the following addresses: -Country layouts: http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/iso_3166-1_decoding_table.html -Language layouts: http://www.loc.gov/standards/iso639-2/langcodes.html +Country layouts: http://www.iso.org/iso/home/standards/country_codes/iso-3166-1_decoding_table.htm +Language layouts: http://www.loc.gov/standards/iso639-2/php/code_list.php Script layouts: http://www.unicode.org/iso15924/iso15924-codes.html -The description in the directory file base.xml.in should match the group names -in the symbols file. +The descriptions of the layouts in the file base.xml.in should match the +group names in the symbols file. -If the layout is country-based, this has to be the full -name of the country. It is highly not recommended to use the forms -"Republic of XXX" or "XXX Republic" - the form "XXX" should be used instead. -The only exception is "United Kingdom". +If the layout is country-based, the group name has to be the full name of +the country. It is highly discouraged to use forms like "Republic of XXX" +or "XXX Republic" -- the form "XXX" should be used instead. The only +exception is "United Kingdom". -If the layout is language-based, this has to be the name of the language. +If the layout is language-based, the group name has to be the name of the +language. -Within single symbols file, all the variants should have the same group name +Within a single symbols file, all the variants should have the same group name (implemented using the "include" directive wherever possible). diff --git a/xorg-server/xkeyboard-config/symbols/altwin b/xorg-server/xkeyboard-config/symbols/altwin index c65727db4..333b7dacd 100644 --- a/xorg-server/xkeyboard-config/symbols/altwin +++ b/xorg-server/xkeyboard-config/symbols/altwin @@ -1,100 +1,106 @@ +// Meta is mapped to second level of Alt keys. partial modifier_keys xkb_symbols "meta_alt" { - key <LALT> { [ Alt_L, Meta_L ] }; + key <LALT> { [ Alt_L, Meta_L ] }; key <RALT> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Alt_R, Meta_R ] }; - modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; -// modifier_map Mod4 {}; + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; +// modifier_map Mod4 {}; }; -// Alt is mapped to the Win-keys (and the usual Alt keys). +// Alt is mapped to the Win keys (and the usual Alt keys). partial modifier_keys xkb_symbols "alt_win" { - key <LWIN> { [ Alt_L ] }; - key <RWIN> { [ Alt_R ] }; + key <LWIN> { [ Alt_L ] }; + key <RWIN> { [ Alt_R ] }; modifier_map Mod1 { <LWIN>, <RWIN> }; }; -// Ctrl is mapped to the Win-keys (and the usual Ctrl keys). +// Ctrl is mapped to the Win keys (and the usual Ctrl keys). partial modifier_keys xkb_symbols "ctrl_win" { - key <LWIN> { [ Control_L ] }; - key <RWIN> { [ Control_R ] }; + key <LWIN> { [ Control_L ] }; + key <RWIN> { [ Control_R ] }; modifier_map Control { <LWIN>, <RWIN> }; }; -// Ctrl is mapped to the Alt-keys, Alt is mapped to the Win-keys, Win is mapped to the Ctrl-keys. +// Ctrl is mapped to the Alt keys, Alt to the Win keys, and Win to the Ctrl keys. partial modifier_keys xkb_symbols "ctrl_alt_win" { - key <LALT> { [ Control_L, Control_L ] }; + key <LALT> { [ Control_L, Control_L ] }; key <RALT> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Control_R, Control_R ] }; - key <LWIN> { [ Alt_L, Meta_L ] }; - key <RWIN> { [ Alt_R, Meta_R ] }; + key <LWIN> { [ Alt_L, Meta_L ] }; + key <RWIN> { [ Alt_R, Meta_R ] }; modifier_map Control { <RALT>, <LALT> }; - modifier_map Mod1 { <LWIN>, <RWIN> }; + modifier_map Mod1 { <LWIN>, <RWIN> }; }; - +// Meta is mapped to the Win keys. partial modifier_keys xkb_symbols "meta_win" { - key <LALT> { [ Alt_L, Alt_L ] }; + key <LALT> { [ Alt_L, Alt_L ] }; key <RALT> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Alt_R, Alt_R ] }; - key <LWIN> { [ Meta_L ] }; - key <RWIN> { [ Meta_R ] }; - modifier_map Mod1 { Alt_L, Alt_R }; - modifier_map Mod4 { <META>, Meta_L, Meta_R }; + key <LWIN> { [ Meta_L ] }; + key <RWIN> { [ Meta_R ] }; + modifier_map Mod1 { Alt_L, Alt_R }; + modifier_map Mod4 { <META>, Meta_L, Meta_R }; }; +// Meta is mapped to the left Win key. partial modifier_keys xkb_symbols "left_meta_win" { - key <LALT> { [ Alt_L, Alt_L ] }; - key <LWIN> { [ Meta_L ] }; - modifier_map Mod1 { Alt_L }; - modifier_map Mod4 { <META>, Meta_L }; + key <LALT> { [ Alt_L, Alt_L ] }; + key <LWIN> { [ Meta_L ] }; + modifier_map Mod1 { Alt_L }; + modifier_map Mod4 { <META>, Meta_L }; }; +// Hyper is mapped to the Win keys. partial modifier_keys xkb_symbols "hyper_win" { - key <LWIN> { [ Hyper_L ] }; - key <RWIN> { [ Hyper_R ] }; - modifier_map Mod4 { Hyper_L, Hyper_R }; + key <LWIN> { [ Hyper_L ] }; + key <RWIN> { [ Hyper_R ] }; + modifier_map Mod4 { Hyper_L, Hyper_R }; }; -// Use Menu for the menu key +// Menu is mapped to the Menu key. partial modifier_keys xkb_symbols "menu" { - key <MENU> { [ Menu ] }; + key <MENU> { [ Menu ] }; }; // Layout for Tux key caps with additional right Alt key partial modifier_keys xkb_symbols "alt_super_win" { - key <LALT> { [ Alt_L, Meta_L ] }; - key <RWIN> { [ Alt_R, Meta_R ] }; - key <LWIN> { [ Super_L ] }; - key <MENU> { [ Super_R ] }; - modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; - modifier_map Mod4 { Super_L, Super_R }; + key <LALT> { [ Alt_L, Meta_L ] }; + key <RWIN> { [ Alt_R, Meta_R ] }; + key <LWIN> { [ Super_L ]}; + key <MENU> { [ Super_R ] }; + modifier_map Mod1 { Alt_L, Alt_R, Meta_L, Meta_R }; + modifier_map Mod4 { Super_L, Super_R }; }; +// Swap the Alt and Win keys. partial modifier_keys xkb_symbols "swap_alt_win" { include "altwin(swap_lalt_lwin)" include "altwin(swap_ralt_rwin)" }; +// Swap the left Alt and Win keys. partial hidden modifier_keys xkb_symbols "swap_lalt_lwin" { key <LALT> { type[Group1] = "ONE_LEVEL", symbols[Group1] = [ Super_L ] }; - key <LWIN> { [ Alt_L, Meta_L ] }; + key <LWIN> { [ Alt_L, Meta_L ] }; }; +// Swap the right Alt and Win keys. partial hidden modifier_keys xkb_symbols "swap_ralt_rwin" { key <RALT> { type[Group1] = "ONE_LEVEL", symbols[Group1] = [ Super_R ] }; - key <RWIN> { [ Alt_R, Meta_R ] }; + key <RWIN> { [ Alt_R, Meta_R ] }; }; diff --git a/xorg-server/xkeyboard-config/symbols/be b/xorg-server/xkeyboard-config/symbols/be index 286e9289e..c89a9338c 100644 --- a/xorg-server/xkeyboard-config/symbols/be +++ b/xorg-server/xkeyboard-config/symbols/be @@ -51,11 +51,11 @@ xkb_symbols "basic" { // │ ³ ≤ │ 1 ≥ │ 2 É │ 3 ˘ │ 4 — │ 5 – │ 6 ™ │ 7 È │ 8 ¡ │ 9 Ç │ 0 À │ ° Ø │ _ ± ┃ ⌫ Retour┃ // │ ² ¹ │ & | │ é @ │ " # │ ' ¸ │ ( ˇ │ § ^ │ è ` │ ! ~ │ ç { │ à } │ ) ø │ - ‑ ┃ arrière┃ // ┢━━━━━┷━┱───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┴─┬───┺━┳━━━━━━━┫ -// ┃ ┃ A Æ │ Z  │ E ¢ │ R Ê │ T Þ │ Y Ÿ │ U Û │ I Î │ O Œ │ P Ô │ ¨ ˚ │ * ̨ ┃Entrée ┃ +// ┃ ┃ A Æ │ Z  │ E ¢ │ R Ê │ T Þ │ Y Ÿ │ U Û │ I Î │ O Œ │ P Ô │ ¨ ˚ │ * ̨ ┃Entrée ┃ // ┃Tab ↹ ┃ a æ │ z â │ e € │ r ê │ t þ │ y ÿ │ u û │ i î │ o œ │ p ô │ ^ [ │ $ ] ┃ ⏎ ┃ // ┣━━━━━━━┻┱────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┴┬────┺┓ ┃ -// ┃ ┃ Q Ä │ S „ │ D Ë │ F ‚ │ G ¥ │ H Ð │ J Ü │ K Ï │ L Ł │ M Ö │ % Ù │ £ ̄ ┃ ┃ -// ┃Maj ⇬ ┃ q ä │ s ß │ d ë │ f ‘ │ g ’ │ h ð │ j ü │ k ï │ l ł │ m ö │ ù ' │ µ ` ┃ ┃ +// ┃ ┃ Q Ä │ S „ │ D Ë │ F ‚ │ G ¥ │ H Ð │ J Ü │ K Ï │ L │ M Ö │ % Ù │ £ ̄ ┃ ┃ +// ┃Maj ⇬ ┃ q ä │ s ß │ d ë │ f ‘ │ g ’ │ h ð │ j ü │ k ï │ l / │ m ö │ ù ' │ µ ` ┃ ┃ // ┣━━━━━━━┳┹────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┬┴────┲┷━━━━━┻━━━━━━┫ // ┃ ┃ > ≠ │ W “ │ X ” │ C ® │ V ← │ B ↑ │ N → │ ? … │ . . │ / ∕ │ + − ┃ ┃ // ┃Shift ⇧┃ < \ │ w « │ x » │ c © │ v ⍽ │ b ↓ │ n ¬ │ , ¿ │ ; × │ : ÷ │ = ~ ┃Shift ⇧ ┃ @@ -92,7 +92,7 @@ xkb_symbols "oss_frbe" { key <AD12> { [ dollar, asterisk, bracketright, dead_ogonek ] }; // $ * ] ̨ // Third row - key <AC09> { [ l, L, dead_stroke ] }; // l L ł Ł + key <AC09> { [ l, L, dead_stroke ] }; key <BKSL> { [ mu, sterling, dead_grave, dead_macron ] }; // µ £ ` ̄ // Fourth row diff --git a/xorg-server/xkeyboard-config/symbols/capslock b/xorg-server/xkeyboard-config/symbols/capslock index 3e0880573..8b315c6f1 100644 --- a/xorg-server/xkeyboard-config/symbols/capslock +++ b/xorg-server/xkeyboard-config/symbols/capslock @@ -1,68 +1,68 @@ default partial hidden modifier_keys xkb_symbols "capslock" { - replace key <CAPS> { [ Caps_Lock ] }; + replace key <CAPS> { [ Caps_Lock ] }; modifier_map Lock { Caps_Lock }; }; partial hidden modifier_keys xkb_symbols "shiftlock" { - replace key <CAPS> { [ Shift_Lock ] }; + replace key <CAPS> { [ Shift_Lock ] }; modifier_map Shift { Shift_Lock }; }; partial hidden modifier_keys xkb_symbols "grouplock" { - replace key <CAPS> { [ ISO_Next_Group, Caps_Lock ] }; + replace key <CAPS> { [ ISO_Next_Group, Caps_Lock ] }; }; partial hidden modifier_keys xkb_symbols "swapescape" { - key <CAPS> { [ Escape ] }; - key <ESC> { [ Caps_Lock ] }; + key <CAPS> { [ Escape ] }; + key <ESC> { [ Caps_Lock ] }; }; partial hidden modifier_keys xkb_symbols "groupshift" { key <CAPS> { - type[Group1]="PC_ALT_LEVEL2", - [ Mode_switch, Caps_Lock ] + type[Group1] = "PC_ALT_LEVEL2", + [ Mode_switch, Caps_Lock ] }; }; partial hidden modifier_keys xkb_symbols "escape" { - key <CAPS> { [ Escape ] }; + key <CAPS> { [ Escape ] }; }; partial hidden modifier_keys xkb_symbols "backspace" { - key <CAPS> { [ BackSpace ] }; + key <CAPS> { [ BackSpace ] }; }; partial hidden modifier_keys xkb_symbols "super" { - key <CAPS> { [ Super_L ] }; - modifier_map Mod4 { <CAPS> }; + key <CAPS> { [ Super_L ] }; + modifier_map Mod4 { <CAPS> }; }; partial hidden modifier_keys xkb_symbols "hyper" { - key <CAPS> { [ Hyper_L ] }; - modifier_map Mod4 { <CAPS> }; + key <CAPS> { [ Hyper_L ] }; + modifier_map Mod4 { <CAPS> }; }; partial hidden modifier_keys xkb_symbols "none" { - key <CAPS> { [ VoidSymbol ] }; + key <CAPS> { [ VoidSymbol ] }; }; partial hidden modifier_keys xkb_symbols "numlock" { - key <CAPS> { [ Num_Lock ] }; + key <CAPS> { [ Num_Lock ] }; }; -// This changes the modifier behavior of the <CAPS> key. -// The keysym will be reset to Caps_Lock +// This changes the <CAPS> key to become a Control modifier, +// but it will still produce the Caps_Lock keysym. partial hidden modifier_keys xkb_symbols "ctrl_modifier" { replace key <CAPS> { diff --git a/xorg-server/xkeyboard-config/symbols/ctrl b/xorg-server/xkeyboard-config/symbols/ctrl index 09d76b551..ca019ec7d 100644 --- a/xorg-server/xkeyboard-config/symbols/ctrl +++ b/xorg-server/xkeyboard-config/symbols/ctrl @@ -1,57 +1,57 @@ -// eliminate the caps lock key completely (replace with control) +// Eliminate CapsLock, making it another Ctrl. partial modifier_keys xkb_symbols "nocaps" { - replace key <CAPS> { [ Control_L, Control_L ] }; + replace key <CAPS> { [ Control_L, Control_L ] }; modifier_map Control { <CAPS>, <LCTL> }; }; -// replace left control with Meta +// Make the left Ctrl key a left Meta. xkb_symbols "lctrl_meta" { - replace key <LCTL> { [ Meta_L ] }; + replace key <LCTL> { [ Meta_L ] }; }; -// swap the caps lock key with the left control key +// Swap the functions of the CapsLock key and the left Ctrl key. partial modifier_keys xkb_symbols "swapcaps" { - replace key <CAPS> { [ Control_L ] }; - replace key <LCTL> { [ Caps_Lock ] }; + replace key <CAPS> { [ Control_L ] }; + replace key <LCTL> { [ Caps_Lock ] }; }; -// moves the control key to the middle row and the caps lock -// to the bottom row. Only works if the geometry or keycodes +// Move Ctrl to the leftmost key on the middle row and CapsLock to the +// leftmost key on the bottom row. Only works if the geometry or keycodes // file has defined appropriate aliases for the keys in question. partial modifier_keys xkb_symbols "ac_ctrl" { - replace key <AC00> { [ Control_L ] }; - replace key <AA00> { [ Caps_Lock ] }; + replace key <AC00> { [ Control_L ] }; + replace key <AA00> { [ Caps_Lock ] }; }; -// Moves the control key to the bottom row and the caps lock -// to the middle row. Only works if the geometry or keycodes +// Move Ctrl to the leftmost key on the bottom row and CapsLock to the +// leftmost key on the middle row. Only works if the geometry or keycodes // file has defined appropriate aliases for the keys in question. partial modifier_keys xkb_symbols "aa_ctrl" { - replace key <AA00> { [ Control_L ] }; - replace key <AC00> { [ Caps_Lock ] }; + replace key <AA00> { [ Control_L ] }; + replace key <AC00> { [ Caps_Lock ] }; }; -// Right Ctrl works as Right Alt +// Right Ctrl key functions as another right Alt. partial modifier_keys xkb_symbols "rctrl_ralt" { - key <RCTL> { symbols[Group1]= [ Alt_R ] }; + key <RCTL> { symbols[Group1]= [ Alt_R ] }; }; -// Menu works as Right Ctrl +// Menu key functions as another right Ctrl. partial modifier_keys xkb_symbols "menu_rctrl" { - replace key <MENU> { [ Control_R, Control_R ] }; - modifier_map Control { Control_L, <MENU> }; + replace key <MENU> { [ Control_R, Control_R ] }; + modifier_map Control { Control_L, <MENU> }; }; -// right alt functions as another ctrl key +// Right Alt key functions as another right Ctrl. partial modifier_keys xkb_symbols "ralt_rctrl" { - replace key <RALT> { type[Group1] = "TWO_LEVEL", + replace key <RALT> { type[Group1] = "TWO_LEVEL", symbols[Group1] = [ Control_R, Control_R ] }; modifier_map Control { <RALT> }; }; diff --git a/xorg-server/xkeyboard-config/symbols/level3 b/xorg-server/xkeyboard-config/symbols/level3 index 2f5575c62..8f3da0da8 100644 --- a/xorg-server/xkeyboard-config/symbols/level3 +++ b/xorg-server/xkeyboard-config/symbols/level3 @@ -1,20 +1,18 @@ -// these variants assign various XKB keycodes to ISO_Level3_Shift so that -// the third shift level can be reached -// +// These partial variants assign ISO_Level3_Shift to various XKB keycodes +// so that the third shift level can be reached. -// Ensure a mapping to a real modifier for LevelThree +// Ensure a mapping to a real modifier for LevelThree. partial modifier_keys xkb_symbols "modifier_mapping" { key.type[Group1] = "ONE_LEVEL"; - replace key <LVL3> { symbols[Group1] = [ ISO_Level3_Shift ] }; modifier_map Mod5 { <LVL3> }; }; -// the default behavior is for the right Alt key (AltGr) to generate the -// third engraved symbol +// The default behaviour: +// the right Alt key (AltGr) chooses the third symbol engraved on a key. default partial modifier_keys xkb_symbols "ralt_switch" { key <RALT> { @@ -24,10 +22,10 @@ xkb_symbols "ralt_switch" { include "level3(modifier_mapping)" }; -// Right Alt key never chooses 3rd level. -// This option attempts to undo the effect of a layout's -// including ralt_switch. You may also want to select another -// level3 option that maps the level3 shift to some other key. +// The right Alt key never chooses the third level. +// This option attempts to undo the effect of a layout's inclusion of +// 'ralt_switch'. You may want to also select another level3 option +// to map the level3 shift to some other key. partial modifier_keys xkb_symbols "ralt_alt" { key <RALT> { @@ -40,9 +38,11 @@ xkb_symbols "ralt_alt" { symbols[Group3] = [ Alt_R, Meta_R ], symbols[Group4] = [ Alt_R, Meta_R ] }; - modifier_map Mod1 { <RALT> }; + modifier_map Mod1 { <RALT> }; }; +// The right Alt key (while pressed) chooses the third shift level, +// and Compose is mapped to its second level. partial modifier_keys xkb_symbols "ralt_switch_multikey" { key <RALT> { @@ -52,14 +52,13 @@ xkb_symbols "ralt_switch_multikey" { include "level3(modifier_mapping)" }; -// special case or right Alt switch - for use with grp:alts_toggle -// +// A special case of the right-Alt switch -- for use with grp:alts_toggle. partial hidden modifier_keys xkb_symbols "ralt_switch_for_alts_toggle" { - virtual_modifiers LAlt, AlGr; + virtual_modifiers LAlt, AltGr; key <LALT> { type[Group1]="PC_RALT_LEVEL2", - symbols[Group1] = [ Alt_L, ISO_Prev_Group, ISO_Prev_Group ], + symbols[Group1] = [ Alt_L, ISO_Prev_Group, ISO_Prev_Group ], virtualMods= LAlt }; key <RALT> { @@ -70,14 +69,15 @@ xkb_symbols "ralt_switch_for_alts_toggle" { include "level3(modifier_mapping)" }; -// using the level(alt_switch) map, either Alt key temporarily chooses -// the third shift level. (Mostly be used to imitate Mac OS functionality.) +// Either Alt key (while pressed) chooses the third shift level. +// (To be used mostly to imitate Mac OS functionality.) partial modifier_keys xkb_symbols "alt_switch" { include "level3(lalt_switch)" include "level3(ralt_switch)" }; +// The left Alt key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "lalt_switch" { key <LALT> { @@ -87,8 +87,7 @@ xkb_symbols "lalt_switch" { include "level3(modifier_mapping)" }; -// using the level(switch) map, the right Control key temporarily -// chooses the third shift level (until it is released). +// The right Ctrl key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "switch" { key <RCTL> { @@ -98,8 +97,7 @@ xkb_symbols "switch" { include "level3(modifier_mapping)" }; -// using the level(menu_switch) map, the Menu key temporarily -// chooses the third shift level (until it is released). +// The Menu key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "menu_switch" { key <MENU> { @@ -109,16 +107,14 @@ xkb_symbols "menu_switch" { include "level3(modifier_mapping)" }; -// using the level3(win_switch) map, the either Windows' logo key -// temporarily chooses the third shift level. +// Either Win key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "win_switch" { include "level3(lwin_switch)" include "level3(rwin_switch)" }; -// using the level3(lwin_switch) map, the left Windows' logo key -// temporarily chooses the third shift level. +// The left Win key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "lwin_switch" { key <LWIN> { @@ -128,10 +124,9 @@ xkb_symbols "lwin_switch" { include "level3(modifier_mapping)" }; -// using the level(rwin_switch) map, the right Windows' logo key -// temporarily chooses the third shift level. If you use this map, -// you should define your keyboard as pc101 or pc102 instead of pc104 -// or pc105. +// The right Win key (while pressed) chooses the third shift level. +// (When using this map, you should set your keyboard as pc101 or pc102 +// instead of pc104 or pc105.) partial modifier_keys xkb_symbols "rwin_switch" { key <RWIN> { @@ -141,9 +136,8 @@ xkb_symbols "rwin_switch" { include "level3(modifier_mapping)" }; -// using the level3(enter_switch) map, the Enter key on the keypad -// temporarily chooses the third shift level. This is especially -// useful for Mac laptops which miss the right Alt key. +// The Enter key on the kepypad (while pressed) chooses the third shift level. +// (This is especially useful for Mac laptops which miss the right Alt key.) partial modifier_keys xkb_symbols "enter_switch" { key <KPEN> { @@ -153,6 +147,7 @@ xkb_symbols "enter_switch" { include "level3(modifier_mapping)" }; +// The CapsLock key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "caps_switch" { key <CAPS> { @@ -162,6 +157,7 @@ xkb_symbols "caps_switch" { include "level3(modifier_mapping)" }; +// The Backslash key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "bksl_switch" { key <BKSL> { @@ -171,6 +167,7 @@ xkb_symbols "bksl_switch" { include "level3(modifier_mapping)" }; +// The Less/Greater key (while pressed) chooses the third shift level. partial modifier_keys xkb_symbols "lsgt_switch" { key <LSGT> { @@ -180,6 +177,8 @@ xkb_symbols "lsgt_switch" { include "level3(modifier_mapping)" }; +// The CapsLock key (while pressed) chooses the third shift level, +// and latches when pressed together with another third-level chooser. partial modifier_keys xkb_symbols "caps_switch_latch" { key <CAPS> { @@ -189,6 +188,8 @@ xkb_symbols "caps_switch_latch" { include "level3(modifier_mapping)" }; +// The Backslash key (while pressed) chooses the third shift level, +// and latches when pressed together with another third-level chooser. partial modifier_keys xkb_symbols "bksl_switch_latch" { key <BKSL> { @@ -198,6 +199,8 @@ xkb_symbols "bksl_switch_latch" { include "level3(modifier_mapping)" }; +// The Less/Greater key (while pressed) chooses the third shift level, +// and latches when pressed together with another third-level chooser. partial modifier_keys xkb_symbols "lsgt_switch_latch" { key <LSGT> { diff --git a/xorg-server/xkeyboard-config/symbols/level5 b/xorg-server/xkeyboard-config/symbols/level5 index 09d71cddf..84507e5b3 100644 --- a/xorg-server/xkeyboard-config/symbols/level5 +++ b/xorg-server/xkeyboard-config/symbols/level5 @@ -1,20 +1,17 @@ -// these variants assign various XKB keycodes to ISO_Level5_Shift so that -// the third shift level can be reached -// +// These partial variants assign ISO_Level5_Shift to various XKB keycodes +// so that the fifth shift level can be reached. -// Ensure a mapping to a real modifier for LevelFive +// Ensure a mapping to a real modifier for LevelFive. partial modifier_keys xkb_symbols "modifier_mapping" { key.type[Group1] = "ONE_LEVEL"; - replace key <MDSW> { symbols[Group1] = [ ISO_Level5_Shift ] }; modifier_map Mod3 { <MDSW> }; }; -// using the level(switch) map, the right Control key temporarily -// chooses the fifth shift level (until it is released). +// The right Ctrl key (while pressed) chooses the fifth shift level. partial modifier_keys xkb_symbols "rctrl_switch" { key <RCTL> { @@ -24,6 +21,7 @@ xkb_symbols "rctrl_switch" { include "level5(modifier_mapping)" }; +// The Less/Greater key (while pressed) chooses the fifth shift level. partial modifier_keys xkb_symbols "lsgt_switch" { key <LSGT> { @@ -33,6 +31,7 @@ xkb_symbols "lsgt_switch" { include "level5(modifier_mapping)" }; +// The right Alt key (while pressed) chooses the fifth shift level. partial modifier_keys xkb_symbols "ralt_switch" { key <RALT> { @@ -43,19 +42,14 @@ xkb_symbols "ralt_switch" { }; -// The following modifier keys are used to switch to the third shift and to set a -// corresponding lock, implemented as NumLock. - +// This adds the definitions needed to create a level5-lock behaviour, using +// the real modifier NumLock as a lock indicator. +// See also: types/level5 : EIGHT_LEVEL_LEVEL_FIVE_LOCK +// See also: compat/level5(level5_lock) partial modifier_keys xkb_symbols "lock" { - // This adds the definitions needed to create a level5-lock behaviour, using - // the real modifier NumLock as a lock indicator. - // See also: types/level5 : EIGHT_LEVEL_LEVEL_FIVE_LOCK - // See also: compat/level5(level5_lock) key.type[Group1] = "ONE_LEVEL"; - include "level5(modifier_mapping)" - replace key <HYPR> { vmods = NumLock, symbols[Group1] = [ NoSymbol ], @@ -64,90 +58,85 @@ xkb_symbols "lock" { modifier_map Mod2 { <HYPR> }; }; +// The following modifier keys are used to switch to the third shift level +// and to set a corresponding lock, implemented as NumLock. + partial modifier_keys xkb_symbols "lsgt_switch_lock" { - include "level5(lock)" - key <LSGT> { type[Group1] = "EIGHT_LEVEL", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "lwin_switch_lock" { - include "level5(lock)" - key <LWIN> { type[Group1] = "EIGHT_LEVEL", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "ralt_switch_lock" { - include "level5(lock)" - key <RALT> { type[Group1] = "EIGHT_LEVEL", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "rwin_switch_lock" { - include "level5(lock)" - key <RWIN> { type[Group1] = "EIGHT_LEVEL", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "lsgt_switch_lock_cancel" { - include "level5(lock)" - key <LSGT> { type[Group1] = "EIGHT_LEVEL_LEVEL_FIVE_LOCK", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "lwin_switch_lock_cancel" { - include "level5(lock)" - key <LWIN> { type[Group1] = "EIGHT_LEVEL_LEVEL_FIVE_LOCK", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "ralt_switch_lock_cancel" { - include "level5(lock)" - key <RALT> { type[Group1] = "EIGHT_LEVEL_LEVEL_FIVE_LOCK", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; partial modifier_keys xkb_symbols "rwin_switch_lock_cancel" { - include "level5(lock)" - key <RWIN> { type[Group1] = "EIGHT_LEVEL_LEVEL_FIVE_LOCK", - symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] + symbols[Group1] = [ ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, ISO_Level5_Shift, + ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock, ISO_Level5_Lock ] }; }; diff --git a/xorg-server/xkeyboard-config/symbols/rs b/xorg-server/xkeyboard-config/symbols/rs index 1b88d0131..baa7a345a 100644 --- a/xorg-server/xkeyboard-config/symbols/rs +++ b/xorg-server/xkeyboard-config/symbols/rs @@ -108,7 +108,7 @@ xkb_symbols "cyralpha" { key <AC11> { [ Serbian_tshe, Serbian_TSHE, any,any ] }; // ' " key <BKSL> { [ Cyrillic_zhe, Cyrillic_ZHE, any,any ] }; // \ | - key <AB01> { [ Cyrillic_zhe, Cyrillic_ZHE, any,any ] }; // z + key <AB01> { [ U0455, U0405, any,any ] }; // z key <AB02> { [ Cyrillic_dzhe, Cyrillic_DZHE, any,any ] }; // x key <AB03> { [ Cyrillic_tse, Cyrillic_TSE, any,any ] }; // c key <AB04> { [ Cyrillic_ve, Cyrillic_VE, any,any ] }; // v diff --git a/xorg-server/xkeyboard-config/symbols/shift b/xorg-server/xkeyboard-config/symbols/shift index 6fbec5b2a..8f9022349 100644 --- a/xorg-server/xkeyboard-config/symbols/shift +++ b/xorg-server/xkeyboard-config/symbols/shift @@ -1,4 +1,5 @@ -partial modifier_keys +// Cancel CapsLock when a Shift key is pressed. +partial modifier_keys xkb_symbols "breaks_caps" { key <LFSH> { type = "ALPHABETIC", @@ -16,20 +17,21 @@ xkb_symbols "breaks_caps" { }; }; -// When pressed together with another Shift key, set/release Lock. + +// Toggle CapsLock when pressed together with the other Shift key. partial modifier_keys xkb_symbols "lshift_both_capslock" { key <LFSH> { type[Group1]="TWO_LEVEL", - symbols[Group1] = [ Shift_L, Caps_Lock ] + symbols[Group1] = [ Shift_L, Caps_Lock ] }; }; -// When pressed together with another Shift key, set or unset Lock. +// Toggle CapsLock when pressed together with the other Shift key. partial modifier_keys xkb_symbols "rshift_both_capslock" { key <RTSH> { type[Group1]="TWO_LEVEL", - symbols[Group1] = [ Shift_R, Caps_Lock ] + symbols[Group1] = [ Shift_R, Caps_Lock ] }; }; partial modifier_keys @@ -38,20 +40,21 @@ xkb_symbols "both_capslock" { include "shift(rshift_both_capslock)" }; -// Release Lock when pressed alone and set Lock when pressed with another Shift key. + +// Set CapsLock when pressed with the other Shift key, release it when pressed alone. partial modifier_keys xkb_symbols "lshift_both_capslock_cancel" { key <LFSH> { type[Group1]="ALPHABETIC", - symbols[Group1] = [ Shift_L, Caps_Lock ] + symbols[Group1] = [ Shift_L, Caps_Lock ] }; }; -// Release Lock when pressed alone and set Lock when pressed with another Shift key. +// Set CapsLock when pressed with the other Shift key, release it when pressed alone. partial modifier_keys xkb_symbols "rshift_both_capslock_cancel" { key <RTSH> { type[Group1]="ALPHABETIC", - symbols[Group1] = [ Shift_R, Caps_Lock ] + symbols[Group1] = [ Shift_R, Caps_Lock ] }; }; partial modifier_keys @@ -61,20 +64,20 @@ xkb_symbols "both_capslock_cancel" { }; -// When pressed together with another Shift key, lock/unlock Shift. +// Toggle ShiftLock when pressed together with the other Shift key. partial modifier_keys xkb_symbols "lshift_both_shiftlock" { key <LFSH> { type[Group1]="TWO_LEVEL", - symbols[Group1] = [ Shift_L, Shift_Lock ] + symbols[Group1] = [ Shift_L, Shift_Lock ] }; }; -// When pressed together with another Shift key, lock/unlock Shift. +// Toggle ShiftLock when pressed together with the other Shift key. partial modifier_keys xkb_symbols "rshift_both_shiftlock" { key <RTSH> { type[Group1]="TWO_LEVEL", - symbols[Group1] = [ Shift_R, Shift_Lock ] + symbols[Group1] = [ Shift_R, Shift_Lock ] }; }; partial modifier_keys |