if (!parse[i].len)
continue;
- str = rxvt_malloc (parse[i].len + xtra_len + 1);
+ str = (unsigned char *) rxvt_malloc (parse[i].len + xtra_len + 1);
len = 0;
if (beg.len)
item->name2 = NULL;
len = STRLEN (name);
- item->name = rxvt_malloc (len + 1);
+ item->name = (char *)rxvt_malloc (len + 1);
STRCPY (item->name, name);
if (name[0] == '.' && name[1] != '.')
len = 0; /* hidden menu name */
item->name2 = NULL;
else
{
- item->name2 = rxvt_malloc (len + 1);
+ item->name2 = (char *)rxvt_malloc (len + 1);
STRCPY (item->name2, name2);
}
item->len2 = len;
}
if (len)
{
- unsigned char *str = rxvt_malloc (len + 1);
+ unsigned char *str = (unsigned char *)rxvt_malloc (len + 1);
STRCPY (str, action);
menu->width = 0;
menu->parent = parent;
menu->len = STRLEN (path);
- menu->name = rxvt_malloc ((menu->len + 1));
+ menu->name = (char *)rxvt_malloc ((menu->len + 1));
STRCPY (menu->name, path);
/* initialize head/tail */
name = NULL;
if (len && name)
- {
-#ifdef USE_XIM
- if (TermWin.fontset)
- XmbDrawString (display->display,
- ActiveMenu->win, TermWin.fontset,
- gc, xoff,
- 2 * SHADOW + y + TermWin.font->ascent + 1,
- name, len);
- else
-#endif
- XDrawString (display->display, ActiveMenu->win, gc, xoff,
- 2 * SHADOW + y + TermWin.font->ascent + 1,
- name, len);
- }
+ draw_string (display->display, ActiveMenu->win, gc, xoff,
+ 2 * SHADOW + y + TermWin.font->ascent + 1,
+ name, len);
len = item->len2;
name = item->name2;
+
if (len && name)
- {
-#ifdef USE_XIM
- if (TermWin.fontset)
- XmbDrawString (display->display,
- ActiveMenu->win, TermWin.fontset,
- gc,
- ActiveMenu->w - (xoff + Width2Pixel (xright)),
- 2 * SHADOW + y + TermWin.font->ascent + 1,
- name, len);
- else
-#endif
- XDrawString (display->display, ActiveMenu->win, gc,
- ActiveMenu->w - (xoff + Width2Pixel (xright)),
- 2 * SHADOW + y + TermWin.font->ascent + 1,
- name, len);
- }
+ draw_string (display->display, ActiveMenu->win, gc,
+ ActiveMenu->w - (xoff + Width2Pixel (xright)),
+ 2 * SHADOW + y + TermWin.font->ascent + 1,
+ name, len);
+
h = HEIGHT_TEXT + 2 * SHADOW;
}
y += h;
}
void
-rxvt_term::menu_display (void (*update) (rxvt_t *))
+rxvt_term::menu_display (void (rxvt_term::*update) ())
{
menu_t *ActiveMenu = ActiveMenu;
if (ActiveMenu->parent == NULL)
drawbox_menubar (ActiveMenu->x, ActiveMenu->len, +1);
ActiveMenu = ActiveMenu->parent;
- update (r);
+ (this->*update) ();
}
void
rxvt_term::menu_hide_all ()
{
- menu_display (rxvt_menu_hide_all);
+ menu_display (&rxvt_term::menu_hide_all);
}
void
rxvt_term::menu_hide ()
{
- menu_display (rxvt_menu_show);
+ menu_display (&rxvt_term::menu_show);
}
void
int n, cmd;
char *path, *name, *name2;
- if (menubar_visible (r) && ActiveMenu != NULL)
+ if (menubar_visible () && ActiveMenu != NULL)
menubar_expose ();
else
ActiveMenu = NULL;
{
if (*str)
{
- name = rxvt_realloc (CurrentBar->title,
- STRLEN (str) + 1);
+ name = (char *)rxvt_realloc (CurrentBar->title, STRLEN (str) + 1);
if (name != NULL)
{
STRCPY (name, str);
menu_t *menu;
int x;
- if (!menubar_visible (r) || menuBar.win == 0)
+ if (!menubar_visible () || menuBar.win == 0)
return;
if (menubarGC == None)
len = (TermWin.ncol - (menu->x + HSPACE));
drawbox_menubar (menu->x, len, +1);
-#ifdef USE_XIM
- if (TermWin.fontset)
- XmbDrawString (display->display,
- menuBar.win, TermWin.fontset,
- menubarGC,
- (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2),
- menuBar_height () - SHADOW, menu->name, len);
- else
-#endif
- XDrawString (display->display, menuBar.win, menubarGC,
- (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2),
- menuBar_height () - SHADOW, menu->name, len);
+ draw_string (display->display, menuBar.win, menubarGC,
+ (Width2Pixel (menu->x) + Width2Pixel (HSPACE) / 2),
+ menuBar_height () - SHADOW, menu->name, len);
if (x >= TermWin.ncol)
break;
ncol -= (x + len + HSPACE);
if (len > 0 && ncol >= 0)
- {
-#ifdef USE_XIM
- if (TermWin.fontset)
- XmbDrawString (display->display,
- menuBar.win, TermWin.fontset,
- menubarGC,
- Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2,
- menuBar_height () - SHADOW, title, len);
- else
-#endif
- XDrawString (display->display, menuBar.win, menubarGC,
- Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2,
- menuBar_height () - SHADOW, title, len);
- }
+ draw_string (display->display, menuBar.win, menubarGC,
+ Width2Pixel (x) + Width2Pixel (ncol + HSPACE) / 2,
+ menuBar_height () - SHADOW, title, len);
}
}
{
int change = 0;
- if (map && !menubar_visible (r))
+ if (map && !menubar_visible ())
{
menuBar.state = 1;
if (menuBar.win == 0)
XMapWindow (display->display, menuBar.win);
change = 1;
}
- else if (!map && menubar_visible (r))
+ else if (!map && menubar_visible ())
{
menubar_expose ();
menuBar.state = 0;
}
int
-rxvt_term::menu_select (XButtonEvent *ev)
+rxvt_term::menu_select (XButtonEvent &ev)
{
menuitem_t *thisitem, *item = NULL;
int this_y, y;
XQueryPointer (display->display, ActiveMenu->win,
&unused_root, &unused_child,
&unused_root_x, &unused_root_y,
- & (ev->x), & (ev->y), &unused_mask);
+ &ev.x, &ev.y, &unused_mask);
- if (ActiveMenu->parent != NULL && (ev->x < 0 || ev->y < 0))
+ if (ActiveMenu->parent != NULL && (ev.x < 0 || ev.y < 0))
{
menu_hide ();
return 1;
}
/* determine the menu item corresponding to the Y index */
y = SHADOW;
- if (ev->x >= 0 && ev->x <= (ActiveMenu->w - SHADOW))
+ if (ev.x >= 0 && ev.x <= (ActiveMenu->w - SHADOW))
{
for (item = ActiveMenu->head; item != NULL; item = item->next)
{
if (isSeparator (item->name))
h = HEIGHT_SEPARATOR;
- else if (ev->y >= y && ev->y < (y + h))
+ else if (ev.y >= y && ev.y < (y + h))
break;
y += h;
}
}
- if (item == NULL && ev->type == ButtonRelease)
+ if (item == NULL && ev.type == ButtonRelease)
{
menu_hide_all ();
return 0;
}
else
{
- switch (ev->type)
+ switch (ev.type)
{
case ButtonRelease:
switch (item->entry.type)
case MenuAction:
case MenuTerminalAction:
- drawbox_menuitem (_y, -1);
+ drawbox_menuitem (this_y, -1);
{
#ifdef HAVE_NANOSLEEP
struct timespec rqt;
drawtriangle (ActiveMenu->w, y, -1);
- x = ev->x + (ActiveMenu->parent
+ x = ev.x + (ActiveMenu->parent
? ActiveMenu->x
: Width2Pixel (ActiveMenu->x));
}
void
-rxvt_term::menubar_select (XButtonEvent *ev)
+rxvt_term::menubar_select (XButtonEvent &ev)
{
menu_t *menu = NULL;
/* determine the pulldown menu corresponding to the X index */
- if (ev->y >= 0 && ev->y <= menuBar_height () && CurrentBar != NULL)
+ if (ev.y >= 0 && ev.y <= menuBar_height () && CurrentBar != NULL)
{
for (menu = CurrentBar->head; menu != NULL; menu = menu->next)
{
int x = Width2Pixel (menu->x);
int w = Width2Pixel (menu->len + HSPACE);
- if ((ev->x >= x && ev->x < x + w))
+ if ((ev.x >= x && ev.x < x + w))
break;
}
}
- switch (ev->type)
+ switch (ev.type)
{
case ButtonRelease:
menu_hide_all ();
break;
case ButtonPress:
- if (menu == NULL && Arrows_x && ev->x >= Arrows_x)
+ if (menu == NULL && Arrows_x && ev.x >= Arrows_x)
{
int i;
for (i = 0; i < NARROWS; i++)
{
- if (ev->x >= (Arrows_x + (Width2Pixel (4 * i + i)) / 4)
- && ev->x < (Arrows_x
+ if (ev.x >= (Arrows_x + (Width2Pixel (4 * i + i)) / 4)
+ && ev.x < (Arrows_x
+ (Width2Pixel (4 * i + i + 4)) / 4))
{
draw_Arrows (Arrows[i].name, -1);
CurrentBar->arrows[i].str);
}
#else /* DEBUG_MENUARROWS */
- if (CurrentBar == NULL
- || rxvt_action_dispatch (r,
- & (CurrentBar->arrows[i]))
- )
+ if (CurrentBar == NULL || action_dispatch (&CurrentBar->arrows[i]))
{
if (Arrows[i].str != NULL && Arrows[i].str[0] != 0)
tt_write ((Arrows[i].str + 1),
* it would be nice to have `sticky' menus
*/
void
-rxvt_term::menubar_control (XButtonEvent *ev)
+rxvt_term::menubar_control (XButtonEvent &ev)
{
- switch (ev->type)
+ switch (ev.type)
{
case ButtonPress:
- if (ev->button == Button1)
+ if (ev.button == Button1)
menubar_select (ev);
break;
case ButtonRelease:
- if (ev->button == Button1)
+ if (ev.button == Button1)
menu_select (ev);
break;
case MotionNotify:
while (XCheckTypedWindowEvent (display->display, TermWin.parent[0],
- MotionNotify, (XEvent *) ev)) ;
+ MotionNotify, (XEvent *)&ev)) ;
if (ActiveMenu)
while (menu_select (ev)) ;
else
- ev->y = -1;
- if (ev->y < 0)
+ ev.y = -1;
+ if (ev.y < 0)
{
Window unused_root, unused_child;
int unused_root_x, unused_root_y;
XQueryPointer (display->display, menuBar.win,
&unused_root, &unused_child,
&unused_root_x, &unused_root_y,
- & (ev->x), & (ev->y), &unused_mask);
+ &ev.x, &ev.y, &unused_mask);
menubar_select (ev);
}
break;
void lookup_key (XKeyEvent &ev);
unsigned int cmd_write (const unsigned char *str, unsigned int count);
uint32_t cmd_getc ();
- void mouse_report (const XButtonEvent &ev);
- void button_press (const XButtonEvent &ev);
- void button_release (const XButtonEvent &ev);
+ void mouse_report (XButtonEvent &ev);
+ void button_press (XButtonEvent &ev);
+ void button_release (XButtonEvent &ev);
int check_our_parents ();
#ifdef PRINTPIPE
FILE *popen_printer ();
int action_dispatch (action_t *action);
void menuarrow_free (char name);
void menuarrow_add (char *string);
- char * menu_find_base (menu_t **menu, char *path);
- menu_t * menu_delete (menu_t *menu);
- menu_t * menu_add (menu_t *parent, char *path);
+ char *menu_find_base (menu_t **menu, char *path);
+ menu_t *menu_delete (menu_t *menu);
+ menu_t *menu_add (menu_t *parent, char *path);
void drawbox_menubar (int x, int len, int state);
void drawtriangle (int x, int y, int state);
void drawbox_menuitem (int y, int state);
void menu_show ();
- void menu_display (void (*update) (rxvt_t *));
+ void menu_display (void (rxvt_term::*update) ());
void menu_hide_all ();
void menu_hide ();
void menu_clear (menu_t *menu);
void menubar_clear ();
- bar_t * menubar_find (const char *name);
+ bar_t *menubar_find (const char *name);
int menubar_push (const char *name);
void menubar_remove (const char *name);
void menubar_dump (FILE *fp);
void draw_Arrows (int name, int state);
void menubar_expose ();
int menubar_mapping (int map);
- int menu_select (XButtonEvent *ev);
- void menubar_select (XButtonEvent *ev);
- void menubar_control (XButtonEvent *ev);
+ int menu_select (XButtonEvent &ev);
+ void menubar_select (XButtonEvent &ev);
+ void menubar_control (XButtonEvent &ev);
void map_menuBar (int map);
#endif