Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: Tag: branch-exp E.h Makefile.am desktops.c ecore-e16.c ecore-e16.h eobj.c ewin-ops.c ewins.c icccm.c iconify.c moveresize.c Removed Files: Tag: branch-exp mod-desks.c Log Message: Shuffle some code around, systray and floating window fixes. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.314.2.77 retrieving revision 1.314.2.78 diff -u -3 -r1.314.2.77 -r1.314.2.78 --- E.h 26 Dec 2004 15:58:14 -0000 1.314.2.77 +++ E.h 27 Dec 2004 11:14:38 -0000 1.314.2.78 @@ -584,7 +584,7 @@ #define EoSetW(eo, _w) (eo)->o.w = (_w) #define EoSetH(eo, _h) (eo)->o.h = (_h) #define EoSetSticky(eo, _x) (eo)->o.sticky = ((_x)?1:0) -#define EoSetFloating(eo, _x) (eo)->o.floating = (_x) +#define EoSetFloating(eo, _f) EobjSetFloating(&((eo)->o), (_f)) #define EoSetDesk(eo, _d) EobjSetDesk(&((eo)->o), (_d)) #define EoSetLayer(eo, _l) EobjSetLayer(&((eo)->o), (_l)) #if USE_COMPOSITE @@ -1460,7 +1460,6 @@ void DesktopsRefresh(void); void InitDesktopControls(void); void DesktopSetBg(int desk, Background * bg, int refresh); -void ConformEwinToDesktop(EWin * ewin); int DesktopAt(int x, int y); void GotoDesktop(int num); void MoveDesktop(int num, int x, int y); @@ -1607,6 +1606,7 @@ int EobjGetDesk(const EObj * eo); int EobjSetDesk(EObj * eo, int desk); void EobjSetLayer(EObj * eo, int layer); +void EobjSetFloating(EObj * eo, int floating); /* events.c */ /* Re-mapped X-events */ @@ -1670,6 +1670,7 @@ void *ptr, void (*init) (EWin * ewin, void *ptr)); void EwinWithdraw(EWin * ewin); +void EwinConformToDesktop(EWin * ewin); void EwinReparent(EWin * ewin, Window parent); void SyncBorderToEwin(EWin * ewin); Window EwinGetClientWin(const EWin * ewin); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v retrieving revision 1.43.2.26 retrieving revision 1.43.2.27 diff -u -3 -r1.43.2.26 -r1.43.2.27 --- Makefile.am 15 Dec 2004 22:17:09 -0000 1.43.2.26 +++ Makefile.am 27 Dec 2004 11:14:38 -0000 1.43.2.27 @@ -1,6 +1,6 @@ SUBDIRS = -EXTRA_DIST = ewmh.c gnome.c ecompmgr.c snprintf.c +EXTRA_DIST = ewmh.c gnome.c ecompmgr.c ecompmgr.h snprintf.c bin_PROGRAMS = e16 @@ -14,11 +14,10 @@ SRCS_SNPRINTF = snprintf.c endif if HAS_COMPOSITE -SRCS_ECOMPMGR = ecompmgr.c +SRCS_ECOMPMGR = ecompmgr.c ecompmgr.h endif e16_SOURCES = \ E.h \ - ecompmgr.h \ econfig.h \ ecore-e16.h \ emodule.h \ @@ -70,7 +69,6 @@ menus.c \ menus-misc.c \ misc.c \ - mod-desks.c \ mod-misc.c \ mod-trans.c \ moveresize.c \ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v retrieving revision 1.95.2.33 retrieving revision 1.95.2.34 diff -u -3 -r1.95.2.33 -r1.95.2.34 --- desktops.c 26 Dec 2004 15:58:15 -0000 1.95.2.33 +++ desktops.c 27 Dec 2004 11:14:38 -0000 1.95.2.34 @@ -1,5 +1,6 @@ /* * Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors + * Copyright (C) 2004 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -693,58 +694,6 @@ EDBUG_RETURN_; } -void -ConformEwinToDesktop(EWin * ewin) -{ - int xo, yo; - Desk *dt; - - EDBUG(3, "ConformEwinToDesktop"); - - dt = desks.desk + EoGetDesk(ewin); - if ((ewin->iconified) && (ewin->parent != dt->win)) - { - ewin->parent = dt->win; - EwinListStackRaise(ewin); - EReparentWindow(disp, EoGetWin(ewin), dt->win, EoGetX(ewin), - EoGetY(ewin)); - ICCCM_Configure(ewin); - StackDesktop(EoGetDesk(ewin)); - } - else if (EoIsFloating(ewin)) - { - xo = dt->x; - yo = dt->y; - if ((ewin->parent != VRoot.win) && (EoIsFloating(ewin) == 2)) - { - ewin->parent = VRoot.win; - EReparentWindow(disp, EoGetWin(ewin), VRoot.win, EoGetX(ewin), - EoGetY(ewin)); - EoSetDesk(ewin, 0); - } - EwinListStackRaise(ewin); - StackDesktop(EoGetDesk(ewin)); - EdgeWindowsShow(); - ICCCM_Configure(ewin); - } - else if (ewin->parent != dt->win) - { - ewin->parent = dt->win; - EwinListStackRaise(ewin); - EReparentWindow(disp, EoGetWin(ewin), dt->win, EoGetX(ewin), - EoGetY(ewin)); - StackDesktop(EoGetDesk(ewin)); - MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin)); - } - else - { - MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin)); - } - EwinDetermineArea(ewin); - HintsSetWindowDesktop(ewin); - EDBUG_RETURN_; -} - int DesktopAt(int x, int y) { @@ -1259,31 +1208,6 @@ } } -#if 0 /* Unused */ -void -FloatEwinAboveDesktops(EWin * ewin) -{ - EWin **lst; - int i, num; - int xo, yo; - Desk *dt; - - dt = desks.desk + EoGetDesk(ewin); - - xo = dt->x; - yo = dt->y; - EoSetDesk(ewin, 0); - EoSetFloating(ewin, 1); - ConformEwinToDesktop(ewin); - - lst = EwinListTransients(ewin, &num, 0); - for (i = 0; i < num; i++) - FloatEwinAboveDesktops(lst[i]); - if (lst) - Efree(lst); -} -#endif - void DesktopsEventsConfigure(int mode) { @@ -1560,3 +1484,665 @@ return 0; } #endif + +/* + * Desktops Module + */ + +static void +DesktopsSighan(int sig, void *prm __UNUSED__) +{ + switch (sig) + { + case ESIGNAL_INIT: + DesktopsInit(); + break; + + case ESIGNAL_CONFIGURE: + SetAreaSize(Conf.areas.nx, Conf.areas.ny); + + DeskSetViewable(0, 1); + RefreshDesktop(0); + + /* toss down the dragbar and related */ + InitDesktopControls(); + + /* then draw all the buttons that belong on the desktop */ + ShowDesktopButtons(); + + ShowDesktopControls(); + break; + } +} + +/* + * Dialodgs + */ +static int tmp_desktops; +static DItem *tmp_desk_text; +static Dialog *tmp_desk_dialog; +static char tmp_desktop_wraparound; + +static void +CB_ConfigureDesktops(Dialog * d __UNUSED__, int val, void *data __UNUSED__) +{ + if (val < 2) + { + ChangeNumberOfDesktops(tmp_desktops); + Conf.desks.wraparound = tmp_desktop_wraparound; + } + autosave(); +} + +static void +CB_DesktopDisplayRedraw(Dialog * d __UNUSED__, int val, void *data) +{ + static char called = 0; + DItem *di; + static Window win, wins[ENLIGHTENMENT_CONF_NUM_DESKTOPS]; + int i; + int w, h; + static int prev_desktops = -1; + char s[64]; + + if (val == 1) + called = 0; + + if ((val != 1) && (prev_desktops == tmp_desktops)) + return; + prev_desktops = tmp_desktops; + di = (DItem *) data; + win = DialogItemAreaGetWindow(di); + DialogItemAreaGetSize(di, &w, &h); + if (!called) + { + ImageClass *ic; + + ic = ImageclassFind("SETTINGS_DESKTOP_AREA", 0); + if (ic) + ImageclassApply(ic, win, w, h, 0, 0, STATE_NORMAL, 0, ST_UNKNWN); + for (i = 0; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++) + wins[i] = 0; + called = 1; + } + for (i = 0; i < tmp_desktops; i++) + { + if (!wins[i]) + { + wins[i] = ECreateWindow(win, 0, 0, 64, 48, 0); + XSetWindowBorderWidth(disp, wins[i], 1); + if (DeskGetBackground(i)) + { + Pixmap pmap; + + pmap = ecore_x_pixmap_new(wins[i], 64, 48, VRoot.depth); + ESetWindowBackgroundPixmap(disp, wins[i], pmap); + BackgroundApply(DeskGetBackground(i), pmap, 0); + ecore_x_pixmap_del(pmap); + } + } + } + for (i = (tmp_desktops - 1); i >= 0; i--) + { + int num; + + num = tmp_desktops - 1; + if (num < 1) + num = 1; + XRaiseWindow(disp, wins[i]); + EMoveWindow(disp, wins[i], (i * (w - 64 - 2)) / num, + (i * (h - 48 - 2)) / num); + EMapWindow(disp, wins[i]); + } + for (i = tmp_desktops; i < ENLIGHTENMENT_CONF_NUM_DESKTOPS; i++) + EUnmapWindow(disp, wins[i]); + if (tmp_desktops > 1) + Esnprintf(s, sizeof(s), _("%i Desktops"), tmp_desktops); + else + Esnprintf(s, sizeof(s), _("%i Desktop"), tmp_desktops); + DialogItemTextSetText(tmp_desk_text, s); + DialogDrawItems(tmp_desk_dialog, tmp_desk_text, 0, 0, 99999, 99999); +} + +void +SettingsDesktops(void) +{ + Dialog *d; + DItem *table, *di, *area, *slider; + char s[64]; + + if ((d = + FindItem("CONFIGURE_DESKTOPS", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG))) + { + SoundPlay("SOUND_SETTINGS_ACTIVE"); + ShowDialog(d); + return; + } + SoundPlay("SOUND_SETTINGS_DESKTOPS"); + + tmp_desktops = Conf.desks.num; + tmp_desktop_wraparound = Conf.desks.wraparound; + + d = tmp_desk_dialog = DialogCreate("CONFIGURE_DESKTOPS"); + DialogSetTitle(d, _("Multiple Desktop Settings")); + + table = DialogInitItem(d); + DialogItemTableSetOptions(table, 2, 0, 0, 0); + + if (Conf.dialogs.headers) + { + di = DialogAddItem(table, DITEM_IMAGE); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemImageSetFile(di, "pix/desktops.png"); + + di = DialogAddItem(table, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemTextSetText(di, + _("Enlightenment Multiple Desktop\n" + "Settings Dialog\n")); + + di = DialogAddItem(table, DITEM_SEPARATOR); + DialogItemSetColSpan(di, 2); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSeparatorSetOrientation(di, 0); + } + + di = DialogAddItem(table, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSetColSpan(di, 2); + DialogItemTextSetText(di, _("Number of virtual desktops:\n")); + + di = tmp_desk_text = DialogAddItem(table, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSetColSpan(di, 2); + if (tmp_desktops > 1) + Esnprintf(s, sizeof(s), _("%i Desktops"), tmp_desktops); + else + Esnprintf(s, sizeof(s), _("%i Desktop"), tmp_desktops); + DialogItemTextSetText(di, s); + + di = slider = DialogAddItem(table, DITEM_SLIDER); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSliderSetBounds(di, 1, 32); + DialogItemSliderSetUnits(di, 1); + DialogItemSliderSetJump(di, 1); + DialogItemSetColSpan(di, 2); + DialogItemSliderSetVal(di, tmp_desktops); + DialogItemSliderSetValPtr(di, &tmp_desktops); + + di = area = DialogAddItem(table, DITEM_AREA); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSetColSpan(di, 2); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemAreaSetSize(di, 128, 96); + + di = DialogAddItem(table, DITEM_SEPARATOR); + DialogItemSetColSpan(di, 2); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSeparatorSetOrientation(di, 0); + + di = DialogAddItem(table, DITEM_CHECKBUTTON); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSetColSpan(di, 2); + DialogItemCheckButtonSetText(di, _("Wrap desktops around")); + DialogItemCheckButtonSetState(di, tmp_desktop_wraparound); + DialogItemCheckButtonSetPtr(di, &tmp_desktop_wraparound); + + di = DialogAddItem(table, DITEM_SEPARATOR); + DialogItemSetColSpan(di, 2); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSeparatorSetOrientation(di, 0); + + DialogAddButton(d, _("OK"), CB_ConfigureDesktops, 1); + DialogAddButton(d, _("Apply"), CB_ConfigureDesktops, 0); + DialogAddButton(d, _("Close"), CB_ConfigureDesktops, 1); + DialogSetExitFunction(d, CB_ConfigureDesktops, 2); + DialogBindKey(d, "Escape", DialogCallbackClose, 0); + DialogBindKey(d, "Return", CB_ConfigureDesktops, 0); + ShowDialog(d); + DialogItemSetCallback(slider, CB_DesktopDisplayRedraw, 0, (void *)area); + CB_DesktopDisplayRedraw(d, 1, area); +} + +static int tmp_area_x; +static int tmp_area_y; +static int tmp_edge_resist; +static char tmp_edge_flip; +static DItem *tmp_area_text; +static Dialog *tmp_area_dialog; +static char tmp_area_wraparound; + +static void +CB_ConfigureAreas(Dialog * d __UNUSED__, int val, void *data __UNUSED__) +{ + if (val < 2) + { + SetNewAreaSize(tmp_area_x, 9 - tmp_area_y); + Conf.areas.wraparound = tmp_area_wraparound; + if (tmp_edge_flip) + { + if (tmp_edge_resist < 1) + tmp_edge_resist = 1; + Conf.edge_flip_resistance = tmp_edge_resist; + } + else + Conf.edge_flip_resistance = 0; + EdgeWindowsShow(); + } + autosave(); +} + +static void +CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data) +{ + char s[64]; + static char called = 0; + DItem *di; + static Window win, awin; + int w, h; + static int prev_ax = 0, prev_ay = 0; + + if (val == 1) + called = 0; + + if ((val != 1) && ((prev_ax == tmp_area_x) && (prev_ay == tmp_area_y))) + return; + prev_ax = tmp_area_x; + prev_ay = tmp_area_y; + di = (DItem *) data; + win = DialogItemAreaGetWindow(di); + DialogItemAreaGetSize(di, &w, &h); + if (!called) + { + ImageClass *ic; + PmapMask pmm; + + ic = ImageclassFind("SETTINGS_AREA_AREA", 0); + if (ic) + ImageclassApply(ic, win, w, h, 0, 0, STATE_NORMAL, 0, ST_UNKNWN); + awin = ECreateWindow(win, 0, 0, 18, 14, 0); + ic = ImageclassFind("SETTINGS_AREADESK_AREA", 0); + if (ic) + { + ImageclassApplyCopy(ic, awin, 18, 14, 0, 0, STATE_NORMAL, &pmm, 0, + ST_UNKNWN); + ESetWindowBackgroundPixmap(disp, awin, pmm.pmap); + FreePmapMask(&pmm); + } + XClearWindow(disp, awin); + called = 1; + } + EMoveResizeWindow(disp, awin, ((w / 2) - (9 * tmp_area_x)), + ((h / 2) - (7 * (9 - tmp_area_y))), 18 * tmp_area_x, + 14 * (9 - tmp_area_y)); + EMapWindow(disp, awin); + + if ((tmp_area_x > 1) || ((9 - tmp_area_y) > 1)) + Esnprintf(s, sizeof(s), _("%i x %i\nScreens in size"), tmp_area_x, + 9 - tmp_area_y); + else + Esnprintf(s, sizeof(s), _("1\nScreen in size")); + DialogItemTextSetText(tmp_area_text, s); + DialogDrawItems(tmp_area_dialog, tmp_area_text, 0, 0, 99999, 99999); +} + +void +SettingsArea(void) +{ + Dialog *d; + DItem *table, *di, *area, *slider, *slider2, *table2; + char s[64]; + + if ((d = FindItem("CONFIGURE_AREA", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG))) + { + SoundPlay("SOUND_SETTINGS_ACTIVE"); + ShowDialog(d); + return; + } + SoundPlay("SOUND_SETTINGS_AREA"); + + tmp_area_wraparound = Conf.areas.wraparound; + tmp_edge_resist = Conf.edge_flip_resistance; + if (tmp_edge_resist == 0) + tmp_edge_flip = 0; + else + tmp_edge_flip = 1; + GetAreaSize(&tmp_area_x, &tmp_area_y); + tmp_area_y = 9 - tmp_area_y; + + d = tmp_area_dialog = DialogCreate("CONFIGURE_AREA"); + DialogSetTitle(d, _("Virtual Desktop Settings")); + + table = DialogInitItem(d); + DialogItemTableSetOptions(table, 1, 0, 0, 0); + + if (Conf.dialogs.headers) + { + table2 = DialogAddItem(table, DITEM_TABLE); + DialogItemTableSetOptions(table2, 2, 0, 0, 0); + + di = DialogAddItem(table2, DITEM_IMAGE); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemImageSetFile(di, "pix/areas.png"); + + di = DialogAddItem(table2, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemTextSetText(di, + _("Enlightenment Virtual Desktop\n" + "Settings Dialog\n")); + + di = DialogAddItem(table, DITEM_SEPARATOR); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSeparatorSetOrientation(di, 0); + } + + di = DialogAddItem(table, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemTextSetText(di, _("Virtual Desktop size:\n")); + + di = tmp_area_text = DialogAddItem(table, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + if ((tmp_area_x > 1) || (tmp_area_y > 1)) + Esnprintf(s, sizeof(s), _("%i x %i\nScreens in size"), tmp_area_x, + 9 - tmp_area_y); + else + Esnprintf(s, sizeof(s), _("1\nScreen in size")); + DialogItemTextSetText(di, s); + + table2 = DialogAddItem(table, DITEM_TABLE); + DialogItemTableSetOptions(table2, 2, 0, 0, 0); + + di = DialogAddItem(table2, DITEM_NONE); + + di = slider = DialogAddItem(table2, DITEM_SLIDER); + DialogItemSliderSetMinLength(di, 10); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSliderSetBounds(di, 1, 8); + DialogItemSliderSetUnits(di, 1); + DialogItemSliderSetJump(di, 1); + DialogItemSliderSetVal(di, tmp_area_x); + DialogItemSliderSetValPtr(di, &tmp_area_x); + + di = slider2 = DialogAddItem(table2, DITEM_SLIDER); + DialogItemSliderSetMinLength(di, 10); + DialogItemSliderSetOrientation(di, 0); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 0, 1); + DialogItemSliderSetBounds(di, 1, 8); + DialogItemSliderSetUnits(di, 1); + DialogItemSliderSetJump(di, 1); + DialogItemSliderSetVal(di, tmp_area_y); + DialogItemSliderSetValPtr(di, &tmp_area_y); + + di = area = DialogAddItem(table2, DITEM_AREA); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemAreaSetSize(di, 160, 120); + + DialogItemSetCallback(slider, CB_AreaDisplayRedraw, 0, (void *)area); + DialogItemSetCallback(slider2, CB_AreaDisplayRedraw, 0, (void *)area); + + di = DialogAddItem(table, DITEM_SEPARATOR); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSeparatorSetOrientation(di, 0); + + di = DialogAddItem(table, DITEM_CHECKBUTTON); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemCheckButtonSetText(di, _("Wrap virtual desktops around")); + DialogItemCheckButtonSetState(di, tmp_area_wraparound); + DialogItemCheckButtonSetPtr(di, &tmp_area_wraparound); + + di = DialogAddItem(table, DITEM_CHECKBUTTON); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemCheckButtonSetText(di, _("Enable edge flip")); + DialogItemCheckButtonSetState(di, tmp_edge_flip); + DialogItemCheckButtonSetPtr(di, &tmp_edge_flip); + + di = DialogAddItem(table, DITEM_TEXT); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemTextSetText(di, _("Resistance at edge of screen:\n")); + + di = slider = DialogAddItem(table, DITEM_SLIDER); + DialogItemSliderSetMinLength(di, 10); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSliderSetBounds(di, 1, 100); + DialogItemSliderSetUnits(di, 1); + DialogItemSliderSetJump(di, 10); + DialogItemSliderSetVal(di, tmp_edge_resist); + DialogItemSliderSetValPtr(di, &tmp_edge_resist); + + di = DialogAddItem(table, DITEM_SEPARATOR); + DialogItemSetPadding(di, 2, 2, 2, 2); + DialogItemSetFill(di, 1, 0); + DialogItemSeparatorSetOrientation(di, 0); + + DialogAddButton(d, _("OK"), CB_ConfigureAreas, 1); + DialogAddButton(d, _("Apply"), CB_ConfigureAreas, 0); + DialogAddButton(d, _("Close"), CB_ConfigureAreas, 1); + DialogSetExitFunction(d, CB_ConfigureAreas, 2); + DialogBindKey(d, "Escape", DialogCallbackClose, 0); + DialogBindKey(d, "Return", CB_ConfigureAreas, 0); + ShowDialog(d); + CB_AreaDisplayRedraw(d, 1, area); +} + +/* + * IPC functions + */ + +static void +DesktopOpGoto(int desk) +{ + int pd = DesksGetCurrent(); + + GotoDesktop(desk); + + if (DesksGetCurrent() != pd) + SoundPlay("SOUND_DESKTOP_SHUT"); +} + +static void +DesktopOpDrag(int desk) +{ + DeskDragStart(desk); +} + +static void +DesktopsIpcDesk(const char *params, Client * c __UNUSED__) +{ + const char *p; + char cmd[128], prm[128]; + int len; + int desk; + + cmd[0] = prm[0] = '\0'; + p = params; + if (p) + { + len = 0; + sscanf(p, "%100s %100s %n", cmd, prm, &len); + p += len; + } + + desk = DesksGetCurrent(); + + if (!p || cmd[0] == '?') + { + IpcPrintf("Current Desktop: %d\n", desk); + } + else if (!strncmp(cmd, "cfg", 3)) + { + SettingsDesktops(); + } + else if (!strncmp(cmd, "set", 3)) + { + sscanf(prm, "%i", &desk); + ChangeNumberOfDesktops(desk); + } + else if (!strncmp(cmd, "goto", 2)) + { + sscanf(prm, "%i", &desk); + DesktopOpGoto(desk); + } + else if (!strncmp(cmd, "next", 2)) + { + DesktopOpGoto(DesksGetCurrent() + 1); + } + else if (!strncmp(cmd, "prev", 2)) + { + DesktopOpGoto(DesksGetCurrent() - 1); + } + else if (!strncmp(cmd, "this", 2)) + { + DesktopOpGoto(DesksGetCurrent()); + } + else if (!strncmp(cmd, "raise", 2)) + { + sscanf(prm, "%i", &desk); + SoundPlay("SOUND_DESKTOP_RAISE"); + RaiseDesktop(desk); + } + else if (!strncmp(cmd, "lower", 2)) + { + sscanf(prm, "%i", &desk); + SoundPlay("SOUND_DESKTOP_LOWER"); + LowerDesktop(desk); + } + else if (!strncmp(cmd, "drag", 2)) + { + if (prm[0]) + desk = atoi(prm); + DesktopOpDrag(desk); + } +} + +static void +DesktopsIpcArea(const char *params, Client * c __UNUSED__) +{ + const char *p; + char cmd[128], prm[128]; + int len; + int ax, ay, dx, dy; + + cmd[0] = prm[0] = '\0'; + p = params; + if (p) + { + len = 0; + sscanf(p, "%100s %100s %n", cmd, prm, &len); + p += len; + } + + DeskGetCurrentArea(&ax, &ay); + + if (!p || cmd[0] == '?') + { + IpcPrintf("Current Area: %d %d\n", ax, ay); + } + else if (!strncmp(cmd, "cfg", 3)) + { + SettingsArea(); + } + else if (!strncmp(cmd, "set", 3)) + { + sscanf(params, "%*s %i %i", &ax, &ay); + SetNewAreaSize(ax, ay); + } + else if (!strncmp(cmd, "goto", 2)) + { + sscanf(params, "%*s %i %i", &ax, &ay); + SetCurrentArea(ax, ay); + } + else if (!strncmp(cmd, "move", 2)) + { + dx = dy = 0; + sscanf(params, "%*s %i %i", &dx, &dy); + MoveCurrentAreaBy(dx, dy); + } + else if (!strncmp(cmd, "lgoto", 2)) + { + sscanf(params, "%*s %i", &ax); + SetCurrentLinearArea(ax); + } + else if (!strncmp(cmd, "lmove", 2)) + { + dx = 0; + sscanf(params, "%*s %i", &dx); + MoveCurrentLinearAreaBy(dx); + } +} + +IpcItem DesktopsIpcArray[] = { + { + DesktopsIpcDesk, + "desk", NULL, + "Desktop functions", + " desk ? Desktop info\n" + " desk cfg Configure desktops\n" + " desk set <nd> Set number of desktops\n" + " desk goto <d> Goto specified desktop\n" + " desk next Goto next desktop\n" + " desk prev Goto previous desktop\n" + " desk this Goto this desktop\n" + " desk lower <d> Lower desktop\n" + " desk raise <d> Raise desktop\n"} + , + { + DesktopsIpcArea, + "area", NULL, + "Area functions", + " area ? Area info\n" + " area cfg Configure areas\n" + " area set <nx> <ny> Set area size\n" + " area goto <ax> <ay> Goto specified area\n" + " area move <dx> <dy> Move relative to current area\n" + " area lgoto <al> Goto specified linear area\n" + " area lmove <dl> Move relative to current linear area\n"} + , +}; +#define N_IPC_FUNCS (sizeof(DesktopsIpcArray)/sizeof(IpcItem)) + +static const CfgItem DesktopsCfgItems[] = { + CFG_ITEM_INT(Conf.desks, num, 2), + CFG_ITEM_BOOL(Conf.desks, wraparound, 0), + CFG_ITEM_INT(Conf.desks, dragdir, 2), + CFG_ITEM_INT(Conf.desks, dragbar_width, 16), + CFG_ITEM_INT(Conf.desks, dragbar_ordering, 1), + CFG_ITEM_INT(Conf.desks, dragbar_length, 0), + CFG_ITEM_BOOL(Conf.desks, slidein, 1), + CFG_ITEM_INT(Conf.desks, slidespeed, 6000), + + CFG_ITEM_INT(Conf.areas, nx, 2), + CFG_ITEM_INT(Conf.areas, ny, 1), + CFG_ITEM_BOOL(Conf.areas, wraparound, 0), +}; +#define N_CFG_ITEMS (sizeof(DesktopsCfgItems)/sizeof(CfgItem)) + +/* + * Module descriptor + */ +EModule ModDesktops = { + "desktops", "desk", + DesktopsSighan, + {N_IPC_FUNCS, DesktopsIpcArray}, + {N_CFG_ITEMS, DesktopsCfgItems} +}; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ecore-e16.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -3 -r1.1.2.7 -r1.1.2.8 --- ecore-e16.c 9 Dec 2004 19:22:20 -0000 1.1.2.7 +++ ecore-e16.c 27 Dec 2004 11:14:38 -0000 1.1.2.8 @@ -74,8 +74,8 @@ * Send client message (format 32) */ int -ecore_x_client_message32_send(Window win, Atom type, long d0, long d1, - long d2, long d3, long d4) +ecore_x_client_message32_send(Window win, Atom type, long mask, long d0, + long d1, long d2, long d3, long d4) { XEvent xev; @@ -89,7 +89,7 @@ xev.xclient.data.l[3] = d3; xev.xclient.data.l[4] = d4; - return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); + return XSendEvent(_ecore_x_disp, win, False, mask, &xev); } /* @@ -257,8 +257,8 @@ ecore_x_icccm_client_message_send(Ecore_X_Window win, Ecore_X_Atom atom, Ecore_X_Time ts) { - ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, atom, ts, - 0, 0, 0); + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, NoEventMask, + atom, ts, 0, 0, 0); } void =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ecore-e16.h,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -3 -r1.1.2.10 -r1.1.2.11 --- ecore-e16.h 8 Dec 2004 20:06:16 -0000 1.1.2.10 +++ ecore-e16.h 27 Dec 2004 11:14:38 -0000 1.1.2.11 @@ -44,6 +44,7 @@ int ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type, + long mask, long d0, long d1, long d2, long d3, long d4); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/eobj.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -u -3 -r1.1.2.7 -r1.1.2.8 --- eobj.c 26 Dec 2004 15:58:16 -0000 1.1.2.7 +++ eobj.c 27 Dec 2004 11:14:38 -0000 1.1.2.8 @@ -121,6 +121,16 @@ } void +EobjSetFloating(EObj * eo, int floating) +{ + if (floating == eo->floating) + return; + + eo->floating = floating; + EobjSetLayer(eo, eo->layer); +} + +void EobjInit(EObj * eo, int type, int x, int y, int w, int h) { eo->type = type; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewin-ops.c,v retrieving revision 1.1.2.26 retrieving revision 1.1.2.27 diff -u -3 -r1.1.2.26 -r1.1.2.27 --- ewin-ops.c 26 Dec 2004 15:58:16 -0000 1.1.2.26 +++ ewin-ops.c 27 Dec 2004 11:14:38 -0000 1.1.2.27 @@ -1301,7 +1301,7 @@ dy = y - EoGetY(ewin); EoSetX(ewin, x); EoSetY(ewin, y); - ConformEwinToDesktop(ewin); + EwinConformToDesktop(ewin); lst = EwinListTransients(ewin, &num, 0); for (i = 0; i < num; i++) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v retrieving revision 1.1.2.38 retrieving revision 1.1.2.39 diff -u -3 -r1.1.2.38 -r1.1.2.39 --- ewins.c 26 Dec 2004 15:58:16 -0000 1.1.2.38 +++ ewins.c 27 Dec 2004 11:14:38 -0000 1.1.2.39 @@ -662,7 +662,7 @@ DeskGetCurrentArea(&x, &y); MoveEwinToArea(ewin, x, y); RaiseEwin(ewin); - ConformEwinToDesktop(ewin); + EwinConformToDesktop(ewin); ShowEwin(ewin); ICCCM_DeIconify(ewin); ewin->iconified = 0; @@ -956,7 +956,7 @@ ewin = AdoptInternal(win, b, type); EoSetDesk(ewin, EoGetDesk(ewin)); - ConformEwinToDesktop(ewin); + EwinConformToDesktop(ewin); if (init) init(ewin, ptr); /* Type specific initialisation */ @@ -991,6 +991,52 @@ } void +EwinConformToDesktop(EWin * ewin) +{ + Window dwin; + + EDBUG(3, "EwinConformToDesktop"); + + dwin = DeskGetWin(EoGetDesk(ewin)); + if ((ewin->iconified) && (ewin->parent != dwin)) + { + ewin->parent = dwin; + EReparentWindow(disp, EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin)); + RaiseEwin(ewin); + ICCCM_Configure(ewin); + } + else if (EoIsFloating(ewin)) + { + if ((ewin->parent != VRoot.win) && (EoIsFloating(ewin) == 2)) + { + ewin->parent = VRoot.win; + EReparentWindow(disp, EoGetWin(ewin), VRoot.win, EoGetX(ewin), + EoGetY(ewin)); + EoSetDesk(ewin, 0); + } + RaiseEwin(ewin); + ICCCM_Configure(ewin); + EdgeWindowsShow(); + } + else if (ewin->parent != dwin) + { + ewin->parent = dwin; + EReparentWindow(disp, EoGetWin(ewin), dwin, EoGetX(ewin), EoGetY(ewin)); + RaiseEwin(ewin); + MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin)); + } + else + { + MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin)); + } + + EwinDetermineArea(ewin); + HintsSetWindowDesktop(ewin); + + EDBUG_RETURN_; +} + +void EwinReparent(EWin * ewin, Window parent) { EReparentWindow(disp, ewin->client.win, parent, 0, 0); @@ -1314,7 +1360,7 @@ EoSetFloating(ewin, 1); EoSetDesk(ewin, 0); - ConformEwinToDesktop(ewin); + EwinConformToDesktop(ewin); RaiseEwin(ewin); lst = EwinListTransients(ewin, &num, 0); @@ -1350,7 +1396,7 @@ dy = y - EoGetY(ewin); EoSetX(ewin, x); EoSetY(ewin, y); - ConformEwinToDesktop(ewin); + EwinConformToDesktop(ewin); lst = EwinListTransients(ewin, &num, 0); for (i = 0; i < num; i++) @@ -1378,11 +1424,13 @@ if (EventDebug(EDBUG_TYPE_STACKING)) Eprintf("RestackEwin %#lx %s\n", ewin->client.win, EwinGetTitle(ewin)); +#if 0 /* FIXME - remove? */ if (EoIsFloating(ewin)) { XRaiseWindow(disp, EoGetWin(ewin)); goto done; } +#endif lst = EwinListGetForDesk(&num, EoGetDesk(ewin)); if (num < 2) @@ -1431,11 +1479,13 @@ if (EoGetWin(ewin)) { +#if 0 /* FIXME - remove? */ if (EoIsFloating(ewin)) { XRaiseWindow(disp, EoGetWin(ewin)); goto done; } +#endif num = EwinListStackRaise(ewin); if (num == 0) /* Quit if stacking is unchanged */ @@ -1477,7 +1527,11 @@ Eprintf("LowerEwin(%d) %#lx %s\n", call_depth, ewin->client.win, EwinGetTitle(ewin)); +#if 0 /* FIXME - remove? */ if ((EoGetWin(ewin)) && (!EoIsFloating(ewin))) +#else + if (EoGetWin(ewin)) +#endif { num = EwinListStackLower(ewin); if (num == 0) /* Quit if stacking is unchanged */ =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v retrieving revision 1.76.2.17 retrieving revision 1.76.2.18 diff -u -3 -r1.76.2.17 -r1.76.2.18 --- icccm.c 13 Dec 2004 21:29:10 -0000 1.76.2.17 +++ icccm.c 27 Dec 2004 11:14:38 -0000 1.76.2.18 @@ -92,7 +92,7 @@ else if (event->message_type == ECORE_X_ATOM_WM_PROTOCOLS) { a = event->data.l[0]; - if (a == ECORE_X_ATOM_WM_DELETE_WINDOW) + if (a == ECORE_X_ATOM_WM_DELETE_WINDOW && event->window == VRoot.win) SessionExit(NULL); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v retrieving revision 1.116.2.30 retrieving revision 1.116.2.31 diff -u -3 -r1.116.2.30 -r1.116.2.31 --- iconify.c 26 Dec 2004 15:58:16 -0000 1.116.2.30 +++ iconify.c 27 Dec 2004 11:14:38 -0000 1.116.2.31 @@ -397,9 +397,20 @@ if (ib->name) Efree(ib->name); - if (ib->type == 0) - for (i = 0; i < ib->num_objs; i++) - EwinDeIconify(ib->objs[i].ewin); + for (i = 0; i < ib->num_objs; i++) + { + switch (ib->type) + { + case 0: + EwinDeIconify(ib->objs[i].ewin); + break; +#if 0 + case 1: + IconboxWindowFree(ib, ib->objs[i].win); + break; +#endif + } + } if (ib->objs) Efree(ib->objs); @@ -654,24 +665,39 @@ } #endif -static void -IconboxAddWindow(Iconbox * ib, Window win) +static int +IconboxWindowAdd(Iconbox * ib, Window win) { if (IconboxObjectAdd(ib, (void *)win)) - return; + return -1; XReparentWindow(disp, win, ib->icon_win, 0, 0); IconboxRedraw(ib); EMapWindow(disp, win); + + return 0; } static void -IconboxDelWindow(Iconbox * ib, Window win) +IconboxWindowDel(Iconbox * ib, Window win) { if (IconboxObjectDel(ib, (void *)win) == 0) IconboxRedraw(ib); } +#if 0 +static void +IconboxWindowFree(Iconbox * ib __UNUSED__, Window win) +{ + Eprintf("IconboxWindowFree %#lx\n", win); + if (disp) + { + EUnmapWindow(disp, win); + EReparentWindow(disp, win, VRoot.win, 0, 0); + } +} +#endif + static void IconboxesEwinIconify(EWin * ewin) { @@ -998,12 +1024,10 @@ } static void -IcondefChecker(int val, void *data) +IcondefChecker(int val __UNUSED__, void *data __UNUSED__) { IB_ReLoadIcondefs(); DoIn("ICONDEF_CHECK", 2.0, IcondefChecker, 0, NULL); - val = 0; - data = NULL; } #if 0 /* Not used */ @@ -2290,6 +2314,23 @@ } } +#if 0 +static void +IconboxesDestroy(void) +{ + int i, num; + Iconbox **ibl; + + ibl = IconboxesList(&num); + if (!ibl) + return; + + for (i = 0; i < num; i++) + IconboxDestroy(ibl[i]); + Efree(ibl); +} +#endif + static void IboxEventScrollWin(XEvent * ev, void *prm) { @@ -3113,6 +3154,11 @@ case ESIGNAL_START: /* We should create one if enabled and none existing */ break; +#if 0 + case ESIGNAL_EXIT: + IconboxesDestroy(); + break; +#endif case ESIGNAL_EWIN_ICONIFY: ewin = (EWin *) prm; IconboxesEwinIconify(ewin); @@ -3248,17 +3294,23 @@ { Window win; - Eprintf("ev->data.l: %#lx %#lx %#lx %#lx\n", + Eprintf("ev->type=%ld ev->data.l: %#lx %#lx %#lx %#lx\n", ev->message_type, ev->data.l[0], ev->data.l[1], ev->data.l[2], ev->data.l[3]); if (ev->message_type == _NET_SYSTEM_TRAY_OPCODE) { win = ev->data.l[2]; + if (win == None) + goto done; - IconboxAddWindow(ib, win); + if (IconboxWindowAdd(ib, win)) + goto done; + + Eprintf("XAddToSaveSet %#lx\n", win); + XAddToSaveSet(disp, win); /* Should proto be set according to clients _XEMBED_INFO? */ - ecore_x_client_message32_send(win, E_XA__XEMBED, + ecore_x_client_message32_send(win, E_XA__XEMBED, NoEventMask, CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0, ev->window, /*proto */ 1); } @@ -3266,6 +3318,8 @@ { Eprintf("got message\n"); } + done: + ; } static void @@ -3276,7 +3330,7 @@ switch (ev->type) { case DestroyNotify: - IconboxDelWindow(prm, ev->xdestroywindow.window); + IconboxWindowDel(prm, ev->xdestroywindow.window); break; case ClientMessage: SystrayEventClientMessage(prm, &(ev->xclient)); @@ -3314,6 +3368,6 @@ SubstructureNotifyMask); EventCallbackRegister(win, 0, SystrayEvent, obj); - ecore_x_client_message32_send(VRoot.win, E_XA_MANAGER, CurrentTime, - _NET_SYSTEM_TRAY_Sx, win, 0, 0); + ecore_x_client_message32_send(VRoot.win, E_XA_MANAGER, StructureNotifyMask, + CurrentTime, _NET_SYSTEM_TRAY_Sx, win, 0, 0); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v retrieving revision 1.22.2.18 retrieving revision 1.22.2.19 diff -u -3 -r1.22.2.18 -r1.22.2.19 --- moveresize.c 22 Dec 2004 23:39:10 -0000 1.22.2.18 +++ moveresize.c 27 Dec 2004 11:14:40 -0000 1.22.2.19 @@ -71,9 +71,6 @@ || Mode.move.swap, &num); for (i = 0; i < num; i++) { -#if 0 - EoSetFloating(gwins[i], 1); /* Reparent to root always */ -#endif FloatEwinAt(gwins[i], EoGetX(gwins[i]), EoGetY(gwins[i])); #if 0 /* Will never get here */ if (Mode.mode == MODE_MOVE) @@ -151,7 +148,6 @@ else MoveEwinToDesktopAt(gwins[i], d, gwins[i]->shape_x, gwins[i]->shape_y); - EoSetFloating(gwins[i], 0); } EoChangeOpacity(ewin, ewin->props.opacity); ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs