1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

- Fixed empty window list menu, if the window list menu was launched through

the root menu ("Marc-Christian Petersen" <m.c.p@wolk-project.de>)
- A small fix for wmtableview when computing visible columns.
This commit is contained in:
dan
2002-09-11 15:02:43 +00:00
parent d4de3d0a45
commit 851835c7a5
6 changed files with 70 additions and 43 deletions

View File

@@ -1,3 +1,11 @@
Changes since version 0.80.1:
.............................
- Some updates to WINGs WMConnection. See WINGs/ChangeLog for details.
- Fixed empty window list menu, if the window list menu was launched through
the root menu ("Marc-Christian Petersen" <m.c.p@wolk-project.de>)
Changes since version 0.80.0:
.............................

View File

@@ -846,27 +846,28 @@ static void drawGrid(WMTableView *table, WMRect rect)
static WMRange columnsInRect(WMTableView *table, WMRect rect)
{
WMTableColumn *column;
int width;
int i , j;
int pos;
int i, found;
int totalColumns = WMGetArrayItemCount(table->columns);
WMRange range;
j = 0;
width = 0;
pos = 0;
found = 0;
for (i = 0; i < totalColumns; i++) {
column = WMGetFromArray(table->columns, i);
if (j == 0) {
if (width <= rect.pos.x && width + column->width > rect.pos.x) {
range.position = i;
j = 1;
if (!found) {
if (rect.pos.x >= pos && rect.pos.x < pos + column->width) {
range.position = i;
range.count = 1;
found = 1;
}
} else {
if (pos > rect.pos.x + rect.size.width) {
break;
}
range.count++;
if (width > rect.pos.x + rect.size.width) {
break;
}
}
width += column->width;
pos += column->width;
}
range.count = WMAX(1, WMIN(range.count, totalColumns - range.position));
return range;

View File

@@ -57,6 +57,8 @@ void OpenRootMenu(WScreen *scr, int x, int y, int keyboard);
void OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard);
void InitializeSwitchMenu(void);
#endif /* !LITE */

View File

@@ -951,6 +951,10 @@ StartUp(Bool defaultScreenOnly)
wScreenCount++;
}
#ifndef LITE
InitializeSwitchMenu();
#endif
/* initialize/restore state for the screens */
for (j = 0; j < wScreenCount; j++) {
int crashed;

View File

@@ -46,6 +46,9 @@ extern WPreferences wPreferences;
extern Time LastTimestamp;
static int initialized = 0;
static void observer(void *self, WMNotification *notif);
static void wsobserver(void *self, WMNotification *notif);
@@ -85,6 +88,27 @@ focusWindow(WMenu *menu, WMenuEntry *entry)
}
}
void
InitializeSwitchMenu()
{
if (!initialized) {
initialized = 1;
WMAddNotificationObserver(observer, NULL, WMNManaged, NULL);
WMAddNotificationObserver(observer, NULL, WMNUnmanaged, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedWorkspace, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedState, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedFocus, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedStacking, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedName, NULL);
WMAddNotificationObserver(wsobserver, NULL, WMNWorkspaceChanged, NULL);
WMAddNotificationObserver(wsobserver, NULL, WMNWorkspaceNameChanged, NULL);
}
}
/*
*
* Open switch menu
@@ -95,22 +119,6 @@ OpenSwitchMenu(WScreen *scr, int x, int y, int keyboard)
{
WMenu *switchmenu = scr->switch_menu;
WWindow *wwin;
static int initialized = 0;
if (!initialized) {
initialized = 1;
WMAddNotificationObserver(observer, NULL, WMNManaged, NULL);
WMAddNotificationObserver(observer, NULL, WMNUnmanaged, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedWorkspace, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedState, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedFocus, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedStacking, NULL);
WMAddNotificationObserver(observer, NULL, WMNChangedName, NULL);
WMAddNotificationObserver(wsobserver, NULL, WMNWorkspaceChanged, NULL);
WMAddNotificationObserver(wsobserver, NULL, WMNWorkspaceNameChanged, NULL);
}
if (switchmenu) {
if (switchmenu->flags.mapped) {
@@ -400,24 +408,27 @@ UpdateSwitchMenuWorkspace(WScreen *scr, int workspace)
}
static void observer(void *self, WMNotification *notif)
static void
observer(void *self, WMNotification *notif)
{
WWindow *wwin = (WWindow*)WMGetNotificationObject(notif);
const char *name = WMGetNotificationName(notif);
void *data = WMGetNotificationClientData(notif);
if (strcmp(name, WMNManaged) == 0 && wwin)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_ADD);
else if (strcmp(name, WMNUnmanaged) == 0 && wwin)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_REMOVE);
else if (strcmp(name, WMNChangedWorkspace) == 0 && wwin)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_WORKSPACE);
else if (strcmp(name, WMNChangedFocus) == 0 && wwin)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
else if (strcmp(name, WMNChangedName) == 0 && wwin)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE);
else if (strcmp(name, WMNChangedState) == 0 && wwin) {
if (!wwin)
return;
if (strcmp(name, WMNManaged) == 0)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_ADD);
else if (strcmp(name, WMNUnmanaged) == 0)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_REMOVE);
else if (strcmp(name, WMNChangedWorkspace) == 0)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_WORKSPACE);
else if (strcmp(name, WMNChangedFocus) == 0)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_STATE);
else if (strcmp(name, WMNChangedName) == 0)
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE);
else if (strcmp(name, WMNChangedState) == 0) {
if (strcmp((char*)data, "omnipresent") == 0) {
UpdateSwitchMenu(wwin->screen_ptr, wwin, ACTION_CHANGE_WORKSPACE);
} else {
@@ -427,7 +438,8 @@ static void observer(void *self, WMNotification *notif)
}
static void wsobserver(void *self, WMNotification *notif)
static void
wsobserver(void *self, WMNotification *notif)
{
WScreen *scr = (WScreen*)WMGetNotificationObject(notif);
const char *name = WMGetNotificationName(notif);