diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-01-12 23:22:15 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2010-01-12 23:22:15 +0000 |
commit | 6ee254699bf787d78835419be2b3241fb037d444 (patch) | |
tree | 07fe67dab517e4990f344fe2c00e65cef4d25b81 /lib/libmenu/m_cursor.c | |
parent | 0b62f5dc36fc7203a74cdc812c4234ae188fdfd2 (diff) |
Update to ncurses 5.7, with local changes reapplied.
This is around eight years worth of changes (previously we were around ncurses
5.2), too many to list - many bug fixes and also a few new functions.
A major bump for libcurses, libpanel, libform and libmenu.
ok deraadt
Diffstat (limited to 'lib/libmenu/m_cursor.c')
-rw-r--r-- | lib/libmenu/m_cursor.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/libmenu/m_cursor.c b/lib/libmenu/m_cursor.c index 4562a46efec..a9bf98c5172 100644 --- a/lib/libmenu/m_cursor.c +++ b/lib/libmenu/m_cursor.c @@ -1,7 +1,7 @@ -/* $OpenBSD: m_cursor.c,v 1.7 2001/01/22 18:02:03 millert Exp $ */ +/* $OpenBSD: m_cursor.c,v 1.8 2010/01/12 23:22:07 nicm Exp $ */ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,17 +29,17 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 * + * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ /*************************************************************************** * Module m_cursor * -* Correctly position a menus cursor * +* Correctly position a menu's cursor * ***************************************************************************/ #include "menu.priv.h" -MODULE_ID("$From: m_cursor.c,v 1.14 2000/12/10 02:16:48 tom Exp $") +MODULE_ID("$Id: m_cursor.c,v 1.8 2010/01/12 23:22:07 nicm Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -52,24 +52,23 @@ MODULE_ID("$From: m_cursor.c,v 1.14 2000/12/10 02:16:48 tom Exp $") | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_menu_cursor_pos -(const MENU* menu, const ITEM* item, int* pY, int* pX) +_nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX) { if (!menu || !pX || !pY) - return(E_BAD_ARGUMENT); + return (E_BAD_ARGUMENT); else { - if ((ITEM*)0 == item) + if ((ITEM *) 0 == item) item = menu->curitem; - assert(item!=(ITEM*)0); + assert(item != (ITEM *) 0); - if ( !( menu->status & _POSTED ) ) - return(E_NOT_POSTED); + if (!(menu->status & _POSTED)) + return (E_NOT_POSTED); *pX = item->x * (menu->spc_cols + menu->itemlen); *pY = (item->y - menu->toprow) * menu->spc_rows; } - return(E_OK); + return (E_OK); } /*--------------------------------------------------------------------------- @@ -83,24 +82,26 @@ _nc_menu_cursor_pos | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -pos_menu_cursor (const MENU * menu) +pos_menu_cursor(const MENU * menu) { WINDOW *win, *sub; - int x, y; - int err = _nc_menu_cursor_pos(menu,(ITEM*)0,&y,&x); + int x = 0, y = 0; + int err = _nc_menu_cursor_pos(menu, (ITEM *) 0, &y, &x); - if (E_OK==err) + T((T_CALLED("pos_menu_cursor(%p)"), menu)); + + if (E_OK == err) { win = menu->userwin ? menu->userwin : stdscr; sub = menu->usersub ? menu->usersub : win; assert(win && sub); if ((menu->opt & O_SHOWMATCH) && (menu->pindex > 0)) - x += ( menu->pindex + menu->marklen - 1); + x += (menu->pindex + menu->marklen - 1); - wmove(sub,y,x); + wmove(sub, y, x); - if ( win != sub ) + if (win != sub) { wcursyncup(sub); wsyncup(sub); |