OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/rtos/ecos-2.0/packages/services/gfx/mw/v2_0/src/demos/nanowm
    from Rev 27 to Rev 174
    Reverse comparison

Rev 27 → Rev 174

/nanowm.c
0,0 → 1,101
/*
* NanoWM - Window Manager for Nano-X
*
* Copyright (C) 2000 Greg Haerr <greg@censoft.com>
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
* Parts based on npanel.c Copyright (C) 1999 Alistair Riddoch.
*/
#include <stdio.h>
#include <stdlib.h>
#define MWINCLUDECOLORS
#include "nano-X.h"
/* Uncomment this if you want debugging output from this file */
/*#define DEBUG*/
 
#include "nanowm.h"
 
GR_SCREEN_INFO si;
 
#ifdef __ECOS
int nanowm_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
{
GR_EVENT event;
GR_WM_PROPERTIES props;
win window;
 
if(GrOpen() < 0) {
fprintf(stderr, "Couldn't connect to Nano-X server!\n");
exit(1);
}
 
/* pass errors through main loop, don't exit*/
GrSetErrorHandler(NULL);
 
GrGetScreenInfo(&si);
 
/* add root window*/
window.wid = GR_ROOT_WINDOW_ID;
window.pid = GR_ROOT_WINDOW_ID;
window.type = WINDOW_TYPE_ROOT;
window.clientid = 1;
window.sizing = GR_FALSE;
window.active = 0;
window.data = NULL;
add_window(&window);
 
GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_CHLD_UPDATE);
 
/* Set new root window background color*/
props.flags = GR_WM_FLAGS_BACKGROUND;
props.background = GrGetSysColor(GR_COLOR_DESKTOP);
GrSetWMProperties(GR_ROOT_WINDOW_ID, &props);
 
while(1) {
GrGetNextEvent(&event);
 
switch(event.type) {
case GR_EVENT_TYPE_ERROR:
printf("nanowm: error %d\n", event.error.code);
break;
case GR_EVENT_TYPE_EXPOSURE:
do_exposure(&event.exposure);
break;
case GR_EVENT_TYPE_BUTTON_DOWN:
do_button_down(&event.button);
break;
case GR_EVENT_TYPE_BUTTON_UP:
do_button_up(&event.button);
break;
case GR_EVENT_TYPE_MOUSE_ENTER:
do_mouse_enter(&event.general);
break;
case GR_EVENT_TYPE_MOUSE_EXIT:
do_mouse_exit(&event.general);
break;
case GR_EVENT_TYPE_MOUSE_POSITION:
do_mouse_moved(&event.mouse);
break;
case GR_EVENT_TYPE_KEY_DOWN:
do_key_down(&event.keystroke);
break;
case GR_EVENT_TYPE_KEY_UP:
do_key_up(&event.keystroke);
break;
case GR_EVENT_TYPE_FOCUS_IN:
do_focus_in(&event.general);
break;
case GR_EVENT_TYPE_CHLD_UPDATE:
do_update(&event.update);
break;
default:
fprintf(stderr, "Got unexpected event %d\n",
event.type);
break;
}
}
 
GrClose();
}
/actions.c
0,0 → 1,502
/*
* NanoWM - Window Manager for Nano-X
*
* Copyright (C) 2000 Greg Haerr <greg@censoft.com>
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
*/
#include <stdio.h>
#include <stdlib.h>
#define MWINCLUDECOLORS
#include "nano-X.h"
#include "nxdraw.h"
/* Uncomment this if you want debugging output from this file */
/*#define DEBUG*/
 
#include "nanowm.h"
 
/* uncomment this line to perform outline move operations*/
/*#define OUTLINE_MOVE*/
 
void redraw_ncarea(win *window)
{
GR_WINDOW_INFO info;
GR_WM_PROPERTIES props;
GR_BOOL active;
 
Dprintf("container_exposure window %d\n", window->wid);
 
GrGetWindowInfo(window->wid, &info);
 
GrGetWMProperties(window->clientid, &props);
 
/*
* Check for invalid window. This will be the
* case if the client exited, and we're just
* getting the paint notification for our parent.
*/
if (props.flags == 0)
return;
 
active = (window->clientid == GrGetFocus());
nxPaintNCArea(window->wid, info.width, info.height, props.title,
active, props.props);
}
 
void container_exposure(win *window, GR_EVENT_EXPOSURE *event)
{
Dprintf("container_exposure window %d\n", window->wid);
 
redraw_ncarea(window);
}
 
static GR_BOOL
PtInRect(GR_RECT *prc, GR_SIZE x, GR_SIZE y)
{
return (x >= prc->x && x < (prc->x+prc->width) &&
y >= prc->y && y < (prc->y+prc->height));
}
 
void container_buttondown(win *window, GR_EVENT_BUTTON *event)
{
struct pos_size *pos;
GR_RECT r;
GR_COORD cxborder = 0, cyborder = 0;
GR_WINDOW_INFO info;
GR_GC_ID gc;
Dprintf("container_buttondown window %d\n", window->wid);
 
if(window->active) return;
 
GrGetWindowInfo(window->wid, &info);
 
/* calc border sizes*/
if (info.props & GR_WM_PROPS_BORDER) {
cxborder = 1;
cyborder = 1;
}
if (info.props & GR_WM_PROPS_APPFRAME) {
cxborder = CXBORDER;
cyborder = CYBORDER;
}
 
/* Check for close box press*/
if ((info.props & (GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) ==
(GR_WM_PROPS_CAPTION|GR_WM_PROPS_CLOSEBOX)) {
 
/* Get close box rect*/
r.x = info.width - CXCLOSEBOX - cxborder - 2;
r.y = cyborder + 2;
r.width = CXCLOSEBOX;
r.height = CYCLOSEBOX;
 
/* Check mousedn in close box*/
if (PtInRect(&r, event->x, event->y)) {
/* this may or not close the window...*/
GrCloseWindow(window->clientid);
return;
}
}
 
/* Set focus on button down*/
GrSetFocus(window->clientid);
/*
* Note: Resize seems to cause lots of trouble since the resize "handle"
* does not seem to be visible/advertized. Thus at any touch, the window
* may get resized and it is often impossible to recover
*/
 
/* check for corner resize */
r.x = info.width - 5;
r.y = info.height - 5;
r.width = 5;
r.height = 5;
 
if(PtInRect(&r,event->x, event->y)) {
 
struct pos_size * pos;
 
if(!window->data)
if(!(window->data = malloc(sizeof(struct pos_size)))) return;
 
window->sizing = GR_TRUE;
pos = (struct pos_size*)window->data;
/* save off the width/height offset from the window manager */
GrGetWindowInfo(window->clientid,&info);
pos->xoff = -info.width;
pos->yoff = -info.height;
 
GrGetWindowInfo(window->wid,&info);
pos->xoff += info.width;
pos->yoff += info.height;
 
gc = GrNewGC();
GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height);
GrDestroyGC(gc);
 
/* save this rectangle's width/height so we can erase it later */
pos->width = info.width;
pos->height = info.height;
 
return;
}
 
/* if not in caption, return (FIXME, not calc'd exactly)*/
if (!(info.props & GR_WM_PROPS_CAPTION))
return;
 
/* Get caption box rect*/
r.x = cxborder;
r.y = cyborder;
r.width = info.width - cxborder*2;
r.height = CYCAPTION;
 
/* Check for mousedn in caption box*/
if (!PtInRect(&r, event->x, event->y))
return;
 
/* Raise window if mouse down and allowed*/
if (!(info.props & GR_WM_PROPS_NORAISE))
GrRaiseWindow(window->wid);
 
/* Don't allow window move if NOMOVE property set*/
if (info.props & GR_WM_PROPS_NOMOVE)
return;
 
if(!window->data)
if(!(window->data = malloc(sizeof(struct pos_size)))) return;
 
pos = (struct pos_size *) window->data;
 
GrGetWindowInfo(window->wid,&info);
pos->xoff = event->x;
pos->yoff = event->y;
 
#ifdef OUTLINE_MOVE
pos->xorig = info.x;
pos->yorig = info.y;
pos->width = info.width;
pos->height = info.height;
 
gc = GrNewGC();
GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, info.width, info.height);
GrDestroyGC(gc);
#endif
window->active = GR_TRUE;
}
 
void container_buttonup(win *window, GR_EVENT_BUTTON *event)
{
Dprintf("container_buttonup window %d\n", window->wid);
 
if(window->active) {
struct pos_size * pos = (struct pos_size *)window->data;
#ifdef OUTLINE_MOVE
GR_GC_ID gc;
gc = GrNewGC();
GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height);
 
GrMoveWindow(window->wid, pos->xorig, pos->yorig);
 
#endif
free(pos);
window->active = GR_FALSE;
window->data = 0;
}
if(window->sizing) {
GR_WINDOW_INFO info;
GR_GC_ID gc;
 
struct pos_size * pos = (struct pos_size *)window->data;
 
gc = GrNewGC();
GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
 
GrGetWindowInfo(window->wid, &info);
 
GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height);
 
GrResizeWindow(window->wid,event->rootx - info.x, event->rooty - info.y);
GrResizeWindow(window->clientid,event->rootx - info.x - pos->xoff,
event->rooty - info.y - pos->yoff);
GrDestroyGC(gc);
free(window->data);
window->sizing = GR_FALSE;
window->data = 0;
}
}
 
void container_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
struct pos_size *pos;
GR_WINDOW_INFO info;
GR_GC_ID gc;
 
Dprintf("container_mousemoved window %d\n", window->wid);
 
if(window->sizing) {
 
struct pos_size * pos = (struct pos_size*)window->data;
GrGetWindowInfo(window->wid, &info);
 
gc = GrNewGC();
GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
 
/* erase old rectangle */
GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y, pos->width, pos->height);
/* draw new one */
GrRect(GR_ROOT_WINDOW_ID,gc,info.x, info.y,
event->rootx - info.x, event->rooty - info.y);
GrDestroyGC(gc);
 
/* save this new rectangle's width, height */
/* I know, this shouldn't be stored in x/y, but... */
pos->width = event->rootx - info.x;
pos->height = event->rooty - info.y;
 
return;
}
 
if(!window->active) return;
 
pos = (struct pos_size *) window->data;
 
#ifdef OUTLINE_MOVE
gc = GrNewGC();
GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width, pos->height);
GrRect(GR_ROOT_WINDOW_ID,gc,event->rootx - pos->xoff, event->rooty - pos->yoff,
pos->width, pos->height);
 
pos->xorig = event->rootx - pos->xoff;
pos->yorig = event->rooty - pos->yoff;
GrDestroyGC(gc);
#else
GrMoveWindow(window->wid, event->rootx - pos->xoff,
event->rooty - pos->yoff);
#endif
}
 
#if 0000
void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event)
{
win *pwin = find_window(window->pid);
struct clientinfo *ci = pwin->data;
GR_WM_PROPERTIES prop;
 
Dprintf("topbar_exposure window %d\n", window->wid);
 
GrGetWMProperties(ci->cid, &prop);
if (prop.title)
GrText(window->wid, buttonsgc, 0, 0, prop.title, -1,
GR_TFASCII|GR_TFTOP);
}
 
void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event)
{
Dprintf("closebutton_exposure window %d\n", window->wid);
 
GrBitmap(window->wid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT,
TITLE_BAR_HEIGHT, window->active ? closebutton_pressed :
closebutton_notpressed);
}
 
void topbar_buttondown(win *window, GR_EVENT_BUTTON *event)
{
struct position *pos;
 
Dprintf("topbar_buttondown window %d\n", window->wid);
 
GrRaiseWindow(window->pid);
 
if(window->active) return;
 
if(!window->data)
if(!(window->data = malloc(sizeof(struct position)))) return;
 
pos = (struct position *) window->data;
 
pos->x = event->x + TITLE_BAR_HEIGHT; /* actually width*/
pos->y = event->y;
 
window->active = GR_TRUE;
}
 
void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event)
{
GR_WINDOW_INFO wi;
struct pos_size *pos;
 
Dprintf("resizebar_buttondown window %d\n", window->wid);
 
GrRaiseWindow(window->pid);
 
if(window->active) return;
 
if(!window->data)
if(!(window->data = malloc(sizeof(struct pos_size)))) return;
 
pos = (struct pos_size *) window->data;
 
GrGetWindowInfo(window->pid, &wi);
 
pos->xoff = event->x;
pos->yoff = event->y;
pos->xorig = wi.x;
pos->yorig = wi.y;
pos->width = wi.width;
pos->height = wi.height;
 
window->active = GR_TRUE;
}
 
void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event)
{
Dprintf("closebutton_buttondown window %d\n", window->wid);
 
GrRaiseWindow(window->pid);
 
window->active = GR_TRUE;
closebutton_exposure(window, NULL);
}
 
 
void topbar_buttonup(win *window, GR_EVENT_BUTTON *event)
{
Dprintf("topbar_buttonup window %d\n", window->wid);
 
window->active = GR_FALSE;
}
 
void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event)
{
win *pwin = find_window(window->pid);
struct clientinfo *ci = pwin->data;
 
Dprintf("closebutton_buttonup window %d\n", window->wid);
 
window->active = GR_FALSE;
closebutton_exposure(window, NULL);
 
GrCloseWindow(ci->cid);
}
 
void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
struct position *pos;
GR_WM_PROPERTIES props;
 
Dprintf("topbar_mousemoved window %d\n", window->wid);
 
if(!window->active) return;
 
pos = (struct position *) window->data;
 
/* turn off background erase draw while moving*/
GrGetWMProperties(window->pid, &props);
props.flags = GR_WM_FLAGS_PROPS;
props.props |= GR_WM_PROPS_NOBACKGROUND;
GrSetWMProperties(window->pid, &props);
 
GrMoveWindow(window->pid, event->rootx - pos->x,
event->rooty - pos->y);
 
props.props &= ~GR_WM_PROPS_NOBACKGROUND;
GrSetWMProperties(window->pid, &props);
}
 
void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
GR_COORD newx;
GR_SIZE newwidth;
struct pos_size *pos;
 
Dprintf("leftbar_mousemoved window %d\n", window->wid);
 
if(!window->active) return;
 
pos = (struct pos_size *) window->data;
 
newx = event->rootx - pos->xoff;
newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
 
GrMoveWindow(window->pid, newx, pos->yorig);
GrResizeWindow(window->pid, newwidth, pos->height);
}
 
void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
GR_COORD newx;
GR_SIZE newwidth, newheight;
struct pos_size *pos;
 
Dprintf("leftresize_mousemoved window %d\n", window->wid);
 
if(!window->active) return;
 
pos = (struct pos_size *) window->data;
 
newx = event->rootx - pos->xoff;
newheight = event->rooty - pos->yorig;
newwidth = pos->width + pos->xorig - event->rootx - pos->xoff;
 
GrMoveWindow(window->pid, newx, pos->yorig);
GrResizeWindow(window->pid, newwidth, newheight);
}
 
void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
GR_SIZE newheight;
struct pos_size *pos;
 
Dprintf("bottombar_mousemoved window %d\n", window->wid);
 
if(!window->active) return;
 
pos = (struct pos_size *) window->data;
 
newheight = event->rooty - pos->yorig;
 
GrResizeWindow(window->pid, pos->width, newheight);
}
 
void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
GR_SIZE newwidth, newheight;
struct pos_size *pos;
 
Dprintf("rightresize_mousemoved window %d\n", window->wid);
 
if(!window->active) return;
 
pos = (struct pos_size *) window->data;
 
newheight = event->rooty - pos->yorig;
newwidth = event->rootx - pos->xorig;
 
GrResizeWindow(window->pid, newwidth, newheight);
}
 
void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event)
{
GR_SIZE newwidth;
struct pos_size *pos;
 
Dprintf("rightbar_mousemoved window %d\n", window->wid);
 
if(!window->active) return;
 
pos = (struct pos_size *) window->data;
 
newwidth = event->rootx - pos->xorig;
 
GrResizeWindow(window->pid, newwidth, pos->height);
 
}
#endif /* 0000*/
/clients.c
0,0 → 1,373
/*
* NanoWM - Window Manager for Nano-X
*
* Copyright (C) 2000 Greg Haerr <greg@censoft.com>
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
*/
#include <stdio.h>
#include <stdlib.h>
#define MWINCLUDECOLORS
#include "nano-X.h"
#include "nxdraw.h"
/* Uncomment this if you want debugging output from this file */
/*#define DEBUG*/
 
#include "nanowm.h"
 
/* default window style for GR_WM_PROPS_APPWINDOW*/
#define DEFAULT_WINDOW_STYLE (GR_WM_PROPS_APPFRAME | GR_WM_PROPS_CAPTION |\
GR_WM_PROPS_CLOSEBOX)
 
static GR_COORD lastx = FIRST_WINDOW_LOCATION;
static GR_COORD lasty = FIRST_WINDOW_LOCATION;
 
/*
* A new client window has been mapped, so we need to reparent and decorate it.
* Returns -1 on failure or 0 on success.
*/
int new_client_window(GR_WINDOW_ID wid)
{
win window;
GR_WINDOW_ID pid;
GR_WINDOW_INFO winfo;
GR_COORD x, y, width, height, xoffset, yoffset;
GR_WM_PROPS style;
GR_WM_PROPERTIES props;
 
/* get client window information*/
GrGetWindowInfo(wid, &winfo);
style = winfo.props;
 
/* if not redecorating or not child of root window, return*/
if (winfo.parent != GR_ROOT_WINDOW_ID ||
(style & GR_WM_PROPS_NODECORATE))
return 0;
 
/* deal with replacing borders with window decorations*/
if (winfo.bordersize) {
/*
* For complex reasons, it's easier to unmap,
* remove the borders, and then map again,
* rather than try to recalculate the window
* position in the server w/o borders. By
* the time we get this event, the window has
* already been painted with borders...
* This currently causes a screen flicker as
* the window is painted twice. The workaround
* is to create the window without borders in
* the first place.
*/
GrUnmapWindow(wid);
 
/* remove client borders, if any*/
props.flags = style | GR_WM_FLAGS_BORDERSIZE;
props.bordersize = 0;
GrSetWMProperties(wid, &props);
 
/* remap the window without borders, call this routine again*/
GrMapWindow(wid);
return 0;
}
/* if default decoration style asked for, set real draw bits*/
if ((style & GR_WM_PROPS_APPMASK) == GR_WM_PROPS_APPWINDOW) {
GR_WM_PROPERTIES pr;
 
style = (style & ~GR_WM_PROPS_APPMASK)|DEFAULT_WINDOW_STYLE;
pr.flags = GR_WM_FLAGS_PROPS;
pr.props = style;
GrSetWMProperties(wid, &pr);
}
 
/* determine container widths and client child window offsets*/
if (style & GR_WM_PROPS_APPFRAME) {
width = winfo.width + CXFRAME;
height = winfo.height + CYFRAME;
xoffset = CXBORDER;
yoffset = CYBORDER;
} else if (style & GR_WM_PROPS_BORDER) {
width = winfo.width + 2;
height = winfo.height + 2;
xoffset = 1;
yoffset = 1;
} else {
width = winfo.width;
height = winfo.height;
xoffset = 0;
yoffset = 0;
}
if (style & GR_WM_PROPS_CAPTION) {
height += CYCAPTION;
yoffset += CYCAPTION;
if (style & GR_WM_PROPS_APPFRAME) {
/* extra line under caption with appframe*/
++height;
++yoffset;
}
}
 
/* determine x,y window location*/
if (style & GR_WM_PROPS_NOAUTOMOVE) {
x = winfo.x;
y = winfo.y;
} else {
/* We could proably use a more intelligent algorithm here */
x = lastx + WINDOW_STEP;
if((x + width) > si.cols)
x = FIRST_WINDOW_LOCATION;
lastx = x;
y = lasty + WINDOW_STEP;
if((y + height) > si.rows)
y = FIRST_WINDOW_LOCATION;
lasty = y;
}
 
/* create container window*/
pid = GrNewWindow(GR_ROOT_WINDOW_ID, x, y, width, height,
0, LTGRAY, BLACK);
window.wid = pid;
window.pid = GR_ROOT_WINDOW_ID;
window.type = WINDOW_TYPE_CONTAINER;
window.sizing = GR_FALSE;
window.active = 0;
window.data = NULL;
window.clientid = wid;
add_window(&window);
 
/* don't erase background of container window*/
props.flags = GR_WM_FLAGS_PROPS;
props.props = style | GR_WM_PROPS_NOBACKGROUND;
GrSetWMProperties(pid, &props);
 
Dprintf("New client window %d container %d\n", wid, pid);
 
GrSelectEvents(pid, GR_EVENT_MASK_CHLD_UPDATE
| GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_BUTTON_DOWN
| GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_EXPOSURE);
 
/* reparent client to container window*/
/* must map before reparent (nano-x bug)*/
GrMapWindow(pid);
GrReparentWindow(wid, pid, xoffset, yoffset);
 
GrSetFocus(wid); /* force fixed focus*/
 
/* add client window*/
window.wid = wid;
window.pid = pid;
window.type = WINDOW_TYPE_CLIENT;
window.sizing = GR_FALSE;
window.active = 0;
window.clientid = 0;
window.data = NULL;
add_window(&window);
 
#if 0000
/* add system utility button*/
nid = GrNewWindow(pid, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0,
LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_UTILITYBUTTON;
window.active = GR_FALSE;
window.data = NULL;
add_window(&window);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_EXPOSURE
| GR_EVENT_MASK_MOUSE_EXIT);
GrMapWindow(nid);
GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
utilitybutton_notpressed);
 
nid = GrNewWindow(pid, TITLE_BAR_HEIGHT + 1, 1, width - (4 *
TITLE_BAR_HEIGHT) - 3, TITLE_BAR_HEIGHT - 3, 1, LTGRAY,
BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_TOPBAR;
window.active = GR_FALSE;
window.data = NULL;
 
add_window(&window);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_EXPOSURE
| GR_EVENT_MASK_MOUSE_POSITION);
GrMapWindow(nid);
 
nid = GrNewWindow(pid, width - (3 * TITLE_BAR_HEIGHT), 0,
TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_ICONISEBUTTON;
window.active = GR_FALSE;
window.data = NULL;
add_window(&window);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_EXPOSURE
| GR_EVENT_MASK_MOUSE_EXIT);
GrMapWindow(nid);
GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
iconisebutton_notpressed);
 
nid = GrNewWindow(pid, width - (2 * TITLE_BAR_HEIGHT), 0,
TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_MAXIMISEBUTTON;
window.active = GR_FALSE;
window.data = NULL;
add_window(&window);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_EXPOSURE
| GR_EVENT_MASK_MOUSE_EXIT);
GrMapWindow(nid);
GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
maximisebutton_notpressed);
 
nid = GrNewWindow(pid, width - TITLE_BAR_HEIGHT, 0,
TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT, 0, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_CLOSEBUTTON;
window.active = GR_FALSE;
window.data = NULL;
add_window(&window);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_EXPOSURE
| GR_EVENT_MASK_MOUSE_EXIT);
GrMapWindow(nid);
GrBitmap(nid, buttonsgc, 0, 0, TITLE_BAR_HEIGHT, TITLE_BAR_HEIGHT,
closebutton_notpressed);
 
nid = GrNewWindow(pid, 1, TITLE_BAR_HEIGHT + 1, BORDER_WIDTHS - 2,
height - TITLE_BAR_HEIGHT - BORDER_WIDTHS - 1,
1, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_LEFTBAR;
window.active = GR_FALSE;
window.data = NULL;
 
add_window(&window);
 
GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
horizontal_resize_hotx, horizontal_resize_hoty,
BLACK, WHITE, horizontal_resize_fg,
horizontal_resize_bg);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_MOUSE_POSITION);
 
GrMapWindow(nid);
 
nid = GrNewWindow(pid, 1, height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_LEFTRESIZE;
window.active = GR_FALSE;
window.data = NULL;
 
 
add_window(&window);
 
GrSetCursor(nid, lefthand_resize_columns, lefthand_resize_rows,
lefthand_resize_hotx, lefthand_resize_hoty,
BLACK, WHITE, lefthand_resize_fg, lefthand_resize_bg);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_MOUSE_POSITION);
 
GrMapWindow(nid);
 
nid = GrNewWindow(pid, BORDER_WIDTHS, height - BORDER_WIDTHS + 1,
width - (2 * BORDER_WIDTHS), BORDER_WIDTHS - 2, 1,
LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_BOTTOMBAR;
window.active = GR_FALSE;
window.data = NULL;
add_window(&window);
 
GrSetCursor(nid, vertical_resize_columns, vertical_resize_rows,
vertical_resize_hotx, vertical_resize_hoty,
BLACK, WHITE, vertical_resize_fg, vertical_resize_bg);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_MOUSE_POSITION);
 
GrMapWindow(nid);
 
nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1,
height - BORDER_WIDTHS + 1, BORDER_WIDTHS - 2,
BORDER_WIDTHS - 2, 1, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_RIGHTRESIZE;
window.active = GR_FALSE;
window.data = NULL;
 
add_window(&window);
 
GrSetCursor(nid, righthand_resize_columns, righthand_resize_rows,
righthand_resize_hotx, righthand_resize_hoty,
BLACK, WHITE, righthand_resize_fg, righthand_resize_bg);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_MOUSE_POSITION);
 
GrMapWindow(nid);
 
nid = GrNewWindow(pid, width - BORDER_WIDTHS + 1, TITLE_BAR_HEIGHT + 1,
BORDER_WIDTHS - 2, height - TITLE_BAR_HEIGHT - BORDER_WIDTHS -1,
1, LTGRAY, BLACK);
window.wid = nid;
window.pid = pid;
window.type = WINDOW_TYPE_RIGHTBAR;
window.active = GR_FALSE;
window.data = NULL;
 
add_window(&window);
 
GrSetCursor(nid, horizontal_resize_columns, horizontal_resize_rows,
horizontal_resize_hotx, horizontal_resize_hoty,
BLACK, WHITE, horizontal_resize_fg,
horizontal_resize_bg);
 
GrSelectEvents(nid, GR_EVENT_MASK_BUTTON_DOWN | GR_EVENT_MASK_BUTTON_UP
| GR_EVENT_MASK_MOUSE_POSITION);
GrMapWindow(nid);
#endif
return 0;
}
 
/*
* We've just received an event notifying us that a client window has been
* unmapped, so we need to destroy all of the decorations.
*/
void client_window_destroy(win *window)
{
win *pwin;
GR_WINDOW_ID pid;
 
Dprintf("Client window %d has been destroyed\n", window->wid);
 
if(!(pwin = find_window(window->pid))) {
fprintf(stderr, "Couldn't find parent of destroyed window "
"%d\n", window->wid);
return;
}
 
/* Do it this way around so we don't handle events after destroying */
pid = pwin->wid;
remove_window_and_children(pwin);
 
Dprintf("Destroying container %d\n", pid);
GrDestroyWindow(pid);
}
/wlist.c
0,0 → 1,123
/*
* NanoWM - Window Manager for Nano-X
*
* Copyright (C) 2000 Greg Haerr <greg@censoft.com>
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
*/
#include <stdio.h>
#include <stdlib.h>
#define MWINCLUDECOLORS
#include "nano-X.h"
/* Uncomment this to get debugging output from this file */
/*#define DEBUG*/
 
#include "nanowm.h"
 
static win *windows = NULL;
 
/*
* Find the windowlist entry for the specified window ID and return a pointer
* to it, or NULL if it isn't in the list.
*/
win *find_window(GR_WINDOW_ID wid)
{
win *w = windows;
 
Dprintf("Looking for window %d... ", wid);
 
while(w) {
Dprintf("%d ", w->wid);
if(w->wid == wid) {
Dprintf("found it!\n");
return w;
}
w = w->next;
}
 
Dprintf("Nope, %d is not in the list\n", wid);
return NULL;
}
 
/*
* Add a new entry to the front of the windowlist.
* Returns -1 on failure or 0 on success.
*/
int add_window(win *window)
{
win *w;
 
Dprintf("Adding window %d\n", window->wid);
 
if(!(w = malloc(sizeof(win)))) return -1;
 
w->wid = window->wid;
w->pid = window->pid;
w->type = window->type;
w->sizing = GR_FALSE; /* window->sizing*/
w->active = window->active;
w->clientid = window->clientid;
w->data = window->data;
w->next = windows;
windows = w;
 
return 0;
}
 
/*
* Remove an entry from the windowlist.
* We must search through the list for it so that we can find the previous
* entry in the list and fix the next pointer. The alternative is to add a
* prev pointer to the structure which would increase the memory usage.
* Returns -1 on failure or 0 on success.
*/
int remove_window(win *window)
{
win *w = windows;
win *prev = NULL;
 
while(w) {
if(w == window) {
if(!prev) windows = w->next;
else prev->next = w->next;
if(w->data) free(w->data);
free(w);
return 0;
}
prev = w;
w = w->next;
}
 
return -1;
}
 
/*
* Remove an entry and all it's children from the windowlist.
* Returns -1 on failure or 0 on success.
*/
int remove_window_and_children(win *window)
{
win *t, *w = windows;
win *prev = NULL;
GR_WINDOW_ID pid = window->wid;
 
Dprintf("Removing window %d and children\n", window->wid);
 
while(w) {
Dprintf("Examining window %d (pid %d)\n", w->wid, w->pid);
if((w->pid == pid) || (w == window)) {
Dprintf("Removing window %d (pid %d)\n", w->wid,
w->pid);
if(prev) prev->next = w->next;
else windows = w->next;
t = w->next;
if(w->data) free(w->data);
free(w);
w = t;
continue;
}
prev = w;
w = w->next;
}
 
return -1;
}
/events.c
0,0 → 1,202
/*
* NanoWM - Window Manager for Nano-X
*
* Copyright (C) 2000 Greg Haerr <greg@censoft.com>
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
*/
#include <stdio.h>
#include <stdlib.h>
#define MWINCLUDECOLORS
#include "nano-X.h"
/* Uncomment this if you want debugging output from this file */
/*#define DEBUG*/
 
#include "nanowm.h"
 
void do_exposure(GR_EVENT_EXPOSURE *event)
{
win *window;
 
Dprintf("do_exposure: wid %d, x %d, y %d, width %d, height %d\n",
event->wid, event->x, event->y, event->width, event->height);
 
if(!(window = find_window(event->wid))) return;
 
switch(window->type) {
case WINDOW_TYPE_CONTAINER:
container_exposure(window, event);
break;
default:
printf("Unhandled exposure on window %d "
"(type %d)\n", window->wid, window->type);
break;
}
 
}
 
void do_button_down(GR_EVENT_BUTTON *event)
{
win *window;
 
Dprintf("do_button_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
"y %d, buttons %d, changebuttons %d, modifiers %d\n",
event->wid, event->subwid, event->rootx, event->rooty, event->x,
event->y, event->buttons, event->changebuttons,
event->modifiers);
 
if(!(window = find_window(event->wid))) return;
 
switch(window->type) {
case WINDOW_TYPE_CONTAINER:
container_buttondown(window, event);
break;
default:
printf("Unhandled button down on window %d "
"(type %d)\n", window->wid, window->type);
break;
}
}
 
void do_button_up(GR_EVENT_BUTTON *event)
{
win *window;
 
Dprintf("do_button_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
"y %d, buttons %d, changebuttons %d, modifiers %d\n",
event->wid, event->subwid, event->rootx, event->rooty, event->x,
event->y, event->buttons, event->changebuttons,
event->modifiers);
 
if(!(window = find_window(event->wid))) return;
 
switch(window->type) {
case WINDOW_TYPE_CONTAINER:
container_buttonup(window, event);
break;
default:
printf("Unhandled button up on window %d "
"(type %d)\n", window->wid, window->type);
break;
}
}
 
void do_mouse_enter(GR_EVENT_GENERAL *event)
{
win *window;
 
Dprintf("do_mouse_enter: wid %d\n", event->wid);
 
if(!(window = find_window(event->wid)))
return;
 
switch(window->type) {
default:
printf("Unhandled mouse enter from window %d "
"(type %d)\n", window->wid, window->type);
break;
}
}
 
void do_mouse_exit(GR_EVENT_GENERAL *event)
{
win *window;
 
Dprintf("do_mouse_exit: wid %d\n", event->wid);
 
if(!(window = find_window(event->wid))) return;
 
switch(window->type) {
default:
printf("Unhandled mouse exit from window %d "
"(type %d)\n", window->wid, window->type);
break;
}
}
 
void do_mouse_moved(GR_EVENT_MOUSE *event)
{
win *window;
 
Dprintf("do_mouse_moved: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
"y %d, buttons %d, modifiers %d\n", event->wid, event->subwid,
event->rootx, event->rooty, event->x, event->y, event->buttons,
event->modifiers);
 
if(!(window = find_window(event->wid))) return;
 
switch(window->type) {
case WINDOW_TYPE_CONTAINER:
container_mousemoved(window, event);
break;
default:
printf("Unhandled mouse movement in window %d "
"(type %d)\n", window->wid, window->type);
break;
}
}
 
void do_focus_in(GR_EVENT_GENERAL *event)
{
win *window;
 
printf("do_focus_in: wid %d\n", event->wid);
 
if(!(window = find_window(event->wid)))
return;
 
switch(window->type) {
default:
printf("Unhandled focus in from window %d "
"(type %d)\n", window->wid, window->type);
break;
}
}
 
void do_key_down(GR_EVENT_KEYSTROKE *event)
{
Dprintf("do_key_down: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
event->rooty, event->x, event->y, event->buttons,
event->modifiers, event->uch, event->special, event->ch,
event->content);
 
/* FIXME: Implement keyboard shortcuts */
}
 
void do_key_up(GR_EVENT_KEYSTROKE *event)
{
Dprintf("do_key_up: wid %d, subwid %d, rootx %d, rooty %d, x %d, "
"y %d, buttons %d, modifiers %d, uch %lu, special %d, "
"ch %d, content %d\n", event->wid, event->subwid, event->rootx,
event->rooty, event->x, event->y, event->buttons,
event->modifiers, event->uch, event->special, event->ch,
event->content);
}
 
void do_update(GR_EVENT_UPDATE *event)
{
win *window;
 
Dprintf("do_update: wid %d, subwid %d, x %d, y %d, width %d, height %d, "
"utype %d\n", event->wid, event->subwid, event->x, event->y, event->width,
event->height, event->utype);
 
if(!(window = find_window(event->subwid))) {
if (event->utype == GR_UPDATE_MAP)
new_client_window(event->subwid);
return;
}
 
if(window->type == WINDOW_TYPE_CONTAINER) {
if (event->utype == GR_UPDATE_ACTIVATE)
redraw_ncarea(window);
return;
}
 
if(window->type != WINDOW_TYPE_CLIENT)
return;
 
if(event->utype == GR_UPDATE_DESTROY)
client_window_destroy(window);
}
/nanowm.h
0,0 → 1,196
/*
* NanoWM- the NanoGUI window manager.
* Copyright (C) 2000 Alex Holden <alex@linuxhacker.org>
*/
 
#ifndef __NANOWM_H
#define __NANOWM_H
 
#ifdef DEBUG
#define Dprintf printf
#else
#define Dprintf(ignore...)
#endif
 
/* Where to place the first window on the screen */
#define FIRST_WINDOW_LOCATION 2
 
/* The distance to leave between windows when deciding where to place */
#define WINDOW_STEP 20
 
/* The different window types which can be used in windowlist->type */
enum {
WINDOW_TYPE_ROOT,
WINDOW_TYPE_CONTAINER,
WINDOW_TYPE_CLIENT
/***WINDOW_TYPE_TOPBAR,
WINDOW_TYPE_LEFTBAR,
WINDOW_TYPE_RIGHTBAR,
WINDOW_TYPE_BOTTOMBAR,
WINDOW_TYPE_LEFTRESIZE,
WINDOW_TYPE_RIGHTRESIZE,
WINDOW_TYPE_CLOSEBUTTON,
WINDOW_TYPE_MAXIMISEBUTTON,
WINDOW_TYPE_RESTOREBUTTON,
WINDOW_TYPE_ICONISEBUTTON,
WINDOW_TYPE_ICON,
WINDOW_TYPE_UTILITYBUTTON,
WINDOW_TYPE_UTILITYMENU,
WINDOW_TYPE_UTILITYMENUENTRY,
WINDOW_TYPE_ROOTMENU,
WINDOW_TYPE_ROOTMENUENTRY**/
};
 
/*
* Used to keep a list of all the windows we know about so we can quickly
* find out whether a window is "one of ours", and if it is, what kind of
* window it is (title bar, side bar, button, icon, root menu, etc.), who
* it's a child of, and any special data associated with it (the title
* used in the title, the text of a root menu entry, the pixmap of an
* icon, etc.).
*/
struct windowlist {
GR_WINDOW_ID wid; /* The ID of this window */
GR_WINDOW_ID pid; /* The ID of this window's parent */
GR_WINDOW_ID clientid; /* clientid for container window*/
int type; /* What kind of window this is */
int sizing; /* True if in the middle of a sizing request */
int active; /* Whether this window is active or not */
void *data; /* Data associated with this window */
struct windowlist *next; /* The next window in the list */
};
typedef struct windowlist win;
 
/*
* Used to record the offset position when performing a move.
*/
struct position {
GR_COORD x;
GR_COORD y;
};
 
/*
* Used to record the original position, original size, and offset position
* when performing a resize.
*/
struct pos_size {
GR_COORD xoff;
GR_COORD yoff;
GR_COORD xorig;
GR_COORD yorig;
GR_SIZE width;
GR_SIZE height;
};
 
#if 0000
/*
* Used to record some general information about the client.
*/
struct clientinfo {
GR_WINDOW_ID cid;
};
#endif
 
/* Function prototypes */
win *find_window(GR_WINDOW_ID wid);
int add_window(win *window);
int remove_window(win *window);
int remove_window_and_children(win *window);
int new_client_window(GR_WINDOW_ID wid);
void client_window_destroy(win *window);
void redraw_ncarea(win *window);
void do_exposure(GR_EVENT_EXPOSURE *event);
void do_button_down(GR_EVENT_BUTTON *event);
void do_button_up(GR_EVENT_BUTTON *event);
void do_mouse_enter(GR_EVENT_GENERAL *event);
void do_mouse_exit(GR_EVENT_GENERAL *event);
void do_mouse_moved(GR_EVENT_MOUSE *event);
void do_focus_in(GR_EVENT_GENERAL *event);
void do_key_down(GR_EVENT_KEYSTROKE *event);
void do_key_up(GR_EVENT_KEYSTROKE *event);
void do_focus_in(GR_EVENT_GENERAL *event);
void do_focus_out(GR_EVENT_GENERAL *event);
void do_update(GR_EVENT_UPDATE *event);
void do_chld_update(GR_EVENT_UPDATE *event);
void rootwindow_exposure(win *window, GR_EVENT_EXPOSURE *event);
void container_exposure(win *window, GR_EVENT_EXPOSURE *event);
void topbar_exposure(win *window, GR_EVENT_EXPOSURE *event);
void closebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
void maximisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
void restorebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
void iconisebutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
void utilitybutton_exposure(win *window, GR_EVENT_EXPOSURE *event);
void utilitymenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
void utilitymenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
void rootmenu_exposure(win *window, GR_EVENT_EXPOSURE *event);
void rootmenuentry_exposure(win *window, GR_EVENT_EXPOSURE *event);
void icon_exposure(win *window, GR_EVENT_EXPOSURE *event);
void rootwindow_buttondown(win *window, GR_EVENT_BUTTON *event);
void container_buttondown(win *window, GR_EVENT_BUTTON *event);
void topbar_buttondown(win *window, GR_EVENT_BUTTON *event);
void resizebar_buttondown(win *window, GR_EVENT_BUTTON *event);
void closebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
void maximisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
void restorebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
void iconisebutton_buttondown(win *window, GR_EVENT_BUTTON *event);
void utilitybutton_buttondown(win *window, GR_EVENT_BUTTON *event);
void icon_buttondown(win *window, GR_EVENT_BUTTON *event);
void rootwindow_buttonup(win *window, GR_EVENT_BUTTON *event);
void container_buttonup(win *window, GR_EVENT_BUTTON *event);
void topbar_buttonup(win *window, GR_EVENT_BUTTON *event);
void resizebar_buttonup(win *window, GR_EVENT_BUTTON *event);
void closebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
void maximisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
void restorebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
void iconisebutton_buttonup(win *window, GR_EVENT_BUTTON *event);
void utilitybutton_buttonup(win *window, GR_EVENT_BUTTON *event);
void icon_buttonup(win *window, GR_EVENT_BUTTON *event);
void utilitymenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
void rootmenuentry_buttonup(win *window, GR_EVENT_BUTTON *event);
void closebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
void maximisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
void restorebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
void iconisebutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
void utilitybutton_mouseexit(win *window, GR_EVENT_GENERAL *event);
void utilitymenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
void utilitymenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
void rootmenu_mouseexit(win *window, GR_EVENT_GENERAL *event);
void rootmenuentry_mouseexit(win *window, GR_EVENT_GENERAL *event);
void container_mousemoved(win *window, GR_EVENT_MOUSE *event);
void topbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
void leftbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
void leftresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
void bottombar_mousemoved(win *window, GR_EVENT_MOUSE *event);
void rightresize_mousemoved(win *window, GR_EVENT_MOUSE *event);
void rightbar_mousemoved(win *window, GR_EVENT_MOUSE *event);
 
extern GR_SCREEN_INFO si;
extern win *windows;
extern GR_BITMAP utilitybutton_notpressed[];
extern GR_BITMAP utilitybutton_pressed[];
extern GR_BITMAP maximisebutton_notpressed[];
extern GR_BITMAP maximisebutton_pressed[];
extern GR_BITMAP iconisebutton_notpressed[];
extern GR_BITMAP iconisebutton_pressed[];
extern GR_BITMAP closebutton_notpressed[];
extern GR_BITMAP closebutton_pressed[];
extern GR_BITMAP restorebutton_notpressed[];
extern GR_BITMAP restorebutton_pressed[];
extern GR_BITMAP horizontal_resize_fg[];
extern GR_BITMAP horizontal_resize_bg[];
extern GR_BITMAP vertical_resize_fg[];
extern GR_BITMAP vertical_resize_bg[];
extern GR_BITMAP righthand_resize_fg[];
extern GR_BITMAP righthand_resize_bg[];
extern GR_BITMAP lefthand_resize_fg[];
extern GR_BITMAP lefthand_resize_bg[];
extern int horizontal_resize_columns, horizontal_resize_rows;
extern int horizontal_resize_hotx, horizontal_resize_hoty;
extern int vertical_resize_columns, vertical_resize_rows;
extern int vertical_resize_hotx, vertical_resize_hoty;
extern int lefthand_resize_columns, lefthand_resize_rows;
extern int lefthand_resize_hotx, lefthand_resize_hoty;
extern int righthand_resize_columns, righthand_resize_rows;
extern int righthand_resize_hotx, righthand_resize_hoty;
 
#endif
/org/.depend
0,0 → 1,6
nanowm.o .depend : $(TOP)/config nanowm.c nanowm.h
bitmaps.o .depend : $(TOP)/config bitmaps.c
events.o .depend : $(TOP)/config events.c nanowm.h
wlist.o .depend : $(TOP)/config wlist.c nanowm.h
clients.o .depend : $(TOP)/config clients.c nanowm.h
actions.o .depend : $(TOP)/config actions.c nanowm.h
/nanowm.syms
0,0 → 1,6
nanowm_main
/Makefile
0,0 → 1,67
##############################################################################
# Microwindows template Makefile
# Copyright (c) 2000, 2002 Martin Jolicoeur, Greg Haerr
##############################################################################
 
ifndef TOP
TOP = ../..
CONFIG = $(TOP)/config
endif
 
include $(CONFIG)
 
VPATH := $(TOP)/demos/nanowm
 
######################## Additional Flags section ############################
 
# Directories list for header files
INCLUDEDIRS +=
# Defines for preprocessor
DEFINES +=
 
# Compilation flags for C files OTHER than include directories
CFLAGS +=
# Preprocessor flags OTHER than defines
CPPFLAGS +=
# Linking flags
LDFLAGS +=
 
############################# targets section ################################
 
ifeq ($(NANOWM), Y)
 
# If you want to create a library with the objects files, define the name here
LIBNAME =
 
# List of objects to compile
OBJS = nanowm.o events.o wlist.o clients.o actions.o
 
ifeq ($(ARCH), ECOS)
TARGET = $(BUILD)/bin/nanowm.o
else
TARGET = $(BUILD)/bin/nanowm
endif
 
all: default $(TARGET)
 
endif
 
######################### Makefile.rules section #############################
 
include $(TOP)/Makefile.rules
 
######################## Tools targets section ###############################
ifeq ($(SHAREDLIBS), Y)
$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(CCNANOXCLIENTLIBS)
else
ifeq ($(ARCH), ECOS)
$(BUILD)/bin/nanowm.o: $(OBJS) $(BUILD)/config
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -Wl,-r -Wl,--defsym -Wl,nanowm_main=main -o XX.o
$(NM) XX.o | grep -v _main | grep ' T' | awk -f $(TOP)/ecos/retain.awk | xargs $(OBJCOPY) XX.o $@
rm -f XX.o
else
$(TOP)/bin/nanowm: $(OBJS) $(NANOXCLIENTLIBS) $(TOP)/config
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(NANOXCLIENTLIBS)
endif
endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.