69#include "ctwm_atoms.h"
98#define SAVEFILE_VERSION 2
109 char *client_id =
NULL;
127 tp.format == 8 &&
tp.nitems != 0) {
128 client_id = (
char *)
tp.value;
151 return ((
char *)
tp.value);
220 unsigned char count = strlen(
string);
225 if(
fwrite(
string, (
int)
sizeof(
char), (
int) count,
file) != count) {
377 int wm_command_count, i;
418 wm_command_count = 0;
421 if(
clientId || !wm_command || wm_command_count == 0) {
430 for(i = 0; i < wm_command_count; i++)
535 if(!
entry->window_role) {
551 if(
entry->wm_command_count == 0) {
557 if(!
entry->wm_command) {
561 for(i = 0; i <
entry->wm_command_count; i++)
580 if(
entry->icon_info_present) {
606 entry->width_ever_changed_by_user =
byte;
611 entry->height_ever_changed_by_user =
byte;
633 if(
entry->client_id) {
636 if(
entry->window_role) {
639 if(
entry->class.res_name) {
642 if(
entry->class.res_class) {
648 if(
entry->wm_command_count &&
entry->wm_command) {
649 for(i = 0; i <
entry->wm_command_count; i++)
650 if(
entry->wm_command[i]) {
654 if(
entry->wm_command) {
705 unsigned short *width,
unsigned short *height,
706 bool *iconified,
bool *icon_info_present,
707 short *icon_x,
short *icon_y,
708 bool *width_ever_changed_by_user,
709 bool *height_ever_changed_by_user,
729 while(
ptr && !found) {
757 ptr->class.res_name) == 0 &&
759 ptr->class.res_class) == 0 &&
776 char **wm_command =
NULL;
777 int wm_command_count = 0, i;
780 &wm_command, &wm_command_count);
782 if(wm_command_count ==
ptr->wm_command_count) {
783 for(i = 0; i < wm_command_count; i++)
785 ptr->wm_command[i]) != 0) {
789 if(i == wm_command_count) {
807 *height =
ptr->height;
808 *iconified =
ptr->iconified;
809 *icon_info_present =
ptr->icon_info_present;
810 *width_ever_changed_by_user =
ptr->width_ever_changed_by_user;
811 *height_ever_changed_by_user =
ptr->height_ever_changed_by_user;
813 if(*icon_info_present) {
814 *icon_x =
ptr->icon_x;
815 *icon_y =
ptr->icon_y;
818 *occupation =
ptr->occupation;
844#ifdef MISSING_MKSTEMP
876# define PATH_MAX 1023
1003 for(i = 0; i <
Argc; i++) {
int NumScreens
How many Screens are on our display.
ScreenInfo ** ScreenList
List of ScreenInfo structs for each Screen.
void DoShutdown(void)
Cleanup and exit ctwm.
void * LookInList(name_list *list_head, const char *name, XClassHint *class)
static TWMWinConfigEntry * winConfigHead
void ReadWinConfigFile(char *filename)
static void ProcessIceMsgProc(XtPointer client_data, int *source, XtInputId *id)
static int write_short(FILE *file, short s)
static int read_int(FILE *file, int *intp)
static int read_byte(FILE *file, unsigned char *bp)
static int write_byte(FILE *file, unsigned char b)
static int write_int(FILE *file, int i)
static char * GetClientID(Window window)
static void DieCB(SmcConn smcCon, SmPointer clientData)
int GetWindowConfig(TwmWindow *theWindow, short *x, short *y, unsigned short *width, unsigned short *height, bool *iconified, bool *icon_info_present, short *icon_x, short *icon_y, bool *width_ever_changed_by_user, bool *height_ever_changed_by_user, int *occupation)
static XtInputId iceInputId
static int ReadWinConfigEntry(FILE *configFile, unsigned short version, TWMWinConfigEntry **pentry)
static int read_short(FILE *file, short *shortp)
static int write_ushort(FILE *file, unsigned short s)
static void ShutdownCancelledCB(SmcConn smcCon, SmPointer clientData)
static char * unique_filename(char *path, char *prefix, int *fd)
static void SaveCompleteCB(SmcConn smcCon, SmPointer clientData)
static int read_counted_string(FILE *file, char **stringp)
void shutdown_session(void)
static int write_counted_string(FILE *file, char *string)
static void SaveYourselfPhase2CB(SmcConn smcCon, SmPointer clientData)
static char * twm_clientId
static bool sent_save_done
static int read_ushort(FILE *file, unsigned short *shortp)
static char * GetWindowRole(Window window)
static void SaveYourselfCB(SmcConn smcCon, SmPointer clientData, int saveType, Bool shutdown, int interactStyle, Bool fast)
static int WriteWinConfigEntry(FILE *configFile, TwmWindow *theWindow, char *clientId, char *windowRole)
void ConnectToSessionManager(char *previous_id)
Info and control for each X Screen we control.
TwmWindow * FirstWindow
The head of the screen's twm window list.
Info and control for every X Window we take over.
char * name
Current window name. Points into TwmWindow::names.