Exemplo n.º 1
0
int grab_window(int src_x, int src_y, int width, int height)
{
	GdkWindow *window, *root;
#ifndef GTK3
	window = gdk_window_foreign_new(GDK_ROOT_WINDOW());
	root = gdk_window_foreign_new(GDK_ROOT_WINDOW());
#else
	GdkDisplay *gdpy = gdk_display_get_default();
	window = root = gdk_x11_window_foreign_new_for_display(gdpy, GDK_ROOT_WINDOW());
#endif

  GdkPixbuf *screenshot;
	GError *error = NULL;

  if (src_x + width > gdk_screen_width ())
  	width = gdk_screen_width () - src_x;
  if (src_y + height > gdk_screen_height ())
   	height = gdk_screen_height () - src_y;

	time_t now;
	time(&now);
	char path[MAXPATHLEN];
	snprintf(path, sizeof(path), "%s%i%s", "./screen-shot-window", now, ".png");
	printf("%s\n", path);
#ifndef GTK3
  screenshot = gdk_pixbuf_get_from_drawable (NULL, root, NULL, src_x, src_y, 0, 0, width, height);
#else
	screenshot = gdk_pixbuf_get_from_window(root, src_x, src_y, width, height);
#endif

	printf("----------------%d\n", gdk_pixbuf_get_rowstride(screenshot));
	gdk_pixbuf_save (screenshot, path, "png", &error, "tEXt::CREATOR", "gnome-panel-screenshot", NULL);

	return 0;
}
// the following function is stolen from xfdesktop
static void
set_num_screens (gpointer num)
{
    static Atom xa_NET_NUMBER_OF_DESKTOPS = 0;
    XClientMessageEvent sev;
    int n;

    if (!xa_NET_NUMBER_OF_DESKTOPS)
    {
	xa_NET_NUMBER_OF_DESKTOPS =
	    XInternAtom (GDK_DISPLAY (), "_NET_NUMBER_OF_DESKTOPS", False);
    }

    n = GPOINTER_TO_INT (num);

    sev.type = ClientMessage;
    sev.display = GDK_DISPLAY ();
    sev.format = 32;
    sev.window = GDK_ROOT_WINDOW ();
    sev.message_type = xa_NET_NUMBER_OF_DESKTOPS;
    sev.data.l[0] = n;

    gdk_error_trap_push ();

    XSendEvent (GDK_DISPLAY (), GDK_ROOT_WINDOW (), False,
		SubstructureNotifyMask | SubstructureRedirectMask,
		(XEvent *) & sev);

    gdk_flush ();
    gdk_error_trap_pop ();
}
Exemplo n.º 3
0
void grab_keys(int mk, int uk, int dk,
	       int mm, int um, int dm,
	       int step) {
  Display* disp = GDK_DISPLAY();

  // ungrab any previous keys
  XUngrabKey(disp, AnyKey, AnyModifier, GDK_ROOT_WINDOW());

  volMuteKey = mk;
  volUpKey = uk;
  volDownKey = dk;
  volMuteMods = mm;
  volUpMods = um;
  volDownMods = dm;
  volStep = step;

  if (mk < 0 &&
      uk < 0 &&
      dk < 0)
    return;
  
  xErr = 0;
  errBuf = g_malloc(errBufSize*sizeof(gchar));
  printBuf = errBuf + snprintf(errBuf,errBufSize,_("Could not bind the following hotkeys:\n"));
  errBufSize -= (printBuf - errBuf);

  if (muteSymStr) g_free(muteSymStr);
  if (upSymStr)   g_free(upSymStr);
  if (downSymStr) g_free(downSymStr);
  muteSymStr = gtk_accelerator_name(XkbKeycodeToKeysym(GDK_DISPLAY(), volMuteKey, 0, 0),volMuteMods);
  upSymStr = gtk_accelerator_name(XkbKeycodeToKeysym(GDK_DISPLAY(),volUpKey,0, 0),volUpMods);
  downSymStr = gtk_accelerator_name(XkbKeycodeToKeysym(GDK_DISPLAY(), volDownKey, 0, 0),volDownMods);

  XErrorHandler old_hdlr = XSetErrorHandler(errhdl);
  if (volMuteKey > 0) {
    muteSerial = NextRequest(disp);
    XGrabKey(disp,volMuteKey,volMuteMods,GDK_ROOT_WINDOW(),1,GrabModeAsync,GrabModeAsync);
  }

  if (volUpKey > 0) {
    upSerial = NextRequest(disp);
    XGrabKey(disp,volUpKey,volUpMods,GDK_ROOT_WINDOW(),1,GrabModeAsync,GrabModeAsync);
  }

  if (volDownKey > 0) {
    downSerial = NextRequest(disp);
    XGrabKey(disp,volDownKey,volDownMods,GDK_ROOT_WINDOW(),1,GrabModeAsync,GrabModeAsync);
  }

  XFlush(disp);
  XSync(disp, False);
  (void) XSetErrorHandler(old_hdlr);
  
  if (xErr) 
    g_idle_add(idle_report_error, NULL);
  else
    g_free(errBuf);
}
Exemplo n.º 4
0
int grab_whole_screen()
{	
	GdkWindow *window, *root;
#ifndef GTK3
	window = gdk_window_foreign_new(GDK_ROOT_WINDOW());
	root = gdk_window_foreign_new(GDK_ROOT_WINDOW());
#else
	GdkDisplay *gdpy = gdk_display_get_default();
	window = root = gdk_x11_window_foreign_new_for_display(gdpy, GDK_ROOT_WINDOW());
#endif

  GdkPixbuf *screenshot;
  gint x_real_orig, y_real_orig;
  gint x_orig, y_orig;
  gint real_width, real_height;
  gint width, height;
	GError *error = NULL;
#ifndef GTK3
	gdk_drawable_get_size(window, &real_width, &real_height);
#else
	real_width = gdk_window_get_width(window);
	real_height = gdk_window_get_height(window); 
#endif
	gdk_window_get_origin(window, &x_real_orig, &y_real_orig);

  x_orig = x_real_orig;
  y_orig = y_real_orig;
  width = real_width;
  height = real_height;
 	if (x_orig < 0) {
  	width = width + x_orig;
    x_orig = 0;
  }
  if (y_orig < 0) {
    height = height + y_orig;
    y_orig = 0;
  }

  if (x_orig + width > gdk_screen_width ())
  	width = gdk_screen_width () - x_orig;
  if (y_orig + height > gdk_screen_height ())
   	height = gdk_screen_height () - y_orig;
	char path[MAXPATHLEN];
	time_t now;
	time(&now);
	snprintf(path, sizeof(path), "%s%i%s", "./screen-shot-whole-screen-", now, ".png");

#ifndef GTK3
	screenshot = gdk_pixbuf_get_from_drawable (NULL, root, NULL, x_orig, y_orig, 0, 0, width, height);
#else
	screenshot = gdk_pixbuf_get_from_window(root, x_orig, y_orig, width, height);
#endif

	gdk_pixbuf_save (screenshot, path, "png", &error, "tEXt::CREATOR", "gnome-panel-screenshot", NULL);
	return 0;
}
Exemplo n.º 5
0
/* Stolen from xfwm4 and modified.
 * FALSE on error. Call initModifiers before this.
 */
static gboolean grabKey(MyKey *key)
{
	Window root;
	Display *dpy = GDK_DISPLAY();
	static gboolean need_init = TRUE;

	if (need_init)
	{
		need_init = FALSE;
		gdk_window_add_filter(gdk_get_default_root_window(),
				filter_keys, NULL);
	}

	gdk_error_trap_push();

	root = GDK_ROOT_WINDOW();

	GRAB(key, 0);

	/* Here we grab all combinations of well known modifiers */
	GRAB(key, ScrollLockMask);
	GRAB(key, NumLockMask);
	GRAB(key, CapsLockMask);
	GRAB(key, ScrollLockMask | NumLockMask);
	GRAB(key, ScrollLockMask | CapsLockMask);
	GRAB(key, CapsLockMask | NumLockMask);
	GRAB(key, ScrollLockMask | CapsLockMask | NumLockMask);

	gdk_flush();
	return gdk_error_trap_pop() == Success;
}
Exemplo n.º 6
0
Arquivo: icons.c Projeto: g7/fbpanel
static void
ics_propertynotify(icons_priv *ics, XEvent *ev)
{
    Atom at;
    Window win;

    
    ENTER;
    win = ev->xproperty.window;
    at = ev->xproperty.atom;
    DBG("win=%lx at=%ld\n", win, at);
    if (win != GDK_ROOT_WINDOW())
    {
	task *tk = find_task(ics, win);

        if (!tk) 
            RET();
        if (at == XA_WM_CLASS)
        {
            get_wmclass(tk);
            set_icon_maybe(ics, tk);
        }
        else if (at == XA_WM_HINTS)
        {
            set_icon_maybe(ics, tk);
        }  
    }
    RET();
}
Exemplo n.º 7
0
static void
select_popup_events (void)
{
    XWindowAttributes attr;
    unsigned long     events;

    gdk_error_trap_push ();

    memset (&attr, 0, sizeof (attr));
    XGetWindowAttributes (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), &attr);

    events = SubstructureNotifyMask | attr.your_event_mask;
    XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), GDK_ROOT_WINDOW (), events);

    gdk_error_trap_pop_ignored ();
}
Exemplo n.º 8
0
static void
show_cursor (Doppelganger *dg)
{
  int current_pointer;
  XIEventMask mask = { dg->mpx, 0, "" };

#if 0
  /* probably unnecessary */
  XIGetClientPointer (gdk_x11_get_default_xdisplay (),
		      None,
		      &current_pointer);
  
  /* probably unnecessary */
  XISetClientPointer (gdk_x11_get_default_xdisplay (),
		      None,
		      dg->mpx);

  if (XIGrabDevice (gdk_x11_get_default_xdisplay (),
                    dg->mpx,
                    GDK_ROOT_WINDOW(), CurrentTime,
                    gdk_x11_cursor_get_xcursor (dg->cursor),
                    GrabModeAsync, GrabModeAsync,
                    True, &mask) != GrabSuccess)
    {
      g_warning ("Grab failed.");
    }

  /* probably unnecessary */
  XISetClientPointer (gdk_x11_get_default_xdisplay (),
		      None,
		      current_pointer);

#endif
}
static void
update_wm_window (void)
{
  Window *xwindow;
  Atom type;
  gint format;
  gulong nitems;
  gulong bytes_after;

  XGetWindowProperty (GDK_DISPLAY (), GDK_ROOT_WINDOW (),
		      XInternAtom (GDK_DISPLAY (), "_NET_SUPPORTING_WM_CHECK", False),
		      0, G_MAXLONG, False, XA_WINDOW, &type, &format,
		      &nitems, &bytes_after, (guchar **) &xwindow);

  if (type != XA_WINDOW)
    {
      wm_window = None;
     return;
    }

  gdk_error_trap_push ();
  XSelectInput (GDK_DISPLAY (), *xwindow, StructureNotifyMask | PropertyChangeMask);
  XSync (GDK_DISPLAY (), False);

  if (gdk_error_trap_pop ())
    {
       XFree (xwindow);
       wm_window = None;
       return;
    }

    wm_window = *xwindow;
    XFree (xwindow);
}
Exemplo n.º 10
0
gint title_motion_event(GtkWidget *widget, GdkEventMotion *event)
{
	gint mov_x, mov_y;
	gint win_x, win_y;

	gint xp, yp;
	GdkModifierType mask;
	static GdkWindow *root_win = NULL;

	//LOG(LOG_DEBUG, "IN : title_motion_event()");

	if((event->state & GDK_BUTTON1_MASK) &&
	   bbutton_down){

		root_win = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
		gdk_window_get_pointer (root_win, &xp, &yp, &mask);

	        mov_x = xp - prev_x;
	        mov_y = yp - prev_y;

 	        gdk_window_get_root_origin(popup->window, &win_x, &win_y);

		gtk_window_move(GTK_WINDOW(popup),
				win_x + mov_x,
				win_y + mov_y);
		prev_x = xp;
		prev_y = yp;
	}

	//LOG(LOG_DEBUG, "OUT : title_motion_event()");
	return(FALSE);
}
Exemplo n.º 11
0
static void
avatar_image_add_filter (EmpathyAvatarImage *avatar_image)
{
	Window     window;
	GdkWindow *gdkwindow;
	gint       mask;

	mask = PropertyChangeMask;

	window = GDK_ROOT_WINDOW ();
	gdkwindow = gdk_xid_table_lookup (window);

	gdk_error_trap_push ();
	if (gdkwindow) {
		XWindowAttributes attrs;
		XGetWindowAttributes (gdk_display, window, &attrs);
		mask |= attrs.your_event_mask;
	}

	XSelectInput (gdk_display, window, mask);

	gdk_error_trap_pop ();

	gdk_window_add_filter (NULL, avatar_image_filter_func, avatar_image);
}
Exemplo n.º 12
0
static void
do_net_client_list(GtkWidget *widget, icons *ics)
{
    int i;
    task *tk;

    ENTER;
    if (ics->wins)
        XFree(ics->wins);
    ics->wins = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_CLIENT_LIST, XA_WINDOW, &ics->win_num);
    if (!ics->wins)
        RET();

    for (i = 0; i < ics->win_num; i++) {
        if ((tk = g_hash_table_lookup(ics->task_list, &ics->wins[i]))) {
            tk->refcount++;
        } else {
            tk = g_new0(task, 1);
            tk->refcount++;
            ics->num_tasks++;
            tk->win = ics->wins[i];
            tk->ics = ics;

            if (!FBPANEL_WIN(tk->win))
                XSelectInput (GDK_DISPLAY(), tk->win, PropertyChangeMask | StructureNotifyMask);
            get_wmclass(tk);
            set_icon_maybe(ics, tk);
            g_hash_table_insert(ics->task_list, &tk->win, tk);
        }
    }

    /* remove windows that arn't in the NET_CLIENT_LIST anymore */
    g_hash_table_foreach_remove(ics->task_list, (GHRFunc) remove_stale_tasks, NULL);
    RET();
}
JNIEXPORT jint JNICALL
Java_gnu_java_awt_peer_gtk_GdkScreenGraphicsDevice_nativeGetDisplayModeIndex
(JNIEnv *env, jobject obj __attribute__((unused)), jobject gdkGraphicsEnv __attribute__((unused)))
{
#ifdef HAVE_XRANDR	

	GdkDisplay *display;
	XRRScreenConfiguration *config;
	SizeID index;
	Rotation rotation;
	
	display = (GdkDisplay *) NSA_GET_DISPLAY_PTR(env, gdkGraphicsEnv);
	
	gdk_threads_enter();
	
	config = XRRGetScreenInfo (GDK_DISPLAY_XDISPLAY(display), GDK_ROOT_WINDOW());

	index = XRRConfigCurrentConfiguration (config, &rotation);

    XRRFreeScreenConfigInfo (config);

	gdk_threads_leave();
	
	return (int) index;

#else

    JCL_ThrowException(env,
                       "java/lang/InternalError",
                       "Method should not have been invoked.");
   
    return -1;
   
#endif	
}
Exemplo n.º 14
0
static Pixmap
get_pixmap_prop (Window the_window, char *prop_id)
{
  Atom prop, type;
  int format;
  unsigned long length, after;
  unsigned char *data;


  Window desktop_window = get_desktop_window(the_window);

  if(desktop_window == None)
    desktop_window = GDK_ROOT_WINDOW();

  prop = XInternAtom(GDK_DISPLAY(), prop_id, True);

  if (prop == None)
    return None;

  XGetWindowProperty(GDK_DISPLAY(), desktop_window, prop, 0L, 1L, False,
         AnyPropertyType, &type, &format, &length, &after,
         &data);

  if (type == XA_PIXMAP)
    return *((Pixmap *)data);

  return None;
}
Exemplo n.º 15
0
/* Handler for "active-window" event from root window listener. */
static void pager_net_active_window(FbEv * ev, PagerPlugin * pg)
{
    Window * focused_window = get_xaproperty(GDK_ROOT_WINDOW(), a_NET_ACTIVE_WINDOW, XA_WINDOW, 0);
    if (focused_window != NULL)
    {
        PagerTask * tk = task_lookup(pg, *focused_window);
        if (tk != pg->focused_task)
        {
            /* Focused task changed.  Redraw both old and new. */
            if (pg->focused_task != NULL)
                desk_set_dirty_by_win(pg, pg->focused_task);
            pg->focused_task = tk;
            if (tk != NULL)
                desk_set_dirty_by_win(pg, tk);
        }
        XFree(focused_window);
    }
    else
    {
        /* Focused task disappeared.  Redraw old. */
        if (pg->focused_task != NULL)
        {
            desk_set_dirty_by_win(pg, pg->focused_task);
            pg->focused_task = NULL;
        }
    }
}
Exemplo n.º 16
0
NetscapePluginX11::NetscapePluginX11(NetscapePlugin& plugin, Display* display, uint64_t windowID)
    : m_plugin(plugin)
    , m_pluginDisplay(display)
    , m_windowID(windowID)
{
    // It seems flash needs the socket to be in the same process,
    // I guess it uses gdk_window_lookup(), so we create a new socket here
    // containing a plug with the UI process socket embedded.
    m_platformPluginWidget = gtk_plug_new(static_cast<Window>(windowID));

    // Hide the GtkPlug on delete-event since we assume the widget is valid while the plugin is active.
    // platformDestroy() will be called anyway right after the delete-event.
    g_signal_connect(m_platformPluginWidget, "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), nullptr);

    GtkWidget* socket = gtk_socket_new();
    // Do not show the plug widget until the socket is connected.
    g_signal_connect_swapped(socket, "plug-added", G_CALLBACK(gtk_widget_show), m_platformPluginWidget);
    g_signal_connect(socket, "plug-removed", G_CALLBACK(socketPlugRemovedCallback), nullptr);
    gtk_container_add(GTK_CONTAINER(m_platformPluginWidget), socket);
    gtk_widget_show(socket);

    Display* hostDisplay = x11HostDisplay();
    m_npWindowID = gtk_socket_get_id(GTK_SOCKET(socket));
    GdkWindow* window = gtk_widget_get_window(socket);
    m_setWindowCallbackStruct.display = GDK_WINDOW_XDISPLAY(window);
    m_setWindowCallbackStruct.visual = GDK_VISUAL_XVISUAL(gdk_window_get_visual(window));
    m_setWindowCallbackStruct.depth = gdk_visual_get_depth(gdk_window_get_visual(window));
    m_setWindowCallbackStruct.colormap = XCreateColormap(hostDisplay, GDK_ROOT_WINDOW(), m_setWindowCallbackStruct.visual, AllocNone);

    XFlush(hostDisplay);
}
Exemplo n.º 17
0
Arquivo: pager.c Projeto: g7/fbpanel
static void
pager_propertynotify(pager_priv *p, XEvent *ev)
{
    Atom at = ev->xproperty.atom;
    Window win = ev->xproperty.window;
    task *t;


    ENTER;
    if ((win == GDK_ROOT_WINDOW()) || !(t = g_hash_table_lookup(p->htable, &win)))
        RET();

    DBG("window=0x%lx\n", t->win);
    if (at == a_NET_WM_STATE) {
        DBG("event=NET_WM_STATE\n");
        get_net_wm_state(t->win, &t->nws);
    } else if (at == a_NET_WM_DESKTOP) {
        DBG("event=NET_WM_DESKTOP\n");
        desk_set_dirty_by_win(p, t); // to clean up desks where this task was
        t->desktop = get_net_wm_desktop(t->win);
    } else {
        RET();
    }
    desk_set_dirty_by_win(p, t);
    RET();
}
Exemplo n.º 18
0
Arquivo: pager.c Projeto: g7/fbpanel
static void
do_net_active_window(FbEv *ev, pager_priv *p)
{
    Window *fwin;
    task *t;

    ENTER;
    fwin = get_xaproperty(GDK_ROOT_WINDOW(), a_NET_ACTIVE_WINDOW, XA_WINDOW, 0);
    DBG("win=%lx\n", fwin ? *fwin : 0);
    if (fwin) {
        t = g_hash_table_lookup(p->htable, fwin);
        if (t != p->focusedtask) {
            if (p->focusedtask)
                desk_set_dirty_by_win(p, p->focusedtask);
            p->focusedtask = t;
            if (t)
                desk_set_dirty_by_win(p, t);
        }
        XFree(fwin);
    } else {
        if (p->focusedtask) {
            desk_set_dirty_by_win(p, p->focusedtask);
            p->focusedtask = NULL;
        }
    }
    RET();
}
Exemplo n.º 19
0
static GdkFilterReturn
panel_event_filter(GdkXEvent *xevent, GdkEvent *event, panel *p)
{
    Atom at;
    Window win;
    XEvent *ev = (XEvent *) xevent;

    ENTER;
    DBG("win = 0x%x\n", ev->xproperty.window);
    if (ev->type != PropertyNotify )
        RET(GDK_FILTER_CONTINUE);
    
    at = ev->xproperty.atom;
    win = ev->xproperty.window;
    DBG("win=%x at=%d\n", win, at);
    if (win == GDK_ROOT_WINDOW()) {
	if (at == a_NET_CLIENT_LIST) {
            DBG("A_NET_CLIENT_LIST\n");
            fb_ev_trigger(fbev, EV_CLIENT_LIST);
	} else if (at == a_NET_CURRENT_DESKTOP) {
            DBG("A_NET_CURRENT_DESKTOP\n");
            p->curdesk = get_net_current_desktop();
            fb_ev_trigger(fbev, EV_CURRENT_DESKTOP);
	} else if (at == a_NET_NUMBER_OF_DESKTOPS) {
            DBG("A_NET_NUMBER_OF_DESKTOPS\n");
            p->desknum = get_net_number_of_desktops();
            fb_ev_trigger(fbev, EV_NUMBER_OF_DESKTOPS);
	} else if (at == a_NET_DESKTOP_NAMES) {
            DBG("A_NET_DESKTOP_NAMES\n");
            fb_ev_trigger(fbev, EV_DESKTOP_NAMES);
        } else if (at == a_NET_ACTIVE_WINDOW) {
            DBG("A_NET_ACTIVE_WINDOW\n");
            fb_ev_trigger(fbev, EV_ACTIVE_WINDOW);
        }else if (at == a_NET_CLIENT_LIST_STACKING) {
            DBG("A_NET_CLIENT_LIST_STACKING\n");
            fb_ev_trigger(fbev, EV_CLIENT_LIST_STACKING);
	} else if (at == a_NET_WORKAREA) {
            DBG("A_NET_WORKAREA\n");
            p->workarea = get_xaproperty (GDK_ROOT_WINDOW(), a_NET_WORKAREA, XA_CARDINAL, &p->wa_len);
            print_wmdata(p);
        } else
            RET(GDK_FILTER_CONTINUE);
        RET(GDK_FILTER_REMOVE);
    }
    DBG("non root %x\n", win);
    RET(GDK_FILTER_CONTINUE);
}
Exemplo n.º 20
0
void
doppelganger_move (Doppelganger *dg,
                   int x, int y)
{
  doppelganger_move_by_window (dg,
                               GDK_ROOT_WINDOW (),
                               x, y);
}
Exemplo n.º 21
0
/**
 * Attaches the key_filter() function as a filter
 * to the the root window, so it will intercept window events.
 */
void
add_filter(void)
{
	gdk_window_add_filter(
		gdk_x11_window_foreign_new_for_display(
			gdk_display_get_default(),GDK_ROOT_WINDOW()),
		key_filter, NULL);
}
Exemplo n.º 22
0
static gint
desk_button_press_event(GtkWidget * widget, GdkEventButton * event, desk *d)
{
    ENTER;
    DBG("s=%d\n", d->no);
    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, d->no, 0, 0, 0, 0);
    RET(TRUE);
}
Exemplo n.º 23
0
/* Handler for "button-press-event" on drawing area. */
static gboolean desk_button_press_event(GtkWidget * widget, GdkEventButton * event, PagerDesk * d)
{
    /* Standard right-click handling. */
    if (plugin_button_press_event(widget, event, d->pg->plugin))
        return TRUE;

    /* Ask the window manager to make the new desktop current. */
    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, d->desktop_number, 0, 0, 0, 0);
    return TRUE;
}
Exemplo n.º 24
0
static inline unsigned long rootWindowID()
{
#if PLATFORM(QT)
    return XDefaultRootWindow(NetscapePlugin::x11HostDisplay());
#elif PLATFORM(GTK)
    return GDK_ROOT_WINDOW();
#else
    return 0;
#endif
}
Exemplo n.º 25
0
void panel_stop(panel *p)
{
    ENTER;

    tray_destructor(p);
    XSelectInput (gdk_helper_display(), GDK_ROOT_WINDOW(), NoEventMask);
    gdk_window_remove_filter(gdk_get_default_root_window (), (GdkFilterFunc)panel_wm_events, p);
    gtk_widget_destroy(p->topgwin);
    RET();
}
Exemplo n.º 26
0
static inline unsigned long rootWindowID()
{
#if PLATFORM(GTK)
    return GDK_ROOT_WINDOW();
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return ecore_x_window_root_first_get();
#else
    return 0;
#endif
}
Exemplo n.º 27
0
static void
hn_others_button_get_workarea (GtkAllocation *allocation)
{
  unsigned long n;
  unsigned long extra;
  int format;
  int status;
  Atom property = XInternAtom (GDK_DISPLAY (), WORKAREA_ATOM, FALSE);
  Atom realType;
  
  /* This is needed to get rid of the punned type-pointer 
     breaks strict aliasing warning*/
  union
  {
    unsigned char *char_value;
    int *int_value;
  } value;
    
  status = XGetWindowProperty (GDK_DISPLAY (), 
			       GDK_ROOT_WINDOW (), 
			       property, 
			       0L, 
			       4L,
			       0, 
			       XA_CARDINAL, 
			       &realType, 
			       &format,
			       &n, 
			       &extra, 
			       (unsigned char **) &value.char_value);
    
  if (status == Success &&
      realType == XA_CARDINAL &&
      format == 32 && 
      n == 4  &&
      value.char_value != NULL)
  {
    allocation->x = value.int_value[0];
    allocation->y = value.int_value[1];
    allocation->width = value.int_value[2];
    allocation->height = value.int_value[3];
  }
  else
  {
    allocation->x = 0;
    allocation->y = 0;
    allocation->width = 0;
    allocation->height = 0;
  }
    
  if (value.char_value) 
  {
    XFree(value.char_value);  
  }
}
Exemplo n.º 28
0
Drawable get_blurred_background()
{
    gulong n_item;
    gpointer data = get_window_property(gdk_x11_get_default_xdisplay(),
                                        GDK_ROOT_WINDOW(), _BG_ATOM, &n_item);
    if (data == NULL) {
        return 0;
    }
    Drawable bg = X_FETCH_32(data, 0);
    XFree(data);
    return bg;
}
Exemplo n.º 29
0
static inline unsigned long rootWindowID()
{
#if PLATFORM(QT)
    return XDefaultRootWindow(NetscapePlugin::x11HostDisplay());
#elif PLATFORM(GTK)
    return GDK_ROOT_WINDOW();
#elif PLATFORM(EFL) && defined(HAVE_ECORE_X)
    return ecore_x_window_root_first_get();
#else
    return 0;
#endif
}
Exemplo n.º 30
0
Arquivo: pager.c Projeto: g7/fbpanel
static gint
desk_button_press_event(GtkWidget * widget, GdkEventButton * event, desk *d)
{
    ENTER;
    if (event->type == GDK_BUTTON_PRESS && event->button == 3
          && event->state & GDK_CONTROL_MASK) {
        RET(FALSE);
    }
    DBG("s=%d\n", d->no);
    Xclimsg(GDK_ROOT_WINDOW(), a_NET_CURRENT_DESKTOP, d->no, 0, 0, 0, 0);
    RET(TRUE);
}