You are not logged in.

#1 2010-05-29 07:13:54

Aakko
Member
Registered: 2007-10-23
Posts: 65

[SOLVED] dwm doesn't compile with moveresize function

I'am trying to compile dwm with moveresize function but I get this error:

dwm build options:
CFLAGS   = -std=c99 -pedantic -Wall -Os -I. -I/usr/include -I/usr/include/X11 -DVERSION="5.7.2" -DXINERAMA
LDFLAGS  = -s -L/usr/lib -lc -L/usr/lib/X11 -lX11 -L/usr/lib/X11 -lXinerama
CC       = cc
CC dwm.c
In file included from dwm.c:254:0:
config.h: In function 'moveresize':
config.h:23:7: error: dereferencing pointer to incomplete type
config.h:23:34: error: dereferencing pointer to incomplete type
config.h:26:9: error: dereferencing pointer to incomplete type
config.h:26:17: error: dereferencing pointer to incomplete type
config.h:27:6: error: dereferencing pointer to incomplete type
config.h:28:6: error: dereferencing pointer to incomplete type
config.h:29:6: error: dereferencing pointer to incomplete type
make: *** [dwm.o] Error 1

Here's my config.h

/* See LICENSE file for copyright and license details. */

/* appearance */
static const char font[]            = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#454545";
static const char normbgcolor[]     = "#454545";
static const char normfgcolor[]     = "#C0C0C0";
static const char selbordercolor[]  = "#C0C0C0";
static const char selbgcolor[]      = "#454545";
static const char selfgcolor[]      = "#FFFFFF";
static const unsigned int borderpx  = 1;        /* border pixel of windows */
static const unsigned int snap      = 32;       /* snap pixel */
static const Bool showbar           = True;     /* False means no bar */
static const Bool topbar            = True;     /* False means bottom bar */

/* moveresize */

static void moveresize(const Arg *arg) {

XEvent ev;
Monitor *m = selmon;

if(!(m->sel && arg && arg->v && m->sel->isfloating))
    return;

resize(m->sel, m->sel->x + ((int *)arg->v)[0],
    m->sel->y + ((int *)arg->v)[1],
    m->sel->w + ((int *)arg->v)[2],
    m->sel->h + ((int *)arg->v)[3],
    True);

while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}

/* tagging */
static const char *tags[] = { "term", "web", "fm", "im", "media", "float" };

static const Rule rules[] = {
    /* class      instance    title       tags mask     isfloating   monitor */
    { "Gimp",     NULL,       NULL,       1 << 5,            True,        -1 },
    { "Chromium",  NULL,       NULL,       1 << 1,       True,       -1 },
    { "MPlayer",     NULL,       NULL,       0,            True,        -1 },
        { "Wine",     NULL,       NULL,       1 << 5,            True,        -1 },
        { "Gpicview",     NULL,       NULL,       0,            True,        -1 },
    { "Pcmanfm",     NULL,       NULL,       1 << 2,            True,        -1 },
    { "Xarchiver",     NULL,       NULL,       0,            True,        -1 },
    { "Amsn",     NULL,       NULL,       1 << 3,            True,        -1 },
};

/* layout(s) */
static const float mfact      = 0.55; /* factor of master area size [0.05..0.95] */
static const Bool resizehints = False; /* True means respect size hints in tiled resizals */

static const Layout layouts[] = {
    /* symbol     arrange function */
    { "[]=",      tile },    /* first entry is default */
    { "><>",      NULL },    /* no layout function means floating behavior */
    { "[M]",      monocle },
};

/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
    { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
    { MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
    { MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },

/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }

/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *tdmenucmd[] = { "tdmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[]  = { "roxterm", NULL };
static const char *mutecmd[] = { "amixer", "-q", "sset", "Master", "toggle", NULL };
static const char *volupcmd[] = { "amixer", "-q", "sset", "Master", "5-", "unmute", NULL };
static const char *voldowncmd[] = { "amixer", "-q", "sset", "Master", "5+", "unmute", NULL };
static const char *bgltupcmd[] = { "xbacklight", "-inc", "15", NULL };
static const char *bgltdowncmd[] = { "xbacklight", "-dec", "1", NULL };   
static const char *displayoff[] = { "xset", "dpms", "force", "off", NULL };
static const char *suspend[] = { "sudo", "pm-suspend", NULL };

static Key keys[] = {
    /* modifier                     key        function        argument */
    { 0,                0x1008ff12,    spawn,          {.v = mutecmd } },
    { 0,                0x1008ff11,    spawn,          {.v = volupcmd } },
    { 0,                0x1008ff13,    spawn,        {.v = voldowncmd } },
        { 0,                            0x1008ff02,     spawn,          {.v = bgltupcmd } }, 
        { 0,                            0x1008ff03,     spawn,          {.v = bgltdowncmd } }, 
        { 0,                            0x1008ff59,     spawn,          {.v = displayoff } },
        { 0,                            0x1008ff2f,     spawn,          {.v = suspend } },
    { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
        { MODKEY,                       XK_r,      spawn,          {.v = tdmenucmd } },
    { MODKEY,                    XK_Return, spawn,          {.v = termcmd } },
    { MODKEY,                       XK_b,      togglebar,      {0} },
    { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
    { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },
    { MODKEY,                       XK_h,      setmfact,       {.f = -0.05} },
    { MODKEY,                       XK_l,      setmfact,       {.f = +0.05} },
    { MODKEY|ShiftMask,             XK_Return, zoom,           {0} },
    { MODKEY,                       XK_Tab,    view,           {0} },
    { MODKEY,                    XK_c,      killclient,     {0} },
    { MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} },
    { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[1]} },
    { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[2]} },
    { MODKEY,                       XK_space,  setlayout,      {0} },
    { MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    { MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    { MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    { MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    { MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    { MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
    { MODKEY,                       XK_Down,   moveresize,     {.v = (int []){ 0, 25, 0, 0 }}},
    { MODKEY,                       XK_Up,     moveresize,     {.v = (int []){ 0, -25, 0, 0 }}},
    { MODKEY,                       XK_Right,  moveresize,     {.v = (int []){ 25, 0, 0, 0 }}},
    { MODKEY,                       XK_Left,   moveresize,     {.v = (int []){ -25, 0, 0, 0 }}},
    { MODKEY|ShiftMask,             XK_Down,   moveresize,     {.v = (int []){ 0, 0, 0, 25 }}},
    { MODKEY|ShiftMask,             XK_Up,     moveresize,     {.v = (int []){ 0, 0, 0, -25 }}},
    { MODKEY|ShiftMask,             XK_Right,  moveresize,     {.v = (int []){ 0, 0, 25, 0 }}},
    { MODKEY|ShiftMask,             XK_Left,   moveresize,     {.v = (int []){ 0, 0, -25, 0 }}},
    TAGKEYS(                        XK_1,                      0)
    TAGKEYS(                        XK_2,                      1)
    TAGKEYS(                        XK_3,                      2)
    TAGKEYS(                        XK_4,                      3)
    TAGKEYS(                        XK_5,                      4)
    TAGKEYS(                        XK_6,                      5)
    TAGKEYS(                        XK_7,                      6)
    TAGKEYS(                        XK_8,                      7)
    TAGKEYS(                        XK_9,                      8)
};

/* button definitions */
/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
    /* click                event mask      button          function        argument */
    { ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    { ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    { ClkWinTitle,          0,              Button2,        zoom,           {0} },
    { ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
    { ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    { ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    { ClkClientWin,         MODKEY|ShiftMask,         Button1,        resizemouse,    {0} },
    { ClkTagBar,            0,              Button1,        view,           {0} },
    { ClkTagBar,            0,              Button3,        toggleview,     {0} },
    { ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    { ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
};

Last edited by Aakko (2010-05-30 18:21:30)

Offline

#2 2010-05-29 16:43:18

stqn
Member
Registered: 2010-03-19
Posts: 1,191
Website

Re: [SOLVED] dwm doesn't compile with moveresize function

Is this MoveResize() function really supposed to be in config.h?

Anyway the problem is that this function uses undefined types (for example Monitor). You need to add some includes.

Offline

#3 2010-05-29 21:53:05

ber_t
Member
From: Berlin, Germany
Registered: 2010-03-10
Posts: 214
Website

Re: [SOLVED] dwm doesn't compile with moveresize function

A vanilla dwm compiles fine with your config.h. So I guess you're using other patches that rearrange the #include directive for config.h in dwm.c, e.g. pertag. If that's the case, you have to put the moveresize function in dwm.c and declare it before config.h get's included, just like any other function in dwm.c.

Last edited by ber_t (2010-05-29 23:36:01)

Offline

#4 2010-05-30 18:19:24

Aakko
Member
Registered: 2007-10-23
Posts: 65

Re: [SOLVED] dwm doesn't compile with moveresize function

ber_t wrote:

A vanilla dwm compiles fine with your config.h. So I guess you're using other patches that rearrange the #include directive for config.h in dwm.c, e.g. pertag. If that's the case, you have to put the moveresize function in dwm.c and declare it before config.h get's included, just like any other function in dwm.c.

Yes I had dwm.c patched with pertag. Vanilla compiles fine. Thanks!

Offline

Board footer

Powered by FluxBB