1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 04:48:06 +01:00
Commit Graph

2594 Commits

Author SHA1 Message Date
Rodolfo García Peñas (kix)
fa27215fcc wIconPaint: avoid crashing if icon is NULL
This patch checks that the icon exists before painting it.
2013-04-09 08:30:45 +01:00
Rodolfo García Peñas (kix)
8cb744739c Remove wIconUpdate in tileObserver
The call to wIconUpdate() can be changed by call to update_icon_pixmap(),
because the icon doesn't need to be changed.

Now, the icon pixmap is updated faster.

This change is more difficult to see, this is the explanation:

1. wIconUpdate() updates the icon for the applications, then call
   update_icon_pixmap() to re-create the pixmap.
2. tileObserver() is used if the event WNIconTileSettingsChanged() is
   launched. This event is used in the Notification for docks and wwindows:

WMAddNotificationObserver(tileObserver, icon, WNIconTileSettingsChanged, icon);

3. The function WNIconTileSettingsChanged() is used if the icon need refresh,
   used in the wReadDefaults() function. See code below. This function is used
   in the wmaker startup.

   if (needs_refresh & REFRESH_ICON_TILE)
     WMPostNotificationName(WNIconTileSettingsChanged, NULL, NULL);

4. Finally, the flag to refresh the icon tile is throw by setIconTile():

   return (reset ? REFRESH_ICON_TILE : 0);

   And this function only changes the the icon tile if reset is "1", that
   happend if src->icon_tile:

        if (scr->icon_tile) {
          reset = 1;
          RReleaseImage(scr->icon_tile);
          XFreePixmap(dpy, scr->icon_tile_pixmap);
        }

5. Then, we can drop the function wIconUpdate(), because the change is in the
   icon_tile variable, used only in icon_update_pixmap(). This function is
   only used in update_icon_pixmap() (not in wIconUpdate):

kix@kentin:~/src/wmaker/git/wmaker-crm/src$ grep icon_tile icon.c
                tile = RCloneImage(scr->icon_tile);
        XSetWindowBackgroundPixmap(dpy, icon->core->window, scr->icon_tile_pixmap);
kix@kentin:~/src/wmaker/git/wmaker-crm/src$

static void icon_update_pixmap(WIcon *icon, RImage *image)
{
[snip]
  if (icon->tile_type == TILE_NORMAL) {
    tile = RCloneImage(scr->icon_tile);
  } else {
    assert(scr->clip_tile);
    tile = RCloneImage(scr->clip_tile);
  }
[snip]

The XSetWindowBackgroundPixmap() call doesn't matter here.
2013-04-08 22:06:27 +01:00
Rodolfo García Peñas (kix)
dee9c457cf Remove wIconUpdate in wDockAttachIcon
The call to wIconUpdate() can be changed by call to update_icon_pixmap(),
because the icon doesn't need to be changed. This update is only for change
the icon pixmap to un-shadowed.

Now, the icon pixmap is updated faster.
2013-04-08 22:06:27 +01:00
Rodolfo García Peñas (kix)
3d0ed99043 Remove wIconUpdate in wDockDetach
The call to wIconUpdate() can be changed by call to update_icon_pixmap(),
because the icon doesn't need to be changed. This update is only for change
the icon pixmap to un-shadowed.

Now, the icon pixmap is updated faster.
2013-04-08 22:06:27 +01:00
Rodolfo García Peñas (kix)
88d16d03b9 Remove wIconUpdate in moveIconBetweenDocks
The call to wIconUpdate() can be changed by call to update_icon_pixmap(),
because the icon doesn't need to be changed. This update is only for change
the icon pixmap to shadowed.

Now, the icon pixmap is updated faster.
2013-04-08 22:06:27 +01:00
Rodolfo García Peñas (kix)
256c8a498e Remove wIconUpdate in keepIconsCallback
The call to wIconUpdate() can be changed by call to update_icon_pixmap(),
because the icon doesn't need to be changed. This update is only for change
the icon pixmap to shadowed.

Now, the icon pixmap is updated faster.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
544bc8e7a7 Move out wIconUpdate from set_icon_image_from_database
The function set_icon_image_from_database() set the icon from the
database, but wIconUpdate() update the icon using different methods
, like for example get the image from X11. So, is better move the
wIconUpdate() to the function who call set_icon_image_from_database(),
to avoid understanding problems.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
883ed8ac9a wIconChangeTitle rewrited
The function wIconChangeTitle() function calls wIconUpdate() or
wIconPaint() depending of changed. In both cases the icon->file_image
doesn't change, only the icon title, so we can use the same image
and we don't need update it. Because the variable changed is removed,
we can use wIconPaint() here.

Then the variable changed is not used, and these lines can be removed.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
ca86f5594d New function update_icon_title
The function update_icon_title() updates the icon title.

The code comes from the function wIconPaint().
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
2c0a449f00 drawIconTitle renamed
The function drawIconTitle() only draw the icon title square, without
the title. The title must be set later, because yet is not initialized,
so is NULL.

Then, the right function name should be drawIconTitleBackground.

This patch also removes the variable titled.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
b3ca57674d Dockapps don't have title
The dockapps don't have title, so this code must be removed.
The title height is 0 then and the variable title_height can
be removed.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
4093d24625 wIconUpdate removed image argument
The argument image is not used in any call, so can be removed.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
c24499f6ad wIconChangeImageFile use set_icon_image_from_image
The function wIconChangeImageFile() now use set_icon_image_from_image()
then:

1. Don't need call unset_icon_image() because the memory is free in the
   function set_icon_image_from_image().
2. After update the icon info, it must set the file name.
3. The pixmap image could be updated.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
c088aba057 New function set_icon_image_from_image
The new function set_icon_image_from_image() sets the icon image using
a image provided as argument.

This function will be used to avoid call wIconUpdate() with the image
argument, doing the code easier and faster.

This patch calls unset_icon_image(), to free the icon image, to avoid
lost memory. After this patch, in winspector.c, the wIconUpdate() call
don't free the memory before update it.
2013-04-08 22:06:26 +01:00
Rodolfo García Peñas (kix)
389a0a252c New file placement.h
The file placement.h hold the definitions for placement.c
2013-04-03 19:33:34 +01:00
Rodolfo García Peñas (kix)
6fe23037ef wGetRectForHead moved to where used
The definition and call for wGetRectForHead is moved inside the
if block where is used. This code adds a WScreen pointer to make
the line shorter.

If menu->frame is NULL, then was NULL before this patch, so this
code doesn't include an error about this.

This patch will used with next patch to move the code inside the
block to an specific function.
2013-04-03 19:33:34 +01:00
Rodolfo García Peñas (kix)
b9e8bbbdc7 code clean at startup.c
Small code clean at startup.c
2013-04-03 19:33:34 +01:00
Rodolfo García Peñas (kix)
052efedd93 Removed dup function wScreenSearchForRootWindow
The function wScreenSearchForRootWindow is exactly like wScreenForRootWindow
so can be removed swapping the function call.
2013-04-03 19:20:10 +01:00
Iain Patterson
a401dcbdf6 Document new workspace shortcuts.
Describe the LastWorkspaceKey and MoveToWorkspace*Key shortcuts in the
NEWS file.
2013-03-28 19:09:17 +00:00
Iain Patterson
124442a811 Allow WPrefs to configure workspace switching keys.
Added MoveToWorkspace*Key, MoveToNextWorkspaceKey,
MoveToPrevWorkspaceKey, MoveToLastWorkspaceKey,
MoveToNextWorkspaceLayerKey and MoveToPrevWorkspaceLayerKey to the
keyboard shortcut panel of WPrefs.
2013-03-28 19:04:03 +00:00
Iain Patterson
ae7235c2df Shortcuts for moving windows between workspaces.
Added new keyboard shortcuts for moving windows between workspaces.

MoveToWorkspace1Key moves the active window directly to workspace 1.
Similarly for MoveToWorkspace2Key through MoveToWorkspace10Key.

MoveToNextWorkspaceKey moves the window to the next workspace,
MoveToPrevWorkspaceKey moves the window to the previous workspace.
Both keys respect the ws_advance and ws_cycle preferences.

MoveToNextWorkspaceLayerKey moves the window ten workspaces "forward" if
possible.
MoveToPrevWorkspaceLayerKey moves the window ten workspaces "back" if
possible.
2013-03-28 19:03:33 +00:00
Iain Patterson
cfdf1e92fe Allow WPrefs to configure the last used workspace key.
Added LastWorkspaceKey to the keyboard shortcut panel of WPrefs.
2013-03-28 18:58:23 +00:00
Iain Patterson
63219247c6 Added shortcut to switch to last used workspace.
Added new LastWorkspaceKey shortcut and Workspaces menu entry to switch back to
the last used workspace.
2013-03-28 18:57:40 +00:00
Iain Patterson
d25fde4173 Show shortcuts for workspace switching menu entries.
When showing a Workspaces menu entry for switching to a particular
workspace, also show the shortcut if one is bound for switching to that
workspace.
2013-03-28 18:53:14 +00:00
Iain Patterson
9b27217b53 Eliminate Workspaces menu magic numbers.
A number of functions relating to the Workspaces menu assume that the
menu contains at least three entries: New, Destroy Last and Workspace1.
Because it is assumed that index 1 contains the Destroy Last entry and
index 2 contains the first workspace entry there are several occurrences
throughout workspace.c of magic numbers relating to those indices.

Replace the magic numbers with some #defines, making the code more
readable and allowing the menu to be expanded later.
2013-03-28 18:50:15 +00:00
Iain Patterson
cd5382cedf Added GetShortcutKey().
The function getShortcutString() was defined statically in winmenu.c.

Replace it with the new function GetShortcutKey() which calls the
existing function GetShortcutString() so it can be used elsewhere and
cut down on code duplication.

A result of this change is that shortcuts are now labelled consistently.
Previously the format was different in generated menus, which used, for
example, M1 to refer to Mod1 whereas window menus used the full string
Mod1.  Now both use the shorter form.

One could argue that the new function name is more consistent, as now
GetShortcutString() takes a char * argument and GetShortcutKey() takes a
WShortcutKey argument.  That argument assumes that the original
intention behind the name of GetShortcutString() was not to hint that it
returns a String...
2013-03-28 18:47:25 +00:00
Rodolfo García Peñas (kix)
0da2b6e928 Removed old window clip balloon code
This code was used to create the window where the workspace name was showed
to the user. The code now use the standar balloon system, therefore this code
is not used anymore and can be removed.
2013-03-27 00:24:17 +00:00
Iain Patterson
e47413eefd Change Select menu entry text for selected windows.
Other toggle menu items such as Maximize and Shade change their text
labels according to the action which will be performed.  A shaded window
has its Shade menu item text changed to Unshade, for instance.

As well as maintaining consistency with other menu items, changing the
Select menu entry's text to Deselect for current selected windows
provides another (the only) way of reporting that a window is selected
when its border has been disabled.  Currently the only indication that a
window is selected is that its border colour will change.
2013-03-26 23:19:39 +00:00
Iain Patterson
17f1eb6568 Document FrameBorder* preferences.
Describe the new FrameBorderWidth and Frame(Selected)BorderColor
preferences in the NEWS file.
2013-03-26 23:19:39 +00:00
Iain Patterson
2affd6d484 Make window border size configurable.
Use the new preference FrameBorderWidth to configure the width of frame
window borders.
2013-03-26 23:19:39 +00:00
Iain Patterson
dee30d06ac Make window border colours configurable.
Use the new preferences FrameBorderColor and FrameSelectedBorderColor to
set the border colour of frame windows and selected frame windows
respectively.
2013-03-26 23:19:39 +00:00
Iain Patterson
c3a2438fac Use wGetColorForColormap() when allocating border pixel.
Cut down on code duplication by using the new wGetColorForColormap()
function in allocFrameBorderPixel().
2013-03-26 23:19:39 +00:00
Iain Patterson
69ff0d72cc Added wGetColorForColormap().
Abstract the wGetColor() function to operate on any colormap not just
the screen colormap.
2013-03-26 23:19:39 +00:00
Rodolfo García Peñas (kix)
4222204abc Workspace clip creation in two steps
This patch assigns always the clip to NULL and only if the clip is
needed is created.

This patch mainly is more clear/clean.
2013-03-21 10:02:43 +00:00
Rodolfo García Peñas (kix)
25d083a85f Removed extra XClearWindow call
The function XClearWindow() is called twice, we can remove one.
See the asterisks (**):

Before the call to wIconPaint():
-----------------8<--------------------------
+++ b/src/icon.c
@@ -621,7 +621,6 @@ void update_icon_pixmap(WIcon *icon)
                XSetWindowBackgroundPixmap(dpy, icon->core->window, icon->pixmap);

        /* Paint it */
**      XClearWindow(dpy, icon->core->window);
        wIconPaint(icon);
 }
-----------------8<--------------------------

First call in wIconPaint() function:
-----------------8<--------------------------
void wIconPaint(WIcon *icon)
{
        WScreen *scr = icon->core->screen_ptr;
        int x, l, w;
        char *tmp;

**      XClearWindow(dpy, icon->core->window);
-----------------8<--------------------------
2013-03-21 10:01:04 +00:00
Rodolfo García Peñas (kix)
bb48c35522 Window attributes moved to wCoreCreateTopLevel
The function wCoreCreateTopLevel() is used in two files (icon.c and
framewin.c), but after create the window, some attributes are changed.

This patch moves the change inside the wCoreCreateTopLevel(), avoiding to
call XChangeWindowAttributes() after the window creation. Now the window
is created in only one step, with all the final attributes.

Some details:

- The function wCoreCreateTopLevel() has now one argument more, the
  border pixel color. This attribute was used always as the screen
  frame_border_pixel, but in icon.c the attribute is changed to
  white_pixel. Now the function wCoreCreateTopLevel() receives the
  value frame_border_pixel in framewin.c and scr->white_pixel in
  icon.c, as argument.

- The vmask and attribs variables and the call to XChangeWindowAttributes()
  are removed in framewin.c and icon.c. The values CWSaveUnder for vmask and
  attribs.save_under = True are used if wPreferences.use_saveunders is True.

- CWBorderPixel is not needed in icon.c, because was previously set in wcore.c!
2013-03-21 10:01:04 +00:00
Rodolfo García Peñas (kix)
42a4d95e5b Removed unused dock types
The dock types NORMAL_DOCK and EXTENDED_DOCK are never used
so can be removed.

kix@debian:~/src/wmaker/git/wmaker-crm-base$ rgrep NORMAL_DOCK *
src/dock.h:#define NORMAL_DOCK    WM_DOCK
kix@debian:~/src/wmaker/git/wmaker-crm-base$ rgrep EXTENDED_DOCK *
src/dock.h:#define EXTENDED_DOCK  WM_CLIP
kix@debian:~/src/wmaker/git/wmaker-crm-base$
2013-03-21 10:01:04 +00:00
Rodolfo García Peñas (kix)
309d5c0d1a Cosmetic code changes in workspace
Added some blank lines, removed commented code and removed some
spaces on function prototypes/definitions.
2013-03-21 10:01:04 +00:00
Rodolfo García Peñas (kix)
53d31c7bbd Removed dead code in wSessionRestoreState
The function wSessionRestoreState() calls execCommand()
with the argument "host", but this argument is never used,
so we can remove the argument and the code to make that
argument, dead code at wSessionRestoreState.
2013-03-21 09:44:16 +00:00
Andreas Bierfert
066de301df Teach WPrefs about OPEN_PLMENU
From 35f19d77874d1b50de5505b6b1cb31531e1c055a Mon Sep 17 00:00:00 2001
From: Andreas Bierfert <andreas.bierfert@lowlatency.de>
Date: Thu, 31 Jan 2013 22:35:42 +0100
Subject: [PATCH 3/3] Teach WPrefs about OPEN_PLMENU

Add option to WPrefs to read, add and edit OPEN_PLMENU menu entries
2013-02-10 11:26:33 +00:00
Andreas Bierfert
c21ae6b580 Add OPEN_PLMENU option to parse command generated proplist style menus
This patch adds the OPEN_PLMENU options which behaves similar to OPEN_MENU but
can be used to parse command generated proplists. This can be used e.g. in
conjunction with wmmenugen like:
(
    "Generated PL Submenu",
    OPEN_PLMENU,
    "|| find /usr/share/applications -type f -name '*desktop' | xargs
wmmenugen -parser:xdg"
)

v2: code cleanup
2013-02-10 11:24:47 +00:00
Andreas Bierfert
cc69d2aae3 WINGS: New function WMReadPropListFromPipe
This functions reads a proplist from a pipe instead of a file (like
WMReadPropListFromFile does). It uses a call to popen to open the desired
command, reads data into a buffer till EOF and passes the data to getPropList
for parsing.

v2: code cleanup
2013-02-10 11:22:54 +00:00
BALATON Zoltan
a657fafcce WPrefs: Fix single click activation button in Icon preferences
Forgot to connect the button to the corresponding defaults key so it
was not working properly.
2013-02-08 17:55:54 +00:00
Carlos R. Mafra
a23e42639a wmgenmenu: Add XBMC entry 2013-01-31 01:00:42 +00:00
Rodolfo García Peñas (kix)
fd7b117346 Sanitize 'Ignore client supplied icon' logic
There can be these 4 situations:

1. ignore flag + file set
2. no ignore flag + file set
3. ignore flag + no file set
4. no ignore flag + no file set

If the "ignore client supplied icon flag" is not set it means the user wants to use the client-provided icon,
so the eventual file name which might be in the entry field is ignored.

If the user sets the ignore flag and sets the icon name all is fine and Option 1 is done.

If the user tries to set an icon (ignore flag is set) but the file textbox is not set we show the
warning:

"Ignore client supplied icon is set, but icon filename textbox is empty. Using client supplied icon"

and use the client-supplied icon instead.
2013-01-26 18:19:01 +00:00
Wade Berrier
ada7161d8d autoconf: add remaining parameter for AC_SEARCH_LIBS
According to:

http://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Libraries.html

Found this while trying to compile for RHEL6.  Otherwise, configure
failed.
2013-01-26 09:50:28 +00:00
Rodolfo García Peñas (kix)
70c9208e40 Simplify the application appicon creation
This patch removes all the appicon stuff from the application creation
to the appicon creation. Now, the application only calls one function
(create_appicon_for_application()) and this function do all the work.

The function do the same code than the code before this patch, but the
only change is that the "if" test to check if the appicon was found in
the docks now is negated, removing the return and doing the appicon_save
inside the function.

Finally, the old makeAppIconFor is now create_appicon_for_application().
2013-01-22 21:46:39 +00:00
Rodolfo García Peñas (kix)
97d7c32184 New function set_icon_image_from_database
The new function set_icon_image_from_database() removes the dup code
from these functions:

icon.c:icon_create_for_dock()
icon.c:icon_create_for_wwindow()
appicon.c:removeAppIconFor()

The only different change is that in the functions icon_create_for_dock()
and icon_create_for_wwindow(), the icon->tile_type assignment is done
before set the icon image filename and icon image, but this variable
is not used in these functions (is used in wIconUpdate function) but in both
functions the icon->tile_type assignment is done before wIconUpdate(), like
the code previous to this patch, so there is no problem moving icon->tile_type.
2013-01-22 21:46:39 +00:00
Rodolfo García Peñas (kix)
d7fe9a5bcd Update docked icon after kill dockapp
This patch sets the correct icon after kill a docked application.
To reproduce the problem (as Carlos reported to me), follow these
steps:

1. With a docked application, not running, set the icon image.
2. Launch the docked application.
3. Kill the application, using for example the app dock menu.

The icon is lost. But if wmaker is restarted, the icon backs again.

The problem is because when the application is closed, the function
removeAppIconFor() calls wIconUpdate(), but this function doesn't
find the icon in the file system again. The icon is loaded from the
filesystem only when the application is created.

This patch creates the icon image again, then calls wIconUpdate() to
set the icon image or the default icon image if the icon image was
not found, then wPaint it.

These lines comes from the create_appicon_from_* functions, used
to set the icon image for docks and applications. Are copy/pasted.
2013-01-22 21:46:39 +00:00
Carlos R. Mafra
74aa65abeb Window placement: Enforce center position
When the "Center" choice for window position is chosen, really enforce
the center position for all windows, instead of falling back to "Auto"
when there are already windows on the workspace.

Signed-off-by: Carlos R. Mafra <crmafra@gmail.com>
2013-01-22 11:55:06 +00:00