[amiwm] Do another pass to clean up build warnings

This is mostly a "dangling if" cleanup, but I did add some other
comments here and there!
This commit is contained in:
Adrian Chadd
2022-02-10 11:11:05 -08:00
parent 59eae9c029
commit 5365f97cbe
20 changed files with 2078 additions and 4412 deletions

View File

@@ -7,7 +7,7 @@ YACC = @YACC@
CFLAGS = @CFLAGS@
YFLAGS = -d
DEFS = @DEFS@
ALL_CFLAGS = -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
ALL_CFLAGS = -Wall -I. -I@srcdir@ -I@srcdir@/libami $(DEFS) $(CFLAGS) @X_CFLAGS@
LIBS = @X_LIBS@ @X_PRE_LIBS@ -Llibami -lami @XT_LIB_KLUDGE@ -lXext -lXmu \
-lX11 @X_EXTRA_LIBS@ @LIBS@
prefix = @prefix@

View File

@@ -296,11 +296,12 @@ int main(int argc, char *argv[])
XNextEvent(dpy, &event);
switch(event.type) {
case Expose:
if(!event.xexpose.count)
if(!event.xexpose.count) {
if(event.xexpose.window == textwin)
refresh_text();
else if((c=getchoice(event.xexpose.window)))
refresh_choice(c);
}
break;
case LeaveNotify:
if(depressed && event.xcrossing.window==selected->win) {
@@ -323,11 +324,12 @@ int main(int argc, char *argv[])
}
break;
case ButtonRelease:
if(event.xbutton.button==Button1 && selected)
if(event.xbutton.button==Button1 && selected) {
if(depressed)
endchoice();
else
abortchoice();
}
break;
}
}

884
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -232,7 +232,7 @@ void strkey(XKeyEvent *e)
if(cur_pos) {
#ifdef USE_FONTSETS
int p=cur_pos;
int z;
// int z;
while(p>0) {
--p;
if(((int)mbrlen(cmdline+p, cur_pos-p, NULL))>0) {
@@ -529,7 +529,7 @@ int main(int argc, char *argv[])
#endif
switch(event.type) {
case Expose:
if(!event.xexpose.count)
if(!event.xexpose.count) {
if(event.xexpose.window == mainwin)
refresh_main();
else if(event.xexpose.window == strwin)
@@ -538,6 +538,7 @@ int main(int argc, char *argv[])
refresh_button(ok, ok_txt, 1);
else if(event.xexpose.window == cancel)
refresh_button(cancel, cancel_txt, 2);
}
case LeaveNotify:
if(depressed && event.xcrossing.window==button[selected]) {
depressed=0;
@@ -565,11 +566,12 @@ int main(int argc, char *argv[])
}
break;
case ButtonRelease:
if(event.xbutton.button==Button1 && selected)
if(event.xbutton.button==Button1 && selected) {
if(depressed)
endchoice();
else
abortchoice();
}
break;
case KeyPress:
if(stractive)

2867
gram.c

File diff suppressed because it is too large Load Diff

258
gram.h
View File

@@ -1,195 +1,73 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#define ERRORTOKEN 257
#define LEFTBRACE 258
#define RIGHTBRACE 259
#define YES 260
#define NO 261
#define RIGHT 262
#define BOTTOM 263
#define BOTH 264
#define NONE 265
#define MAGICWB 266
#define SYSTEM 267
#define SCHWARTZ 268
#define ALWAYS 269
#define AUTO 270
#define MANUAL 271
#define SEPARATOR 272
#define T_DETAILPEN 273
#define T_BLOCKPEN 274
#define T_TEXTPEN 275
#define T_SHINEPEN 276
#define T_SHADOWPEN 277
#define T_FILLPEN 278
#define T_FILLTEXTPEN 279
#define T_BACKGROUNDPEN 280
#define T_HIGHLIGHTTEXTPEN 281
#define T_BARDETAILPEN 282
#define T_BARBLOCKPEN 283
#define T_BARTRIMPEN 284
#define FASTQUIT 285
#define SIZEBORDER 286
#define DEFAULTICON 287
#define ICONDIR 288
#define ICONPALETTE 289
#define SCREENFONT 290
#define ICONFONT 291
#define TOOLITEM 292
#define FORCEMOVE 293
#define SCREEN 294
#define MODULE 295
#define MODULEPATH 296
#define INTERSCREENGAP 297
#define AUTORAISE 298
#define FOCUS 299
#define FOLLOWMOUSE 300
#define CLICKTOTYPE 301
#define SLOPPY 302
#define CUSTOMICONSONLY 303
#define TITLEBARCLOCK 304
#define TITLECLOCKFORMAT 305
#define OPAQUEMOVE 306
#define OPAQUERESIZE 307
#define SCREENMENU 308
#define STYLE 309
#define CLASS 310
#define TITLE 311
#define ICONTITLE 312
#define ICON 313
#define SHORTLABELICONS 314
#define STRING 315
#define NUMBER 316
#ifdef YYSTYPE
#undef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
ERRORTOKEN = 258,
LEFTBRACE = 259,
RIGHTBRACE = 260,
YES = 261,
NO = 262,
RIGHT = 263,
BOTTOM = 264,
BOTH = 265,
NONE = 266,
MAGICWB = 267,
SYSTEM = 268,
SCHWARTZ = 269,
ALWAYS = 270,
AUTO = 271,
MANUAL = 272,
SEPARATOR = 273,
T_DETAILPEN = 274,
T_BLOCKPEN = 275,
T_TEXTPEN = 276,
T_SHINEPEN = 277,
T_SHADOWPEN = 278,
T_FILLPEN = 279,
T_FILLTEXTPEN = 280,
T_BACKGROUNDPEN = 281,
T_HIGHLIGHTTEXTPEN = 282,
T_BARDETAILPEN = 283,
T_BARBLOCKPEN = 284,
T_BARTRIMPEN = 285,
FASTQUIT = 286,
SIZEBORDER = 287,
DEFAULTICON = 288,
ICONDIR = 289,
ICONPALETTE = 290,
SCREENFONT = 291,
ICONFONT = 292,
TOOLITEM = 293,
FORCEMOVE = 294,
SCREEN = 295,
MODULE = 296,
MODULEPATH = 297,
INTERSCREENGAP = 298,
AUTORAISE = 299,
FOCUS = 300,
FOLLOWMOUSE = 301,
CLICKTOTYPE = 302,
SLOPPY = 303,
CUSTOMICONSONLY = 304,
TITLEBARCLOCK = 305,
TITLECLOCKFORMAT = 306,
OPAQUEMOVE = 307,
OPAQUERESIZE = 308,
SCREENMENU = 309,
STYLE = 310,
CLASS = 311,
TITLE = 312,
ICONTITLE = 313,
ICON = 314,
SHORTLABELICONS = 315,
STRING = 316,
NUMBER = 317
};
#endif
/* Tokens. */
#define ERRORTOKEN 258
#define LEFTBRACE 259
#define RIGHTBRACE 260
#define YES 261
#define NO 262
#define RIGHT 263
#define BOTTOM 264
#define BOTH 265
#define NONE 266
#define MAGICWB 267
#define SYSTEM 268
#define SCHWARTZ 269
#define ALWAYS 270
#define AUTO 271
#define MANUAL 272
#define SEPARATOR 273
#define T_DETAILPEN 274
#define T_BLOCKPEN 275
#define T_TEXTPEN 276
#define T_SHINEPEN 277
#define T_SHADOWPEN 278
#define T_FILLPEN 279
#define T_FILLTEXTPEN 280
#define T_BACKGROUNDPEN 281
#define T_HIGHLIGHTTEXTPEN 282
#define T_BARDETAILPEN 283
#define T_BARBLOCKPEN 284
#define T_BARTRIMPEN 285
#define FASTQUIT 286
#define SIZEBORDER 287
#define DEFAULTICON 288
#define ICONDIR 289
#define ICONPALETTE 290
#define SCREENFONT 291
#define ICONFONT 292
#define TOOLITEM 293
#define FORCEMOVE 294
#define SCREEN 295
#define MODULE 296
#define MODULEPATH 297
#define INTERSCREENGAP 298
#define AUTORAISE 299
#define FOCUS 300
#define FOLLOWMOUSE 301
#define CLICKTOTYPE 302
#define SLOPPY 303
#define CUSTOMICONSONLY 304
#define TITLEBARCLOCK 305
#define TITLECLOCKFORMAT 306
#define OPAQUEMOVE 307
#define OPAQUERESIZE 308
#define SCREENMENU 309
#define STYLE 310
#define CLASS 311
#define TITLE 312
#define ICONTITLE 313
#define ICON 314
#define SHORTLABELICONS 315
#define STRING 316
#define NUMBER 317
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
#ifndef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
typedef union
{
#line 50 "gram.y" /* yacc.c:1909 */
int num;
char *ptr;
#line 183 "y.tab.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */

1
icc.c
View File

@@ -6,6 +6,7 @@
#include "prefs.h"
#include <string.h>
#include <stdlib.h>
#ifdef AMIGAOS
#include <pragmas/xlib_pragmas.h>

View File

@@ -1,5 +1,3 @@
int yywrap() { return 1; }
#line 2 "<stdout>"
@@ -10,89 +8,11 @@ int yywrap() { return 1; }
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 3
#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
#define yy_create_buffer yy_create_buffer
#define yy_delete_buffer yy_delete_buffer
#define yy_scan_buffer yy_scan_buffer
#define yy_scan_string yy_scan_string
#define yy_scan_bytes yy_scan_bytes
#define yy_init_buffer yy_init_buffer
#define yy_flush_buffer yy_flush_buffer
#define yy_load_buffer_state yy_load_buffer_state
#define yy_switch_to_buffer yy_switch_to_buffer
#define yypush_buffer_state yypush_buffer_state
#define yypop_buffer_state yypop_buffer_state
#define yyensure_buffer_stack yyensure_buffer_stack
#define yylex yylex
#define yyrestart yyrestart
#define yylex_init yylex_init
#define yylex_init_extra yylex_init_extra
#define yylex_destroy yylex_destroy
#define yyget_debug yyget_debug
#define yyset_debug yyset_debug
#define yyget_extra yyget_extra
#define yyset_extra yyset_extra
#define yyget_in yyget_in
#define yyset_in yyset_in
#define yyget_out yyget_out
#define yyset_out yyset_out
#define yyget_leng yyget_leng
#define yyget_text yyget_text
#define yyget_lineno yyget_lineno
#define yyset_lineno yyset_lineno
#define yywrap yywrap
#define yyalloc yyalloc
#define yyrealloc yyrealloc
#define yyfree yyfree
#define yytext yytext
#define yyleng yyleng
#define yyin yyin
#define yyout yyout
#define yy_flex_debug yy_flex_debug
#define yylineno yylineno
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
@@ -110,7 +30,8 @@ int yywrap() { return 1; }
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#if defined(__FreeBSD__) || \
(defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
@@ -163,10 +84,16 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
/* begin standard C++ headers. */
/* TODO: this is always defined, so inline it */
#define yyconst const
@@ -198,7 +125,7 @@ typedef unsigned int flex_uint32_t;
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart(yyin )
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
@@ -333,6 +260,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
#define yy_current_buffer YY_CURRENT_BUFFER
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
@@ -364,7 +292,7 @@ void yypop_buffer_state ( void );
static void yyensure_buffer_stack ( void );
static void yy_load_buffer_state ( void );
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
@@ -380,7 +308,7 @@ void yyfree ( void * );
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
@@ -389,7 +317,7 @@ void yyfree ( void * );
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
@@ -624,8 +552,8 @@ int parse_keyword(char *str, YYSTYPE *val)
return ERRORTOKEN;
}
#line 625 "<stdout>"
#line 626 "<stdout>"
#line 555 "<stdout>"
#line 556 "<stdout>"
#define INITIAL 0
@@ -835,17 +763,17 @@ YY_DECL
if ( ! YY_CURRENT_BUFFER ) {
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer(yyin,YY_BUF_SIZE );
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_load_buffer_state( );
yy_load_buffer_state( );
}
{
#line 108 "kbdlexer.l"
#line 846 "<stdout>"
#line 776 "<stdout>"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -958,7 +886,7 @@ YY_RULE_SETUP
#line 137 "kbdlexer.l"
ECHO;
YY_BREAK
#line 959 "<stdout>"
#line 889 "<stdout>"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1036,7 +964,7 @@ case YY_STATE_EOF(INITIAL):
{
(yy_did_buffer_switch_on_eof) = 0;
if ( yywrap( ) )
if ( yywrap( ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
@@ -1168,7 +1096,8 @@ static int yy_get_next_buffer (void)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yyrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) );
yyrealloc( (void *) b->yy_ch_buf,
(yy_size_t) (b->yy_buf_size + 2) );
}
else
/* Can't grow it, we don't own it. */
@@ -1200,7 +1129,7 @@ static int yy_get_next_buffer (void)
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart(yyin );
yyrestart( yyin );
}
else
@@ -1217,9 +1146,12 @@ static int yy_get_next_buffer (void)
if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size );
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
/* "- 2" to take care of EOB's */
YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
}
(yy_n_chars) += number_to_move;
@@ -1370,14 +1302,18 @@ static int yy_get_next_buffer (void)
*/
/* Reset buffer status. */
yyrestart(yyin );
yyrestart( yyin );
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
if ( yywrap( ) )
#ifdef YY_FLEX_LEX_COMPAT
return 0;
#else
return EOF;
#endif
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@@ -1414,11 +1350,11 @@ static int yy_get_next_buffer (void)
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer(yyin,YY_BUF_SIZE );
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_init_buffer(YY_CURRENT_BUFFER,input_file );
yy_load_buffer_state( );
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
yy_load_buffer_state( );
}
/** Switch to a different input buffer.
@@ -1446,7 +1382,7 @@ static int yy_get_next_buffer (void)
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
yy_load_buffer_state( );
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
@@ -1474,7 +1410,7 @@ static void yy_load_buffer_state (void)
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -1483,13 +1419,13 @@ static void yy_load_buffer_state (void)
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yyalloc((yy_size_t) (b->yy_buf_size + 2) );
b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer(b,file );
yy_init_buffer( b, file );
return b;
}
@@ -1508,9 +1444,9 @@ static void yy_load_buffer_state (void)
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yyfree((void *) b->yy_ch_buf );
yyfree( (void *) b->yy_ch_buf );
yyfree((void *) b );
yyfree( (void *) b );
}
/* Initializes or reinitializes a buffer.
@@ -1522,7 +1458,7 @@ static void yy_load_buffer_state (void)
{
int oerrno = errno;
yy_flush_buffer(b );
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
@@ -1565,7 +1501,7 @@ static void yy_load_buffer_state (void)
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
yy_load_buffer_state( );
yy_load_buffer_state( );
}
/** Pushes the new state onto the stack. The new state becomes
@@ -1596,7 +1532,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from yy_switch_to_buffer. */
yy_load_buffer_state( );
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
@@ -1615,7 +1551,7 @@ void yypop_buffer_state (void)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
yy_load_buffer_state( );
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
@@ -1682,7 +1618,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
/* They forgot to leave room for the EOB's. */
return NULL;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
@@ -1696,7 +1632,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer(b );
yy_switch_to_buffer( b );
return b;
}
@@ -1712,7 +1648,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
YY_BUFFER_STATE yy_scan_string (const char * yystr )
{
return yy_scan_bytes(yystr,(int) strlen(yystr) );
return yy_scan_bytes( yystr, (int) strlen(yystr) );
}
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
@@ -1731,7 +1667,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
/* Get memory for full buffer, including space for trailing EOB's. */
n = (yy_size_t) (_yybytes_len + 2);
buf = (char *) yyalloc(n );
buf = (char *) yyalloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
@@ -1740,7 +1676,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer(buf,n );
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
@@ -1758,7 +1694,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
static void yynoreturn yy_fatal_error (const char* msg )
{
(void) fprintf( stderr, "%s\n", msg );
fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@@ -1893,7 +1829,7 @@ int yylex_destroy (void)
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
yy_delete_buffer(YY_CURRENT_BUFFER );
yy_delete_buffer( YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
yypop_buffer_state();
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,94 +1,24 @@
/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_YY_Y_TAB_H_INCLUDED
# define YY_YY_Y_TAB_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#define ERRORTOKEN 257
#define META 258
#define MODIFIER 259
#define WHEREABOUTS 260
#define COLON 261
#define BAR 262
#define KEYSYM 263
#define FUNCTION 264
#ifdef YYSTYPE
#undef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
#endif
#if YYDEBUG
extern int yydebug;
#endif
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
ERRORTOKEN = 258,
META = 259,
MODIFIER = 260,
WHEREABOUTS = 261,
COLON = 262,
BAR = 263,
KEYSYM = 264,
FUNCTION = 265
};
#endif
/* Tokens. */
#define ERRORTOKEN 258
#define META 259
#define MODIFIER 260
#define WHEREABOUTS 261
#define COLON 262
#define BAR 263
#define KEYSYM 264
#define FUNCTION 265
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
#ifndef YYSTYPE_IS_DECLARED
#define YYSTYPE_IS_DECLARED 1
typedef union
{
#line 14 "kbdmodule.y" /* yacc.c:1909 */
int num;
char *ptr;
KeySym keysym;
struct { unsigned int mods; int meta; } modifiers;
void (*function)(Window);
#line 82 "y.tab.h" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif
} YYSTYPE;
#endif /* !YYSTYPE_IS_DECLARED */
extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_Y_TAB_H_INCLUDED */

170
lex.c
View File

@@ -8,89 +8,11 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
#define YY_FLEX_SUBMINOR_VERSION 3
#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
#define yy_create_buffer yy_create_buffer
#define yy_delete_buffer yy_delete_buffer
#define yy_scan_buffer yy_scan_buffer
#define yy_scan_string yy_scan_string
#define yy_scan_bytes yy_scan_bytes
#define yy_init_buffer yy_init_buffer
#define yy_flush_buffer yy_flush_buffer
#define yy_load_buffer_state yy_load_buffer_state
#define yy_switch_to_buffer yy_switch_to_buffer
#define yypush_buffer_state yypush_buffer_state
#define yypop_buffer_state yypop_buffer_state
#define yyensure_buffer_stack yyensure_buffer_stack
#define yylex yylex
#define yyrestart yyrestart
#define yylex_init yylex_init
#define yylex_init_extra yylex_init_extra
#define yylex_destroy yylex_destroy
#define yyget_debug yyget_debug
#define yyset_debug yyset_debug
#define yyget_extra yyget_extra
#define yyset_extra yyset_extra
#define yyget_in yyget_in
#define yyset_in yyset_in
#define yyget_out yyget_out
#define yyset_out yyset_out
#define yyget_leng yyget_leng
#define yyget_text yyget_text
#define yyget_lineno yyget_lineno
#define yyset_lineno yyset_lineno
#define yywrap yywrap
#define yyalloc yyalloc
#define yyrealloc yyrealloc
#define yyfree yyfree
#define yytext yytext
#define yyleng yyleng
#define yyin yyin
#define yyout yyout
#define yy_flex_debug yy_flex_debug
#define yylineno yylineno
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
@@ -108,7 +30,8 @@
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#if defined(__FreeBSD__) || \
(defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
* if you want the limit (max/min) macros for int types.
@@ -161,10 +84,16 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
/* begin standard C++ headers. */
/* TODO: this is always defined, so inline it */
#define yyconst const
@@ -196,7 +125,7 @@ typedef unsigned int flex_uint32_t;
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
#define YY_NEW_FILE yyrestart(yyin )
#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
@@ -331,6 +260,7 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
: NULL)
#define yy_current_buffer YY_CURRENT_BUFFER
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
@@ -362,7 +292,7 @@ void yypop_buffer_state ( void );
static void yyensure_buffer_stack ( void );
static void yy_load_buffer_state ( void );
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
@@ -378,7 +308,7 @@ void yyfree ( void * );
if ( ! YY_CURRENT_BUFFER ){ \
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
@@ -387,7 +317,7 @@ void yyfree ( void * );
if ( ! YY_CURRENT_BUFFER ){\
yyensure_buffer_stack (); \
YY_CURRENT_BUFFER_LVALUE = \
yy_create_buffer(yyin,YY_BUF_SIZE ); \
yy_create_buffer( yyin, YY_BUF_SIZE ); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
@@ -532,8 +462,8 @@ extern FILE *rcfile;
extern int parse_keyword(char *);
void fixup_string(char *, char *);
#define YY_SKIP_YYWRAP
#line 535 "<stdout>"
#line 536 "<stdout>"
#line 465 "<stdout>"
#line 466 "<stdout>"
#define INITIAL 0
@@ -743,17 +673,17 @@ YY_DECL
if ( ! YY_CURRENT_BUFFER ) {
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer(yyin,YY_BUF_SIZE );
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_load_buffer_state( );
yy_load_buffer_state( );
}
{
#line 14 "lex.l"
#line 756 "<stdout>"
#line 686 "<stdout>"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -868,7 +798,7 @@ YY_RULE_SETUP
#line 42 "lex.l"
ECHO;
YY_BREAK
#line 871 "<stdout>"
#line 801 "<stdout>"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -946,7 +876,7 @@ case YY_STATE_EOF(INITIAL):
{
(yy_did_buffer_switch_on_eof) = 0;
if ( yywrap( ) )
if ( yywrap( ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
@@ -1078,7 +1008,8 @@ static int yy_get_next_buffer (void)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
yyrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) );
yyrealloc( (void *) b->yy_ch_buf,
(yy_size_t) (b->yy_buf_size + 2) );
}
else
/* Can't grow it, we don't own it. */
@@ -1110,7 +1041,7 @@ static int yy_get_next_buffer (void)
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
yyrestart(yyin );
yyrestart( yyin );
}
else
@@ -1127,9 +1058,12 @@ static int yy_get_next_buffer (void)
if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size );
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
/* "- 2" to take care of EOB's */
YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
}
(yy_n_chars) += number_to_move;
@@ -1280,14 +1214,18 @@ static int yy_get_next_buffer (void)
*/
/* Reset buffer status. */
yyrestart(yyin );
yyrestart( yyin );
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
if ( yywrap( ) )
if ( yywrap( ) )
#ifdef YY_FLEX_LEX_COMPAT
return 0;
#else
return EOF;
#endif
if ( ! (yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@@ -1324,11 +1262,11 @@ static int yy_get_next_buffer (void)
if ( ! YY_CURRENT_BUFFER ){
yyensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
yy_create_buffer(yyin,YY_BUF_SIZE );
yy_create_buffer( yyin, YY_BUF_SIZE );
}
yy_init_buffer(YY_CURRENT_BUFFER,input_file );
yy_load_buffer_state( );
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
yy_load_buffer_state( );
}
/** Switch to a different input buffer.
@@ -1356,7 +1294,7 @@ static int yy_get_next_buffer (void)
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
yy_load_buffer_state( );
yy_load_buffer_state( );
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
@@ -1384,7 +1322,7 @@ static void yy_load_buffer_state (void)
{
YY_BUFFER_STATE b;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -1393,13 +1331,13 @@ static void yy_load_buffer_state (void)
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
b->yy_ch_buf = (char *) yyalloc((yy_size_t) (b->yy_buf_size + 2) );
b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
yy_init_buffer(b,file );
yy_init_buffer( b, file );
return b;
}
@@ -1418,9 +1356,9 @@ static void yy_load_buffer_state (void)
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
yyfree((void *) b->yy_ch_buf );
yyfree( (void *) b->yy_ch_buf );
yyfree((void *) b );
yyfree( (void *) b );
}
/* Initializes or reinitializes a buffer.
@@ -1432,7 +1370,7 @@ static void yy_load_buffer_state (void)
{
int oerrno = errno;
yy_flush_buffer(b );
yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
@@ -1475,7 +1413,7 @@ static void yy_load_buffer_state (void)
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
yy_load_buffer_state( );
yy_load_buffer_state( );
}
/** Pushes the new state onto the stack. The new state becomes
@@ -1506,7 +1444,7 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
YY_CURRENT_BUFFER_LVALUE = new_buffer;
/* copied from yy_switch_to_buffer. */
yy_load_buffer_state( );
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
@@ -1525,7 +1463,7 @@ void yypop_buffer_state (void)
--(yy_buffer_stack_top);
if (YY_CURRENT_BUFFER) {
yy_load_buffer_state( );
yy_load_buffer_state( );
(yy_did_buffer_switch_on_eof) = 1;
}
}
@@ -1592,7 +1530,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
/* They forgot to leave room for the EOB's. */
return NULL;
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
@@ -1606,7 +1544,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
yy_switch_to_buffer(b );
yy_switch_to_buffer( b );
return b;
}
@@ -1622,7 +1560,7 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
YY_BUFFER_STATE yy_scan_string (const char * yystr )
{
return yy_scan_bytes(yystr,(int) strlen(yystr) );
return yy_scan_bytes( yystr, (int) strlen(yystr) );
}
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
@@ -1641,7 +1579,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
/* Get memory for full buffer, including space for trailing EOB's. */
n = (yy_size_t) (_yybytes_len + 2);
buf = (char *) yyalloc(n );
buf = (char *) yyalloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
@@ -1650,7 +1588,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
b = yy_scan_buffer(buf,n );
b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
@@ -1668,7 +1606,7 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
static void yynoreturn yy_fatal_error (const char* msg )
{
(void) fprintf( stderr, "%s\n", msg );
fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@@ -1803,7 +1741,7 @@ int yylex_destroy (void)
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
yy_delete_buffer(YY_CURRENT_BUFFER );
yy_delete_buffer( YY_CURRENT_BUFFER );
YY_CURRENT_BUFFER_LVALUE = NULL;
yypop_buffer_state();
}

View File

@@ -8,7 +8,7 @@ RANLIB = @RANLIB@
CFLAGS = @CFLAGS@
YFLAGS = -d
DEFS = @DEFS@
ALL_CFLAGS = -I@srcdir@ -I@top_srcdir@ $(DEFS) $(CFLAGS) @X_CFLAGS@
ALL_CFLAGS = -Wall -I@srcdir@ -I@top_srcdir@ $(DEFS) $(CFLAGS) @X_CFLAGS@
LIBS = @X_LIBS@ @X_PRE_LIBS@ -lXext -lXmu -lX11 @X_EXTRA_LIBS@ @LIBS@
prefix = @prefix@
exec_prefix = @exec_prefix@

View File

@@ -40,7 +40,7 @@ BOOL Fault(LONG code, UBYTE *header, UBYTE *buffer, LONG len)
strcpy((char *)buffer, syserrmsg[code-MIN_ERRNO]);
} else {
char number[6+4*sizeof(LONG)];
sprintf(number, "Error %ld", code);
sprintf(number, "Error %ld", (long int) code);
if(len<strlen(number)+1)
return FALSE;
strcpy((char *)buffer, number);

View File

@@ -505,12 +505,13 @@ struct DiskObject *GetDefDiskObject(LONG def_type)
if(def_type<WBDISK || def_type>WBAPPICON)
return NULL;
if(!icondir)
if(!(icondir = get_current_icondir()))
if(!icondir) {
if(!(icondir = get_current_icondir())) {
return NULL;
else
} else {
l = strlen(icondir);
}
}
#ifdef HAVE_ALLOCA
buf = alloca(l+18);
#else

View File

@@ -2,6 +2,8 @@
#ifndef AMIGAOS
#include <string.h>
void NewList(struct List *list)
{
list->lh_TailPred = (struct Node *)&list->lh_Head;

37
main.c
View File

@@ -19,6 +19,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
@@ -99,9 +100,6 @@ extern void menubar_enter(Window);
extern void menubar_leave(Window);
extern void *getitembyhotkey(KeySym);
extern void menuaction(void *);
extern void screentoback();
extern void openscreen(char *, Window);
extern void realizescreens(void);
extern Scrn *getscreenbyroot(Window);
extern void assimilate(Window, int, int);
extern void deselect_all_icons(Scrn *);
@@ -245,13 +243,14 @@ void remove_fd_from_set(int fd)
FD_CLR(fd, &master_fd_set);
}
void lookup_keysyms()
void lookup_keysyms(Display *dpy, unsigned int *meta_mask,
unsigned int *switch_mask)
{
int i,j,k,maxsym,mincode,maxcode;
XModifierKeymap *map=XGetModifierMapping(dpy);
KeySym *kp, *kmap;
unsigned int alt_mask = 0;
meta_mask=0, switch_mask=0;
*meta_mask=0, *switch_mask=0;
XDisplayKeycodes(dpy, &mincode, &maxcode);
kmap=XGetKeyboardMapping(dpy, mincode, maxcode-mincode+1, &maxsym);
for(i=3; i<8; i++)
@@ -262,10 +261,10 @@ void lookup_keysyms()
switch(*kp++) {
case XK_Meta_L:
case XK_Meta_R:
meta_mask|=1<<i;
*meta_mask|=1<<i;
break;
case XK_Mode_switch:
switch_mask|=1<<i;
*switch_mask|=1<<i;
break;
case XK_Alt_L:
case XK_Alt_R:
@@ -274,9 +273,9 @@ void lookup_keysyms()
}
XFree(kmap);
XFreeModifiermap(map);
if(meta_mask == 0)
meta_mask = (alt_mask? alt_mask :
(switch_mask? switch_mask : Mod1Mask));
if(*meta_mask == 0)
*meta_mask = (alt_mask? alt_mask :
(*switch_mask? *switch_mask : Mod1Mask));
}
@@ -663,7 +662,7 @@ void starticondragging(Scrn *scr, XEvent *e)
CWBackPixmap|CWOverrideRedirect|CWSaveUnder|CWColormap,
&xswa);
#ifdef HAVE_XSHAPE
if(shape_extn)
if(shape_extn) {
if(i->innerwin) {
int bShaped, xbs, ybs, cShaped, xcs, ycs;
unsigned int wbs, hbs, wcs, hcs;
@@ -676,6 +675,7 @@ void starticondragging(Scrn *scr, XEvent *e)
XShapeCombineMask(dpy, dragiconlist[numdragicons].w, ShapeBounding,
0, 0, i->maskpm, ShapeSet);
}
}
#endif
XMapRaised(dpy, dragiconlist[numdragicons].w);
numdragicons++;
@@ -787,7 +787,14 @@ static void instcmap(Colormap c)
void internal_broker(XEvent *e)
{
int event_loc=(int)e->xany.display;
/*
* XXX this is one of the things that the code in module.c
* is abusing to overload display with some numeric
* values. Surely there's a better way to do this?
*/
uintptr_t event_loc=(uintptr_t)e->xany.display;
e->xany.display=dpy;
if(event_loc==1) {
XSendEvent(dpy, e->xany.window, False, 0, e);
@@ -895,7 +902,8 @@ int main(int argc, char *argv[])
wm_curs=XCreateFontCursor(dpy, XC_top_left_arrow);
FD_ZERO(&master_fd_set);
FD_SET((x_fd=ConnectionNumber(dpy)), &master_fd_set);
x_fd=ConnectionNumber(dpy);
FD_SET(x_fd, &master_fd_set);
max_fd=x_fd+1;
initting = 1;
@@ -1289,7 +1297,7 @@ int main(int argc, char *argv[])
XRaiseWindow(dpy, c->parent);
}
if(event.xbutton.window!=c->depth &&
event.xbutton.window!=c->window)
event.xbutton.window!=c->window) {
if(c==doubleclient && (event.xbutton.time-last_double)<
dblClickTime) {
XRaiseWindow(dpy, c->parent);
@@ -1297,6 +1305,7 @@ int main(int argc, char *argv[])
doubleclient=c;
last_double=event.xbutton.time;
}
}
if(event.xbutton.window==c->drag) {
forcemoving=(prefs.forcemove==FM_ALWAYS) ||
(event.xbutton.state & ShiftMask);

12
menu.c
View File

@@ -46,6 +46,7 @@ extern void select_all_icons(Scrn *i);
extern void mod_menuselect(struct module *, int, int, int);
extern void setfocus(Window);
extern void flushmodules();
extern void wberror(Scrn *, char *);
Scrn *mbdclick=NULL, *mbdscr=NULL;
@@ -361,7 +362,8 @@ void redraw_item(struct Item *i, Window w)
void createmenubar()
{
XSetWindowAttributes attr;
struct Menu *m, *sm1, *sm2, *sm3;
struct Menu *m, *sm1;
// struct Menu *sm2, *sm3;
struct ToolItem *ti;
GC gc;
@@ -575,11 +577,13 @@ static void leave_item(struct Item *i, Window w)
{
if(i==activesubitem)
activesubitem=NULL;
if(i==activeitem)
if(activesubmenu && i->sub==activesubmenu)
if(i==activeitem) {
if(activesubmenu && i->sub==activesubmenu) {
return;
else
} else {
activeitem=NULL;
}
}
XSetWindowBackground(dpy, i->win, scr->dri.dri_Pens[BARBLOCKPEN]);
XClearWindow(dpy, i->win);
redraw_item(i, i->win);

View File

@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
@@ -267,11 +268,13 @@ static int m_write(int fd, char *ptr, int len)
char *p=ptr;
int r, tot=0;
while(len>0) {
if((r=write(fd, p, len))<0)
if(errno==EINTR)
if((r=write(fd, p, len))<0) {
if(errno==EINTR) {
continue;
else
} else {
return r;
}
}
if(!r)
return tot;
tot+=r;
@@ -293,22 +296,23 @@ int dispatch_event_to_broker(XEvent *e, unsigned long mask, struct module *m)
{
Client *c;
Icon *i;
e->xany.display=(Display *)0;
/* XXX TODO: overloading display here seems .. dangerous? */
e->xany.display=(Display *)(uintptr_t) 0;
if(!XFindContext(dpy, e->xany.window, client_context, (XPointer *)&c))
if(e->xany.window==c->window)
e->xany.display=(Display *)1;
e->xany.display=(Display *)(uintptr_t) 1;
else
e->xany.display=(Display *)2;
e->xany.display=(Display *)(uintptr_t) 2;
else if(!XFindContext(dpy, e->xany.window, icon_context, (XPointer *)&i))
if(e->xany.window==i->window)
e->xany.display=(Display *)3;
e->xany.display=(Display *)(uintptr_t) 3;
while(m) {
if(m->out_fd>=0 && ((m->broker.mask & mask)||(m->broker.exists && !mask))) {
struct mcmd_event me;
me.mask=mask;
me.event=*e;
reply_module(m, (char *)&me, ~sizeof(me));
reply_module(m, (char *)&me, ~((int) sizeof(me)));
return 1;
}
m=m->next;
@@ -506,7 +510,7 @@ static void module_input_callback(struct module *m)
int t=(r>m->in_left? m->in_left:r);
memcpy(m->in_ptr, p, t);
m->in_ptr+=t;
if(!(m->in_left-=t))
if(!(m->in_left-=t)) {
if(m->in_phase || ((!m->mcmd.len)&&(m->in_ptr=m->in_buf))) {
*m->in_ptr=0;
handle_module_cmd(m, m->in_buf, m->mcmd.len);
@@ -515,15 +519,17 @@ static void module_input_callback(struct module *m)
m->in_phase=0;
} else {
if(m->mcmd.len>=m->in_buf_size) {
if((m->in_buf_size<<=1)<=m->mcmd.len)
m->in_buf_size=m->mcmd.len+1; {
m->in_buf=realloc(m->in_buf, m->in_buf_size);
/* Resize buffer if needed */
if((m->in_buf_size<<=1)<=m->mcmd.len) {
m->in_buf_size=m->mcmd.len+1;
m->in_buf=realloc(m->in_buf, m->in_buf_size);
}
}
m->in_ptr=m->in_buf;
m->in_left=m->mcmd.len;
m->in_phase++;
}
}
p+=t;
r-=t;
}

View File

@@ -296,11 +296,12 @@ int main(int argc, char *argv[])
XNextEvent(dpy, &event);
switch(event.type) {
case Expose:
if(!event.xexpose.count)
if(!event.xexpose.count) {
if(event.xexpose.window == textwin)
refresh_text();
else if((c=getchoice(event.xexpose.window)))
refresh_choice(c);
}
break;
case LeaveNotify:
if(depressed && event.xcrossing.window==selected->win) {
@@ -323,11 +324,12 @@ int main(int argc, char *argv[])
}
break;
case ButtonRelease:
if(event.xbutton.button==Button1 && selected)
if(event.xbutton.button==Button1 && selected) {
if(depressed)
endchoice();
else
abortchoice();
}
break;
}
}

View File

@@ -27,4 +27,9 @@ typedef struct _Scrn {
extern Scrn *scr, *front;
extern void closescreen();
extern Scrn * openscreen(char *, Window);
extern void realizescreens();
extern void screentoback();
#endif