Convert menus.c to C++ menus.cc
This commit is contained in:
parent
86161c72c5
commit
893bdb5928
22
ChangeLog
22
ChangeLog
@ -1,3 +1,25 @@
|
|||||||
|
2021-01-31 Mike Small <smallm@sdf.org>
|
||||||
|
|
||||||
|
* src/util.h: move CreateMenuIcon prototype here
|
||||||
|
|
||||||
|
* src/add_window.h: C++ compatibility (extern "C")
|
||||||
|
|
||||||
|
* src/events.h: ditto
|
||||||
|
|
||||||
|
* src/resize.h: ditto
|
||||||
|
|
||||||
|
* src/twm.h: ditto and move or remove some functions
|
||||||
|
|
||||||
|
* src/twm.c (InitVariables): remove use of CaseSensitive variable
|
||||||
|
|
||||||
|
* src/screen.h (ScreenInfo): remove CaseSensitive variable
|
||||||
|
|
||||||
|
* src/menus.h: C++ compatibility (extern "C"), move GetWMState here
|
||||||
|
|
||||||
|
* src/menus.cc: convert to C++ (beginning, enough to build)
|
||||||
|
|
||||||
|
* src/Makefile.am (AM_CXXFLAGS): remove -Wno-logical-op-parenthesis
|
||||||
|
|
||||||
2019-10-21 Mike Small <smallm@sdf.org>
|
2019-10-21 Mike Small <smallm@sdf.org>
|
||||||
|
|
||||||
* src/icons.h: Remove IconUp and IconDown from icons interface
|
* src/icons.h: Remove IconUp and IconDown from icons interface
|
||||||
|
@ -346,6 +346,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
@ -295,6 +295,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
|
@ -32,7 +32,7 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
AM_CFLAGS = -Werror $(TWM_CFLAGS)
|
AM_CFLAGS = -Werror $(TWM_CFLAGS)
|
||||||
# TWM_CFLAGS has results of pkg-config --cflags x11
|
# TWM_CFLAGS has results of pkg-config --cflags x11
|
||||||
AM_CXXFLAGS = -Werror -Wno-logical-op-parenthesis $(TWM_CFLAGS) -std=c++11
|
AM_CXXFLAGS = -Werror $(TWM_CFLAGS) -std=c++11
|
||||||
twmruined_LDADD = $(TWM_LIBS)
|
twmruined_LDADD = $(TWM_LIBS)
|
||||||
|
|
||||||
twmruined_SOURCES = \
|
twmruined_SOURCES = \
|
||||||
@ -48,7 +48,7 @@ twmruined_SOURCES = \
|
|||||||
icons.h \
|
icons.h \
|
||||||
list.c \
|
list.c \
|
||||||
list.h \
|
list.h \
|
||||||
menus.c \
|
menus.cc \
|
||||||
menus.h \
|
menus.h \
|
||||||
parse.c \
|
parse.c \
|
||||||
parse.h \
|
parse.h \
|
||||||
|
@ -368,6 +368,7 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
@ -384,7 +385,7 @@ AM_CPPFLAGS = \
|
|||||||
|
|
||||||
AM_CFLAGS = -Werror $(TWM_CFLAGS)
|
AM_CFLAGS = -Werror $(TWM_CFLAGS)
|
||||||
# TWM_CFLAGS has results of pkg-config --cflags x11
|
# TWM_CFLAGS has results of pkg-config --cflags x11
|
||||||
AM_CXXFLAGS = -Werror -Wno-logical-op-parenthesis $(TWM_CFLAGS) -std=c++11
|
AM_CXXFLAGS = -Werror $(TWM_CFLAGS) -std=c++11
|
||||||
twmruined_LDADD = $(TWM_LIBS)
|
twmruined_LDADD = $(TWM_LIBS)
|
||||||
twmruined_SOURCES = \
|
twmruined_SOURCES = \
|
||||||
add_window.c \
|
add_window.c \
|
||||||
@ -399,7 +400,7 @@ twmruined_SOURCES = \
|
|||||||
icons.h \
|
icons.h \
|
||||||
list.c \
|
list.c \
|
||||||
list.h \
|
list.h \
|
||||||
menus.c \
|
menus.cc \
|
||||||
menus.h \
|
menus.h \
|
||||||
parse.c \
|
parse.c \
|
||||||
parse.h \
|
parse.h \
|
||||||
|
@ -61,13 +61,20 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
#ifndef _ADD_WINDOW_
|
#ifndef _ADD_WINDOW_
|
||||||
#define _ADD_WINDOW_
|
#define _ADD_WINDOW_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
extern char NoName[];
|
extern char NoName[];
|
||||||
|
|
||||||
extern void AddDefaultBindings ( void );
|
EXTERN void AddDefaultBindings( void );
|
||||||
extern TwmWindow* AddWindow( Window w );
|
extern TwmWindow* AddWindow( Window w );
|
||||||
|
EXTERN void ComputeCommonTitleOffsets( void );
|
||||||
extern ColormapWindow * CreateColormapWindow ( Window w, Bool creating_parent, Bool property_window );
|
extern ColormapWindow * CreateColormapWindow ( Window w, Bool creating_parent, Bool property_window );
|
||||||
extern TwmColormap* CreateTwmColormap( Colormap c );
|
extern TwmColormap* CreateTwmColormap( Colormap c );
|
||||||
extern void FetchWmColormapWindows ( TwmWindow *tmp );
|
EXTERN void FetchWmColormapWindows( TwmWindow *tmp );
|
||||||
extern void FetchWmProtocols ( TwmWindow *tmp );
|
extern void FetchWmProtocols ( TwmWindow *tmp );
|
||||||
extern void GetGravityOffsets ( TwmWindow *tmp, int *xp, int *yp );
|
extern void GetGravityOffsets ( TwmWindow *tmp, int *xp, int *yp );
|
||||||
extern void GetWindowSizeHints ( TwmWindow *tmp );
|
extern void GetWindowSizeHints ( TwmWindow *tmp );
|
||||||
|
20
src/events.h
20
src/events.h
@ -64,18 +64,24 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "twm.h"
|
#include "twm.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef void (*event_proc)(void);
|
typedef void (*event_proc)(void);
|
||||||
|
|
||||||
extern Time lastTimestamp;
|
extern Time lastTimestamp;
|
||||||
#define LastTimestamp() lastTimestamp
|
#define LastTimestamp() lastTimestamp
|
||||||
|
|
||||||
extern void AutoRaiseWindow ( TwmWindow *tmp );
|
EXTERN void AutoRaiseWindow( TwmWindow *tmp );
|
||||||
extern void SetRaiseWindow( TwmWindow *tmp );
|
extern void SetRaiseWindow( TwmWindow *tmp );
|
||||||
extern void InitEvents( void );
|
extern void InitEvents( void );
|
||||||
extern Bool StashEventTime( XEvent *ev );
|
extern Bool StashEventTime( XEvent *ev );
|
||||||
extern Window WindowOfEvent( XEvent *e );
|
extern Window WindowOfEvent( XEvent *e );
|
||||||
extern Bool DispatchEvent2 ( void );
|
EXTERN Bool DispatchEvent2( void );
|
||||||
extern Bool DispatchEvent ( void );
|
EXTERN Bool DispatchEvent( void );
|
||||||
extern void HandleEvents( void );
|
extern void HandleEvents( void );
|
||||||
extern void HandleColormapNotify( void );
|
extern void HandleColormapNotify( void );
|
||||||
extern void HandleVisibilityNotify( void );
|
extern void HandleVisibilityNotify( void );
|
||||||
@ -97,12 +103,12 @@ extern void HandleEnterNotify ( void );
|
|||||||
extern void HandleLeaveNotify( void );
|
extern void HandleLeaveNotify( void );
|
||||||
extern void HandleConfigureRequest( void );
|
extern void HandleConfigureRequest( void );
|
||||||
extern void HandleShapeNotify( void );
|
extern void HandleShapeNotify( void );
|
||||||
extern void HandleUnknown ( void );
|
EXTERN void HandleUnknown( void );
|
||||||
extern int Transient( Window w, Window *propw );
|
extern int Transient( Window w, Window *propw );
|
||||||
extern ScreenInfo* FindScreenInfo( Window w );
|
extern ScreenInfo* FindScreenInfo( Window w );
|
||||||
extern void InstallWindowColormaps ( int type, TwmWindow *tmp );
|
EXTERN void InstallWindowColormaps( int type, TwmWindow *tmp );
|
||||||
extern void InstallRootColormap ( void );
|
EXTERN void InstallRootColormap( void );
|
||||||
extern void UninstallRootColormap ( void );
|
EXTERN void UninstallRootColormap( void );
|
||||||
|
|
||||||
extern event_proc EventHandler[];
|
extern event_proc EventHandler[];
|
||||||
extern Window DragWindow;
|
extern Window DragWindow;
|
||||||
|
@ -56,13 +56,16 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
*
|
*
|
||||||
* 17-Nov-87 Thomas E. LaStrange File created
|
* 17-Nov-87 Thomas E. LaStrange File created
|
||||||
*
|
*
|
||||||
|
* 29-Nov-20 Mike Small Switch to C++
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <vector>
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include "twm.h"
|
#include "twm.h"
|
||||||
#include "gc.h"
|
#include "gc.h"
|
||||||
@ -82,14 +85,19 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
#include <X11/extensions/sync.h>
|
#include <X11/extensions/sync.h>
|
||||||
#include <X11/SM/SMlib.h>
|
#include <X11/SM/SMlib.h>
|
||||||
|
|
||||||
int RootFunction = 0;
|
constexpr Pixel UNUSED_PIXEL{~0UL};
|
||||||
MenuRoot *ActiveMenu = NULL; /**< the active menu */
|
const int SHADOWWIDTH{5}; /* in pixels */
|
||||||
MenuItem *ActiveItem = NULL; /**< the active menu item */
|
|
||||||
int MoveFunction; /**< either F_MOVE or F_FORCEMOVE */
|
|
||||||
int WindowMoved = FALSE;
|
int RootFunction{0};
|
||||||
int menuFromFrameOrWindowOrTitlebar = FALSE;
|
MenuRoot *ActiveMenu{nullptr}; /**< the active menu */
|
||||||
|
MenuItem *ActiveItem{nullptr}; /**< the active menu item */
|
||||||
|
int MoveFunction; /**< either F_MOVE or F_FORCEMOVE */
|
||||||
|
// change these two to bool when use in events.c changes to C++.
|
||||||
|
int WindowMoved{false};
|
||||||
|
int menuFromFrameOrWindowOrTitlebar{false};
|
||||||
|
int ConstMove{false}; /**< constrained move variables */
|
||||||
|
|
||||||
int ConstMove = FALSE; /**< constrained move variables */
|
|
||||||
int ConstMoveDir;
|
int ConstMoveDir;
|
||||||
int ConstMoveX;
|
int ConstMoveX;
|
||||||
int ConstMoveY;
|
int ConstMoveY;
|
||||||
@ -103,19 +111,19 @@ int ConstMoveYB;
|
|||||||
int ResizeOrigX;
|
int ResizeOrigX;
|
||||||
int ResizeOrigY;
|
int ResizeOrigY;
|
||||||
|
|
||||||
int MenuDepth = 0; /**< number of menus up */
|
int MenuDepth{0}; /**< number of menus up */
|
||||||
static struct {
|
static struct {
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
} MenuOrigins[MAXMENUDEPTH];
|
} MenuOrigins[MAXMENUDEPTH];
|
||||||
static Cursor LastCursor;
|
static Cursor LastCursor;
|
||||||
|
|
||||||
static Bool belongs_to_twm_window ( TwmWindow *t, Window w );
|
static bool belongs_to_twm_window(const TwmWindow& t, Window w);
|
||||||
static void Identify ( TwmWindow *t );
|
static void Identify(const TwmWindow* t);
|
||||||
static void send_clientmessage(Window w, Atom a, Time timestamp);
|
static void send_clientmessage(Window w, Atom a, Time timestamp);
|
||||||
static void BumpWindowColormap ( TwmWindow *tmp, int inc );
|
static void BumpWindowColormap(TwmWindow &tmp, int inc);
|
||||||
static int DeferExecution ( int context, int func, Cursor cursor );
|
static bool DeferExecution(int context, int func, Cursor cursor);
|
||||||
static Bool NeedToDefer ( MenuRoot *root );
|
static bool NeedToDefer(MenuRoot *root);
|
||||||
static void DestroyMenu(MenuRoot *menu);
|
static void DestroyMenu(MenuRoot *menu);
|
||||||
static void MakeMenu ( MenuRoot *mr );
|
static void MakeMenu ( MenuRoot *mr );
|
||||||
static void Execute ( const char *s );
|
static void Execute ( const char *s );
|
||||||
@ -123,8 +131,6 @@ static void WarpAlongRing ( XButtonEvent *ev, Bool forward );
|
|||||||
static int WarpThere ( TwmWindow * t );
|
static int WarpThere ( TwmWindow * t );
|
||||||
static void WarpToWindow ( TwmWindow *t );
|
static void WarpToWindow ( TwmWindow *t );
|
||||||
|
|
||||||
#define SHADOWWIDTH 5 /* in pixels */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +183,7 @@ InitMenus(void)
|
|||||||
Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
||||||
char *action)
|
char *action)
|
||||||
{
|
{
|
||||||
FuncKey *tmp;
|
FuncKey *fkey;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
KeyCode keycode;
|
KeyCode keycode;
|
||||||
|
|
||||||
@ -192,29 +198,29 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* see if there already is a key defined for this context */
|
/* see if there already is a key defined for this context */
|
||||||
for (tmp = Scr->FuncKeyRoot.next; tmp != NULL; tmp = tmp->next)
|
for (fkey = Scr->FuncKeyRoot.next; fkey != NULL; fkey = fkey->next)
|
||||||
{
|
{
|
||||||
if (tmp->keysym == keysym &&
|
if (fkey->keysym == keysym &&
|
||||||
tmp->cont == cont &&
|
fkey->cont == cont &&
|
||||||
tmp->mods == mods)
|
fkey->mods == mods)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp == NULL)
|
if (fkey == NULL)
|
||||||
{
|
{
|
||||||
tmp = malloc(sizeof(FuncKey));
|
fkey = new FuncKey;
|
||||||
tmp->next = Scr->FuncKeyRoot.next;
|
fkey->next = Scr->FuncKeyRoot.next;
|
||||||
Scr->FuncKeyRoot.next = tmp;
|
Scr->FuncKeyRoot.next = fkey;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp->name = name;
|
fkey->name = name;
|
||||||
tmp->keysym = keysym;
|
fkey->keysym = keysym;
|
||||||
tmp->keycode = keycode;
|
fkey->keycode = keycode;
|
||||||
tmp->cont = cont;
|
fkey->cont = cont;
|
||||||
tmp->mods = mods;
|
fkey->mods = mods;
|
||||||
tmp->func = func;
|
fkey->func = func;
|
||||||
tmp->win_name = win_name;
|
fkey->win_name = win_name;
|
||||||
tmp->action = action;
|
fkey->action = action;
|
||||||
|
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
@ -224,29 +230,17 @@ Bool AddFuncKey (char *name, int cont, int mods, int func, char *win_name,
|
|||||||
int CreateTitleButton(const char *name, int func, const char *action,
|
int CreateTitleButton(const char *name, int func, const char *action,
|
||||||
MenuRoot *menuroot, Bool rightside, Bool append)
|
MenuRoot *menuroot, Bool rightside, Bool append)
|
||||||
{
|
{
|
||||||
TitleButton *tb = malloc (sizeof(TitleButton));
|
/* 1. Note that we are not copying name.
|
||||||
|
* 2. bitmap, width, and height are set later by InitTitlebarButtons */
|
||||||
if (!tb) {
|
TitleButton* tb = new TitleButton {
|
||||||
fprintf (stderr,
|
// next, name, bitmap, srcx, srcy, width, height, dstx, dsty
|
||||||
"%s: unable to allocate %ld bytes for title button\n",
|
nullptr, name, None, 0, 0, 0, 0, 0, 0,
|
||||||
ProgramName, (unsigned long)sizeof(TitleButton));
|
func, action, menuroot, rightside
|
||||||
return 0;
|
};
|
||||||
}
|
if (rightside)
|
||||||
|
|
||||||
tb->next = NULL;
|
|
||||||
tb->name = name; /* note that we are not copying */
|
|
||||||
tb->bitmap = None; /* WARNING, values not set yet */
|
|
||||||
tb->width = 0; /* see InitTitlebarButtons */
|
|
||||||
tb->height = 0; /* ditto */
|
|
||||||
tb->func = func;
|
|
||||||
tb->action = action;
|
|
||||||
tb->menuroot = menuroot;
|
|
||||||
tb->rightside = rightside;
|
|
||||||
if (rightside) {
|
|
||||||
Scr->TBInfo.nright++;
|
Scr->TBInfo.nright++;
|
||||||
} else {
|
else
|
||||||
Scr->TBInfo.nleft++;
|
Scr->TBInfo.nleft++;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cases for list:
|
* Cases for list:
|
||||||
@ -262,13 +256,13 @@ int CreateTitleButton (const char *name, int func, const char *action,
|
|||||||
tb->next = Scr->TBInfo.head;
|
tb->next = Scr->TBInfo.head;
|
||||||
Scr->TBInfo.head = tb;
|
Scr->TBInfo.head = tb;
|
||||||
} else if (append && rightside) { /* 3 */
|
} else if (append && rightside) { /* 3 */
|
||||||
register TitleButton *t;
|
TitleButton *t;
|
||||||
for /* SUPPRESS 530 */
|
for /* SUPPRESS 530 */
|
||||||
(t = Scr->TBInfo.head; t->next; t = t->next);
|
(t = Scr->TBInfo.head; t->next; t = t->next);
|
||||||
t->next = tb;
|
t->next = tb;
|
||||||
tb->next = NULL;
|
tb->next = NULL;
|
||||||
} else { /* 2 */
|
} else { /* 2 */
|
||||||
register TitleButton *t, *prev = NULL;
|
TitleButton *t, *prev = NULL;
|
||||||
for (t = Scr->TBInfo.head; t && !t->rightside; t = t->next) {
|
for (t = Scr->TBInfo.head; t && !t->rightside; t = t->next) {
|
||||||
prev = t;
|
prev = t;
|
||||||
}
|
}
|
||||||
@ -511,7 +505,7 @@ UpdateMenu(void)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Event.type == ButtonRelease || Cancel) {
|
if (Event.type == ButtonRelease || Cancel) {
|
||||||
menuFromFrameOrWindowOrTitlebar = FALSE;
|
menuFromFrameOrWindowOrTitlebar = false;
|
||||||
fromMenu = FALSE;
|
fromMenu = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -626,47 +620,39 @@ UpdateMenu(void)
|
|||||||
MenuRoot *
|
MenuRoot *
|
||||||
NewMenuRoot(const char *name)
|
NewMenuRoot(const char *name)
|
||||||
{
|
{
|
||||||
MenuRoot *tmp;
|
MenuRoot *mroot;
|
||||||
|
|
||||||
#define UNUSED_PIXEL ((unsigned long) (~0)) /* more than 24 bits */
|
mroot = new MenuRoot {
|
||||||
|
nullptr, nullptr, nullptr, nullptr,
|
||||||
|
name, None, None, UNUSED_PIXEL, UNUSED_PIXEL, NEVER_MAPPED,
|
||||||
|
0, 0, 0, false, false, false };
|
||||||
|
|
||||||
tmp = malloc(sizeof(MenuRoot));
|
if (Scr->MenuList == nullptr)
|
||||||
tmp->hi_fore = UNUSED_PIXEL;
|
|
||||||
tmp->hi_back = UNUSED_PIXEL;
|
|
||||||
tmp->name = name;
|
|
||||||
tmp->prev = NULL;
|
|
||||||
tmp->first = NULL;
|
|
||||||
tmp->last = NULL;
|
|
||||||
tmp->items = 0;
|
|
||||||
tmp->width = 0;
|
|
||||||
tmp->mapped = NEVER_MAPPED;
|
|
||||||
tmp->pull = FALSE;
|
|
||||||
tmp->w = None;
|
|
||||||
tmp->shadow = None;
|
|
||||||
tmp->real_menu = FALSE;
|
|
||||||
|
|
||||||
if (Scr->MenuList == NULL)
|
|
||||||
{
|
{
|
||||||
Scr->MenuList = tmp;
|
Scr->MenuList = mroot;
|
||||||
Scr->MenuList->next = NULL;
|
Scr->MenuList->next = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Scr->LastMenu == NULL)
|
// This is the only use of LastMenu. Careful. Though the variable
|
||||||
|
// is only referenced here it builds out the tail of the list
|
||||||
|
// referenced by MenuList. Might as well keep til the list can
|
||||||
|
// be put in a std::vector.
|
||||||
|
if (Scr->LastMenu == nullptr)
|
||||||
{
|
{
|
||||||
Scr->LastMenu = tmp;
|
Scr->LastMenu = mroot;
|
||||||
Scr->LastMenu->next = NULL;
|
Scr->LastMenu->next = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Scr->LastMenu->next = tmp;
|
Scr->LastMenu->next = mroot;
|
||||||
Scr->LastMenu = tmp;
|
Scr->LastMenu = mroot;
|
||||||
Scr->LastMenu->next = NULL;
|
Scr->LastMenu->next = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(name, TWM_WINDOWS) == 0)
|
if (strcmp(name, TWM_WINDOWS) == 0)
|
||||||
Scr->Windows = tmp;
|
Scr->Windows = mroot;
|
||||||
|
|
||||||
return (tmp);
|
return mroot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -686,64 +672,64 @@ MenuItem *
|
|||||||
AddToMenu(MenuRoot *menu, const char *item, const char *action,
|
AddToMenu(MenuRoot *menu, const char *item, const char *action,
|
||||||
MenuRoot *sub, int func, const char *fore, const char *back)
|
MenuRoot *sub, int func, const char *fore, const char *back)
|
||||||
{
|
{
|
||||||
MenuItem *tmp;
|
|
||||||
int width;
|
|
||||||
|
|
||||||
#ifdef DEBUG_MENUS
|
#ifdef DEBUG_MENUS
|
||||||
fprintf(stderr, "adding menu item=\"%s\", action=%s, sub=%d, f=%d\n",
|
fprintf(stderr, "adding menu item=\"%s\", action=%s, sub=%d, f=%d\n",
|
||||||
item, action, sub, func);
|
item, action, sub, func);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tmp = malloc(sizeof(MenuItem));
|
MenuItem *m_item = new MenuItem{
|
||||||
tmp->root = menu;
|
nullptr, // next
|
||||||
|
nullptr, // prev
|
||||||
|
sub, // sub
|
||||||
|
menu, // root
|
||||||
|
item,
|
||||||
|
action,
|
||||||
|
0, // fore
|
||||||
|
0, // back
|
||||||
|
0, // hi_fore
|
||||||
|
0, // hi_back
|
||||||
|
menu->items++,
|
||||||
|
0, // x coord for text
|
||||||
|
static_cast<short>(func),
|
||||||
|
0, // state
|
||||||
|
static_cast<short>(strlen(item)),
|
||||||
|
false // user_colors
|
||||||
|
};
|
||||||
|
|
||||||
if (menu->first == NULL)
|
if (menu->first == nullptr)
|
||||||
{
|
{
|
||||||
menu->first = tmp;
|
menu->first = m_item;
|
||||||
tmp->prev = NULL;
|
m_item->prev = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
menu->last->next = tmp;
|
menu->last->next = m_item;
|
||||||
tmp->prev = menu->last;
|
m_item->prev = menu->last;
|
||||||
}
|
}
|
||||||
menu->last = tmp;
|
menu->last = m_item;
|
||||||
|
|
||||||
tmp->item = item;
|
if (!Scr->HaveFonts)
|
||||||
tmp->strlen = strlen(item);
|
CreateFonts();
|
||||||
tmp->action = action;
|
|
||||||
tmp->next = NULL;
|
|
||||||
tmp->sub = NULL;
|
|
||||||
tmp->state = 0;
|
|
||||||
tmp->func = func;
|
|
||||||
|
|
||||||
if (!Scr->HaveFonts) CreateFonts();
|
int width{MyFont_TextWidth(&Scr->MenuFont, item, m_item->strlen)};
|
||||||
width = MyFont_TextWidth(&Scr->MenuFont, item, tmp->strlen);
|
|
||||||
if (width <= 0)
|
if (width <= 0)
|
||||||
width = 1;
|
width = 1;
|
||||||
if (width > menu->width)
|
if (width > menu->width)
|
||||||
menu->width = width;
|
menu->width = width;
|
||||||
|
|
||||||
tmp->user_colors = FALSE;
|
if (Scr->Monochrome == COLOR && fore != nullptr)
|
||||||
if (Scr->Monochrome == COLOR && fore != NULL)
|
|
||||||
{
|
{
|
||||||
int save;
|
auto save{Scr->FirstTime};
|
||||||
|
Scr->FirstTime = true;
|
||||||
save = Scr->FirstTime;
|
GetColor(COLOR, &m_item->fore, fore);
|
||||||
Scr->FirstTime = TRUE;
|
GetColor(COLOR, &m_item->back, back);
|
||||||
GetColor(COLOR, &tmp->fore, fore);
|
|
||||||
GetColor(COLOR, &tmp->back, back);
|
|
||||||
Scr->FirstTime = save;
|
Scr->FirstTime = save;
|
||||||
tmp->user_colors = TRUE;
|
m_item->user_colors = true;
|
||||||
}
|
}
|
||||||
if (sub != NULL)
|
if (sub != nullptr)
|
||||||
{
|
menu->pull = true;
|
||||||
tmp->sub = sub;
|
|
||||||
menu->pull = TRUE;
|
|
||||||
}
|
|
||||||
tmp->item_num = menu->items++;
|
|
||||||
|
|
||||||
return (tmp);
|
return m_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -964,71 +950,50 @@ MakeMenu(MenuRoot *mr)
|
|||||||
Bool
|
Bool
|
||||||
PopUpMenu(MenuRoot *menu, int x, int y, Bool center)
|
PopUpMenu(MenuRoot *menu, int x, int y, Bool center)
|
||||||
{
|
{
|
||||||
int WindowNameCount;
|
if (!menu)
|
||||||
TwmWindow **WindowNames;
|
return False;
|
||||||
TwmWindow *tmp_win2,*tmp_win3;
|
|
||||||
int i;
|
|
||||||
int (*compar)(const char *, const char *) =
|
|
||||||
(Scr->CaseSensitive ? strcmp : XmuCompareISOLatin1);
|
|
||||||
|
|
||||||
if (!menu) return False;
|
|
||||||
|
|
||||||
InstallRootColormap();
|
InstallRootColormap();
|
||||||
|
|
||||||
if (menu == Scr->Windows)
|
if (menu == Scr->Windows)
|
||||||
{
|
{
|
||||||
TwmWindow *tmp_win;
|
/* this is the windows list menu, rebuild it */
|
||||||
|
|
||||||
/* this is the twm windows menu, let's go ahead and build it */
|
|
||||||
|
|
||||||
DestroyMenu(menu);
|
DestroyMenu(menu);
|
||||||
|
|
||||||
menu->first = NULL;
|
menu->first = nullptr;
|
||||||
menu->last = NULL;
|
menu->last = nullptr;
|
||||||
menu->items = 0;
|
menu->items = 0;
|
||||||
menu->width = 0;
|
menu->width = 0;
|
||||||
menu->mapped = NEVER_MAPPED;
|
menu->mapped = NEVER_MAPPED;
|
||||||
AddToMenu(menu, "TWM Windows", NULLSTR, NULL, F_TITLE,NULLSTR,NULLSTR);
|
AddToMenu(menu, "Windows", NULLSTR, nullptr,
|
||||||
|
F_TITLE, NULLSTR, NULLSTR);
|
||||||
|
|
||||||
for(tmp_win = Scr->TwmRoot.next , WindowNameCount=0;
|
std::vector<const TwmWindow*> windows;
|
||||||
tmp_win != NULL;
|
for(auto w = Scr->TwmRoot.next; w; w = w->next)
|
||||||
tmp_win = tmp_win->next)
|
windows.push_back(w);
|
||||||
WindowNameCount++;
|
|
||||||
if (WindowNameCount != 0)
|
std::sort(windows.begin(), windows.end(),
|
||||||
|
[](const TwmWindow* w1, const TwmWindow* w2) {
|
||||||
|
return 0 > XmuCompareISOLatin1(w1->name, w2->name);
|
||||||
|
});
|
||||||
|
|
||||||
|
for (auto w : windows)
|
||||||
{
|
{
|
||||||
WindowNames = malloc(sizeof(TwmWindow *) * WindowNameCount);
|
// 3rd argument char* (action)? How does that work?
|
||||||
WindowNames[0] = Scr->TwmRoot.next;
|
AddToMenu(menu, w->name, (char *)w, nullptr, F_POPUP,
|
||||||
for(tmp_win = Scr->TwmRoot.next->next , WindowNameCount=1;
|
nullptr, nullptr);
|
||||||
tmp_win != NULL;
|
|
||||||
tmp_win = tmp_win->next,WindowNameCount++)
|
|
||||||
{
|
|
||||||
tmp_win2 = tmp_win;
|
|
||||||
for (i=0;i<WindowNameCount;i++)
|
|
||||||
{
|
|
||||||
if ((*compar)(tmp_win2->name,WindowNames[i]->name) < 0)
|
|
||||||
{
|
|
||||||
tmp_win3 = tmp_win2;
|
|
||||||
tmp_win2 = WindowNames[i];
|
|
||||||
WindowNames[i] = tmp_win3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WindowNames[WindowNameCount] = tmp_win2;
|
|
||||||
}
|
|
||||||
for (i=0; i<WindowNameCount; i++)
|
|
||||||
{
|
|
||||||
AddToMenu(menu, WindowNames[i]->name, (char *)WindowNames[i],
|
|
||||||
NULL, F_POPUP,NULL,NULL);
|
|
||||||
}
|
|
||||||
free(WindowNames);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeMenu(menu);
|
MakeMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu->w == None || menu->items == 0) return False;
|
if (menu->w == None || menu->items == 0)
|
||||||
|
return False;
|
||||||
|
|
||||||
/* Prevent recursively bringing up menus. */
|
/* Prevent recursively bringing up menus. */
|
||||||
if (menu->mapped == MAPPED) return False;
|
if (menu->mapped == MAPPED)
|
||||||
|
return False;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dynamically set the parent; this allows pull-ups to also be main
|
* Dynamically set the parent; this allows pull-ups to also be main
|
||||||
@ -1116,7 +1081,7 @@ PopDownMenu(void)
|
|||||||
ActiveItem = NULL;
|
ActiveItem = NULL;
|
||||||
MenuDepth = 0;
|
MenuDepth = 0;
|
||||||
if (Context == C_WINDOW || Context == C_FRAME || Context == C_TITLE)
|
if (Context == C_WINDOW || Context == C_FRAME || Context == C_TITLE)
|
||||||
menuFromFrameOrWindowOrTitlebar = TRUE;
|
menuFromFrameOrWindowOrTitlebar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1143,22 +1108,20 @@ FindMenuRoot(const char *name)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static Bool
|
static bool
|
||||||
belongs_to_twm_window (TwmWindow *t, Window w)
|
belongs_to_twm_window(const TwmWindow& t, Window w)
|
||||||
{
|
{
|
||||||
if (!t) return False;
|
if (w == t.frame || w == t.title_w || w == t.hilite_w ||
|
||||||
|
w == t.icon_w || w == t.icon_bm_w) return true;
|
||||||
|
|
||||||
if (w == t->frame || w == t->title_w || w == t->hilite_w ||
|
if (t.titlebuttons) {
|
||||||
w == t->icon_w || w == t->icon_bm_w) return True;
|
int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright;
|
||||||
|
for (const TBWindow* tbw = t.titlebuttons; nb > 0; tbw++, nb--) {
|
||||||
if (t && t->titlebuttons) {
|
if (tbw->window == w)
|
||||||
register TBWindow *tbw;
|
return true;
|
||||||
register int nb = Scr->TBInfo.nleft + Scr->TBInfo.nright;
|
|
||||||
for (tbw = t->titlebuttons; nb > 0; tbw++, nb--) {
|
|
||||||
if (tbw->window == w) return True;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return False;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1348,18 +1311,18 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_IDENTIFY:
|
case F_IDENTIFY:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
Identify(tmp_win);
|
Identify(tmp_win);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_VERSION:
|
case F_VERSION:
|
||||||
Identify ((TwmWindow *) NULL);
|
Identify(nullptr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_AUTORAISE:
|
case F_AUTORAISE:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
tmp_win->auto_raise = !tmp_win->auto_raise;
|
tmp_win->auto_raise = !tmp_win->auto_raise;
|
||||||
if (tmp_win->auto_raise) ++(Scr->NumAutoRaises);
|
if (tmp_win->auto_raise) ++(Scr->NumAutoRaises);
|
||||||
@ -1389,7 +1352,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
EventHandler[EnterNotify] = HandleUnknown;
|
EventHandler[EnterNotify] = HandleUnknown;
|
||||||
EventHandler[LeaveNotify] = HandleUnknown;
|
EventHandler[LeaveNotify] = HandleUnknown;
|
||||||
if (DeferExecution(context, func, Scr->MoveCursor))
|
if (DeferExecution(context, func, Scr->MoveCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
PopDownMenu();
|
PopDownMenu();
|
||||||
|
|
||||||
@ -1407,7 +1370,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
* see if this is being done from the titlebar
|
* see if this is being done from the titlebar
|
||||||
*/
|
*/
|
||||||
fromtitlebar =
|
fromtitlebar =
|
||||||
belongs_to_twm_window (tmp_win, eventp->xbutton.window);
|
belongs_to_twm_window(*tmp_win, eventp->xbutton.window);
|
||||||
|
|
||||||
/* Save pointer position so we can tell if it was moved or
|
/* Save pointer position so we can tell if it was moved or
|
||||||
not during the resize. */
|
not during the resize. */
|
||||||
@ -1453,14 +1416,14 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
case F_TOPZOOM:
|
case F_TOPZOOM:
|
||||||
case F_BOTTOMZOOM:
|
case F_BOTTOMZOOM:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
fullzoom(tmp_win, func);
|
fullzoom(tmp_win, func);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_MOVE:
|
case F_MOVE:
|
||||||
case F_FORCEMOVE:
|
case F_FORCEMOVE:
|
||||||
if (DeferExecution(context, func, Scr->MoveCursor))
|
if (DeferExecution(context, func, Scr->MoveCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
PopDownMenu();
|
PopDownMenu();
|
||||||
rootw = eventp->xbutton.root;
|
rootw = eventp->xbutton.root;
|
||||||
@ -1487,7 +1450,6 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
DragY = eventp->xbutton.y;
|
DragY = eventp->xbutton.y;
|
||||||
moving_icon = TRUE;
|
moving_icon = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (w != tmp_win->icon_w)
|
else if (w != tmp_win->icon_w)
|
||||||
{
|
{
|
||||||
XTranslateCoordinates(dpy, w, tmp_win->frame,
|
XTranslateCoordinates(dpy, w, tmp_win->frame,
|
||||||
@ -1518,7 +1480,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|
||||||
ConstMove = TRUE;
|
ConstMove = true;
|
||||||
ConstMoveDir = MOVE_NONE;
|
ConstMoveDir = MOVE_NONE;
|
||||||
ConstMoveX = eventp->xbutton.x_root - DragX - JunkBW;
|
ConstMoveX = eventp->xbutton.x_root - DragX - JunkBW;
|
||||||
ConstMoveY = eventp->xbutton.y_root - DragY - JunkBW;
|
ConstMoveY = eventp->xbutton.y_root - DragY - JunkBW;
|
||||||
@ -1565,7 +1527,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
/*
|
/*
|
||||||
* see if this is being done from the titlebar
|
* see if this is being done from the titlebar
|
||||||
*/
|
*/
|
||||||
fromtitlebar = belongs_to_twm_window (tmp_win, eventp->xbutton.window);
|
fromtitlebar = belongs_to_twm_window(*tmp_win, eventp->xbutton.window);
|
||||||
|
|
||||||
if (menuFromFrameOrWindowOrTitlebar) {
|
if (menuFromFrameOrWindowOrTitlebar) {
|
||||||
/* warp the pointer to the middle of the window */
|
/* warp the pointer to the middle of the window */
|
||||||
@ -1575,7 +1537,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (TRUE)
|
while (true)
|
||||||
{
|
{
|
||||||
long releaseEvent = menuFromFrameOrWindowOrTitlebar ?
|
long releaseEvent = menuFromFrameOrWindowOrTitlebar ?
|
||||||
ButtonPress : ButtonRelease;
|
ButtonPress : ButtonRelease;
|
||||||
@ -1621,7 +1583,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
if (Cancel)
|
if (Cancel)
|
||||||
{
|
{
|
||||||
WindowMoved = FALSE;
|
WindowMoved = false;
|
||||||
UninstallRootColormap();
|
UninstallRootColormap();
|
||||||
return TRUE; /* XXX should this be FALSE? */
|
return TRUE; /* XXX should this be FALSE? */
|
||||||
}
|
}
|
||||||
@ -1652,7 +1614,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
abs(eventp->xmotion.y_root - origY) < Scr->MoveDelta)
|
abs(eventp->xmotion.y_root - origY) < Scr->MoveDelta)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
WindowMoved = TRUE;
|
WindowMoved = true;
|
||||||
DragWindow = w;
|
DragWindow = w;
|
||||||
|
|
||||||
if (ConstMove)
|
if (ConstMove)
|
||||||
@ -1771,7 +1733,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NeedToDefer(mroot) && DeferExecution(context, func, Scr->SelectCursor))
|
if (NeedToDefer(mroot) && DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (mitem = mroot->first; mitem != NULL; mitem = mitem->next)
|
for (mitem = mroot->first; mitem != NULL; mitem = mitem->next)
|
||||||
@ -1787,7 +1749,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
case F_DEICONIFY:
|
case F_DEICONIFY:
|
||||||
case F_ICONIFY:
|
case F_ICONIFY:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (tmp_win->icon)
|
if (tmp_win->icon)
|
||||||
{
|
{
|
||||||
@ -1802,7 +1764,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_RAISELOWER:
|
case F_RAISELOWER:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (!WindowMoved) {
|
if (!WindowMoved) {
|
||||||
XWindowChanges xwc;
|
XWindowChanges xwc;
|
||||||
@ -1816,7 +1778,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_RAISE:
|
case F_RAISE:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
/* check to make sure raise is not from the WindowFunction */
|
/* check to make sure raise is not from the WindowFunction */
|
||||||
if (w == tmp_win->icon_w && Context != C_ROOT)
|
if (w == tmp_win->icon_w && Context != C_ROOT)
|
||||||
@ -1828,7 +1790,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_LOWER:
|
case F_LOWER:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (w == tmp_win->icon_w)
|
if (w == tmp_win->icon_w)
|
||||||
XLowerWindow(dpy, tmp_win->icon_w);
|
XLowerWindow(dpy, tmp_win->icon_w);
|
||||||
@ -1839,7 +1801,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_FOCUS:
|
case F_FOCUS:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (tmp_win->icon == FALSE)
|
if (tmp_win->icon == FALSE)
|
||||||
{
|
{
|
||||||
@ -1868,13 +1830,13 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_DESTROY:
|
case F_DESTROY:
|
||||||
if (DeferExecution(context, func, Scr->DestroyCursor))
|
if (DeferExecution(context, func, Scr->DestroyCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
XKillClient(dpy, tmp_win->w);
|
XKillClient(dpy, tmp_win->w);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case F_DELETE:
|
case F_DELETE:
|
||||||
if (DeferExecution(context, func, Scr->DestroyCursor))
|
if (DeferExecution(context, func, Scr->DestroyCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
else if (tmp_win->protocols & DoesWmDeleteWindow)
|
else if (tmp_win->protocols & DoesWmDeleteWindow)
|
||||||
SendDeleteWindowMessage (tmp_win, LastTimestamp());
|
SendDeleteWindowMessage (tmp_win, LastTimestamp());
|
||||||
else
|
else
|
||||||
@ -1883,7 +1845,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_SAVEYOURSELF:
|
case F_SAVEYOURSELF:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (tmp_win->protocols & DoesWmSaveYourself)
|
if (tmp_win->protocols & DoesWmSaveYourself)
|
||||||
SendSaveYourselfMessage (tmp_win, LastTimestamp());
|
SendSaveYourselfMessage (tmp_win, LastTimestamp());
|
||||||
@ -1961,12 +1923,14 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_COLORMAP:
|
case F_COLORMAP:
|
||||||
{
|
{
|
||||||
|
if (tmp_win != nullptr) {
|
||||||
if (strcmp(action, COLORMAP_NEXT) == 0) {
|
if (strcmp(action, COLORMAP_NEXT) == 0) {
|
||||||
BumpWindowColormap (tmp_win, 1);
|
BumpWindowColormap(*tmp_win, 1);
|
||||||
} else if(strcmp (action, COLORMAP_PREV) == 0) {
|
} else if(strcmp (action, COLORMAP_PREV) == 0) {
|
||||||
BumpWindowColormap (tmp_win, -1);
|
BumpWindowColormap(*tmp_win, -1);
|
||||||
} else {
|
} else {
|
||||||
BumpWindowColormap (tmp_win, 0);
|
BumpWindowColormap(*tmp_win, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1974,10 +1938,10 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
case F_WARPPREV:
|
case F_WARPPREV:
|
||||||
case F_WARPNEXT:
|
case F_WARPNEXT:
|
||||||
{
|
{
|
||||||
register TwmWindow *t;
|
TwmWindow* t;
|
||||||
static TwmWindow *savedwarp = NULL;
|
static TwmWindow* savedwarp{nullptr};
|
||||||
TwmWindow *of, *l, *n;
|
TwmWindow *of, *l, *n;
|
||||||
int c=0;
|
int c{0};
|
||||||
|
|
||||||
#define wseq(w) (func == F_WARPNEXT ? (w)->next : (w)->prev)
|
#define wseq(w) (func == F_WARPNEXT ? (w)->next : (w)->prev)
|
||||||
#define nwin(w) ((w) && (n=wseq(w)) != NULL && n != &Scr->TwmRoot ? n : l)
|
#define nwin(w) ((w) && (n=wseq(w)) != NULL && n != &Scr->TwmRoot ? n : l)
|
||||||
@ -2007,22 +1971,20 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_WARPTO:
|
case F_WARPTO:
|
||||||
{
|
{
|
||||||
register TwmWindow *t;
|
const size_t len{strlen(action)};
|
||||||
int len;
|
|
||||||
|
|
||||||
len = strlen(action);
|
TwmWindow* t;
|
||||||
|
for (t = Scr->TwmRoot.next; t != nullptr; t = t->next) {
|
||||||
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
|
|
||||||
if (!strncmp(action, t->name, len))
|
if (!strncmp(action, t->name, len))
|
||||||
if (WarpThere(t)) break;
|
if (WarpThere(t)) break;
|
||||||
}
|
}
|
||||||
if (!t) {
|
if (!t) {
|
||||||
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
|
for (t = Scr->TwmRoot.next; t != nullptr; t = t->next) {
|
||||||
if (!strncmp(action, t->classh.res_name, len))
|
if (!strncmp(action, t->classh.res_name, len))
|
||||||
if (WarpThere(t)) break;
|
if (WarpThere(t)) break;
|
||||||
}
|
}
|
||||||
if (!t) {
|
if (!t) {
|
||||||
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) {
|
for (t = Scr->TwmRoot.next; t != nullptr; t = t->next) {
|
||||||
if (!strncmp(action, t->classh.res_class, len))
|
if (!strncmp(action, t->classh.res_class, len))
|
||||||
if (WarpThere(t)) break;
|
if (WarpThere(t)) break;
|
||||||
}
|
}
|
||||||
@ -2091,7 +2053,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
|
|
||||||
case F_WINREFRESH:
|
case F_WINREFRESH:
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
if (context == C_ICON && tmp_win->icon_w)
|
if (context == C_ICON && tmp_win->icon_w)
|
||||||
w = XCreateSimpleWindow(dpy, tmp_win->icon_w,
|
w = XCreateSimpleWindow(dpy, tmp_win->icon_w,
|
||||||
@ -2113,7 +2075,7 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
if (HasSync)
|
if (HasSync)
|
||||||
{
|
{
|
||||||
if (DeferExecution(context, func, Scr->SelectCursor))
|
if (DeferExecution(context, func, Scr->SelectCursor))
|
||||||
return TRUE;
|
return true;
|
||||||
(void)XSyncSetPriority(dpy, tmp_win->w, atoi(action));
|
(void)XSyncSetPriority(dpy, tmp_win->w, atoi(action));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2136,13 +2098,12 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
|
|||||||
*
|
*
|
||||||
* \param context the context in which the mouse button was pressed
|
* \param context the context in which the mouse button was pressed
|
||||||
* \param func the function to defer
|
* \param func the function to defer
|
||||||
* \param cursor cursor the cursor to display while waiting
|
* \param cursor the cursor to display while waiting
|
||||||
*/
|
*/
|
||||||
static int
|
static bool
|
||||||
DeferExecution(int context, int func, Cursor cursor)
|
DeferExecution(int context, int func, Cursor cursor)
|
||||||
{
|
{
|
||||||
if (context == C_ROOT)
|
if (context == C_ROOT) {
|
||||||
{
|
|
||||||
LastCursor = cursor;
|
LastCursor = cursor;
|
||||||
XGrabPointer(dpy, Scr->Root, True,
|
XGrabPointer(dpy, Scr->Root, True,
|
||||||
ButtonPressMask | ButtonReleaseMask,
|
ButtonPressMask | ButtonReleaseMask,
|
||||||
@ -2151,10 +2112,9 @@ DeferExecution(int context, int func, Cursor cursor)
|
|||||||
|
|
||||||
RootFunction = func;
|
RootFunction = func;
|
||||||
|
|
||||||
return (TRUE);
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
return (FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2179,12 +2139,10 @@ ReGrab(void)
|
|||||||
*
|
*
|
||||||
* \param root the menu root to check
|
* \param root the menu root to check
|
||||||
*/
|
*/
|
||||||
static Bool
|
static bool
|
||||||
NeedToDefer(MenuRoot *root)
|
NeedToDefer(MenuRoot *root)
|
||||||
{
|
{
|
||||||
MenuItem *mitem;
|
for (MenuItem* mitem = root->first; mitem != nullptr; mitem = mitem->next)
|
||||||
|
|
||||||
for (mitem = root->first; mitem != NULL; mitem = mitem->next)
|
|
||||||
{
|
{
|
||||||
switch (mitem->func)
|
switch (mitem->func)
|
||||||
{
|
{
|
||||||
@ -2208,10 +2166,10 @@ NeedToDefer(MenuRoot *root)
|
|||||||
case F_TOPZOOM:
|
case F_TOPZOOM:
|
||||||
case F_BOTTOMZOOM:
|
case F_BOTTOMZOOM:
|
||||||
case F_AUTORAISE:
|
case F_AUTORAISE:
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2426,7 +2384,7 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Identify (TwmWindow *t)
|
Identify(const TwmWindow* t)
|
||||||
{
|
{
|
||||||
int i, n, twidth, width, height;
|
int i, n, twidth, width, height;
|
||||||
int x, y;
|
int x, y;
|
||||||
@ -2583,45 +2541,46 @@ WarpToScreen (int n, int inc)
|
|||||||
* rotate our internal copy of WM_COLORMAP_WINDOWS
|
* rotate our internal copy of WM_COLORMAP_WINDOWS
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
BumpWindowColormap (TwmWindow *tmp, int inc)
|
BumpWindowColormap(TwmWindow& cmw, int inc)
|
||||||
{
|
{
|
||||||
int i, j, previously_installed;
|
|
||||||
ColormapWindow **cwins;
|
|
||||||
|
|
||||||
if (!tmp) return;
|
|
||||||
|
|
||||||
if (inc && tmp->cmaps.number_cwins > 0) {
|
if (inc && cmw.cmaps.number_cwins > 0) {
|
||||||
cwins = malloc(sizeof(ColormapWindow *) * tmp->cmaps.number_cwins);
|
// must use malloc until uses in C files convert to C++ and new.
|
||||||
|
ColormapWindow **cwins{
|
||||||
|
static_cast<ColormapWindow**>(malloc(sizeof(ColormapWindow*)
|
||||||
|
* cmw.cmaps.number_cwins)) };
|
||||||
if (cwins) {
|
if (cwins) {
|
||||||
|
int previously_installed;
|
||||||
if ((previously_installed =
|
if ((previously_installed =
|
||||||
/* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &tmp->cmaps &&
|
/* SUPPRESS 560 */(Scr->cmapInfo.cmaps == &cmw.cmaps &&
|
||||||
tmp->cmaps.number_cwins))) {
|
cmw.cmaps.number_cwins))) {
|
||||||
for (i = tmp->cmaps.number_cwins; i-- > 0; )
|
for (int i = cmw.cmaps.number_cwins; i-- > 0; )
|
||||||
tmp->cmaps.cwins[i]->colormap->state = 0;
|
cmw.cmaps.cwins[i]->colormap->state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < tmp->cmaps.number_cwins; i++) {
|
for (int i = 0; i < cmw.cmaps.number_cwins; ++i) {
|
||||||
j = i - inc;
|
int j{i-inc};
|
||||||
if (j >= tmp->cmaps.number_cwins)
|
if (j >= cmw.cmaps.number_cwins)
|
||||||
j -= tmp->cmaps.number_cwins;
|
j -= cmw.cmaps.number_cwins;
|
||||||
else if (j < 0)
|
else if (j < 0)
|
||||||
j += tmp->cmaps.number_cwins;
|
j += cmw.cmaps.number_cwins;
|
||||||
cwins[j] = tmp->cmaps.cwins[i];
|
cwins[j] = cmw.cmaps.cwins[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tmp->cmaps.cwins);
|
free(cmw.cmaps.cwins);
|
||||||
|
|
||||||
tmp->cmaps.cwins = cwins;
|
cmw.cmaps.cwins = cwins;
|
||||||
|
|
||||||
if (tmp->cmaps.number_cwins > 1)
|
if (cmw.cmaps.number_cwins > 1)
|
||||||
bzero (tmp->cmaps.scoreboard,
|
bzero (cmw.cmaps.scoreboard,
|
||||||
ColormapsScoreboardLength(&tmp->cmaps));
|
ColormapsScoreboardLength(&cmw.cmaps));
|
||||||
|
|
||||||
if (previously_installed)
|
if (previously_installed)
|
||||||
InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL);
|
InstallWindowColormaps(PropertyNotify, (TwmWindow *) NULL);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
FetchWmColormapWindows (tmp);
|
FetchWmColormapWindows(&cmw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2643,19 +2602,18 @@ SetBorder (TwmWindow *tmp, Bool onoroff)
|
|||||||
static void
|
static void
|
||||||
DestroyMenu(MenuRoot *menu)
|
DestroyMenu(MenuRoot *menu)
|
||||||
{
|
{
|
||||||
MenuItem *item;
|
|
||||||
|
|
||||||
if (menu->w) {
|
if (menu->w) {
|
||||||
XDeleteContext(dpy, menu->w, MenuContext);
|
XDeleteContext(dpy, menu->w, MenuContext);
|
||||||
XDeleteContext(dpy, menu->w, ScreenContext);
|
XDeleteContext(dpy, menu->w, ScreenContext);
|
||||||
if (Scr->Shadow) XDestroyWindow (dpy, menu->shadow);
|
if (Scr->Shadow)
|
||||||
|
XDestroyWindow(dpy, menu->shadow);
|
||||||
XDestroyWindow(dpy, menu->w);
|
XDestroyWindow(dpy, menu->w);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (item = menu->first; item; ) {
|
for (MenuItem* item = menu->first; item; ) {
|
||||||
MenuItem *tmp = item;
|
MenuItem* tmp{item};
|
||||||
item = item->next;
|
item = item->next;
|
||||||
free (tmp);
|
delete tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2748,15 +2706,15 @@ WarpToWindow (TwmWindow *t)
|
|||||||
static void
|
static void
|
||||||
send_clientmessage(Window w, Atom a, Time timestamp)
|
send_clientmessage(Window w, Atom a, Time timestamp)
|
||||||
{
|
{
|
||||||
XClientMessageEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
ev.type = ClientMessage;
|
ev.xclient.type = ClientMessage;
|
||||||
ev.window = w;
|
ev.xclient.window = w;
|
||||||
ev.message_type = _XA_WM_PROTOCOLS;
|
ev.xclient.message_type = _XA_WM_PROTOCOLS;
|
||||||
ev.format = 32;
|
ev.xclient.format = 32;
|
||||||
ev.data.l[0] = a;
|
ev.xclient.data.l[0] = a;
|
||||||
ev.data.l[1] = timestamp;
|
ev.xclient.data.l[1] = timestamp;
|
||||||
XSendEvent (dpy, w, False, 0L, (XEvent *) &ev);
|
XSendEvent(dpy, w, False, 0L, &ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
55
src/menus.h
55
src/menus.h
@ -164,29 +164,36 @@ extern int MenuDepth;
|
|||||||
#define COLORMAP_PREV "prev"
|
#define COLORMAP_PREV "prev"
|
||||||
#define COLORMAP_DEFAULT "default"
|
#define COLORMAP_DEFAULT "default"
|
||||||
|
|
||||||
extern void InitMenus ( void );
|
#ifdef __cplusplus
|
||||||
extern Bool AddFuncKey ( char *name, int cont, int mods, int func, char *win_name, char *action );
|
#define EXTERN extern "C"
|
||||||
extern int CreateTitleButton ( const char *name, int func, const char *action, MenuRoot *menuroot, Bool rightside, Bool append );
|
#else
|
||||||
extern void InitTitlebarButtons ( void );
|
#define EXTERN extern
|
||||||
extern void PaintEntry ( MenuRoot *mr, MenuItem *mi, int exposure );
|
#endif
|
||||||
extern void PaintMenu ( MenuRoot *mr, XEvent *e );
|
|
||||||
extern void UpdateMenu ( void );
|
EXTERN void InitMenus( void );
|
||||||
extern MenuRoot * NewMenuRoot ( const char *name );
|
EXTERN Bool AddFuncKey( char *name, int cont, int mods, int func, char *win_name, char *action );
|
||||||
extern MenuItem * AddToMenu ( MenuRoot *menu, const char *item, const char *action, MenuRoot *sub, int func, const char *fore, const char *back );
|
EXTERN int CreateTitleButton( const char *name, int func, const char *action, MenuRoot *menuroot, Bool rightside, Bool append );
|
||||||
extern void MakeMenus ( void );
|
EXTERN void InitTitlebarButtons( void );
|
||||||
extern Bool PopUpMenu ( MenuRoot *menu, int x, int y, Bool center );
|
EXTERN void PaintEntry( MenuRoot *mr, MenuItem *mi, int exposure );
|
||||||
extern void PopDownMenu ( void );
|
EXTERN void PaintMenu( MenuRoot *mr, XEvent *e );
|
||||||
extern MenuRoot * FindMenuRoot ( const char *name );
|
EXTERN void UpdateMenu( void );
|
||||||
extern int ExecuteFunction ( int func, const char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown );
|
EXTERN MenuRoot * NewMenuRoot( const char *name );
|
||||||
extern void ReGrab ( void );
|
EXTERN MenuItem * AddToMenu( MenuRoot *menu, const char *item, const char *action, MenuRoot *sub, int func, const char *fore, const char *back );
|
||||||
extern void FocusOnRoot ( void );
|
EXTERN void MakeMenus( void );
|
||||||
extern void DeIconify ( TwmWindow *tmp_win );
|
EXTERN Bool PopUpMenu( MenuRoot *menu, int x, int y, Bool center );
|
||||||
extern void Iconify ( TwmWindow *tmp_win, int def_x, int def_y );
|
EXTERN void PopDownMenu( void );
|
||||||
extern void SetMapStateProp ( TwmWindow *tmp_win, int state );
|
EXTERN MenuRoot * FindMenuRoot( const char *name );
|
||||||
extern void WarpToScreen ( int n, int inc );
|
EXTERN int ExecuteFunction( int func, const char *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, int pulldown );
|
||||||
extern void SetBorder ( TwmWindow *tmp, Bool onoroff );
|
EXTERN void ReGrab( void );
|
||||||
extern void SendDeleteWindowMessage ( TwmWindow *tmp, Time timestamp );
|
EXTERN void FocusOnRoot( void );
|
||||||
extern void SendSaveYourselfMessage ( TwmWindow *tmp, Time timestamp );
|
EXTERN void DeIconify( TwmWindow *tmp_win );
|
||||||
extern void SendTakeFocusMessage ( TwmWindow *tmp, Time timestamp );
|
EXTERN void Iconify( TwmWindow *tmp_win, int def_x, int def_y );
|
||||||
|
EXTERN void SetMapStateProp( TwmWindow *tmp_win, int state );
|
||||||
|
EXTERN void WarpToScreen( int n, int inc );
|
||||||
|
EXTERN void SetBorder( TwmWindow *tmp, Bool onoroff );
|
||||||
|
EXTERN void SendDeleteWindowMessage( TwmWindow *tmp, Time timestamp );
|
||||||
|
EXTERN void SendSaveYourselfMessage( TwmWindow *tmp, Time timestamp );
|
||||||
|
EXTERN void SendTakeFocusMessage( TwmWindow *tmp, Time timestamp );
|
||||||
|
EXTERN Bool GetWMState( Window w, int *statep, Window *iwp );
|
||||||
|
|
||||||
#endif /* _MENUS_ */
|
#endif /* _MENUS_ */
|
||||||
|
16
src/resize.h
16
src/resize.h
@ -61,18 +61,24 @@ in this Software without prior written authorization from The Open Group.
|
|||||||
#ifndef _RESIZE_
|
#ifndef _RESIZE_
|
||||||
#define _RESIZE_
|
#define _RESIZE_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
extern void AddEndResize( TwmWindow *tmp_win );
|
extern void AddEndResize( TwmWindow *tmp_win );
|
||||||
extern void AddStartResize( TwmWindow *tmp_win, int x, int y, int w, int h );
|
extern void AddStartResize( TwmWindow *tmp_win, int x, int y, int w, int h );
|
||||||
extern void ConstrainSize( TwmWindow *tmp_win, int *widthp, int *heightp );
|
extern void ConstrainSize( TwmWindow *tmp_win, int *widthp, int *heightp );
|
||||||
extern void DoResize( int x_root, int y_root, TwmWindow *tmp_win );
|
extern void DoResize( int x_root, int y_root, TwmWindow *tmp_win );
|
||||||
extern void EndResize( void );
|
extern void EndResize( void );
|
||||||
extern void fullzoom ( TwmWindow *tmp_win, int flag );
|
EXTERN void fullzoom( TwmWindow *tmp_win, int flag );
|
||||||
extern void MenuDoResize ( int x_root, int y_root, TwmWindow *tmp_win );
|
EXTERN void MenuDoResize( int x_root, int y_root, TwmWindow *tmp_win );
|
||||||
extern void MenuEndResize ( TwmWindow *tmp_win );
|
EXTERN void MenuEndResize( TwmWindow *tmp_win );
|
||||||
extern void MenuStartResize ( TwmWindow *tmp_win, int x, int y, int w, int h );
|
EXTERN void MenuStartResize( TwmWindow *tmp_win, int x, int y, int w, int h );
|
||||||
extern void SetFrameShape( TwmWindow *tmp );
|
extern void SetFrameShape( TwmWindow *tmp );
|
||||||
extern void SetupFrame( TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool sendEvent );
|
extern void SetupFrame( TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool sendEvent );
|
||||||
extern void SetupWindow( TwmWindow *tmp_win, int x, int y, int w, int h, int bw );
|
extern void SetupWindow( TwmWindow *tmp_win, int x, int y, int w, int h, int bw );
|
||||||
extern void StartResize ( XEvent *evp, TwmWindow *tmp_win, Bool fromtitlebar );
|
EXTERN void StartResize( XEvent *evp, TwmWindow *tmp_win, Bool fromtitlebar );
|
||||||
|
|
||||||
#endif /* _RESIZE_ */
|
#endif /* _RESIZE_ */
|
||||||
|
@ -87,7 +87,7 @@ typedef struct ScreenInfo
|
|||||||
int hilite_pm_width, hilite_pm_height; /* cache the size */
|
int hilite_pm_width, hilite_pm_height; /* cache the size */
|
||||||
|
|
||||||
MenuRoot *MenuList; /* head of the menu list */
|
MenuRoot *MenuList; /* head of the menu list */
|
||||||
MenuRoot *LastMenu; /* the last menu (mostly unused?) */
|
MenuRoot *LastMenu; /* the last menu (for adding to menu list) */
|
||||||
MenuRoot *Windows; /* the TwmWindows menu */
|
MenuRoot *Windows; /* the TwmWindows menu */
|
||||||
|
|
||||||
TwmWindow *Ring; /* one of the windows in window ring */
|
TwmWindow *Ring; /* one of the windows in window ring */
|
||||||
@ -212,7 +212,6 @@ typedef struct ScreenInfo
|
|||||||
short InterpolateMenuColors;/* make pretty menus */
|
short InterpolateMenuColors;/* make pretty menus */
|
||||||
short HaveFonts; /* set if fonts have been loaded */
|
short HaveFonts; /* set if fonts have been loaded */
|
||||||
short FirstTime; /* first time we've read .twmrc */
|
short FirstTime; /* first time we've read .twmrc */
|
||||||
short CaseSensitive; /* be case-sensitive when sorting names */
|
|
||||||
short WarpUnmapped; /* allow warping to unmapped windows */
|
short WarpUnmapped; /* allow warping to unmapped windows */
|
||||||
|
|
||||||
FuncKey FuncKeyRoot;
|
FuncKey FuncKeyRoot;
|
||||||
|
@ -722,7 +722,6 @@ InitVariables(void)
|
|||||||
Scr->InterpolateMenuColors = FALSE;
|
Scr->InterpolateMenuColors = FALSE;
|
||||||
Scr->FirstTime = TRUE;
|
Scr->FirstTime = TRUE;
|
||||||
Scr->HaveFonts = FALSE; /* i.e. not loaded yet */
|
Scr->HaveFonts = FALSE; /* i.e. not loaded yet */
|
||||||
Scr->CaseSensitive = TRUE;
|
|
||||||
Scr->WarpUnmapped = FALSE;
|
Scr->WarpUnmapped = FALSE;
|
||||||
|
|
||||||
/* setup default fonts; overridden by defaults from system.twmrc */
|
/* setup default fonts; overridden by defaults from system.twmrc */
|
||||||
|
15
src/twm.h
15
src/twm.h
@ -74,6 +74,12 @@ from The Open Group.
|
|||||||
#include <X11/StringDefs.h>
|
#include <X11/StringDefs.h>
|
||||||
#include <X11/Intrinsic.h>
|
#include <X11/Intrinsic.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#define EXTERN extern "C"
|
||||||
|
#else
|
||||||
|
#define EXTERN extern
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef WithdrawnState
|
#ifndef WithdrawnState
|
||||||
#define WithdrawnState 0
|
#define WithdrawnState 0
|
||||||
#endif
|
#endif
|
||||||
@ -327,11 +333,10 @@ typedef struct TWMWinConfigEntry
|
|||||||
|
|
||||||
#include <X11/Xosdefs.h>
|
#include <X11/Xosdefs.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
extern void CreateFonts ( void );
|
EXTERN void CreateFonts( void );
|
||||||
extern void RestoreWithdrawnLocation ( TwmWindow *tmp );
|
extern void RestoreWithdrawnLocation ( TwmWindow *tmp );
|
||||||
extern void Reborder( Time time);
|
EXTERN void Reborder( Time time);
|
||||||
extern void Done( XtPointer, XtSignalId * ) _X_NORETURN;
|
EXTERN void Done( XtPointer, XtSignalId * ) _X_NORETURN;
|
||||||
extern void ComputeCommonTitleOffsets ( void );
|
|
||||||
extern void ComputeTitleLocation ( TwmWindow *tmp );
|
extern void ComputeTitleLocation ( TwmWindow *tmp );
|
||||||
extern void ComputeWindowTitleOffsets ( TwmWindow *tmp_win, int width, Bool squeeze );
|
extern void ComputeWindowTitleOffsets ( TwmWindow *tmp_win, int width, Bool squeeze );
|
||||||
extern char *ProgramName;
|
extern char *ProgramName;
|
||||||
@ -373,7 +378,6 @@ extern int Argc;
|
|||||||
extern char **Argv;
|
extern char **Argv;
|
||||||
extern void NewFontCursor ( Cursor *cp, const char *str );
|
extern void NewFontCursor ( Cursor *cp, const char *str );
|
||||||
extern void NewBitmapCursor ( Cursor *cp, char *source, char *mask );
|
extern void NewBitmapCursor ( Cursor *cp, char *source, char *mask );
|
||||||
extern Pixmap CreateMenuIcon ( int height, unsigned int *widthp, unsigned int *heightp );
|
|
||||||
|
|
||||||
extern Bool ErrorOccurred;
|
extern Bool ErrorOccurred;
|
||||||
extern XErrorEvent LastErrorEvent;
|
extern XErrorEvent LastErrorEvent;
|
||||||
@ -381,7 +385,6 @@ extern XErrorEvent LastErrorEvent;
|
|||||||
#define ResetError() (ErrorOccurred = False)
|
#define ResetError() (ErrorOccurred = False)
|
||||||
|
|
||||||
extern Bool RestartPreviousState;
|
extern Bool RestartPreviousState;
|
||||||
extern Bool GetWMState ( Window w, int *statep, Window *iwp );
|
|
||||||
|
|
||||||
extern void twmrc_error_prefix ( void );
|
extern void twmrc_error_prefix ( void );
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ EXTERN void MoveOutline ( Window root, int x, int y, int width, int height,
|
|||||||
int bw, int th );
|
int bw, int th );
|
||||||
EXTERN void Zoom ( Window wf, Window wt );
|
EXTERN void Zoom ( Window wf, Window wt );
|
||||||
EXTERN const char * ExpandFilename ( const char *name );
|
EXTERN const char * ExpandFilename ( const char *name );
|
||||||
|
EXTERN Pixmap CreateMenuIcon( int height, unsigned int *widthp, unsigned int *heightp );
|
||||||
EXTERN void GetUnknownIcon( const char *name );
|
EXTERN void GetUnknownIcon( const char *name );
|
||||||
EXTERN Pixmap FindBitmap ( const char *name, unsigned int *widthp,
|
EXTERN Pixmap FindBitmap ( const char *name, unsigned int *widthp,
|
||||||
unsigned int *heightp );
|
unsigned int *heightp );
|
||||||
|
Loading…
Reference in New Issue
Block a user