summaryrefslogtreecommitdiff
path: root/src/twm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/twm.c')
-rw-r--r--src/twm.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/twm.c b/src/twm.c
index 1a6ae95..d05d992 100644
--- a/src/twm.c
+++ b/src/twm.c
@@ -82,10 +82,15 @@ in this Software without prior written authorization from The Open Group.
#include <X11/Xmu/Error.h>
#include <X11/extensions/sync.h>
#include <X11/Xlocale.h>
+
#ifdef XPRINT
#include <X11/extensions/Print.h>
#endif /* XPRINT */
+#ifdef HAVE_XRANDR
+#include <X11/extensions/Xrandr.h>
+#endif
+
static void InitVariables ( void );
XtAppContext appContext; /* Xt application context */
@@ -98,6 +103,12 @@ int MultiScreen = TRUE; /* try for more than one screen? */
int NoPrintscreens = False; /* ignore special handling of print screens? */
int NumScreens; /* number of screens in ScreenList */
int HasShape; /* server supports shape extension? */
+
+#ifdef HAVE_XRANDR
+int HasXrandr; /* server supports Xrandr extension? */
+int XrandrEventBase, XrandrErrorBase;
+#endif
+
int ShapeEventBase, ShapeErrorBase;
int HasSync; /* server supports SYNC extension? */
int SyncEventBase, SyncErrorBase;
@@ -320,7 +331,7 @@ main(int argc, char *argv[])
if (Home == NULL)
Home = "./";
- HomeLen = strlen(Home);
+ HomeLen = (int)strlen(Home);
NoClass.res_name = NoName;
NoClass.res_class = NoName;
@@ -349,6 +360,9 @@ main(int argc, char *argv[])
HasShape = XShapeQueryExtension (dpy, &ShapeEventBase, &ShapeErrorBase);
HasSync = XSyncQueryExtension(dpy, &SyncEventBase, &SyncErrorBase);
+#ifdef HAVE_XRANDR
+ HasXrandr = XRRQueryExtension(dpy, &XrandrEventBase, &XrandrErrorBase);
+#endif
TwmContext = XUniqueContext();
MenuContext = XUniqueContext();
IconManagerContext = XUniqueContext();
@@ -375,7 +389,7 @@ main(int argc, char *argv[])
InfoLines = 0;
/* for simplicity, always allocate NumScreens ScreenInfo struct pointers */
- ScreenList = calloc (NumScreens, sizeof (ScreenInfo *));
+ ScreenList = calloc ((size_t)NumScreens, sizeof (ScreenInfo *));
if (ScreenList == NULL)
{
fprintf (stderr, "%s: Unable to allocate memory for screen list, exiting.\n",
@@ -469,7 +483,7 @@ main(int argc, char *argv[])
Scr->d_depth = DefaultDepth(dpy, scrnum);
Scr->d_visual = DefaultVisual(dpy, scrnum);
Scr->Root = RootWindow(dpy, scrnum);
- XSaveContext (dpy, Scr->Root, ScreenContext, (caddr_t) Scr);
+ XSaveContext (dpy, Scr->Root, ScreenContext, (XPointer) Scr);
Scr->TwmRoot.cmaps.number_cwins = 1;
Scr->TwmRoot.cmaps.cwins = malloc(sizeof(ColormapWindow *));
@@ -587,13 +601,13 @@ main(int argc, char *argv[])
/*
* weed out icon windows
*/
- for (i = 0; i < nchildren; i++) {
+ for (i = 0; (unsigned)i < nchildren; i++) {
if (children[i]) {
XWMHints *wmhintsp = XGetWMHints (dpy, children[i]);
if (wmhintsp) {
if (wmhintsp->flags & IconWindowHint) {
- for (j = 0; j < nchildren; j++) {
+ for (j = 0; (unsigned)j < nchildren; j++) {
if (children[j] == wmhintsp->icon_window) {
children[j] = None;
break;
@@ -608,7 +622,7 @@ main(int argc, char *argv[])
/*
* map all of the non-override windows
*/
- for (i = 0; i < nchildren; i++)
+ for (i = 0; (unsigned)i < nchildren; i++)
{
if (children[i] && MappedNotOverride(children[i]))
{
@@ -856,7 +870,7 @@ RestoreWithdrawnLocation (TwmWindow *tmp)
GetGravityOffsets (tmp, &gravx, &gravy);
if (gravy < 0) xwc.y -= tmp->title_height;
- if (bw != tmp->old_bw) {
+ if (bw != (unsigned)tmp->old_bw) {
int xoff, yoff;
if (!Scr->ClientBorderWidth) {
@@ -876,7 +890,7 @@ RestoreWithdrawnLocation (TwmWindow *tmp)
}
mask = (CWX | CWY);
- if (bw != tmp->old_bw) {
+ if (bw != (unsigned)tmp->old_bw) {
xwc.border_width = tmp->old_bw;
mask |= CWBorderWidth;
}
@@ -918,7 +932,7 @@ Reborder (Time time)
}
static void
-sigHandler(int sig)
+sigHandler(int sig _X_UNUSED)
{
XtNoticeSignal(si);
}
@@ -927,7 +941,7 @@ sigHandler(int sig)
* cleanup and exit twm
*/
void
-Done(XtPointer client_data, XtSignalId *si)
+Done(XtPointer client_data _X_UNUSED, XtSignalId *si2 _X_UNUSED)
{
if (dpy)
{
@@ -948,7 +962,7 @@ Bool ErrorOccurred = False;
XErrorEvent LastErrorEvent;
static int
-TwmErrorHandler(Display *dpy, XErrorEvent *event)
+TwmErrorHandler(Display *dpy2, XErrorEvent *event)
{
LastErrorEvent = *event;
ErrorOccurred = True;
@@ -957,13 +971,13 @@ TwmErrorHandler(Display *dpy, XErrorEvent *event)
event->error_code != BadWindow && /* watch for dead puppies */
(event->request_code != X_GetGeometry && /* of all styles */
event->error_code != BadDrawable))
- XmuPrintDefaultErrorMessage (dpy, event, stderr);
+ XmuPrintDefaultErrorMessage (dpy2, event, stderr);
return 0;
}
static int
-CatchRedirectError(Display *dpy, XErrorEvent *event)
+CatchRedirectError(Display *dpy2 _X_UNUSED, XErrorEvent *event)
{
RedirectError = TRUE;
LastErrorEvent = *event;