CTWM
Loading...
Searching...
No Matches
/usr/src/RPM/BUILD/ctwm-4.1.0/win_utils.c File Reference
#include "ctwm.h"
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xatom.h>
#include "add_window.h"
#include "ctwm_atoms.h"
#include "drawing.h"
#include "events.h"
#include "event_internal.h"
#include "icons.h"
#include "list.h"
#include "occupation.h"
#include "otp.h"
#include "r_area.h"
#include "r_area_list.h"
#include "r_layout.h"
#include "screen.h"
#include "util.h"
#include "win_decorations.h"
#include "win_ops.h"
#include "win_utils.h"
#include "workspace_utils.h"
Include dependency graph for win_utils.c:

Go to the source code of this file.

Macros

#define TRY(fld)
#define TRY(fld)

Enumerations

enum  PushDirection {
  PD_ANY , PD_BOTTOM , PD_LEFT , PD_RIGHT ,
  PD_TOP
}

Functions

void GetWindowSizeHints (TwmWindow *tmp)
void FetchWmProtocols (TwmWindow *tmp)
void GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp)
TwmWindowGetTwmWindow (Window w)
char * GetWMPropertyString (Window w, Atom prop)
void FreeWMPropertyString (char *prop)
bool visible (const TwmWindow *tmp_win)
long mask_out_event (Window w, long ignore_event)
long mask_out_event_mask (Window w, long ignore_event, long curmask)
int restore_mask (Window w, long restore)
void SetMapStateProp (TwmWindow *tmp_win, int state)
bool GetWMState (Window w, int *statep, Window *iwp)
void DisplayPosition (const TwmWindow *_unused_tmp_win, int x, int y)
void MoveResizeSizeWindow (int x, int y, unsigned int width, unsigned int height)
static void _tryToPack (RArea *final, const RArea *cur_win)
static bool _tryToPackVsEachMonitor (const RArea *monitor_area, void *vfinal)
void TryToPack (TwmWindow *tmp_win, int *x, int *y)
static void TryToPush_be (TwmWindow *tmp_win, int x, int y, PushDirection dir)
void TryToPush (TwmWindow *tmp_win, int x, int y)
void TryToGrid (TwmWindow *tmp_win, int *x, int *y)
bool ConstrainByLayout (RLayout *layout, int move_off_res, int *left, int width, int *top, int height)
void ConstrainByBorders1 (int *left, int width, int *top, int height)
void ConstrainByBorders (TwmWindow *twmwin, int *left, int width, int *top, int height)
void WarpToWindow (TwmWindow *t, bool must_raise)
void send_clientmessage (Window w, Atom a, Time timestamp)
XWMHints * gen_synthetic_wmhints (TwmWindow *win)
XWMHints * munge_wmhints (TwmWindow *win, XWMHints *hints)
 Perform whatever adaptations of WM_HINTS info we do.
bool set_window_name (TwmWindow *win)
 [Re]set a window's name.
void apply_window_name (TwmWindow *win)
 [Re]set and apply changes to a window's name.
bool set_window_icon_name (TwmWindow *win)
 [Re]set a window's icon name.
void apply_window_icon_name (TwmWindow *win)
 [Re]set and apply changes to a window's icon name.

Macro Definition Documentation

◆ TRY [1/2]

#define TRY ( fld)
Value:
{ \
if(newname == NULL && win->names.fld != NULL) { \
newname = win->names.fld; \
win->names.icon_set = true; \
} \
}

◆ TRY [2/2]

#define TRY ( fld)
Value:
{ \
if(newname == NULL && win->names.fld != NULL) { \
newname = win->names.fld; \
} \
}

Enumeration Type Documentation

◆ PushDirection

Enumerator
PD_ANY 
PD_BOTTOM 
PD_LEFT 
PD_RIGHT 
PD_TOP 

Definition at line 607 of file win_utils.c.

Function Documentation

◆ _tryToPack()

void _tryToPack ( RArea * final,
const RArea * cur_win )
static

Definition at line 516 of file win_utils.c.

References _tryToPack(), RArea::height, MAX, MIN, Scr, RArea::width, RArea::x, and RArea::y.

Referenced by _tryToPack(), _tryToPackVsEachMonitor(), and TryToPack().

◆ _tryToPackVsEachMonitor()

bool _tryToPackVsEachMonitor ( const RArea * monitor_area,
void * vfinal )
static

Definition at line 553 of file win_utils.c.

References _tryToPack(), and _tryToPackVsEachMonitor().

Referenced by _tryToPackVsEachMonitor(), and TryToPack().

◆ apply_window_icon_name()

void apply_window_icon_name ( TwmWindow * win)

[Re]set and apply changes to a window's icon name.

This is called after we've received a new WM_ICON_NAME (or other name-setting) property, to update our titlebars, icon managers, etc.

See also
apply_window_name() which does the same for the window title.

Definition at line 1349 of file win_utils.c.

References apply_window_icon_name(), AutoPopupMaybe(), RedoIcon(), set_window_icon_name(), and Tmp_win.

Referenced by apply_window_icon_name(), apply_window_name(), EwmhHandlePropertyNotify(), and HandlePropertyNotify().

◆ apply_window_name()

◆ ConstrainByBorders()

void ConstrainByBorders ( TwmWindow * twmwin,
int * left,
int width,
int * top,
int height )

◆ ConstrainByBorders1()

void ConstrainByBorders1 ( int * left,
int width,
int * top,
int height )

Definition at line 818 of file win_utils.c.

References ConstrainByBorders1(), ConstrainByLayout(), and Scr.

Referenced by ConstrainByBorders(), ConstrainByBorders1(), and MoveMenu().

◆ ConstrainByLayout()

bool ConstrainByLayout ( RLayout * layout,
int move_off_res,
int * left,
int width,
int * top,
int height )

◆ DisplayPosition()

void DisplayPosition ( const TwmWindow * _unused_tmp_win,
int x,
int y )

Definition at line 466 of file win_utils.c.

References DisplayPosition(), dpy, Draw3DBorder(), FB, off, Scr, SIZE_HINDENT, and SIZE_VINDENT.

Referenced by AddWindow(), DisplayPosition(), and movewindow().

◆ FetchWmProtocols()

◆ FreeWMPropertyString()

void FreeWMPropertyString ( char * prop)

◆ gen_synthetic_wmhints()

XWMHints * gen_synthetic_wmhints ( TwmWindow * win)

Definition at line 1030 of file win_utils.c.

References gen_synthetic_wmhints().

Referenced by AddWindow(), and gen_synthetic_wmhints().

◆ GetGravityOffsets()

void GetGravityOffsets ( TwmWindow * tmp,
int * xp,
int * yp )

◆ GetTwmWindow()

◆ GetWindowSizeHints()

◆ GetWMPropertyString()

char * GetWMPropertyString ( Window w,
Atom prop )

◆ GetWMState()

bool GetWMState ( Window w,
int * statep,
Window * iwp )

Definition at line 429 of file win_utils.c.

References dpy, and GetWMState().

Referenced by GetWMState(), HandleMapRequest(), and SetupOccupation().

◆ mask_out_event()

long mask_out_event ( Window w,
long ignore_event )

◆ mask_out_event_mask()

long mask_out_event_mask ( Window w,
long ignore_event,
long curmask )

Definition at line 389 of file win_utils.c.

References dpy, and mask_out_event_mask().

Referenced by Iconify(), mask_out_event(), mask_out_event_mask(), and UnmapTransients().

◆ MoveResizeSizeWindow()

void MoveResizeSizeWindow ( int x,
int y,
unsigned int width,
unsigned int height )

◆ munge_wmhints()

XWMHints * munge_wmhints ( TwmWindow * win,
XWMHints * hints )

Perform whatever adaptations of WM_HINTS info we do.

Most of these relate to focus, but we also fiddle with group membership.

Definition at line 1059 of file win_utils.c.

References GetTwmWindow(), TwmWindow::group, IsInList(), munge_wmhints(), Scr, and TwmWindow::w.

Referenced by AddWindow(), HandlePropertyNotify(), and munge_wmhints().

◆ restore_mask()

int restore_mask ( Window w,
long restore )

◆ send_clientmessage()

void send_clientmessage ( Window w,
Atom a,
Time timestamp )

◆ set_window_icon_name()

bool set_window_icon_name ( TwmWindow * win)

[Re]set a window's icon name.

As with the window name version in set_window_name(), this is mostly separate so the AddWindow() process can call it.

Note
As with TwmWindow::name, we never want to try free()'ing or the like TwmWindow::icon_name.
See also
set_window_name() for details; this is just the icon name equivalent of it.

Definition at line 1288 of file win_utils.c.

References dpy, TwmWindow::icon_name, TwmWindow::_names::icon_set, TwmWindow::name, TwmWindow::names, set_window_icon_name(), TRY, TwmWindow::w, and TwmWindow::_names::wm_icon_name.

Referenced by AddWindow(), apply_window_icon_name(), and set_window_icon_name().

◆ set_window_name()

bool set_window_name ( TwmWindow * win)

[Re]set a window's name.

This goes over the available naming sources for the window and points the TwmWindow::name at the appropriate one. It may also set a property to signal other EWMH-aware clients when we're naming it a way they can't see themselves.

Note
This should rarely be called directly; apply_window_name() should be used instead. It's split out because we need to do this step individually in AddWindow().
Note also that we never need to worry about freeing the TwmWindow::name; it always points to one of the TwmWindow::names values (which are free'd by the event handler when they change) or to NoName (which is static). So we can just casually flip it around at will.

Definition at line 1126 of file win_utils.c.

References dpy, TwmWindow::name, TwmWindow::names, NoName, set_window_name(), TRY, TwmWindow::w, and TwmWindow::_names::wm_name.

Referenced by AddWindow(), apply_window_name(), and set_window_name().

◆ SetMapStateProp()

◆ TryToGrid()

void TryToGrid ( TwmWindow * tmp_win,
int * x,
int * y )

◆ TryToPack()

◆ TryToPush()

void TryToPush ( TwmWindow * tmp_win,
int x,
int y )

Definition at line 617 of file win_utils.c.

References PD_ANY, TryToPush(), and TryToPush_be().

Referenced by HandleButtonRelease(), movewindow(), and TryToPush().

◆ TryToPush_be()

◆ visible()

◆ WarpToWindow()