active_menubar = 0;
active_popup_menu = 0;
active_subwindow = 0;
+ cursor_entered = 0;
pixmap = 0;
bg_pixmap = 0;
_7segment_pixmaps = 0;
size_hints.x = this->x;
size_hints.y = this->y;
}
-
- char *txlist[2];
- txlist[0] = this->title;
- txlist[1] = 0;
- XTextProperty titleprop;
- if(options & WINDOW_UTF8)
- Xutf8TextListToTextProperty(display, txlist, 1,
- XUTF8StringStyle, &titleprop);
- else
- XmbTextListToTextProperty(display, txlist, 1,
- XStdICCTextStyle, &titleprop);
- XSetWMProperties(display, win, &titleprop, &titleprop,
- 0, 0, &size_hints, 0, 0);
- XFree(titleprop.value);
+ XSetWMProperties(display, win, 0, 0, 0, 0, &size_hints, 0, 0);
get_atoms();
-
+ set_title(title);
#ifndef SINGLE_THREAD
- clipboard = new BC_Clipboard(display_name);
+ clipboard = new BC_Clipboard(this);
clipboard->start_clipboard();
#endif
}
}
}
+
+ static int xsynch = -1;
+ if( xsynch < 0 ) {
+ const char *cp = getenv("CIN_XSYNCH");
+ xsynch = !cp ? 0 : atoi(cp);
+ }
+ if( xsynch > 0 )
+ XSynchronize(display, True);
+
return display;
}
break;
case LeaveNotify:
+ if( cursor_entered && event->xcrossing.window == win ) {
+ cursor_entered = 0;
+ }
event_win = event->xany.window;
dispatch_cursor_leave();
break;
case EnterNotify:
+ if( !cursor_entered && event->xcrossing.window == win ) {
+ if( !event->xcrossing.focus && get_resources()->grab_input_focus ) {
+ XSetInputFocus(display, win, RevertToParent, CurrentTime);
+ }
+ cursor_entered = 1;
+ }
event_win = event->xany.window;
cursor_x = event->xcrossing.x;
cursor_y = event->xcrossing.y;
dispatch_cursor_enter();
break;
+
default:
break;
}
#endif
}
+Atom BC_WindowBase::to_clipboard(const char *data, long len, int clipboard_num)
+{
+ return get_clipboard()->to_clipboard(this, data, len, clipboard_num);
+}
+
+long BC_WindowBase::from_clipboard(char *data, long maxlen, int clipboard_num)
+{
+ return get_clipboard()->from_clipboard(data, maxlen, clipboard_num);
+}
+
+long BC_WindowBase::clipboard_len(int clipboard_num)
+{
+ return get_clipboard()->clipboard_len(clipboard_num);
+}
+
+int BC_WindowBase::do_selection_clear(Window win)
+{
+ top_level->event_win = win;
+ return dispatch_selection_clear();
+}
+
+int BC_WindowBase::dispatch_selection_clear()
+{
+ int result = 0;
+ for( int i=0; i<subwindows->total && !result; ++i )
+ result = subwindows->values[i]->dispatch_selection_clear();
+ if( !result )
+ result = selection_clear_event();
+ return result;
+}
+
+
void BC_WindowBase::get_relative_cursor_xy(int &x, int &y, int lock_window)
{
int abs_x, abs_y, win_x, win_y;
*cp = 0;
}
-void BC_WindowBase::set_title(const char *text)
+void BC_WindowBase::set_title(const char *text, int utf8)
{
+// utf8>0: wm + net_wm, utf8=0: wm only, utf<0: net_wm only
put_title(_(text));
-
- char *txlist[2];
- txlist[0] = this->title;
- txlist[1] = 0;
-
- XTextProperty titleprop;
- XmbTextListToTextProperty(top_level->display, txlist, 1,
- XStdICCTextStyle, &titleprop);
- XSetWMName(top_level->display, top_level->win, &titleprop);
- XSetWMIconName(top_level->display, top_level->win, &titleprop);
- XFree(titleprop.value);
-
- flush();
-}
-
-void BC_WindowBase::set_utf8title(const char *text)
-{
- XTextProperty titleprop;
- char *txlist[2];
-
- strcpy(this->title, text);
- txlist[0] = this->title;
- txlist[1] = 0;
-
- Xutf8TextListToTextProperty(top_level->display, txlist, 1,
- XUTF8StringStyle, &titleprop);
- XSetWMName(top_level->display, top_level->win, &titleprop);
- XSetWMIconName(top_level->display, top_level->win, &titleprop);
- XFree(titleprop.value);
-
+ const unsigned char *wm_title = (const unsigned char *)title;
+ int title_len = strlen((const char *)title);
+ if( utf8 >= 0 ) {
+ Atom xa_wm_name = XA_WM_NAME;
+ Atom xa_icon_name = XA_WM_ICON_NAME;
+ Atom xa_string = XA_STRING;
+ XChangeProperty(display, win, xa_wm_name, xa_string, 8,
+ PropModeReplace, wm_title, title_len);
+ XChangeProperty(display, win, xa_icon_name, xa_string, 8,
+ PropModeReplace, wm_title, title_len);
+ }
+ if( utf8 != 0 ) {
+ Atom xa_net_wm_name = XInternAtom(display, "_NET_WM_NAME", True);
+ Atom xa_net_icon_name = XInternAtom(display, "_NET_WM_ICON_NAME", True);
+ Atom xa_utf8_string = XInternAtom(display, "UTF8_STRING", True);
+ XChangeProperty(display, win, xa_net_wm_name, xa_utf8_string, 8,
+ PropModeReplace, wm_title, title_len);
+ XChangeProperty(display, win, xa_net_icon_name, xa_utf8_string, 8,
+ PropModeReplace, wm_title, title_len);
+ }
flush();
}