Allen Webster 2016-03-03 14:27:20 -05:00
commit f40161e888
1 changed files with 54 additions and 28 deletions

View File

@ -390,6 +390,7 @@ Sys_Set_File_List_Sig(system_set_file_list){
}
}
#if 0
Sys_File_Paths_Equal_Sig(system_file_paths_equal){
b32 result = 0;
@ -405,6 +406,28 @@ Sys_File_Paths_Equal_Sig(system_file_paths_equal){
return result;
}
#endif
static_assert(
(sizeof(((struct stat*)0)->st_dev) +
sizeof(((struct stat*)0)->st_ino)) <=
sizeof(Unique_Hash),
"Unique_Hash too small"
);
Sys_File_Unique_Hash_Sig(system_file_unique_hash){
Unique_Hash result = {};
struct stat st;
if(stat(filename, &st) == -1){
perror("sys_file_unique_hash: stat");
} else {
memcpy(&result, &st.st_dev, sizeof(st.st_dev));
memcpy((char*)&result + sizeof(st.st_dev), &st.st_ino, sizeof(st.st_ino));
}
return result;
}
Sys_Post_Clipboard_Sig(system_post_clipboard){
LinuxStringDup(&linuxvars.clipboard_outgoing, str.str, str.size);
@ -1088,6 +1111,7 @@ LinuxLoadSystemCode(){
linuxvars.system->file_exists = system_file_exists;
linuxvars.system->directory_cd = system_directory_cd;
linuxvars.system->file_unique_hash = system_file_unique_hash;
linuxvars.system->post_clipboard = system_post_clipboard;
linuxvars.system->time = system_time;
@ -1867,6 +1891,33 @@ main(int argc, char **argv)
if(linuxvars.XWindow)
{
XStoreName(linuxvars.XDisplay, linuxvars.XWindow, "4coder-window");
Atom _NET_WM_WINDOW_TYPE = XInternAtom(linuxvars.XDisplay, "_NET_WM_WINDOW_TYPE", False);
Atom _NET_WIN_TYPE_NORMAL = XInternAtom(linuxvars.XDisplay, "_NET_WM_WINDOW_TYPE_NORMAL", False);
XChangeProperty(
linuxvars.XDisplay,
linuxvars.XWindow,
_NET_WM_WINDOW_TYPE,
XA_ATOM,
32,
PropModeReplace,
(unsigned char*)&_NET_WIN_TYPE_NORMAL,
1
);
Atom _NET_WM_PID = XInternAtom(linuxvars.XDisplay, "_NET_WM_PID", False);
pid_t pid = getpid();
XChangeProperty(
linuxvars.XDisplay,
linuxvars.XWindow,
_NET_WM_PID,
XA_CARDINAL,
32,
PropModeReplace,
(unsigned char*)&pid,
1
);
XMapWindow(linuxvars.XDisplay, linuxvars.XWindow);
Init_Input_Result input_result =
@ -1939,31 +1990,6 @@ main(int argc, char **argv)
);
}
Atom _NET_WM_WINDOW_TYPE = XInternAtom(linuxvars.XDisplay, "_NET_WM_WINDOW_TYPE", False);
Atom _NET_WIN_TYPE_NORMAL = XInternAtom(linuxvars.XDisplay, "_NET_WM_WINDOW_TYPE_NORMAL", False);
XChangeProperty(
linuxvars.XDisplay,
linuxvars.XWindow,
_NET_WM_WINDOW_TYPE,
XA_ATOM,
32,
PropModeReplace,
(unsigned char*)&_NET_WIN_TYPE_NORMAL,
1
);
Atom _NET_WM_PID = XInternAtom(linuxvars.XDisplay, "_NET_WM_PID", False);
pid_t pid = getpid();
XChangeProperty(
linuxvars.XDisplay,
linuxvars.XWindow,
_NET_WM_PID,
XA_CARDINAL,
32,
PropModeReplace,
(unsigned char*)&pid,
1
);
Atom WM_DELETE_WINDOW = XInternAtom(linuxvars.XDisplay, "WM_DELETE_WINDOW", False);
Atom _NET_WM_PING = XInternAtom(linuxvars.XDisplay, "_NET_WM_PING", False);