예제 #1
0
파일: events.c 프로젝트: Limsik/e17
static void
ExtInitSync(int available)
{
   int                 i, num;
   XSyncSystemCounter *xssc;

   if (!available)
      return;

   xssc = XSyncListSystemCounters(disp, &num);
   for (i = 0; i < num; i++)
     {
	if (!strcmp(xssc[i].name, "SERVERTIME"))
	   Mode.display.server_time = xssc[i].counter;
	if (EDebug(EDBUG_TYPE_VERBOSE))
	   Eprintf(" Sync counter %2d: %10s %#lx %#x:%#x\n", i,
		   xssc[i].name, xssc[i].counter,
		   XSyncValueHigh32(xssc[i].resolution),
		   XSyncValueLow32(xssc[i].resolution));
     }
   XSyncFreeSystemCounterList(xssc);

   if (Mode.display.server_time == None)
      Conf.movres.enable_sync_request = 0;
}
예제 #2
0
EAPI Eina_Bool
ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter,
                             int                 *val_hi,
                             unsigned int        *val_lo)
{
   XSyncValue value;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   if (XSyncQueryCounter(_ecore_x_disp, counter, &value))
     {
        *val_lo = (unsigned int)XSyncValueLow32(value);
        *val_hi = (int)XSyncValueHigh32(value);
        return EINA_TRUE;
     }
   return EINA_FALSE;
}
예제 #3
0
파일: moveresize.c 프로젝트: ahtik/openbox
static void do_resize(void)
{
    gint x, y, w, h, lw, lh;

    /* see if it is actually going to resize
       USE cur_x AND cur_y HERE !  Otherwise the try_configure won't know
       what struts to use !!
     */
    x = cur_x;
    y = cur_y;
    w = cur_w;
    h = cur_h;
    client_try_configure(moveresize_client, &x, &y, &w, &h,
                         &lw, &lh, TRUE);
    if (!(w == moveresize_client->area.width &&
          h == moveresize_client->area.height) &&
        /* if waiting_for_sync == 0, then we aren't waiting.
           if it is > SYNC_TIMEOUTS, then we have timed out
           that many times already, so forget about waiting more */
        (waiting_for_sync == 0 || waiting_for_sync > SYNC_TIMEOUTS))
    {
#ifdef SYNC
        if (config_resize_redraw && obt_display_extension_sync &&
            /* don't send another sync when one is pending */
            waiting_for_sync == 0 &&
            moveresize_client->sync_request &&
            moveresize_client->sync_counter &&
            !moveresize_client->not_responding)
        {
            XEvent ce;
            XSyncValue val;

            /* increment the value we're waiting for */
            ++moveresize_client->sync_counter_value;
            XSyncIntToValue(&val, moveresize_client->sync_counter_value);

            /* tell the client what we're waiting for */
            ce.xclient.type = ClientMessage;
            ce.xclient.message_type = OBT_PROP_ATOM(WM_PROTOCOLS);
            ce.xclient.display = obt_display;
            ce.xclient.window = moveresize_client->window;
            ce.xclient.format = 32;
            ce.xclient.data.l[0] = OBT_PROP_ATOM(NET_WM_SYNC_REQUEST);
            ce.xclient.data.l[1] = event_time();
            ce.xclient.data.l[2] = XSyncValueLow32(val);
            ce.xclient.data.l[3] = XSyncValueHigh32(val);
            ce.xclient.data.l[4] = 0l;
            XSendEvent(obt_display, moveresize_client->window, FALSE,
                       NoEventMask, &ce);

            waiting_for_sync = 1;

            if (sync_timer) g_source_remove(sync_timer);
            sync_timer = g_timeout_add(2000, sync_timeout_func, NULL);
        }
#endif

        /* force a ConfigureNotify, it is part of the spec for SYNC resizing
           and MUST follow the sync counter notification */
        client_configure(moveresize_client, cur_x, cur_y, cur_w, cur_h,
                         TRUE, FALSE, TRUE);
    }

    /* this would be better with a fixed width font ... XXX can do it better
       if there are 2 text boxes */
    if (config_resize_popup_show == 2 || /* == "Always" */
            (config_resize_popup_show == 1 && /* == "Nonpixel" */
             moveresize_client->size_inc.width > 1 &&
             moveresize_client->size_inc.height > 1))
        popup_coords(moveresize_client, "%d x %d", lw, lh);
}