about summary refs log tree commit diff stats
path: root/client.c
Commit message (Collapse)AuthorAgeFilesLines
* separated several functions into view.cAnselm R. Garbe2006-08-221-61/+0
|
* windows which have set transient_for hint inherit the transient_for window ↵arg@localhost.10kloc.org2006-08-211-1/+6
| | | | tags now
* after switching to OpenBSD again, I switched back to a saner color schemearg@localhost.10kloc.org2006-08-211-5/+7
|
* applied Sanders focus_* patches, removed the unnecessary clean-prefix from ↵Anselm R.Garbe2006-08-211-28/+30
| | | | the new function names
* applied Sanders patchAnselm R.Garbe2006-08-181-6/+2
|
* made a new client position strategy similiar to that one proposed by Sander, ↵Anselm R.Garbe2006-08-181-7/+7
| | | | but which takes top bar into account
* fixed a bug reported by sanderAnselm R.Garbe2006-08-171-1/+1
|
* centering apps only if transient_for is not(!) setAnselm R.Garbe2006-08-171-9/+1
|
* fixed issue Sander reportedAnselm R.Garbe2006-08-171-4/+3
|
* condition was insufficientAnselm R.Garbe2006-08-161-2/+2
|
* fixed issue reported by sanderAnselm R.Garbe2006-08-161-0/+4
|
* added general centralization rule for new clients (works around various ↵Anselm R.Garbe2006-08-161-1/+10
| | | | borken apps)
* removed NUMLOCKMASK, added dynamically calculated numlockmask insteadAnselm R.Garbe2006-08-141-6/+6
|
* fixedAnselm R.Garbe2006-08-141-8/+4
|
* added some flicker preventionAnselm R.Garbe2006-08-141-1/+3
|
* fixed a core dumpAnselm R.Garbe2006-08-141-1/+0
|
* implemented restack behavior (floats are on top in tiled mode)Anselm R.Garbe2006-08-141-18/+8
|
* implement multi-tag selection through button3 click on the specific tagAnselm R.Garbe2006-08-111-2/+2
|
* applied Sander's patch as wellAnselm R.Garbe2006-08-111-2/+1
|
* simplified unmanageAnselm R.Garbe2006-08-111-7/+2
|
* removed the if(clients) check from popping codeAnselm R.Garbe2006-08-111-2/+1
|
* applied Sanders zoom_update patchAnselm R.Garbe2006-08-101-1/+1
|
* respecting inc hints in floating mode on togglemaxAnselm R.Garbe2006-08-101-1/+1
|
* reverting last patch, that sucks, I don't care about retarded apps like gvimAnselm R.Garbe2006-08-101-1/+1
|
* togglemax repects inc-hints (this way gvim can be toggle'maxed as well)Anselm R.Garbe2006-08-101-1/+1
|
* applied sumik's multihead patchAnselm R.Garbe2006-08-101-0/+2
|
* disallow zoom on maximized clientsAnselm R.Garbe2006-08-101-7/+0
|
* removed NET_ACTIVE_WINDOW handlingAnselm R.Garbe2006-08-081-5/+0
|
* implemented NET_ACTIVE_WINDOW supportAnselm R.Garbe2006-08-081-0/+5
|
* applied endless loop prevention on zoom()arg@10ksloc.org2006-08-071-1/+3
|
* small fix of the last commitarg@10ksloc.org2006-08-051-1/+1
|
* using -Os again, zoom is ignored in floating mode or on floating clientsarg@10ksloc.org2006-08-051-1/+1
|
* mouse grab needs also to grab for combinations of numlock/lockmaskarg@10ksloc.org2006-08-051-0/+20
|
* removed TLast tag enum, now tags is simple defined as char *[] array, the ↵arg@10ksloc.org2006-08-031-1/+3
| | | | rest is calculated correctly, rules take an int array for the tags
* changed Client->tags and Rule->tags to be Bool (I'll also try to remove the ↵arg@10ksloc.org2006-08-031-1/+1
| | | | TLast enum)
* made fullscreen apps working fine in floating mode (there is no sane way to ↵arg@10ksloc.org2006-08-021-22/+10
| | | | make them work in tiled mode, thus I switch to floating mode if I run such kind of app), also fixed the xterm issue reported by Sander
* new stuffarg@10ksloc.org2006-08-021-15/+21
|
* implemented focus on enterwindow on titlebarsarg@10ksloc.org2006-08-021-1/+1
|
* reverting to old resize policyarg@10ksloc.org2006-08-021-11/+19
|
* new resize stuff (using XConfigureWindow instead of XSendEvent)arg@10ksloc.org2006-08-021-19/+11
|
* renamed WM_PROTOCOL_DELWIN into PROTODELWINarg@10ksloc.org2006-08-011-1/+1
|
* removed artefacts of single-linked list (thanx to Jukka, I must have been mad)arg@10ksloc.org2006-08-011-8/+3
|
* uppercasing all define'd values (uppercase-prefixed should only be enum ↵arg@10ksloc.org2006-08-011-3/+3
| | | | field qualifiers)
* applied Sanders patchesarg@10ksloc.org2006-08-011-3/+3
|
* committed a patch which fixes the hints of Jukkaarg@10ksloc.org2006-08-011-34/+8
|
* sanitization of several clunky stuff, removed heretag (rarely of use), ↵arg@10ksloc.org2006-07-211-2/+15
| | | | simplified pop(), changed shortcuts to always contain MODKEY
* applied sanders no_sizehints for tiled mode patch (thx!)arg@10ksloc.org2006-07-201-10/+10
|
* serious mistake in pop() (forgot to set c->prev to NULL on pop)arg@10ksloc.org2006-07-201-0/+1
|
* using double-linked list in order to get correct prev focus handlingarg@10ksloc.org2006-07-201-15/+31
|
* made status bar drawing more robust, implemented togglemax and togglemode, ↵arg@10ksloc.org2006-07-201-15/+38
| | | | works quite well
> rbtNone: discard of rbtString: writer.swrite(o.s) of rbtMultipart: writer.swrite(o.multipart) of rbtOutput: writer.swrite(o.outputId) of rbtCache: writer.swrite(o.cacheId) proc sread*(reader: var BufferedReader; o: var RequestBody) = var t: RequestBodyType reader.sread(t) o = RequestBody(t: t) case t of rbtNone: discard of rbtString: reader.sread(o.s) of rbtMultipart: reader.sread(o.multipart) of rbtOutput: reader.sread(o.outputId) of rbtCache: reader.sread(o.cacheId) proc contentLength*(body: RequestBody): int = case body.t of rbtNone: return 0 of rbtString: return body.s.len of rbtMultipart: return body.multipart.calcLength() of rbtOutput: return 0 of rbtCache: return 0 func headers(this: JSRequest): Headers {.jsfget.} = return this.request.headers func url(this: JSRequest): URL = return this.request.url proc jsUrl(this: JSRequest): string {.jsfget: "url".} = return $this.url #TODO pretty sure this is incorrect proc jsReferrer(this: JSRequest): string {.jsfget: "referrer".} = if this.request.referrer != nil: return $this.request.referrer return "" iterator pairs*(headers: Headers): (string, string) = for k, vs in headers.table: for v in vs: yield (k, v) func newRequest*(url: URL; httpMethod = hmGet; headers = newHeaders(); body = RequestBody(); referrer: URL = nil; tocache = false): Request = return Request( url: url, httpMethod: httpMethod, headers: headers, body: body, referrer: referrer, tocache: tocache ) func createPotentialCORSRequest*(url: URL; destination: RequestDestination; cors: CORSAttribute; fallbackFlag = false): JSRequest = var mode = if cors == caNoCors: rmNoCors else: rmCors if fallbackFlag and mode == rmNoCors: mode = rmSameOrigin let credentialsMode = if cors == caAnonymous: cmSameOrigin else: cmInclude return JSRequest( request: newRequest(url), destination: destination, mode: mode, credentialsMode: credentialsMode ) type BodyInitType = enum bitBlob, bitFormData, bitUrlSearchParams, bitString BodyInit = object #TODO ReadableStream, BufferSource case t: BodyInitType of bitBlob: blob: Blob of bitFormData: formData: FormData of bitUrlSearchParams: searchParams: URLSearchParams of bitString: str: string RequestInit* = object of JSDict `method`* {.jsdefault.}: Option[HttpMethod] #TODO aliasing in dicts headers* {.jsdefault.}: Option[HeadersInit] body* {.jsdefault.}: Option[BodyInit] referrer* {.jsdefault.}: Option[string] referrerPolicy* {.jsdefault.}: Option[ReferrerPolicy] credentials* {.jsdefault.}: Option[CredentialsMode] mode* {.jsdefault.}: Option[RequestMode] window* {.jsdefault: JS_UNDEFINED.}: JSValue proc fromJS(ctx: JSContext; val: JSValue; res: var BodyInit): Opt[void] = if not JS_IsUndefined(val) and not JS_IsNull(val): res = BodyInit(t: bitFormData) if ctx.fromJS(val, res.formData).isSome: return ok() res = BodyInit(t: bitBlob) if ctx.fromJS(val, res.blob).isSome: return ok() res = BodyInit(t: bitUrlSearchParams) if ctx.fromJS(val, res.searchParams).isSome: return ok() res = BodyInit(t: bitString) if ctx.fromJS(val, res.str).isSome: return ok() JS_ThrowTypeError(ctx, "invalid body init type") return err() var getAPIBaseURLImpl*: proc(ctx: JSContext): URL {.noSideEffect, nimcall.} proc newRequest*(ctx: JSContext; resource: JSValue; init = RequestInit(window: JS_UNDEFINED)): JSResult[JSRequest] {.jsctor.} = let headers = newHeaders(hgRequest) var fallbackMode = opt(rmCors) var window = RequestWindow(t: rwtClient) var body = RequestBody() var credentials = cmSameOrigin var httpMethod = hmGet var referrer: URL = nil var url: URL = nil if (var res: JSRequest; ctx.fromJS(resource, res).isSome): url = res.url httpMethod = res.request.httpMethod headers.table = res.headers.table referrer = res.request.referrer credentials = res.credentialsMode body = res.request.body fallbackMode = opt(RequestMode) window = res.window else: var s: string ?ctx.fromJS(resource, s) url = ?parseJSURL(s, option(ctx.getAPIBaseURLImpl())) if url.username != "" or url.password != "": return errTypeError("Input URL contains a username or password") var mode = fallbackMode.get(rmNoCors) let destination = rdNone #TODO origin, window if not JS_IsUndefined(init.window): if not JS_IsNull(init.window): return errTypeError("Expected window to be null") window = RequestWindow(t: rwtNoWindow) if mode == rmNavigate: mode = rmSameOrigin #TODO flags? #TODO referrer if init.`method`.isSome: httpMethod = init.`method`.get if init.body.isSome: let ibody = init.body.get case ibody.t of bitFormData: body = RequestBody(t: rbtMultipart, multipart: ibody.formData) of bitString: body = RequestBody(t: rbtString, s: ibody.str) else: discard #TODO if httpMethod in {hmGet, hmHead}: return errTypeError("HEAD or GET Request cannot have a body.") if init.headers.isSome: ?headers.fill(init.headers.get) if init.credentials.isSome: credentials = init.credentials.get if init.mode.isSome: mode = init.mode.get if mode == rmNoCors: headers.guard = hgRequestNoCors return ok(JSRequest( request: newRequest( url, httpMethod, headers, body, referrer = referrer ), mode: mode, credentialsMode: credentials, destination: destination, window: window )) func credentialsMode*(attribute: CORSAttribute): CredentialsMode = case attribute of caNoCors, caAnonymous: return cmSameOrigin of caUseCredentials: return cmInclude proc addRequestModule*(ctx: JSContext) = ctx.registerType(JSRequest, name = "Request")